RED-7762: fields show 'unchanged' by default.
This commit is contained in:
parent
24bde55bb3
commit
677d6732b0
@ -49,7 +49,7 @@
|
||||
<mat-select
|
||||
class="full-width"
|
||||
formControlName="reason"
|
||||
[placeholder]="'edit-redaction.dialog.content.unchanged' | translate"
|
||||
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
|
||||
>
|
||||
<mat-option
|
||||
*ngFor="let option of legalOptions"
|
||||
@ -65,7 +65,12 @@
|
||||
|
||||
<div class="iqser-input-group w-450">
|
||||
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
|
||||
<input [value]="form.controls.reason.value?.legalBasis" disabled type="text" />
|
||||
<input
|
||||
[value]="form.controls.reason.value?.legalBasis"
|
||||
disabled
|
||||
type="text"
|
||||
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="iqser-input-group w-450">
|
||||
|
||||
@ -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<string>(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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user