diff --git a/assets/js/components/appointments_modal.js b/assets/js/components/appointments_modal.js index baf52779..3bd90066 100755 --- a/assets/js/components/appointments_modal.js +++ b/assets/js/components/appointments_modal.js @@ -636,6 +636,8 @@ App.Components.AppointmentsModal = (function () { addEventListeners(); } + document.addEventListener('DOMContentLoaded', initialize); + return { resetModal, initialize diff --git a/assets/js/pages/calendar.js b/assets/js/pages/calendar.js index ea73432b..0d39ed5b 100755 --- a/assets/js/pages/calendar.js +++ b/assets/js/pages/calendar.js @@ -107,12 +107,6 @@ App.Pages.Calendar = (function () { * @param {String} view Optional (default), the calendar view to be loaded. */ function initialize(view) { - App.Utils.CalendarGoogleSync.initialize(); - - App.Components.AppointmentsModal.initialize(); - - App.Components.UnavailabilitiesModal.initialize(); - // Load and initialize the calendar view. if (view === 'table') { App.Utils.CalendarTableView.initialize(); diff --git a/assets/js/utils/calendar_google_sync.js b/assets/js/utils/calendar_google_sync.js index c485069f..a30db84c 100644 --- a/assets/js/utils/calendar_google_sync.js +++ b/assets/js/utils/calendar_google_sync.js @@ -178,10 +178,15 @@ App.Utils.CalendarGoogleSync = (function () { $.post(url, data); } + /** + * Initialize the module. + */ function initialize() { bindEventHandlers(); } + document.addEventListener('DOMContentLoaded', initialize); + return { initialize };