Merge branch 'RED-7762' into 'master'

RED-7762: fixed unchanged placeholder.

Closes RED-7762

See merge request redactmanager/red-ui!223
This commit is contained in:
Dan Percic 2023-12-11 14:03:56 +01:00
commit 3a8f75bb95
2 changed files with 25 additions and 10 deletions

View File

@ -23,7 +23,10 @@
<label [translate]="'edit-redaction.dialog.content.type'"></label> <label [translate]="'edit-redaction.dialog.content.type'"></label>
<mat-form-field> <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-select-trigger>{{ displayedDictionaryLabel }}</mat-select-trigger>
<mat-option <mat-option
(click)="typeChanged()" (click)="typeChanged()"
@ -43,7 +46,9 @@
<label [translate]="'edit-redaction.dialog.content.reason'"></label> <label [translate]="'edit-redaction.dialog.content.reason'"></label>
<mat-form-field> <mat-form-field>
<mat-select <mat-select
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''" [placeholder]="
isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
"
class="full-width" class="full-width"
formControlName="reason" formControlName="reason"
> >
@ -62,7 +67,7 @@
<div class="iqser-input-group w-450"> <div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.legal-basis'"></label> <label [translate]="'edit-redaction.dialog.content.legal-basis'"></label>
<input <input
[placeholder]="!hidePlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''" [placeholder]="isBulkEdit || !hideReasonPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''"
[value]="form.controls.reason.value?.legalBasis" [value]="form.controls.reason.value?.legalBasis"
disabled disabled
type="text" type="text"
@ -72,7 +77,9 @@
<div class="iqser-input-group w-450"> <div class="iqser-input-group w-450">
<label [translate]="'edit-redaction.dialog.content.section'"></label> <label [translate]="'edit-redaction.dialog.content.section'"></label>
<input <input
[placeholder]="'edit-redaction.dialog.content.unchanged' | translate" [placeholder]="
isBulkEdit && !hideParagraphPlaceholder ? ('edit-redaction.dialog.content.unchanged' | translate) : ''
"
formControlName="section" formControlName="section"
name="section" name="section"
type="text" type="text"
@ -94,7 +101,7 @@
<label [translate]="'edit-redaction.dialog.content.comment'"></label> <label [translate]="'edit-redaction.dialog.content.comment'"></label>
<textarea <textarea
[placeholder]=" [placeholder]="
!isImage && redactedTexts.length === 1 !isBulkEdit
? ('edit-redaction.dialog.content.comment-placeholder' | translate) ? ('edit-redaction.dialog.content.comment-placeholder' | translate)
: ('edit-redaction.dialog.content.unchanged' | 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); return this.redactBasedTypes.includes(this.form.controls.type.value);
} }
get hidePlaceholder() { get hideReasonPlaceholder() {
return this.hasTypeChanged && this.isRedactBasedType; 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() { async ngOnInit() {
this.#setTypes(); this.#setTypes();
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId)); 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), value: new FormControl<string>(this.allRectangles ? this.data.annotations[0].value : null),
}); });
} }
get hiddenReason() {
return this.isImage && this.form.controls.reason.disabled;
}
} }