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 2c40876fc..f263a5904 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
@@ -54,14 +54,10 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
});
this.addSubscription = this.form.controls['validFrom'].valueChanges.subscribe(value => {
- if (value) {
- this._lastValidFrom = value;
- }
+ this._lastValidFrom = value ? value : this._lastValidFrom;
});
this.addSubscription = this.form.controls['validTo'].valueChanges.subscribe(value => {
- if (value) {
- this._lastValidTo = value;
- }
+ this._lastValidFrom = value ? value : this._lastValidFrom;
});
}
diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html
index 169d826ac..7a8b7aa38 100644
--- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html
+++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-file-attribute-dialog/add-edit-file-attribute-dialog.component.html
@@ -84,7 +84,7 @@
-
diff --git a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts
index 827962c04..5a2c6f83b 100644
--- a/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts
+++ b/apps/red-ui/src/app/modules/dossier/dialogs/edit-dossier-dialog/edit-dossier-dialog.component.ts
@@ -148,24 +148,19 @@ export class EditDossierDialogComponent extends BaseDialogComponent {
changeTab(key: Section) {
if (this.changed) {
- this._waitingForConfirmation = true;
- const dialogRef = this._dialogService.openDialog({ disableConfirm: !this.valid });
- dialogRef
- .afterClosed()
- .toPromise()
- .then(async result => {
- if (result in ConfirmOptions) {
- if (result === ConfirmOptions.CONFIRM) {
- await this.save();
- } else {
- this.revert();
- }
- this.activeNav = key;
+ this._openConfirmDialog().then(async result => {
+ if (result in ConfirmOptions) {
+ if (result === ConfirmOptions.CONFIRM) {
+ await this.save();
+ } else {
+ this.revert();
}
- this._waitingForConfirmation = false;
- });
- return;
+ this.activeNav = key;
+ }
+ this._waitingForConfirmation = false;
+ });
+ } else {
+ this.activeNav = key;
}
- this.activeNav = key;
}
}
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 3cb2db26c..486aded3f 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
@@ -42,10 +42,6 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
}
get changed(): boolean {
- // console.log('-------------------------------------------------------');
- // console.log('initialForm: ', this.initialForm.value);
- // console.log('form: ', this.form.value);
-
for (const key of Object.keys(this.form.getRawValue())) {
const initialValue = this.initialForm.get(key).value;
const updatedValue = this.form.get(key).value;
@@ -78,24 +74,25 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
close(): void {
if (this.changed) {
- this._waitingForConfirmation = true;
- const dialogRef = this._dialogService.openDialog({ disableConfirm: !this.valid });
- dialogRef
- .afterClosed()
- .toPromise()
- .then(result => {
- if (result in ConfirmOptions) {
- if (result === ConfirmOptions.CONFIRM) {
- this.save(true);
- } else {
- this._dialogRef.close();
- }
+ this._openConfirmDialog().then(result => {
+ if (result in ConfirmOptions) {
+ if (result === ConfirmOptions.CONFIRM) {
+ this.save(true);
+ } else {
+ this._dialogRef.close();
}
- this._waitingForConfirmation = false;
- });
- return;
+ }
+ this._waitingForConfirmation = false;
+ });
+ } else {
+ this._dialogRef.close();
}
- this._dialogRef.close();
+ }
+
+ protected _openConfirmDialog() {
+ this._waitingForConfirmation = true;
+ const dialogRef = this._dialogService.openDialog({ disableConfirm: !this.valid });
+ return dialogRef.afterClosed().toPromise();
}
@HostListener('window:keydown.Enter', ['$event'])