This commit is contained in:
30
assets/js/layouts/account_layout.js
Normal file
30
assets/js/layouts/account_layout.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Online Appointment Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) Alex Tselegidis
|
||||
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link https://easyappointments.org
|
||||
* @since v1.5.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Account layout.
|
||||
*
|
||||
* This module implements the account layout functionality.
|
||||
*/
|
||||
window.App.Layouts.Account = (function () {
|
||||
const $selectLanguage = $('#select-language');
|
||||
|
||||
/**
|
||||
* Initialize the module.
|
||||
*/
|
||||
function initialize() {
|
||||
App.Utils.Lang.enableLanguageSelection($selectLanguage);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initialize);
|
||||
|
||||
return {};
|
||||
})();
|
120
assets/js/layouts/backend_layout.js
Normal file
120
assets/js/layouts/backend_layout.js
Normal file
@ -0,0 +1,120 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Online Appointment Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) Alex Tselegidis
|
||||
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link https://easyappointments.org
|
||||
* @since v1.5.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Backend layout.
|
||||
*
|
||||
* This module implements the backend layout functionality.
|
||||
*/
|
||||
window.App.Layouts.Backend = (function () {
|
||||
const $selectLanguage = $('#select-language');
|
||||
const $notification = $('#notification');
|
||||
const $loading = $('#loading');
|
||||
const $footer = $('#footer');
|
||||
|
||||
const DB_SLUG_ADMIN = 'admin';
|
||||
const DB_SLUG_PROVIDER = 'provider';
|
||||
const DB_SLUG_SECRETARY = 'secretary';
|
||||
const DB_SLUG_CUSTOMER = 'customer';
|
||||
|
||||
const PRIV_VIEW = 1;
|
||||
const PRIV_ADD = 2;
|
||||
const PRIV_EDIT = 4;
|
||||
const PRIV_DELETE = 8;
|
||||
|
||||
const PRIV_APPOINTMENTS = 'appointments';
|
||||
const PRIV_CUSTOMERS = 'customers';
|
||||
const PRIV_SERVICES = 'services';
|
||||
const PRIV_USERS = 'users';
|
||||
const PRIV_SYSTEM_SETTINGS = 'system_settings';
|
||||
const PRIV_USER_SETTINGS = 'user_settings';
|
||||
|
||||
/**
|
||||
* Display backend notifications to user.
|
||||
*
|
||||
* Using this method you can display notifications to the use with custom messages. If the 'actions' array is
|
||||
* provided then an action link will be displayed too.
|
||||
*
|
||||
* @param {String} message Notification message
|
||||
* @param {Array} [actions] An array with custom actions that will be available to the user. Every array item is an
|
||||
* object that contains the 'label' and 'function' key values.
|
||||
*/
|
||||
function displayNotification(message, actions = []) {
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
|
||||
const $toast = $(`
|
||||
<div class="toast bg-dark d-flex align-items-center mb-2 fade show position-fixed p-1 m-4 bottom-0 end-0 backend-notification" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-body w-100 text-white">
|
||||
${message}
|
||||
</div>
|
||||
<button type="button" class="btn-close btn-close-white me-2" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
`).appendTo('body');
|
||||
|
||||
actions.forEach(function (action) {
|
||||
$('<button/>', {
|
||||
class: 'btn btn-light btn-sm ms-2',
|
||||
text: action.label,
|
||||
on: {
|
||||
click: action.function,
|
||||
},
|
||||
}).prependTo($toast);
|
||||
});
|
||||
|
||||
const toast = new bootstrap.Toast($toast[0]);
|
||||
|
||||
toast.show();
|
||||
|
||||
setTimeout(() => {
|
||||
toast.dispose();
|
||||
$toast.remove();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the module.
|
||||
*/
|
||||
function initialize() {
|
||||
$(document).ajaxStart(() => {
|
||||
$loading.show();
|
||||
});
|
||||
|
||||
$(document).ajaxStop(() => {
|
||||
$loading.hide();
|
||||
});
|
||||
|
||||
tippy('[data-tippy-content]');
|
||||
|
||||
App.Utils.Lang.enableLanguageSelection($selectLanguage);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initialize);
|
||||
|
||||
return {
|
||||
DB_SLUG_ADMIN,
|
||||
DB_SLUG_PROVIDER,
|
||||
DB_SLUG_SECRETARY,
|
||||
DB_SLUG_CUSTOMER,
|
||||
PRIV_VIEW,
|
||||
PRIV_ADD,
|
||||
PRIV_EDIT,
|
||||
PRIV_DELETE,
|
||||
PRIV_APPOINTMENTS,
|
||||
PRIV_CUSTOMERS,
|
||||
PRIV_SERVICES,
|
||||
PRIV_USERS,
|
||||
PRIV_SYSTEM_SETTINGS,
|
||||
PRIV_USER_SETTINGS,
|
||||
displayNotification,
|
||||
};
|
||||
})();
|
30
assets/js/layouts/booking_layout.js
Normal file
30
assets/js/layouts/booking_layout.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Online Appointment Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) Alex Tselegidis
|
||||
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link https://easyappointments.org
|
||||
* @since v1.5.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Booking layout.
|
||||
*
|
||||
* This module implements the booking layout functionality.
|
||||
*/
|
||||
window.App.Layouts.Booking = (function () {
|
||||
const $selectLanguage = $('#select-language');
|
||||
|
||||
/**
|
||||
* Initialize the module.
|
||||
*/
|
||||
function initialize() {
|
||||
App.Utils.Lang.enableLanguageSelection($selectLanguage);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initialize);
|
||||
|
||||
return {};
|
||||
})();
|
19
assets/js/layouts/message_layout.js
Normal file
19
assets/js/layouts/message_layout.js
Normal file
@ -0,0 +1,19 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Online Appointment Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) Alex Tselegidis
|
||||
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link https://easyappointments.org
|
||||
* @since v1.5.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Message layout.
|
||||
*
|
||||
* This module implements the message layout functionality.
|
||||
*/
|
||||
window.App.Layouts.Message = (function () {
|
||||
return {};
|
||||
})();
|
Reference in New Issue
Block a user