RED-6865: Added setting for default dossier template manipulation.

This commit is contained in:
Nicoleta Panaghiu 2023-06-20 17:35:32 +03:00
parent 3e128e9e65
commit 40c5a9cd22
6 changed files with 28 additions and 9 deletions

View File

@ -68,6 +68,13 @@
</div>
</div>
<p class="heading download-includes">{{ 'add-edit-clone-dossier-template.form.apply-updates-default.heading' | translate }}</p>
<div class="iqser-input-group">
<mat-checkbox color="primary" formControlName="applyDictionaryUpdatesToAllDossiersByDefault">
{{ 'add-edit-clone-dossier-template.form.apply-updates-default.description' | translate }}
</mat-checkbox>
</div>
<p class="heading download-includes">{{ 'download-includes' | translate }}</p>
<div class="flex">
<redaction-select

View File

@ -43,7 +43,7 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon
) {
super(_dialogRef, !!data && !data.clone);
this.dossierTemplate = this._dossierTemplatesService.find(this.data?.dossierTemplateId);
this.form = this._getForm();
this.form = this.#getForm();
this.initialFormValue = this.form.getRawValue();
this.hasValidFrom = !!this.dossierTemplate?.validFrom;
this.hasValidTo = !!this.dossierTemplate?.validTo;
@ -113,18 +113,19 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon
this._lastValidTo = this._previousValidTo || this._lastValidTo;
}
private _getForm() {
#getForm() {
return this._formBuilder.group({
name: [this._getCloneName(), Validators.required],
name: [this.#getCloneName(), Validators.required],
description: [this.dossierTemplate?.description],
validFrom: [
this.dossierTemplate?.validFrom ? dayjs(this.dossierTemplate?.validFrom).toDate() : null,
this._requiredIfValidator(() => this.hasValidFrom),
this.#requiredIfValidator(() => this.hasValidFrom),
],
validTo: [
this.dossierTemplate?.validTo ? dayjs(this.dossierTemplate?.validTo).toDate() : null,
this._requiredIfValidator(() => this.hasValidTo),
this.#requiredIfValidator(() => this.hasValidTo),
],
applyDictionaryUpdatesToAllDossiersByDefault: [this.dossierTemplate?.applyDictionaryUpdatesToAllDossiersByDefault],
downloadFileTypes: [this.dossierTemplate?.downloadFileTypes || ['PREVIEW', 'REDACTED']],
keepHiddenText: [this.dossierTemplate?.keepHiddenText],
keepImageMetadata: [this.dossierTemplate?.keepImageMetadata],
@ -132,7 +133,7 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon
});
}
private _getCloneName(): string {
#getCloneName(): string {
if (!this.data?.clone) {
return this.dossierTemplate?.name;
}
@ -157,7 +158,7 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon
return `Copy of ${nameOfClonedTemplate}`;
}
private _requiredIfValidator(predicate) {
#requiredIfValidator(predicate) {
return (formControl: AbstractControl) => {
if (!formControl.parent) {
return null;

View File

@ -61,7 +61,11 @@
"title": ""
},
"valid-from": "Gültig ab",
"valid-to": "Gültig bis"
"valid-to": "Gültig bis",
"apply-updates-default": {
"heading": "",
"description": ""
}
},
"save": "Dossier-Vorlage speichern",
"title": "{type, select, edit{Dossier-Vorlage {name} bearbeiten} create{Dossier-Vorlage erstellen} clone{} other{}}"

View File

@ -61,7 +61,11 @@
"title": "Keep overlapping elements"
},
"valid-from": "Valid from",
"valid-to": "Valid to"
"valid-to": "Valid to",
"apply-updates-default": {
"heading": "Entity configuration",
"description": "Apply dictionary updates to all dossiers by default"
}
},
"save": "Save Dossier Template",
"title": "{type, select, edit{Edit {name}} create{Create} clone{Clone} other{}} Dossier Template"

View File

@ -19,6 +19,7 @@ export class DossierTemplate implements IDossierTemplate, IListable {
readonly keepHiddenText: boolean;
readonly keepImageMetadata: boolean;
readonly keepOverlappingObjects: boolean;
readonly applyDictionaryUpdatesToAllDossiersByDefault: boolean;
constructor(dossierTemplate: IDossierTemplate) {
this.createdBy = dossierTemplate.createdBy;
@ -36,6 +37,7 @@ export class DossierTemplate implements IDossierTemplate, IListable {
this.keepHiddenText = dossierTemplate.keepHiddenText;
this.keepImageMetadata = dossierTemplate.keepImageMetadata;
this.keepOverlappingObjects = dossierTemplate.keepOverlappingObjects;
this.applyDictionaryUpdatesToAllDossiersByDefault = dossierTemplate.applyDictionaryUpdatesToAllDossiersByDefault;
}
get isActive(): boolean {

View File

@ -60,4 +60,5 @@ export interface IDossierTemplate {
* Overlapping elements in the document can potentially contain hidden sensitive information
*/
readonly keepOverlappingObjects: boolean;
readonly applyDictionaryUpdatesToAllDossiersByDefault: boolean;
}