Correct the message modal handling methods

This commit is contained in:
Alex Tselegidis 2023-02-20 08:24:49 +01:00
parent 97382d8da3
commit 93fdbd875a
11 changed files with 50 additions and 53 deletions

View file

@ -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();
}
}
];

View file

@ -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();
}
},
{

View file

@ -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();
});
}
}

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];

View file

@ -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();
}
}
];