RED-7761 - Missing fields in Edit Dialog for Signature (redacted images)

This commit is contained in:
Valentin Mihai 2023-11-23 14:40:03 +02:00
parent 3631df4619
commit d45490ccaf

View File

@ -10,6 +10,8 @@ import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-
import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types';
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
const SIGNATURE = 'signature';
@Component({
templateUrl: './edit-redaction-dialog.component.html',
styleUrls: ['./edit-redaction-dialog.component.scss'],
@ -88,24 +90,21 @@ 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();
console.log(JSON.stringify(this.form.getRawValue()));
}
typeChanged() {
const selectedDictionaryType = this.form.controls.type.value;
const isSignature = selectedDictionaryType === SIGNATURE;
this.#setOptions(selectedDictionaryType);
console.log(this.redactBasedTypes);
console.log(selectedDictionaryType);
if (this.redactBasedTypes.includes(selectedDictionaryType)) {
if (this.redactBasedTypes.includes(selectedDictionaryType) || (isSignature && !this.allSkipped)) {
if (isSignature) {
this.form.patchValue({ reason: this.initialFormValue.reason, option: this.initialFormValue.option });
}
this.form.controls.reason.enable();
} else {
this.form.patchValue({ reason: null, option: null });
@ -124,6 +123,14 @@ 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,
@ -166,7 +173,7 @@ export class EditRedactionDialogComponent
get showExtras() {
const type = this.form.get('type').value;
const isSignature = type === 'signature';
const isSignature = type === SIGNATURE;
return (isSignature && this.isRedacted) || !(this.isImage || this.isHint);
}
}