diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts index 89e15164e..9327ec6bc 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dictionary-dialog/add-edit-dictionary-dialog.component.ts @@ -46,7 +46,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent { ) { super(_injector, _dialogRef); this.form = this._getForm(this.dictionary); - this.initialForm = this._getForm(this.dictionary); + this.initialFormValue = this.form.getRawValue(); this.hasColor$ = this._colorEmpty$; this.technicalName$ = this.form.get('label').valueChanges.pipe(map(value => this._toTechnicalName(value))); } diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts index f263a5904..fb541d419 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-dossier-template-dialog.component.ts @@ -42,7 +42,7 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent { ) { super(_injector, _dialogRef); this.form = this._getForm(); - this.initialForm = this._getForm(); + this.initialFormValue = this.form.getRawValue(); this.hasValidFrom = !!this.dossierTemplate?.validFrom; this.hasValidTo = !!this.dossierTemplate?.validTo; diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts index 1e17d2d58..387c78462 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.ts @@ -39,7 +39,7 @@ export class AddEditFileAttributeDialogComponent extends BaseDialogComponent { this.canSetDisplayed = data.numberOfDisplayedAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.displayedInFileList; this.canSetFilterable = data.numberOfFilterableAttrs < this.DISPLAYED_FILTERABLE_LIMIT || data.fileAttribute?.filterable; this.form = this._getForm(this.fileAttribute); - this.initialForm = this._getForm(this.fileAttribute); + this.initialFormValue = this.form.getRawValue(); } save() { diff --git a/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts index bbef7e13d..ebc4e483d 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/edit-color-dialog/edit-color-dialog.component.ts @@ -38,7 +38,7 @@ export class EditColorDialogComponent extends BaseDialogComponent { this._dossierTemplateId = data.dossierTemplateId; this.form = this._getForm(); - this.initialForm = this._getForm(); + this.initialFormValue = this.form.getRawValue(); } async save() { diff --git a/apps/red-ui/src/app/modules/shared/dialog/base-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialog/base-dialog.component.ts index 486aded3f..f1452b5bb 100644 --- a/apps/red-ui/src/app/modules/shared/dialog/base-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialog/base-dialog.component.ts @@ -23,7 +23,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI protected _waitingForConfirmation = false; form!: FormGroup; - initialForm!: FormGroup; + initialFormValue; constructor(protected readonly _injector: Injector, protected readonly _dialogRef: MatDialogRef) { super(); @@ -43,7 +43,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI get changed(): boolean { for (const key of Object.keys(this.form.getRawValue())) { - const initialValue = this.initialForm.get(key).value; + const initialValue = this.initialFormValue[key]; const updatedValue = this.form.get(key).value; if (initialValue == null && updatedValue != null) {