From fe83a9c75a3fde805211e32c32c96eb7bf7bdf37 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 23 Nov 2023 15:29:33 +0200 Subject: [PATCH] RED-7761 - removed reset reason method --- .../edit-redaction-dialog.component.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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,