RED-7762: fixed comment and empty field placeholders.

This commit is contained in:
Nicoleta Panaghiu 2023-12-19 11:32:39 +02:00
parent 3497b89fec
commit 60664a56f2
2 changed files with 9 additions and 9 deletions

View File

@ -47,7 +47,7 @@
<mat-form-field>
<mat-select
[placeholder]="
isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
isBulkEdit && !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
"
class="full-width"
formControlName="reason"
@ -67,7 +67,7 @@
<div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
<input
[placeholder]="isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[placeholder]="isBulkEdit && !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[value]="form.controls.reason.value?.legalBasis"
disabled
type="text"
@ -100,11 +100,7 @@
<div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.comment'"></label>
<textarea
[placeholder]="
!isBulkEdit
? ('edit-redaction.dialog.content.comment-placeholder' | translate)
: ('edit-redaction.dialog.content.unchanged' | translate)
"
[placeholder]="'edit-redaction.dialog.content.comment-placeholder' | translate"
formControlName="comment"
iqserHasScrollbar
name="comment"

View File

@ -83,11 +83,11 @@ export class EditRedactionDialogComponent
}
get hideReasonPlaceholder() {
return this.hasTypeChanged && this.isRedactBasedType;
return (this.hasTypeChanged && this.isRedactBasedType) || this.#isFieldEmpty('legalBasis');
}
get hideParagraphPlaceholder() {
return this.form.controls.section.value !== this.initialFormValue['section'];
return this.form.controls.section.value !== this.initialFormValue['section'] || this.#isFieldEmpty('section');
}
get hiddenReason() {
@ -184,4 +184,8 @@ export class EditRedactionDialogComponent
value: new FormControl<string>(this.allRectangles ? this.data.annotations[0].value : null),
});
}
#isFieldEmpty(field: string) {
return this.data.annotations.every(annotation => !annotation[field].length);
}
}