diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 45f46c2a1..f82044acc 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -90,8 +90,14 @@ export class EditRedactionDialogComponent description: lbm.description, label: lbm.name, })); + + const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); + const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); + this.form.patchValue({ + reason: sameLegalBasis ? reason : null, + }); + this.legalOptions.sort((a, b) => a.label.localeCompare(b.label)); - this.#resetReason(); this.initialFormValue = this.form.getRawValue(); } @@ -122,14 +128,6 @@ export class EditRedactionDialogComponent }); } - #resetReason() { - const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); - const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); - this.form.patchValue({ - reason: sameLegalBasis ? reason : null, - }); - } - #setTypes() { this.dictionaries = this._dictionaryService.getEditableRedactionTypes( this.#dossier.dossierTemplateId,