From b7c54af0d080fc95a3bd9b8b7487b55d9e8c1e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Sun, 3 May 2020 22:40:29 +0200 Subject: [PATCH] Remove timeout when appointment modal save/update action is successfull. --- assets/js/backend_calendar_appointments_modal.js | 14 +++++--------- .../js/backend_calendar_unavailabilities_modal.js | 15 +++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/assets/js/backend_calendar_appointments_modal.js b/assets/js/backend_calendar_appointments_modal.js index 3464e976..268a5139 100755 --- a/assets/js/backend_calendar_appointments_modal.js +++ b/assets/js/backend_calendar_appointments_modal.js @@ -99,16 +99,12 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa // Define success callback. var successCallback = function (response) { // Display success message to the user. - $dialog.find('.modal-message').text(EALang.appointment_saved); - $dialog.find('.modal-message').addClass('alert-success').removeClass('alert-danger hidden'); - $dialog.find('.modal-body').scrollTop(0); + Backend.displayNotification(EALang.appointment_saved); - // Close the modal dialog and refresh the calendar appointments after one second. - setTimeout(function () { - $dialog.find('.alert').addClass('hidden'); - $dialog.modal('hide'); - $('#select-filter-item').trigger('change'); - }, 2000); + // Close the modal dialog and refresh the calendar appointments. + $dialog.find('.alert').addClass('hidden'); + $dialog.modal('hide'); + $('#select-filter-item').trigger('change'); }; // Define error callback. diff --git a/assets/js/backend_calendar_unavailabilities_modal.js b/assets/js/backend_calendar_unavailabilities_modal.js index fa3cb69b..3d320039 100755 --- a/assets/js/backend_calendar_unavailabilities_modal.js +++ b/assets/js/backend_calendar_unavailabilities_modal.js @@ -60,17 +60,12 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili var successCallback = function (response) { // Display success message to the user. - $dialog.find('.modal-message') - .text(EALang.unavailable_saved) - .addClass('alert-success') - .removeClass('alert-danger hidden'); + Backend.displayNotification(EALang.unavailable_saved); - // Close the modal dialog and refresh the calendar appointments after one second. - setTimeout(function () { - $dialog.find('.alert').addClass('hidden'); - $dialog.modal('hide'); - $('#select-filter-item').trigger('change'); - }, 2000); + // Close the modal dialog and refresh the calendar appointments. + $dialog.find('.alert').addClass('hidden'); + $dialog.modal('hide'); + $('#select-filter-item').trigger('change'); }; var errorCallback = function (jqXHR, textStatus, errorThrown) {