From 93fdbd875aadf44c40eeb82158b117085e24448e Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 20 Feb 2023 08:24:49 +0100 Subject: [PATCH] Correct the message modal handling methods --- assets/js/pages/admins.js | 8 ++++---- assets/js/pages/booking.js | 8 ++++---- assets/js/pages/business_settings.js | 8 ++++---- assets/js/pages/categories.js | 8 ++++---- assets/js/pages/customers.js | 8 ++++---- assets/js/pages/providers.js | 8 ++++---- assets/js/pages/secretaries.js | 8 ++++---- assets/js/pages/services.js | 8 ++++---- assets/js/pages/webhooks.js | 8 ++++---- assets/js/utils/calendar_default_view.js | 23 ++++++++++------------- assets/js/utils/calendar_google_sync.js | 8 ++++---- 11 files changed, 50 insertions(+), 53 deletions(-) diff --git a/assets/js/pages/admins.js b/assets/js/pages/admins.js index ec702380..c1767769 100644 --- a/assets/js/pages/admins.js +++ b/assets/js/pages/admins.js @@ -153,15 +153,15 @@ App.Pages.Admins = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(adminId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/booking.js b/assets/js/pages/booking.js index 1e6dd4cc..e0c68234 100644 --- a/assets/js/pages/booking.js +++ b/assets/js/pages/booking.js @@ -381,8 +381,8 @@ App.Pages.Booking = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { @@ -420,8 +420,8 @@ App.Pages.Booking = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { diff --git a/assets/js/pages/business_settings.js b/assets/js/pages/business_settings.js index b4ef9173..4658b3ba 100644 --- a/assets/js/pages/business_settings.js +++ b/assets/js/pages/business_settings.js @@ -112,13 +112,13 @@ App.Pages.BusinessSettings = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: 'OK', - click: () => { + click: (event, messageModal) => { const workingPlan = workingPlanManager.get(); App.Http.BusinessSettings.applyGlobalWorkingPlan(workingPlan) @@ -126,7 +126,7 @@ App.Pages.BusinessSettings = (function () { App.Layouts.Backend.displayNotification(lang('working_plans_got_updated')); }) .always(() => { - $('#message-box').dialog('close'); + messageModal.dispose(); }); } } diff --git a/assets/js/pages/categories.js b/assets/js/pages/categories.js index fb75fa3e..390cc60b 100644 --- a/assets/js/pages/categories.js +++ b/assets/js/pages/categories.js @@ -97,15 +97,15 @@ App.Pages.Categories = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(categoryId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/customers.js b/assets/js/pages/customers.js index 604f6eba..8fd409c6 100644 --- a/assets/js/pages/customers.js +++ b/assets/js/pages/customers.js @@ -146,15 +146,15 @@ App.Pages.Customers = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(customerId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/providers.js b/assets/js/pages/providers.js index 3e54451e..fb48b222 100755 --- a/assets/js/pages/providers.js +++ b/assets/js/pages/providers.js @@ -134,15 +134,15 @@ App.Pages.Providers = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(providerId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/secretaries.js b/assets/js/pages/secretaries.js index 06e74de4..5db6a171 100644 --- a/assets/js/pages/secretaries.js +++ b/assets/js/pages/secretaries.js @@ -157,15 +157,15 @@ App.Pages.Secretaries = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(secretaryId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/services.js b/assets/js/pages/services.js index cc8f97e1..d9651089 100644 --- a/assets/js/pages/services.js +++ b/assets/js/pages/services.js @@ -176,15 +176,15 @@ App.Pages.Services = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(serviceId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/pages/webhooks.js b/assets/js/pages/webhooks.js index dc168c2c..e58f151f 100644 --- a/assets/js/pages/webhooks.js +++ b/assets/js/pages/webhooks.js @@ -147,15 +147,15 @@ App.Pages.Webhooks = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { remove(webhookId); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/utils/calendar_default_view.js b/assets/js/utils/calendar_default_view.js index f50f1769..69b6984d 100755 --- a/assets/js/utils/calendar_default_view.js +++ b/assets/js/utils/calendar_default_view.js @@ -234,19 +234,19 @@ App.Utils.CalendarDefaultView = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('delete'), - click: () => { + click: (event, messageModal) => { const appointmentId = lastFocusedEventData.extendedProps.data.id; const deleteReason = $('#delete-reason').val(); App.Http.Calendar.deleteAppointment(appointmentId, deleteReason).done(() => { - $('#message-box').dialog('close'); + messageModal.dispose(); // Refresh calendar event items. $reloadAppointments.trigger('click'); @@ -272,8 +272,6 @@ App.Utils.CalendarDefaultView = (function () { const unavailabilityId = lastFocusedEventData.extendedProps.data.id; App.Http.Calendar.deleteUnavailability(unavailabilityId).done(() => { - $('#message-box').dialog('close'); - // Refresh calendar event items. $reloadAppointments.trigger('click'); }); @@ -1523,13 +1521,13 @@ App.Utils.CalendarDefaultView = (function () { const buttons = [ { text: lang('close'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: lang('unavailability'), - click: () => { + click: (event, messageModal) => { $('#insert-unavailability').trigger('click'); if (isProviderDisplayed) { @@ -1544,12 +1542,12 @@ App.Utils.CalendarDefaultView = (function () { $('#unavailability-end')[0]._flatpickr.setDate( info.end); - $('#message-box').dialog('close'); + messageModal.dispose(); } }, { text: lang('appointment'), - click: () => { + click: (event, messageModal) => { $('#insert-appointment').trigger('click'); // Preselect service & provider. @@ -1601,8 +1599,7 @@ App.Utils.CalendarDefaultView = (function () { $('#start-datetime')[0]._flatpickr.setDate( info.start); $('#end-datetime')[0]._flatpickr.setDate( App.Pages.Calendar.getSelectionEndDate(info)); - // $('#end-datetime')[0]._flatpickr.setDate( info.end); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ]; diff --git a/assets/js/utils/calendar_google_sync.js b/assets/js/utils/calendar_google_sync.js index a2462832..971ec3d8 100644 --- a/assets/js/utils/calendar_google_sync.js +++ b/assets/js/utils/calendar_google_sync.js @@ -79,13 +79,13 @@ App.Utils.CalendarGoogleSync = (function () { const buttons = [ { text: lang('cancel'), - click: () => { - $('#message-box').dialog('close'); + click: (event, messageModal) => { + messageModal.dispose(); } }, { text: 'OK', - click: () => { + click: (event, messageModal) => { // Disable synchronization for selected provider. const providerId = $('#select-filter-item').val(); @@ -107,7 +107,7 @@ App.Utils.CalendarGoogleSync = (function () { $('#google-sync').prop('disabled', true); $('#select-filter-item option:selected').attr('google-sync', 'false'); - $('#message-box').dialog('close'); + messageModal.dispose(); } } ];