mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 16:02:54 +03:00
Refactored the backend.js module.
This commit is contained in:
parent
fb5e4aa20e
commit
d1a0aa02fd
1 changed files with 58 additions and 52 deletions
|
@ -9,10 +9,22 @@
|
||||||
* @since v1.0.0
|
* @since v1.0.0
|
||||||
* ---------------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
window.Backend = window.Backend || {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This module contains functions that are used in the backend section of
|
||||||
|
* the application.
|
||||||
|
*
|
||||||
|
* @module Backend
|
||||||
|
*/
|
||||||
|
(function(exports) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
* Main javascript code for the backend of Easy!Appointments.
|
* Main javascript code for the backend of Easy!Appointments.
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
if (window.console === undefined) {
|
if (window.console === undefined) {
|
||||||
window.console = function() {} // IE compatibility
|
window.console = function() {} // IE compatibility
|
||||||
}
|
}
|
||||||
|
@ -40,39 +52,32 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
GeneralFunctions.enableLanguageSelection($('#select-language'));
|
GeneralFunctions.enableLanguageSelection($('#select-language'));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* This namespace contains functions that are used in the backend section of
|
|
||||||
* the applications.
|
|
||||||
*
|
|
||||||
* @namespace Backend
|
|
||||||
*/
|
|
||||||
var Backend = {
|
|
||||||
/**
|
/**
|
||||||
* Backend Constants
|
* Backend Constants
|
||||||
*/
|
*/
|
||||||
DB_SLUG_ADMIN: 'admin',
|
exports.DB_SLUG_ADMIN = 'admin';
|
||||||
DB_SLUG_PROVIDER: 'provider',
|
exports.DB_SLUG_PROVIDER = 'provider';
|
||||||
DB_SLUG_SECRETARY: 'secretary',
|
exports.DB_SLUG_SECRETARY = 'secretary';
|
||||||
DB_SLUG_CUSTOMER: 'customer',
|
exports.DB_SLUG_CUSTOMER = 'customer';
|
||||||
|
|
||||||
PRIV_VIEW: 1,
|
exports.PRIV_VIEW = 1;
|
||||||
PRIV_ADD: 2,
|
exports.PRIV_ADD = 2;
|
||||||
PRIV_EDIT: 4,
|
exports.PRIV_EDIT = 4;
|
||||||
PRIV_DELETE: 8,
|
exports.PRIV_DELETE = 8;
|
||||||
|
|
||||||
PRIV_APPOINTMENTS: 'appointments',
|
exports.PRIV_APPOINTMENTS = 'appointments';
|
||||||
PRIV_CUSTOMERS: 'customers',
|
exports.PRIV_CUSTOMERS = 'customers';
|
||||||
PRIV_SERVICES: 'services',
|
exports.PRIV_SERVICES = 'services';
|
||||||
PRIV_USERS: 'users',
|
exports.PRIV_USERS = 'users';
|
||||||
PRIV_SYSTEM_SETTINGS: 'system_settings',
|
exports.PRIV_SYSTEM_SETTINGS = 'system_settings';
|
||||||
PRIV_USER_SETTINGS: 'user_settings',
|
exports.PRIV_USER_SETTINGS = 'user_settings';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place the backend footer always on the bottom of the page.
|
* Place the backend footer always on the bottom of the page.
|
||||||
*/
|
*/
|
||||||
placeFooterToBottom: function() {
|
exports.placeFooterToBottom = function() {
|
||||||
var $footer = $('#footer');
|
var $footer = $('#footer');
|
||||||
|
|
||||||
if (window.innerHeight > $('body').height()) {
|
if (window.innerHeight > $('body').height()) {
|
||||||
|
@ -86,7 +91,7 @@ var Backend = {
|
||||||
'position': 'static'
|
'position': 'static'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display backend notifications to user.
|
* Display backend notifications to user.
|
||||||
|
@ -100,7 +105,7 @@ var Backend = {
|
||||||
* to the user. Every array item is an object that contains the 'label' and
|
* to the user. Every array item is an object that contains the 'label' and
|
||||||
* 'function' key values.
|
* 'function' key values.
|
||||||
*/
|
*/
|
||||||
displayNotification: function(message, actions) {
|
exports.displayNotification = function(message, actions) {
|
||||||
if (message == undefined) {
|
if (message == undefined) {
|
||||||
message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION';
|
message = 'NO MESSAGE PROVIDED FOR THIS NOTIFICATION';
|
||||||
}
|
}
|
||||||
|
@ -130,4 +135,5 @@ var Backend = {
|
||||||
$('#notification').html(notificationHtml);
|
$('#notification').html(notificationHtml);
|
||||||
$('#notification').show('blind');
|
$('#notification').show('blind');
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
})(window.Backend);
|
||||||
|
|
Loading…
Reference in a new issue