RED-7761 - removed reset reason method

This commit is contained in:
Valentin Mihai 2023-11-23 15:29:33 +02:00
parent 86c83311c7
commit fe83a9c75a

View File

@ -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,