From 6c8fea4ad8fd8620666d0417153026ef26b4ec0d Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 7 Sep 2020 10:51:46 +0300 Subject: [PATCH] Register modal events before using them, e.g. when provider edits an existing appointment via link (#839) --- assets/js/backend_calendar.js | 10 +++++----- assets/js/backend_calendar_default_view.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/js/backend_calendar.js b/assets/js/backend_calendar.js index 45253c3a..1f30959b 100755 --- a/assets/js/backend_calendar.js +++ b/assets/js/backend_calendar.js @@ -75,6 +75,11 @@ window.BackendCalendar = window.BackendCalendar || {}; * @param {String} view Optional (default), the calendar view to be loaded. */ exports.initialize = function (view) { + BackendCalendarGoogleSync.initialize(); + BackendCalendarAppointmentsModal.initialize(); + BackendCalendarUnavailabilitiesModal.initialize(); + BackendCalendarExtraPeriodsModal.initialize(); + // Load and initialize the calendar view. if (view === 'table') { BackendCalendarTableView.initialize(); @@ -82,11 +87,6 @@ window.BackendCalendar = window.BackendCalendar || {}; BackendCalendarDefaultView.initialize(); } - BackendCalendarGoogleSync.initialize(); - BackendCalendarAppointmentsModal.initialize(); - BackendCalendarUnavailabilitiesModal.initialize(); - BackendCalendarExtraPeriodsModal.initialize(); - bindEventHandlers(); }; diff --git a/assets/js/backend_calendar_default_view.js b/assets/js/backend_calendar_default_view.js index 50a6cd14..b3055db0 100755 --- a/assets/js/backend_calendar_default_view.js +++ b/assets/js/backend_calendar_default_view.js @@ -1475,7 +1475,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; $dialog.find('.modal-header h3').text(EALang.edit_appointment_title); $dialog.find('#appointment-id').val(appointment.id); - $dialog.find('#select-service').val(appointment.id_services).change(); + $dialog.find('#select-service').val(appointment.id_services).trigger('change'); $dialog.find('#select-provider').val(appointment.id_users_provider); // Set the start and end datetime of the appointment.