From f14f8aa12310c6304610591f828e944927436b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silke=20Gr=C3=BCber?= Date: Wed, 27 Mar 2024 10:02:37 +0100 Subject: [PATCH] fix: prevent validation error when closing dialogs (#1617) * do not show validation error after submitting the wish list/order template form * do not show validation error after saving data when rejecting a requisition in dialogs --- .../requisition-reject-dialog.component.ts | 2 +- .../order-template-preferences-dialog.component.ts | 6 ++---- .../wishlist-preferences-dialog.component.ts | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.ts b/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.ts index 47852e8320..d099929981 100644 --- a/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.ts +++ b/projects/requisition-management/src/app/pages/requisition-detail/requisition-reject-dialog/requisition-reject-dialog.component.ts @@ -86,12 +86,12 @@ export class RequisitionRejectDialogComponent implements OnInit { /** Opens the modal. */ show() { + this.rejectForm.reset(); this.modal = this.ngbModal.open(this.modalTemplate); } /** Close the modal. */ hide() { - this.rejectForm.reset(); this.submitted = false; if (this.modal) { this.modal.close(); diff --git a/src/app/extensions/order-templates/shared/order-template-preferences-dialog/order-template-preferences-dialog.component.ts b/src/app/extensions/order-templates/shared/order-template-preferences-dialog/order-template-preferences-dialog.component.ts index 6e7f4ec88a..dd3cbf832d 100644 --- a/src/app/extensions/order-templates/shared/order-template-preferences-dialog/order-template-preferences-dialog.component.ts +++ b/src/app/extensions/order-templates/shared/order-template-preferences-dialog/order-template-preferences-dialog.component.ts @@ -112,15 +112,13 @@ export class OrderTemplatePreferencesDialogComponent implements OnInit { /** Opens the modal. */ show() { - if (this.orderTemplate) { - this.model = pick(this.orderTemplate, 'title'); - } + this.orderTemplateForm.reset(); + this.model = pick(this.orderTemplate, 'title'); this.modal = this.ngbModal.open(this.modalTemplate); } /** Close the modal. */ hide() { - this.orderTemplateForm.reset({}); this.submitted = false; if (this.modal) { this.modal.close(); diff --git a/src/app/extensions/wishlists/shared/wishlist-preferences-dialog/wishlist-preferences-dialog.component.ts b/src/app/extensions/wishlists/shared/wishlist-preferences-dialog/wishlist-preferences-dialog.component.ts index 7922391b74..c65aa6b854 100644 --- a/src/app/extensions/wishlists/shared/wishlist-preferences-dialog/wishlist-preferences-dialog.component.ts +++ b/src/app/extensions/wishlists/shared/wishlist-preferences-dialog/wishlist-preferences-dialog.component.ts @@ -126,6 +126,7 @@ export class WishlistPreferencesDialogComponent implements OnInit { /** Opens the modal. */ show() { + this.wishListForm.reset(); if (!this.wishlist) { this.model = { preferred: false }; } else { @@ -136,7 +137,6 @@ export class WishlistPreferencesDialogComponent implements OnInit { /** Close the modal. */ hide() { - this.wishListForm.reset(); this.submitted = false; if (this.modal) { this.modal.close();