RED-7762: fixed unchanged placeholder.

This commit is contained in:
Nicoleta Panaghiu 2023-12-11 14:54:09 +02:00
parent 964395040f
commit 0b7dc23014
2 changed files with 25 additions and 10 deletions

View File

@ -23,7 +23,10 @@
<label [translate]="'edit-redaction.dialog.content.type'"></label>
<mat-form-field>
<mat-select [placeholder]="'edit-redaction.dialog.content.unchanged' | translate" formControlName="type">
<mat-select
[placeholder]="isBulkEdit ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
formControlName="type"
>
<mat-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
<mat-option
(click)="typeChanged()"
@ -43,7 +46,9 @@
<label [translate]="'edit-redaction.dialog.content.reason'"></label>
<mat-form-field>
<mat-select
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[placeholder]="
isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
"
class="full-width"
formControlName="reason"
>
@ -62,7 +67,7 @@
<div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
<input
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[placeholder]="isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[value]="form.controls.reason.value?.legalBasis"
disabled
type="text"
@ -72,7 +77,9 @@
<div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.section'"></label>
<input
[placeholder]="'edit-redaction.dialog.content.unchanged' | translate"
[placeholder]="
isBulkEdit && !hideParagraphPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
"
formControlName="section"
name="section"
type="text"
@ -94,7 +101,7 @@
<label [translate]="'edit-redaction.dialog.content.comment'"></label>
<textarea
[placeholder]="
!isImage && redactedTexts.length === 1
!isBulkEdit
? ('edit-redaction.dialog.content.comment-placeholder' | translate)
: ('edit-redaction.dialog.content.unchanged' | translate)
"

View File

@ -81,10 +81,22 @@ export class EditRedactionDialogComponent
return this.redactBasedTypes.includes(this.form.controls.type.value);
}
get hidePlaceholder() {
get hideReasonPlaceholder() {
return this.hasTypeChanged && this.isRedactBasedType;
}
get hideParagraphPlaceholder() {
return this.form.controls.section.value !== this.initialFormValue['section'];
}
get hiddenReason() {
return this.isImage && this.form.controls.reason.disabled;
}
get isBulkEdit() {
return this.data.annotations.length > 1;
}
async ngOnInit() {
this.#setTypes();
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId));
@ -165,8 +177,4 @@ export class EditRedactionDialogComponent
value: new FormControl<string>(this.allRectangles ? this.data.annotations[0].value : null),
});
}
get hiddenReason() {
return this.isImage && this.form.controls.reason.disabled;
}
}