Replace all backend layout occurrences.

This commit is contained in:
Alex Tselegidis 2022-01-17 05:26:57 +01:00
parent 4ee715e308
commit 22439eb60a
18 changed files with 76 additions and 73 deletions

View file

@ -113,7 +113,7 @@ App.Components.AppointmentsModal = (function () {
// Define success callback.
const successCallback = () => {
// Display success message to the user.
Backend.displayNotification(App.Lang.appointment_saved);
App.Layouts.Backend.displayNotification(App.Lang.appointment_saved);
// Close the modal dialog and refresh the calendar appointments.
$appointmentsModal.find('.alert').addClass('d-none').modal('hide');
@ -343,12 +343,15 @@ App.Components.AppointmentsModal = (function () {
App.Vars.available_providers.forEach((provider) => {
provider.services.forEach((providerServiceId) => {
if (App.Vars.role_slug === Backend.DB_SLUG_PROVIDER && Number(provider.id) !== App.Vars.user_id) {
if (
App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_PROVIDER &&
Number(provider.id) !== App.Vars.user_id
) {
return; // continue
}
if (
App.Vars.role_slug === Backend.DB_SLUG_SECRETARY &&
App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_SECRETARY &&
App.Vars.secretaryProviders.indexOf(provider.id) === -1
) {
return; // continue

View file

@ -85,7 +85,7 @@ App.Components.UnavailabilitiesModal = (function () {
const successCallback = () => {
// Display success message to the user.
Backend.displayNotification(App.Lang.unavailable_saved);
App.Layouts.Backend.displayNotification(App.Lang.unavailable_saved);
// Close the modal dialog and refresh the calendar appointments.
$unavailabilitiesModal.find('.alert').addClass('d-none');

View file

@ -105,7 +105,7 @@ window.App.Layouts.Backend = (function () {
function initialize() {
$(window)
.on('resize', () => {
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
})
.trigger('resize');

View file

@ -84,7 +84,7 @@ App.Pages.Account = (function () {
return false;
} catch (error) {
Backend.displayNotification(error.message);
App.Layouts.Backend.displayNotification(error.message);
return true;
}
}
@ -147,7 +147,7 @@ App.Pages.Account = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
Backend.displayNotification(App.Lang.user_settings_are_invalid);
App.Layouts.Backend.displayNotification(App.Lang.user_settings_are_invalid);
return;
}
@ -155,7 +155,7 @@ App.Pages.Account = (function () {
const account = serialize();
App.Http.Account.save(account).done(() => {
Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
$footerUserDisplayName.text('Hello, ' + $firstName.val() + ' ' + $lastName.val() + '!');
});
@ -171,7 +171,7 @@ App.Pages.Account = (function () {
const isValid = response.is_valid;
$username.toggleClass('is-invalid', !isValid);
if (!isValid) {
Backend.displayNotification(App.Lang.username_already_exists);
App.Layouts.Backend.displayNotification(App.Lang.username_already_exists);
}
});
}
@ -188,7 +188,7 @@ App.Pages.Account = (function () {
$username.on('change', onUsernameChange);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -212,7 +212,7 @@ App.Pages.Admins = (function () {
*/
function save(admin) {
App.Http.Admins.save(admin).then((response) => {
Backend.displayNotification(App.Lang.admin_saved);
App.Layouts.Backend.displayNotification(App.Lang.admin_saved);
resetForm();
$('#filter-admins .key').val('');
filter('', response.id, true);
@ -226,7 +226,7 @@ App.Pages.Admins = (function () {
*/
function remove(id) {
App.Http.Admins.destroy(id).then(() => {
Backend.displayNotification(App.Lang.admin_deleted);
App.Layouts.Backend.displayNotification(App.Lang.admin_deleted);
resetForm();
filter($('#filter-admins .key').val());
});

View file

@ -46,7 +46,7 @@ App.Pages.BookingSettings = (function () {
return false;
} catch (error) {
Backend.displayNotification(error.message);
App.Layouts.Backend.displayNotification(error.message);
return true;
}
}
@ -143,7 +143,7 @@ App.Pages.BookingSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
return;
}
@ -151,7 +151,7 @@ App.Pages.BookingSettings = (function () {
const bookingSettings = serialize();
App.Http.BookingSettings.save(bookingSettings).done(() => {
Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
});
}
@ -193,7 +193,7 @@ App.Pages.BookingSettings = (function () {
applyInitialState();
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -47,7 +47,7 @@ App.Pages.BusinessSettings = (function () {
return false;
} catch (error) {
Backend.displayNotification(error.message);
App.Layouts.Backend.displayNotification(error.message);
return true;
}
}
@ -85,7 +85,7 @@ App.Pages.BusinessSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
return;
}
@ -93,7 +93,7 @@ App.Pages.BusinessSettings = (function () {
const businessSettings = serialize();
App.Http.BusinessSettings.save(businessSettings).done(() => {
Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
});
}
@ -115,7 +115,7 @@ App.Pages.BusinessSettings = (function () {
App.Http.BusinessSettings.applyGlobalWorkingPlan(workingPlan)
.done(() => {
Backend.displayNotification(App.Lang.working_plans_got_updated);
App.Layouts.Backend.displayNotification(App.Lang.working_plans_got_updated);
})
.always(function () {
$('#message-box').dialog('close');
@ -152,7 +152,7 @@ App.Pages.BusinessSettings = (function () {
$applyGlobalWorkingPlan.on('click', onApplyGlobalWorkingPlan);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -67,7 +67,7 @@ App.Pages.Calendar = (function () {
App.Components.WorkingPlanExceptionsModal.add().done((date, workingPlanException) => {
const successCallback = () => {
Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};

View file

@ -205,7 +205,7 @@ App.Pages.Categories = (function () {
*/
function save(category) {
App.Http.Categories.save(category).then((response) => {
Backend.displayNotification(App.Lang.category_saved);
App.Layouts.Backend.displayNotification(App.Lang.category_saved);
resetForm();
$('#filter-categories .key').val('');
filter('', response.id, true);
@ -219,7 +219,7 @@ App.Pages.Categories = (function () {
*/
function remove(id) {
App.Http.Categories.destroy(id).then(() => {
Backend.displayNotification(App.Lang.category_deleted);
App.Layouts.Backend.displayNotification(App.Lang.category_deleted);
resetForm();
filter($('#filter-categories .key').val());
});

View file

@ -152,7 +152,7 @@ App.Pages.Customers = (function () {
*/
function save(customer) {
App.Http.Customers.save(customer).then((response) => {
Backend.displayNotification(App.Lang.customer_saved);
App.Layouts.Backend.displayNotification(App.Lang.customer_saved);
resetForm();
$('#filter-customers .key').val('');
filter('', response.id, true);
@ -166,7 +166,7 @@ App.Pages.Customers = (function () {
*/
function remove(id) {
App.Http.Customers.destroy(id).then(() => {
Backend.displayNotification(App.Lang.customer_deleted);
App.Layouts.Backend.displayNotification(App.Lang.customer_deleted);
resetForm();
filter($('#filter-customers .key').val());
});
@ -257,14 +257,14 @@ App.Pages.Customers = (function () {
customer.appointments.forEach(function (appointment) {
if (
App.Vars.role_slug === Backend.DB_SLUG_PROVIDER &&
App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_PROVIDER &&
parseInt(appointment.id_users_provider) !== App.Vars.user_id
) {
return;
}
if (
App.Vars.role_slug === Backend.DB_SLUG_SECRETARY &&
App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_SECRETARY &&
App.Vars.secretary_providers.indexOf(appointment.id_users_provider) === -1
) {
return;

View file

@ -45,7 +45,7 @@ App.Pages.GeneralSettings = (function () {
return false;
} catch (error) {
Backend.displayNotification(error.message);
App.Layouts.Backend.displayNotification(error.message);
return true;
}
}
@ -76,7 +76,7 @@ App.Pages.GeneralSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
return;
}
@ -84,7 +84,7 @@ App.Pages.GeneralSettings = (function () {
const generalSettings = serialize();
App.Http.GeneralSettings.save(generalSettings).done(() => {
Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
});
}
@ -98,7 +98,7 @@ App.Pages.GeneralSettings = (function () {
$saveSettings.on('click', onSaveSettingsClick);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -51,7 +51,7 @@ App.Pages.LegalSettings = (function () {
return false;
} catch (error) {
Backend.displayNotification(error.message);
App.Layouts.Backend.displayNotification(error.message);
return true;
}
}
@ -125,7 +125,7 @@ App.Pages.LegalSettings = (function () {
*/
function onSaveSettingsClick() {
if (isInvalid()) {
Backend.displayNotification(App.Lang.settings_are_invalid);
App.Layouts.Backend.displayNotification(App.Lang.settings_are_invalid);
return;
}
@ -133,7 +133,7 @@ App.Pages.LegalSettings = (function () {
const legalSettings = serialize();
App.Http.LegalSettings.save(legalSettings).done(() => {
Backend.displayNotification(App.Lang.settings_saved);
App.Layouts.Backend.displayNotification(App.Lang.settings_saved);
});
}
@ -151,7 +151,7 @@ App.Pages.LegalSettings = (function () {
$saveSettings.on('click', onSaveSettingsClick);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
document.addEventListener('DOMContentLoaded', initialize);

View file

@ -197,7 +197,7 @@ App.Pages.Providers = (function () {
* Event: Display Provider Details "Click"
*/
$providers.on('shown.bs.tab', 'a[data-toggle="tab"]', function () {
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
});
/**
@ -221,7 +221,7 @@ App.Pages.Providers = (function () {
*/
function save(provider) {
App.Http.Providers.save(provider).then((response) => {
Backend.displayNotification(App.Lang.provider_saved);
App.Layouts.Backend.displayNotification(App.Lang.provider_saved);
resetForm();
$('#filter-providers .key').val('');
filter('', response.id, true);
@ -235,7 +235,7 @@ App.Pages.Providers = (function () {
*/
function remove(id) {
App.Http.Providers.destroy(id).then(() => {
Backend.displayNotification(App.Lang.provider_deleted);
App.Layouts.Backend.displayNotification(App.Lang.provider_deleted);
resetForm();
filter($('#filter-providers .key').val());
});
@ -409,7 +409,7 @@ App.Pages.Providers = (function () {
.find('.edit-working-plan-exception, .delete-working-plan-exception')
.prop('disabled', true);
$('#providers .working-plan input:checkbox').prop('disabled', true);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
/**

View file

@ -248,7 +248,7 @@ App.Pages.Secretaries = (function () {
*/
function save(secretary) {
App.Http.Secretaries.save(secretary).done((response) => {
Backend.displayNotification(App.Lang.secretary_saved);
App.Layouts.Backend.displayNotification(App.Lang.secretary_saved);
resetForm();
$('#filter-secretaries .key').val('');
filter('', response.id, true);
@ -262,7 +262,7 @@ App.Pages.Secretaries = (function () {
*/
function remove(id) {
App.Http.Secretaries.destroy(id).done(() => {
Backend.displayNotification(App.Lang.secretary_deleted);
App.Layouts.Backend.displayNotification(App.Lang.secretary_deleted);
resetForm();
filter($('#filter-secretaries .key').val());
});

View file

@ -178,7 +178,7 @@ App.Pages.Services = (function () {
*/
function save(service) {
App.Http.Services.save(service).then((response) => {
Backend.displayNotification(App.Lang.service_saved);
App.Layouts.Backend.displayNotification(App.Lang.service_saved);
resetForm();
$('#filter-services .key').val('');
filter('', response.id, true);
@ -192,7 +192,7 @@ App.Pages.Services = (function () {
*/
function remove(id) {
App.Http.Services.destroy(id).then(() => {
Backend.displayNotification(App.Lang.service_deleted);
App.Layouts.Backend.displayNotification(App.Lang.service_deleted);
resetForm();
filter($('#filter-services .key').val());
});

View file

@ -86,7 +86,7 @@ App.Utils.CalendarDefaultView = (function () {
workingPlanException
) {
const successCallback = function () {
Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
@ -194,7 +194,7 @@ App.Utils.CalendarDefaultView = (function () {
}
const successCallback = () => {
Backend.displayNotification(App.Lang.working_plan_exception_deleted);
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_deleted);
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
delete workingPlanExceptions[date];
@ -741,7 +741,7 @@ App.Utils.CalendarDefaultView = (function () {
function calendarEventResize(event, delta, revertFunc) {
if (App.Vars.privileges.appointments.edit === false) {
revertFunc();
Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
return;
}
@ -788,7 +788,7 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -837,7 +837,7 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -894,7 +894,7 @@ App.Utils.CalendarDefaultView = (function () {
function calendarEventDrop(event, delta, revertFunc) {
if (App.Vars.privileges.appointments.edit === false) {
revertFunc();
Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
return;
}
@ -955,7 +955,7 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -1005,7 +1005,7 @@ App.Utils.CalendarDefaultView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
{
label: App.Lang.undo,
function: undoFunction
@ -1657,7 +1657,7 @@ App.Utils.CalendarDefaultView = (function () {
}
// Check permissions.
if (App.Vars.role_slug === Backend.DB_SLUG_PROVIDER) {
if (App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_PROVIDER) {
$selectFilterItem
.find('optgroup:eq(0)')
.find('option[value="' + App.Vars.user_id + '"]')
@ -1665,7 +1665,7 @@ App.Utils.CalendarDefaultView = (function () {
$selectFilterItem.prop('disabled', true);
}
if (App.Vars.role_slug === Backend.DB_SLUG_SECRETARY) {
if (App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_SECRETARY) {
// Remove the providers that are not connected to the secretary.
$selectFilterItem.find('optgroup:eq(1)').remove();

View file

@ -131,7 +131,7 @@ App.Utils.CalendarGoogleSync = (function () {
calendar_id: $('#google-calendar').val()
};
$.post(url, data).done(() => {
Backend.displayNotification(App.Lang.google_calendar_selected);
App.Layouts.Backend.displayNotification(App.Lang.google_calendar_selected);
$('#select-google-calendar').modal('hide');
});
});
@ -150,11 +150,11 @@ App.Utils.CalendarGoogleSync = (function () {
dataType: 'json'
})
.done(() => {
Backend.displayNotification(App.Lang.google_sync_completed);
App.Layouts.Backend.displayNotification(App.Lang.google_sync_completed);
$('#reload-appointments').trigger('click');
})
.fail(() => {
Backend.displayNotification(App.Lang.google_sync_failed);
App.Layouts.Backend.displayNotification(App.Lang.google_sync_failed);
});
});
}

View file

@ -113,7 +113,7 @@ App.Utils.CalendarTableView = (function () {
}
// setCalendarViewSize();
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
});
});
@ -153,7 +153,7 @@ App.Utils.CalendarTableView = (function () {
App.Components.WorkingPlanExceptionsModal.edit(date, workingPlanException).done(
(date, workingPlanException) => {
const successCallback = () => {
Backend.displayNotification(App.Lang.working_plan_exception_saved);
App.Layouts.Backend.displayNotification(App.Lang.working_plan_exception_saved);
const workingPlanExceptions = JSON.parse(provider.settings.working_plan_exceptions) || {};
@ -405,10 +405,10 @@ App.Utils.CalendarTableView = (function () {
const providers = GlobalVariables.availableProviders.filter(
(provider) =>
App.Vars.role_slug === Backend.DB_SLUG_ADMIN ||
(App.Vars.role_slug === Backend.DB_SLUG_SECRETARY &&
App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_ADMIN ||
(App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_SECRETARY &&
GlobalVariables.secretaryProviders.indexOf(provider.id) !== -1) ||
(App.Vars.role_slug === Backend.DB_SLUG_PROVIDER &&
(App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_PROVIDER &&
Number(provider.id) === Number(GlobalVariables.user.id))
);
@ -429,7 +429,7 @@ App.Utils.CalendarTableView = (function () {
}
}).appendTo($calendarHeader);
if (App.Vars.role_slug !== Backend.DB_SLUG_PROVIDER) {
if (App.Vars.role_slug !== App.Layouts.Backend.DB_SLUG_PROVIDER) {
providers.forEach((provider) => {
$filterProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
});
@ -448,7 +448,7 @@ App.Utils.CalendarTableView = (function () {
return provider.services.indexOf(service.id) !== -1;
});
return App.Vars.role_slug === Backend.DB_SLUG_ADMIN || provider;
return App.Vars.role_slug === App.Layouts.Backend.DB_SLUG_ADMIN || provider;
});
$('<label/>', {
@ -497,7 +497,7 @@ App.Utils.CalendarTableView = (function () {
$('#calendar .calendar-view').remove();
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
const $calendarView = $('<div/>', {
'class': 'calendar-view'
@ -520,7 +520,7 @@ App.Utils.CalendarTableView = (function () {
setCalendarViewSize();
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
// Activate calendar navigation.
$('#calendar .calendar-header .btn').removeClass('disabled').prop('disabled', false);
@ -635,7 +635,7 @@ App.Utils.CalendarTableView = (function () {
// Add the unavailability events to the column.
createUnavailabilityEvents($providerColumn, events.unavailability_events);
Backend.placeFooterToBottom();
App.Layouts.Backend.placeFooterToBottom();
}
/**
@ -1499,7 +1499,7 @@ App.Utils.CalendarTableView = (function () {
function onEventResize(event, delta, revertFunc) {
if (App.Vars.privileges.appointments.edit === false) {
revertFunc();
Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
return;
}
@ -1546,7 +1546,7 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -1593,7 +1593,7 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -1619,7 +1619,7 @@ App.Utils.CalendarTableView = (function () {
function onEventDrop(event, delta, revertFunc) {
if (App.Vars.privileges.appointments.edit === false) {
revertFunc();
Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
App.Layouts.Backend.displayNotification(App.Lang.no_privileges_edit_appointments);
return;
}
@ -1678,7 +1678,7 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.appointment_updated, [
App.Layouts.Backend.displayNotification(App.Lang.appointment_updated, [
{
'label': App.Lang.undo,
'function': undoFunction
@ -1726,7 +1726,7 @@ App.Utils.CalendarTableView = (function () {
revertFunc();
};
Backend.displayNotification(App.Lang.unavailable_updated, [
App.Layouts.Backend.displayNotification(App.Lang.unavailable_updated, [
{
label: App.Lang.undo,
function: undoFunction