From 03efbe3f7d4ca20f9c41c3bc051ca4d2ad008ca3 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 24 Apr 2023 15:55:36 +0300 Subject: [PATCH] UI: Add refresh delivery notification method --- .../sent-notification-dialog.component.html | 18 ++++++++++--- .../sent-notification-dialog.component.scss | 7 +++++ .../sent/sent-notification-dialog.componet.ts | 26 ++++++++++++------- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html index 6aac94f03b..fe5211d024 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html @@ -59,9 +59,21 @@
- -
notification.at-least-one-should-be-selected
+
+
+ +
notification.at-least-one-should-be-selected
+
+ +
, @@ -162,15 +164,7 @@ export class SentNotificationDialogComponent extends this.notificationRequestForm.get('useTemplate').setValue(useTemplate, {onlySelf : true}); } - this.notificationService.getAvailableDeliveryMethods({ignoreLoading: true}).subscribe(allowMethods => { - this.notificationDeliveryMethods.forEach(method => { - if (allowMethods.includes(method)) { - this.getDeliveryMethodsTemplatesControl(method).enable({emitEvent: true}); - } else { - this.getDeliveryMethodsTemplatesControl(method).setValue(false, {emitEvent: true}); //used for notify again - } - }); - }); + this.refreshAllowDeliveryMethod(); } ngOnDestroy() { @@ -340,4 +334,18 @@ export class SentNotificationDialogComponent extends return '/settings/notifications'; } } + + refreshAllowDeliveryMethod() { + this.notificationService.getAvailableDeliveryMethods({ignoreLoading: true}).subscribe(allowMethods => { + this.notificationDeliveryMethods.forEach(method => { + if (allowMethods.includes(method)) { + this.getDeliveryMethodsTemplatesControl(method).enable({emitEvent: true}); + } else { + this.getDeliveryMethodsTemplatesControl(method).disable({emitEvent: true}); + this.getDeliveryMethodsTemplatesControl(method).setValue(false, {emitEvent: true}); //used for notify again + } + }); + this.showRefresh = (this.notificationDeliveryMethods.length !== allowMethods.length); + }); + } }