From 9905c942acdf9918a9b08a12dd65bd6c2ee9010c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 4 May 2020 21:19:02 +0200 Subject: [PATCH] Remove timeout before closing the extra periods modal on success. --- .../backend_calendar_extra_periods_modal.js | 41 ++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/assets/js/backend_calendar_extra_periods_modal.js b/assets/js/backend_calendar_extra_periods_modal.js index 6335589f..50a6e21f 100644 --- a/assets/js/backend_calendar_extra_periods_modal.js +++ b/assets/js/backend_calendar_extra_periods_modal.js @@ -59,33 +59,28 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa var successCallback = function (response) { // Display success message to the user. - $dialog.find('.modal-message') - .text(EALang.extra_period_saved) - .addClass('alert-success') - .removeClass('alert-danger hidden'); + Backend.displayNotification(EALang.extra_period_saved); - // Close the modal dialog and refresh the calendar appointments after one second. - setTimeout(function () { - $dialog.find('.alert').addClass('hidden'); - $dialog.modal('hide'); + // Close the modal dialog and refresh the calendar appointments. + $dialog.find('.alert').addClass('hidden'); + $dialog.modal('hide'); - var providerId = $('#extra-provider').val(); - var provider = GlobalVariables.availableProviders.filter(function (p) { - return p.id === providerId; - })[0]; - var providerIdx = GlobalVariables.availableProviders.indexOf(provider); + var providerId = $('#extra-provider').val(); + var provider = GlobalVariables.availableProviders.filter(function (p) { + return p.id === providerId; + })[0]; + var providerIdx = GlobalVariables.availableProviders.indexOf(provider); - var extraWorkingPlan = jQuery.parseJSON(provider.settings.extra_working_plan); - extraWorkingPlan[start.toString('yyyy-MM-dd')] = { - start: start.toString('HH:mm'), - end: end.toString('HH:mm'), - breaks: [] - }; - provider.settings.extra_working_plan = JSON.stringify(extraWorkingPlan); - GlobalVariables.availableProviders[providerIdx] = provider; + var extraWorkingPlan = jQuery.parseJSON(provider.settings.extra_working_plan); + extraWorkingPlan[start.toString('yyyy-MM-dd')] = { + start: start.toString('HH:mm'), + end: end.toString('HH:mm'), + breaks: [] + }; + provider.settings.extra_working_plan = JSON.stringify(extraWorkingPlan); + GlobalVariables.availableProviders[providerIdx] = provider; - $('#select-filter-item').trigger('change'); - }, 2000); + $('#select-filter-item').trigger('change'); }; var errorCallback = function (jqXHR, textStatus, errorThrown) {