From 677d6732b0b41275f27e039b2c0bcc91815b92fe Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 27 Nov 2023 11:15:48 +0200 Subject: [PATCH] RED-7762: fields show 'unchanged' by default. --- .../edit-redaction-dialog.component.html | 9 +++++++-- .../edit-redaction-dialog.component.ts | 20 ++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html index bb1270077..b682425b5 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html @@ -49,7 +49,7 @@ - +
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 f82044acc..970bff833 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 @@ -34,6 +34,7 @@ export class EditRedactionDialogComponent legalOptions: LegalBasisOption[] = []; dictionaries: Dictionary[] = []; readonly form = this.#getForm(); + hasTypeChanged = false; constructor( private readonly _justificationsService: JustificationsService, @@ -57,6 +58,12 @@ export class EditRedactionDialogComponent return null; } + get showExtras() { + const type = this.form.get('type').value; + const isSignature = type === SIGNATURE; + return (isSignature && this.isRedacted) || !(this.isImage || this.isHint); + } + get disabled() { return ( this.form.invalid || @@ -82,6 +89,10 @@ export class EditRedactionDialogComponent return this.redactBasedTypes.includes(this.form.controls.type.value); } + get hidePlaceholder() { + return this.hasTypeChanged && this.isRedactBasedType; + } + async ngOnInit() { this.#setTypes(); const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId)); @@ -111,10 +122,11 @@ export class EditRedactionDialogComponent this.form.patchValue({ reason: this.initialFormValue.reason, option: this.initialFormValue.option }); } this.form.controls.reason.enable(); + this.hasTypeChanged = true; } else { - this.form.patchValue({ reason: null, option: null }); this.form.controls.reason.disable(); } + this.form.patchValue({ reason: null, option: null }); } save() { @@ -167,10 +179,4 @@ export class EditRedactionDialogComponent value: new FormControl(this.allRectangles ? this.data.annotations[0].value : null), }); } - - get showExtras() { - const type = this.form.get('type').value; - const isSignature = type === SIGNATURE; - return (isSignature && this.isRedacted) || !(this.isImage || this.isHint); - } }