mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 22:52:35 +03:00
Refactored js code.
This commit is contained in:
parent
ad4e23302e
commit
279b931d80
15 changed files with 311 additions and 309 deletions
|
@ -23,8 +23,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
var FILTER_TYPE_PROVIDER = 'provider',
|
var FILTER_TYPE_PROVIDER = 'provider';
|
||||||
FILTER_TYPE_SERVICE = 'service';
|
var FILTER_TYPE_SERVICE = 'service';
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
var lastFocusedEventData; // Contains event data for later use.
|
var lastFocusedEventData; // Contains event data for later use.
|
||||||
|
@ -241,11 +241,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
$('#delete-reason').css('width', '100%');
|
$('#delete-reason').css('width', '100%');
|
||||||
} else {
|
} else {
|
||||||
// Do not display confirmation promt.
|
// Do not display confirmation promt.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_unavailable',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_unavailable';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
unavailable_id : lastFocusedEventData.data.id
|
unavailable_id : lastFocusedEventData.data.id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
$('#message_box').dialog('close');
|
$('#message_box').dialog('close');
|
||||||
|
@ -296,8 +296,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
// an insert operation.
|
// an insert operation.
|
||||||
|
|
||||||
var startDatetime = $dialog.find('#start-datetime')
|
var startDatetime = $dialog.find('#start-datetime')
|
||||||
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss'),
|
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
|
||||||
endDatetime = $dialog.find('#end-datetime')
|
var endDatetime = $dialog.find('#end-datetime')
|
||||||
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
|
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
|
||||||
|
|
||||||
var appointment = {
|
var appointment = {
|
||||||
|
@ -369,9 +369,9 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* Stores the unavailable period changes or inserts a new record.
|
* Stores the unavailable period changes or inserts a new record.
|
||||||
*/
|
*/
|
||||||
$('#manage-unavailable #save-unavailable').click(function() {
|
$('#manage-unavailable #save-unavailable').click(function() {
|
||||||
var $dialog = $('#manage-unavailable'),
|
var $dialog = $('#manage-unavailable');
|
||||||
start = $dialog.find('#unavailable-start').datetimepicker('getDate'),
|
var start = $dialog.find('#unavailable-start').datetimepicker('getDate');
|
||||||
end = $dialog.find('#unavailable-end').datetimepicker('getDate');
|
var end = $dialog.find('#unavailable-end').datetimepicker('getDate');
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
// Start time is after end time - display message to user.
|
// Start time is after end time - display message to user.
|
||||||
|
@ -485,11 +485,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
// Display the calendar selection dialog. First we will get a list of the available
|
// Display the calendar selection dialog. First we will get a list of the available
|
||||||
// user's calendars and then we will display a selection modal so the user can select
|
// user's calendars and then we will display a selection modal so the user can select
|
||||||
// the sync calendar.
|
// the sync calendar.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_google_calendars',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_google_calendars';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
provider_id: $('#select-filter-item').val()
|
provider_id: $('#select-filter-item').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -565,8 +565,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var start = new Date(),
|
var start = new Date();
|
||||||
currentMin = parseInt(start.toString('mm'));
|
var currentMin = parseInt(start.toString('mm'));
|
||||||
|
|
||||||
if (currentMin > 0 && currentMin < 15) {
|
if (currentMin > 0 && currentMin < 15) {
|
||||||
start.set({ 'minute': 15 });
|
start.set({ 'minute': 15 });
|
||||||
|
@ -598,8 +598,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
var $dialog = $('#manage-unavailable');
|
var $dialog = $('#manage-unavailable');
|
||||||
|
|
||||||
// Set the default datetime values.
|
// Set the default datetime values.
|
||||||
var start = new Date(),
|
var start = new Date();
|
||||||
currentMin = parseInt(start.toString('mm'));
|
var currentMin = parseInt(start.toString('mm'));
|
||||||
|
|
||||||
if (currentMin > 0 && currentMin < 15) {
|
if (currentMin > 0 && currentMin < 15) {
|
||||||
start.set({ 'minute': 15 });
|
start.set({ 'minute': 15 });
|
||||||
|
@ -668,13 +668,13 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* Event: Filter Existing Customers "Change"
|
* Event: Filter Existing Customers "Change"
|
||||||
*/
|
*/
|
||||||
$('#filter-existing-customers').keyup(function() {
|
$('#filter-existing-customers').keyup(function() {
|
||||||
var key = $(this).val().toLowerCase(),
|
var key = $(this).val().toLowerCase();
|
||||||
$list = $('#existing-customers-list'),
|
var $list = $('#existing-customers-list');
|
||||||
postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'key': key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
// Try to get the updated customer list.
|
// Try to get the updated customer list.
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -765,12 +765,12 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* Event: Select Google Calendar "Click"
|
* Event: Select Google Calendar "Click"
|
||||||
*/
|
*/
|
||||||
$('#select-calendar').click(function() {
|
$('#select-calendar').click(function() {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_select_google_calendar',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_select_google_calendar';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
provider_id: $('#select-filter-item').val(),
|
provider_id: $('#select-filter-item').val(),
|
||||||
calendar_id: $('#google-calendar').val()
|
calendar_id: $('#google-calendar').val()
|
||||||
};
|
};
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
return;
|
return;
|
||||||
|
@ -814,14 +814,14 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* @param {Date} endDate Visible end date of the calendar.
|
* @param {Date} endDate Visible end date of the calendar.
|
||||||
*/
|
*/
|
||||||
function _refreshCalendarAppointments($calendar, recordId, filterType, startDate, endDate) {
|
function _refreshCalendarAppointments($calendar, recordId, filterType, startDate, endDate) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_appointments',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_appointments';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
record_id: recordId,
|
record_id: recordId,
|
||||||
start_date: startDate.toString('yyyy-MM-dd'),
|
start_date: startDate.toString('yyyy-MM-dd'),
|
||||||
end_date: endDate.toString('yyyy-MM-dd'),
|
end_date: endDate.toString('yyyy-MM-dd'),
|
||||||
filter_type: filterType
|
filter_type: filterType
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -829,8 +829,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add appointments to calendar.
|
// Add appointments to calendar.
|
||||||
var calendarEvents = [],
|
var calendarEvents = [];
|
||||||
$calendar = $('#calendar');
|
var $calendar = $('#calendar');
|
||||||
|
|
||||||
$.each(response.appointments, function(index, appointment) {
|
$.each(response.appointments, function(index, appointment) {
|
||||||
var event = {
|
var event = {
|
||||||
|
@ -917,8 +917,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add unavailable period after work ends.
|
// Add unavailable period after work ends.
|
||||||
var calendarDateEnd = $calendar.fullCalendar('getView').end,
|
var calendarDateEnd = $calendar.fullCalendar('getView').end;
|
||||||
workDateEnd = Date.parseExact(
|
var workDateEnd = Date.parseExact(
|
||||||
calendarDateStart.toString('dd/MM/yyyy') + ' '
|
calendarDateStart.toString('dd/MM/yyyy') + ' '
|
||||||
+ workingPlan[selDayName].end,
|
+ workingPlan[selDayName].end,
|
||||||
'dd/MM/yyyy HH:mm'); // Use calendarDateStart ***
|
'dd/MM/yyyy HH:mm'); // Use calendarDateStart ***
|
||||||
|
@ -936,7 +936,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add unavailable periods for breaks.
|
// Add unavailable periods for breaks.
|
||||||
var breakStart, breakEnd;
|
var breakStart;
|
||||||
|
var breakEnd;
|
||||||
$.each(workingPlan[selDayName].breaks, function(index, currBreak) {
|
$.each(workingPlan[selDayName].breaks, function(index, currBreak) {
|
||||||
breakStart = Date.parseExact(calendarDateStart.toString('dd/MM/yyyy')
|
breakStart = Date.parseExact(calendarDateStart.toString('dd/MM/yyyy')
|
||||||
+ ' ' + currBreak.start, 'dd/MM/yyyy HH:mm');
|
+ ' ' + currBreak.start, 'dd/MM/yyyy HH:mm');
|
||||||
|
@ -957,8 +958,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'agendaWeek':
|
case 'agendaWeek':
|
||||||
var currDateStart = GeneralFunctions.clone($calendar.fullCalendar('getView').start),
|
var currDateStart = GeneralFunctions.clone($calendar.fullCalendar('getView').start);
|
||||||
currDateEnd = GeneralFunctions.clone(currDateStart).addDays(1);
|
var currDateEnd = GeneralFunctions.clone(currDateStart).addDays(1);
|
||||||
|
|
||||||
// Add custom unavailable periods (they are always displayed on the calendar, even if
|
// Add custom unavailable periods (they are always displayed on the calendar, even if
|
||||||
// the provider won't work on that day).
|
// the provider won't work on that day).
|
||||||
|
@ -997,8 +998,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
return; // Go to the next loop.
|
return; // Go to the next loop.
|
||||||
}
|
}
|
||||||
|
|
||||||
var start,
|
var start;
|
||||||
end;
|
var end;
|
||||||
|
|
||||||
// Add unavailable period before work starts.
|
// Add unavailable period before work starts.
|
||||||
start = Date.parseExact(currDateStart.toString('dd/MM/yyyy')
|
start = Date.parseExact(currDateStart.toString('dd/MM/yyyy')
|
||||||
|
@ -1033,7 +1034,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add unavailable periods during day breaks.
|
// Add unavailable periods during day breaks.
|
||||||
var breakStart, breakEnd;
|
var breakStart;
|
||||||
|
var breakEnd;
|
||||||
$.each(workingDay.breaks, function(index, currBreak) {
|
$.each(workingDay.breaks, function(index, currBreak) {
|
||||||
breakStart = Date.parseExact(currDateStart.toString('dd/MM/yyyy')
|
breakStart = Date.parseExact(currDateStart.toString('dd/MM/yyyy')
|
||||||
+ ' ' + currBreak.start, 'dd/MM/yyyy HH:mm');
|
+ ' ' + currBreak.start, 'dd/MM/yyyy HH:mm');
|
||||||
|
@ -1074,11 +1076,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* @param {Function} errorCallback Optional, if defined, this function is going to be executed on post failure.
|
* @param {Function} errorCallback Optional, if defined, this function is going to be executed on post failure.
|
||||||
*/
|
*/
|
||||||
function _saveAppointment(appointment, customer, successCallback, errorCallback) {
|
function _saveAppointment(appointment, customer, successCallback, errorCallback) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
appointment_data: JSON.stringify(appointment)
|
appointment_data: JSON.stringify(appointment)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (customer !== undefined) {
|
if (customer !== undefined) {
|
||||||
postData['customer_data'] = JSON.stringify(customer);
|
postData['customer_data'] = JSON.stringify(customer);
|
||||||
|
@ -1110,11 +1112,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
* @param {Function} errorCallback The ajax failure callback function.
|
* @param {Function} errorCallback The ajax failure callback function.
|
||||||
*/
|
*/
|
||||||
function _saveUnavailable(unavailable, successCallback, errorCallback) {
|
function _saveUnavailable(unavailable, successCallback, errorCallback) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
unavailable: JSON.stringify(unavailable)
|
unavailable: JSON.stringify(unavailable)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -1183,8 +1185,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment';
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment';
|
||||||
var postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'appointment_data': JSON.stringify(appointment)
|
appointment_data: JSON.stringify(appointment)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
|
@ -1238,8 +1240,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
||||||
var postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'unavailable': JSON.stringify(unavailable)
|
unavailable: JSON.stringify(unavailable)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
|
@ -1295,9 +1297,9 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
function _calendarEventClick(event, jsEvent, view) {
|
function _calendarEventClick(event, jsEvent, view) {
|
||||||
$('.popover').remove(); // Close all open popovers.
|
$('.popover').remove(); // Close all open popovers.
|
||||||
|
|
||||||
var html,
|
var html;
|
||||||
displayEdit,
|
var displayEdit;
|
||||||
displayDelete;
|
var displayDelete;
|
||||||
|
|
||||||
// Depending where the user clicked the event (title or empty space) we
|
// Depending where the user clicked the event (title or empty space) we
|
||||||
// need to use different selectors to reach the parent element.
|
// need to use different selectors to reach the parent element.
|
||||||
|
@ -1458,11 +1460,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
event.data['start_datetime'] = appointment['start_datetime'];
|
event.data['start_datetime'] = appointment['start_datetime'];
|
||||||
event.data['end_datetime'] = appointment['end_datetime'];
|
event.data['end_datetime'] = appointment['end_datetime'];
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_appointment';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
appointment_data: JSON.stringify(appointment)
|
appointment_data: JSON.stringify(appointment)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
$('#notification').hide('blind');
|
$('#notification').hide('blind');
|
||||||
|
@ -1489,7 +1491,7 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
start_datetime: event.start.toString('yyyy-MM-dd HH:mm:ss'),
|
start_datetime: event.start.toString('yyyy-MM-dd HH:mm:ss'),
|
||||||
end_datetime: event.end.toString('yyyy-MM-dd HH:mm:ss'),
|
end_datetime: event.end.toString('yyyy-MM-dd HH:mm:ss'),
|
||||||
id_users_provider: event.data.id_users_provider
|
id_users_provider: event.data.id_users_provider
|
||||||
}
|
};
|
||||||
|
|
||||||
var successCallback = function(response) {
|
var successCallback = function(response) {
|
||||||
if (response.exceptions) {
|
if (response.exceptions) {
|
||||||
|
@ -1519,11 +1521,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
event.data['start_datetime'] = unavailable['start_datetime'];
|
event.data['start_datetime'] = unavailable['start_datetime'];
|
||||||
event.data['end_datetime'] = unavailable['end_datetime'];
|
event.data['end_datetime'] = unavailable['end_datetime'];
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
unavailable: JSON.stringify(unavailable)
|
unavailable: JSON.stringify(unavailable)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
$('#notification').hide('blind');
|
$('#notification').hide('blind');
|
||||||
|
@ -1586,11 +1588,11 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
function _disableProviderSync(providerId) {
|
function _disableProviderSync(providerId) {
|
||||||
// Make an ajax call to the server in order to disable the setting
|
// Make an ajax call to the server in order to disable the setting
|
||||||
// from the database.
|
// from the database.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_disable_provider_sync',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_disable_provider_sync';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
provider_id: providerId
|
provider_id: providerId
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (response.exceptions) {
|
if (response.exceptions) {
|
||||||
|
@ -1654,9 +1656,9 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var startDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout),
|
var startDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout);
|
||||||
endDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout).addMinutes(serviceDuration),
|
var endDatetime = new Date().addMinutes(GlobalVariables.bookAdvanceTimeout).addMinutes(serviceDuration);
|
||||||
dateFormat;
|
var dateFormat;
|
||||||
|
|
||||||
switch(GlobalVariables.dateFormat) {
|
switch(GlobalVariables.dateFormat) {
|
||||||
case 'DMY':
|
case 'DMY':
|
||||||
|
@ -1766,8 +1768,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check appointment start and end time.
|
// Check appointment start and end time.
|
||||||
var start = $('#start-datetime').datepicker('getDate'),
|
var start = $('#start-datetime').datepicker('getDate');
|
||||||
end = $('#end-datetime').datepicker('getDate');
|
var end = $('#end-datetime').datepicker('getDate');
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
$dialog.find('#start-datetime').parents('.form-group').addClass('has-error');
|
$dialog.find('#start-datetime').parents('.form-group').addClass('has-error');
|
||||||
$dialog.find('#end-datetime').parents('.form-group').addClass('has-error');
|
$dialog.find('#end-datetime').parents('.form-group').addClass('has-error');
|
||||||
|
@ -1793,9 +1795,9 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
$dialog.find('#unavailable-id').val('');
|
$dialog.find('#unavailable-id').val('');
|
||||||
|
|
||||||
// Set default time values
|
// Set default time values
|
||||||
var start = GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat, true),
|
var start = GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat, true);
|
||||||
end = GeneralFunctions.formatDate(new Date().addHours(1), GlobalVariables.dateFormat, true),
|
var end = GeneralFunctions.formatDate(new Date().addHours(1), GlobalVariables.dateFormat, true);
|
||||||
dateFormat;
|
var dateFormat;
|
||||||
|
|
||||||
switch(GlobalVariables.dateFormat) {
|
switch(GlobalVariables.dateFormat) {
|
||||||
case 'DMY':
|
case 'DMY':
|
||||||
|
@ -1908,18 +1910,18 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
switch(GlobalVariables.dateFormat) {
|
switch(GlobalVariables.dateFormat) {
|
||||||
case 'DMY':
|
case 'DMY':
|
||||||
columnFormat = {
|
columnFormat = {
|
||||||
'month': 'ddd',
|
month: 'ddd',
|
||||||
'week': 'ddd dd/MM',
|
week: 'ddd dd/MM',
|
||||||
'day': 'dddd dd/MM'
|
day: 'dddd dd/MM'
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'MDY':
|
case 'MDY':
|
||||||
case 'YMD':
|
case 'YMD':
|
||||||
columnFormat = {
|
columnFormat = {
|
||||||
'month': 'ddd',
|
month: 'ddd',
|
||||||
'week': 'ddd MM/dd',
|
week: 'ddd MM/dd',
|
||||||
'day': 'dddd MM/dd'
|
day: 'dddd MM/dd'
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2064,8 +2066,8 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
|
|
||||||
// Display the edit dialog if an appointment hash is provided.
|
// Display the edit dialog if an appointment hash is provided.
|
||||||
if (GlobalVariables.editAppointment != null) {
|
if (GlobalVariables.editAppointment != null) {
|
||||||
var $dialog = $('#manage-appointment'),
|
var $dialog = $('#manage-appointment');
|
||||||
appointment = GlobalVariables.editAppointment;
|
var appointment = GlobalVariables.editAppointment;
|
||||||
_resetAppointmentDialog();
|
_resetAppointmentDialog();
|
||||||
|
|
||||||
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']);
|
$dialog.find('.modal-header h3').text(EALang['edit_appointment_title']);
|
||||||
|
|
|
@ -161,11 +161,11 @@
|
||||||
* @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form.
|
* @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form.
|
||||||
*/
|
*/
|
||||||
CategoriesHelper.prototype.filter = function(key, selectId, display) {
|
CategoriesHelper.prototype.filter = function(key, selectId, display) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -198,11 +198,11 @@
|
||||||
* @param {Object} category Contains the category data.
|
* @param {Object} category Contains the category data.
|
||||||
*/
|
*/
|
||||||
CategoriesHelper.prototype.save = function(category) {
|
CategoriesHelper.prototype.save = function(category) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service_category',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service_category';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
category: JSON.stringify(category)
|
category: JSON.stringify(category)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -223,11 +223,11 @@
|
||||||
* @param Number} id Record ID to be deleted.
|
* @param Number} id Record ID to be deleted.
|
||||||
*/
|
*/
|
||||||
CategoriesHelper.prototype.delete = function(id) {
|
CategoriesHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service_category',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service_category';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'category_id': id
|
category_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -60,8 +60,8 @@
|
||||||
return; // Do nothing when user edits a customer record.
|
return; // Do nothing when user edits a customer record.
|
||||||
}
|
}
|
||||||
|
|
||||||
var customerId = $(this).attr('data-id'),
|
var customerId = $(this).attr('data-id');
|
||||||
customer = {};
|
var customer = {};
|
||||||
$.each(instance.filterResults, function(index, item) {
|
$.each(instance.filterResults, function(index, item) {
|
||||||
if (item.id == customerId) {
|
if (item.id == customerId) {
|
||||||
customer = item;
|
customer = item;
|
||||||
|
@ -84,9 +84,9 @@
|
||||||
$('#customer-appointments .selected').removeClass('selected');
|
$('#customer-appointments .selected').removeClass('selected');
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
|
|
||||||
var customerId = $('#filter-customers .selected').attr('data-id'),
|
var customerId = $('#filter-customers .selected').attr('data-id');
|
||||||
appointmentId = $(this).attr('data-id'),
|
var appointmentId = $(this).attr('data-id');
|
||||||
appointment = {};
|
var appointment = {};
|
||||||
|
|
||||||
$.each(instance.filterResults, function(index, c) {
|
$.each(instance.filterResults, function(index, c) {
|
||||||
if (c.id === customerId) {
|
if (c.id === customerId) {
|
||||||
|
@ -144,14 +144,14 @@
|
||||||
*/
|
*/
|
||||||
$('#save-customer').click(function() {
|
$('#save-customer').click(function() {
|
||||||
var customer = {
|
var customer = {
|
||||||
'first_name': $('#first-name').val(),
|
first_name: $('#first-name').val(),
|
||||||
'last_name': $('#last-name').val(),
|
last_name: $('#last-name').val(),
|
||||||
'email': $('#email').val(),
|
email: $('#email').val(),
|
||||||
'phone_number': $('#phone-number').val(),
|
phone_number: $('#phone-number').val(),
|
||||||
'address': $('#address').val(),
|
address: $('#address').val(),
|
||||||
'city': $('#city').val(),
|
city: $('#city').val(),
|
||||||
'zip_code': $('#zip-code').val(),
|
zip_code: $('#zip-code').val(),
|
||||||
'notes': $('#notes').val()
|
notes: $('#notes').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($('#customer-id').val() != '') {
|
if ($('#customer-id').val() != '') {
|
||||||
|
@ -167,8 +167,8 @@
|
||||||
* Event: Delete Customer Button "Click"
|
* Event: Delete Customer Button "Click"
|
||||||
*/
|
*/
|
||||||
$('#delete-customer').click(function() {
|
$('#delete-customer').click(function() {
|
||||||
var customerId = $('#customer-id').val(),
|
var customerId = $('#customer-id').val();
|
||||||
messageBtns = {};
|
var messageBtns = {};
|
||||||
|
|
||||||
messageBtns[EALang['delete']] = function() {
|
messageBtns[EALang['delete']] = function() {
|
||||||
instance.delete(customerId);
|
instance.delete(customerId);
|
||||||
|
@ -190,11 +190,11 @@
|
||||||
* @param {Object} customer Contains the customer data.
|
* @param {Object} customer Contains the customer data.
|
||||||
*/
|
*/
|
||||||
CustomersHelper.prototype.save = function(customer) {
|
CustomersHelper.prototype.save = function(customer) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_customer',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_customer';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'customer': JSON.stringify(customer)
|
customer: JSON.stringify(customer)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -214,11 +214,11 @@
|
||||||
* @param {Number} id Record id to be deleted.
|
* @param {Number} id Record id to be deleted.
|
||||||
*/
|
*/
|
||||||
CustomersHelper.prototype.delete = function(id) {
|
CustomersHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_customer',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_customer';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'customer_id': id
|
customer_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -309,9 +309,9 @@
|
||||||
$('#customer-appointments').data('jsp').destroy();
|
$('#customer-appointments').data('jsp').destroy();
|
||||||
$('#customer-appointments').empty();
|
$('#customer-appointments').empty();
|
||||||
$.each(customer.appointments, function(index, appointment) {
|
$.each(customer.appointments, function(index, appointment) {
|
||||||
var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true),
|
var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true);
|
||||||
end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true),
|
var end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true);
|
||||||
html =
|
var html =
|
||||||
'<div class="appointment-row" data-id="' + appointment.id + '">' +
|
'<div class="appointment-row" data-id="' + appointment.id + '">' +
|
||||||
start + ' - ' + end + '<br>' +
|
start + ' - ' + end + '<br>' +
|
||||||
appointment.service.name + ', ' +
|
appointment.service.name + ', ' +
|
||||||
|
@ -335,11 +335,11 @@
|
||||||
CustomersHelper.prototype.filter = function(key, selectId, display) {
|
CustomersHelper.prototype.filter = function(key, selectId, display) {
|
||||||
display = display || false;
|
display = display || false;
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -429,8 +429,8 @@
|
||||||
* @param {Object} appointment Appointment data
|
* @param {Object} appointment Appointment data
|
||||||
*/
|
*/
|
||||||
CustomersHelper.prototype.displayAppointment = function(appointment) {
|
CustomersHelper.prototype.displayAppointment = function(appointment) {
|
||||||
var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true),
|
var start = GeneralFunctions.formatDate(Date.parse(appointment.start_datetime), GlobalVariables.dateFormat, true);
|
||||||
end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true);
|
var end = GeneralFunctions.formatDate(Date.parse(appointment.end_datetime), GlobalVariables.dateFormat, true);
|
||||||
|
|
||||||
var html =
|
var html =
|
||||||
'<div>' +
|
'<div>' +
|
||||||
|
|
|
@ -105,11 +105,11 @@ window.BackendServices = window.BackendServices || {};
|
||||||
* Use this method every time a change is made to the service categories db table.
|
* Use this method every time a change is made to the service categories db table.
|
||||||
*/
|
*/
|
||||||
exports.updateAvailableCategories = function() {
|
exports.updateAvailableCategories = function() {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: ''
|
key: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -60,8 +60,8 @@
|
||||||
return; // exit because we are on edit mode
|
return; // exit because we are on edit mode
|
||||||
}
|
}
|
||||||
|
|
||||||
var serviceId = $(this).attr('data-id'),
|
var serviceId = $(this).attr('data-id');
|
||||||
service = {};
|
var service = {};
|
||||||
$.each(instance.filterResults, function(index, item) {
|
$.each(instance.filterResults, function(index, item) {
|
||||||
if (item.id === serviceId) {
|
if (item.id === serviceId) {
|
||||||
service = item;
|
service = item;
|
||||||
|
@ -150,8 +150,8 @@
|
||||||
* Event: Delete Service Button "Click"
|
* Event: Delete Service Button "Click"
|
||||||
*/
|
*/
|
||||||
$('#delete-service').click(function() {
|
$('#delete-service').click(function() {
|
||||||
var serviceId = $('#service-id').val(),
|
var serviceId = $('#service-id').val();
|
||||||
messageBtns = {};
|
var messageBtns = {};
|
||||||
|
|
||||||
messageBtns[EALang['delete']] = function() {
|
messageBtns[EALang['delete']] = function() {
|
||||||
instance.delete(serviceId);
|
instance.delete(serviceId);
|
||||||
|
@ -174,11 +174,11 @@
|
||||||
* then the update operation is going to be executed.
|
* then the update operation is going to be executed.
|
||||||
*/
|
*/
|
||||||
ServicesHelper.prototype.save = function(service) {
|
ServicesHelper.prototype.save = function(service) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_service';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'service': JSON.stringify(service)
|
service: JSON.stringify(service)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -198,11 +198,11 @@
|
||||||
* @param {Number} id Record ID to be deleted.
|
* @param {Number} id Record ID to be deleted.
|
||||||
*/
|
*/
|
||||||
ServicesHelper.prototype.delete = function(id) {
|
ServicesHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_service';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
service_id: id
|
service_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -293,11 +293,11 @@
|
||||||
ServicesHelper.prototype.filter = function(key, selectId, display) {
|
ServicesHelper.prototype.filter = function(key, selectId, display) {
|
||||||
display = display || false;
|
display = display || false;
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_services',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_services';
|
||||||
postData = {
|
var postData = {
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
'key': key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -194,12 +194,12 @@ window.BackendSettings = window.BackendSettings || {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_validate_username',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_validate_username';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
username: $input.val(),
|
username: $input.val(),
|
||||||
user_id: $input.parents().eq(2).find('#user-id').val()
|
user_id: $input.parents().eq(2).find('#user-id').val()
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
* @param {Array} settings Contains the system settings data.
|
* @param {Array} settings Contains the system settings data.
|
||||||
*/
|
*/
|
||||||
SystemSettings.prototype.save = function(settings) {
|
SystemSettings.prototype.save = function(settings) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
settings: JSON.stringify(settings),
|
settings: JSON.stringify(settings),
|
||||||
type: BackendSettings.SETTINGS_SYSTEM
|
type: BackendSettings.SETTINGS_SYSTEM
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -62,12 +62,12 @@
|
||||||
return; // Validation failed, do not procceed.
|
return; // Validation failed, do not procceed.
|
||||||
}
|
}
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
type: BackendSettings.SETTINGS_USER,
|
type: BackendSettings.SETTINGS_USER,
|
||||||
settings: JSON.stringify(settings)
|
settings: JSON.stringify(settings)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -142,11 +142,11 @@ window.BackendUsers = window.BackendUsers || {};
|
||||||
helper = new SecretariesHelper();
|
helper = new SecretariesHelper();
|
||||||
|
|
||||||
// Update the list with the all the available providers.
|
// Update the list with the all the available providers.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: ''
|
key: ''
|
||||||
};
|
};
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
return;
|
return;
|
||||||
|
@ -200,12 +200,12 @@ window.BackendUsers = window.BackendUsers || {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_validate_username',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_validate_username';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
username: $input.val(),
|
username: $input.val(),
|
||||||
user_id: userId
|
user_id: userId
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
return; // exit because we are currently on edit mode
|
return; // exit because we are currently on edit mode
|
||||||
}
|
}
|
||||||
|
|
||||||
var adminId = $(e.currentTarget).attr('data-id'),
|
var adminId = $(e.currentTarget).attr('data-id');
|
||||||
admin = {};
|
var admin = {};
|
||||||
|
|
||||||
$.each(this.filterResults, function(index, item) {
|
$.each(this.filterResults, function(index, item) {
|
||||||
if (item.id === adminId) {
|
if (item.id === adminId) {
|
||||||
|
@ -109,8 +109,8 @@
|
||||||
* Event: Delete Admin Button "Click"
|
* Event: Delete Admin Button "Click"
|
||||||
*/
|
*/
|
||||||
$('#admins').on('click', '#delete-admin', function() {
|
$('#admins').on('click', '#delete-admin', function() {
|
||||||
var adminId = $('#admin-id').val(),
|
var adminId = $('#admin-id').val();
|
||||||
messageBtns = {};
|
var messageBtns = {};
|
||||||
|
|
||||||
messageBtns[EALang['delete']] = function() {
|
messageBtns[EALang['delete']] = function() {
|
||||||
this.delete(adminId);
|
this.delete(adminId);
|
||||||
|
@ -184,11 +184,11 @@
|
||||||
* then the update operation is going to be executed.
|
* then the update operation is going to be executed.
|
||||||
*/
|
*/
|
||||||
AdminsHelper.prototype.save = function(admin) {
|
AdminsHelper.prototype.save = function(admin) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_admin',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_admin';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
admin: JSON.stringify(admin)
|
admin: JSON.stringify(admin)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -207,11 +207,11 @@
|
||||||
* @param {Number} id Record id to be deleted.
|
* @param {Number} id Record id to be deleted.
|
||||||
*/
|
*/
|
||||||
AdminsHelper.prototype.delete = function(id) {
|
AdminsHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_admin',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_admin';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
admin_id: id
|
admin_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -339,11 +339,11 @@
|
||||||
AdminsHelper.prototype.filter = function(key, selectId, display) {
|
AdminsHelper.prototype.filter = function(key, selectId, display) {
|
||||||
display = display || false;
|
display = display || false;
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_admins',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_admins';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -378,8 +378,8 @@
|
||||||
* @return {String} The html code that represents the record on the filter results list.
|
* @return {String} The html code that represents the record on the filter results list.
|
||||||
*/
|
*/
|
||||||
AdminsHelper.prototype.getFilterHtml = function(admin) {
|
AdminsHelper.prototype.getFilterHtml = function(admin) {
|
||||||
var name = admin.first_name + ' ' + admin.last_name,
|
var name = admin.first_name + ' ' + admin.last_name;
|
||||||
info = admin.email;
|
var info = admin.email;
|
||||||
|
|
||||||
info = (admin.mobile_number != '' && admin.mobile_number != null)
|
info = (admin.mobile_number != '' && admin.mobile_number != null)
|
||||||
? info + ', ' + admin.mobile_number : info;
|
? info + ', ' + admin.mobile_number : info;
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
return; // Exit because we are currently on edit mode.
|
return; // Exit because we are currently on edit mode.
|
||||||
}
|
}
|
||||||
|
|
||||||
var providerId = $(e.currentTarget).attr('data-id'),
|
var providerId = $(e.currentTarget).attr('data-id');
|
||||||
provider = {};
|
var provider = {};
|
||||||
|
|
||||||
$.each(this.filterResults, function(index, item) {
|
$.each(this.filterResults, function(index, item) {
|
||||||
if (item.id === providerId) {
|
if (item.id === providerId) {
|
||||||
|
@ -236,11 +236,11 @@
|
||||||
* then the update operation is going to be executed.
|
* then the update operation is going to be executed.
|
||||||
*/
|
*/
|
||||||
ProvidersHelper.prototype.save = function(provider) {
|
ProvidersHelper.prototype.save = function(provider) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_provider',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_provider';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
provider: JSON.stringify(provider)
|
provider: JSON.stringify(provider)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -259,11 +259,11 @@
|
||||||
* @param {Number} id Record id to be deleted.
|
* @param {Number} id Record id to be deleted.
|
||||||
*/
|
*/
|
||||||
ProvidersHelper.prototype.delete = function(id) {
|
ProvidersHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_provider',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_provider';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
provider_id: id
|
provider_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -412,11 +412,11 @@
|
||||||
ProvidersHelper.prototype.filter = function(key, selectId, display) {
|
ProvidersHelper.prototype.filter = function(key, selectId, display) {
|
||||||
display = display || false;
|
display = display || false;
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
return; // exit because we are currently on edit mode
|
return; // exit because we are currently on edit mode
|
||||||
}
|
}
|
||||||
|
|
||||||
var secretaryId = $(e.currentTarget).attr('data-id'),
|
var secretaryId = $(e.currentTarget).attr('data-id');
|
||||||
secretary = {};
|
var secretary = {};
|
||||||
|
|
||||||
$.each(this.filterResults, function(index, item) {
|
$.each(this.filterResults, function(index, item) {
|
||||||
if (item.id === secretaryId) {
|
if (item.id === secretaryId) {
|
||||||
|
@ -114,8 +114,8 @@
|
||||||
* Event: Delete Secretary Button "Click"
|
* Event: Delete Secretary Button "Click"
|
||||||
*/
|
*/
|
||||||
$('#secretaries').on('click', '#delete-secretary', function() {
|
$('#secretaries').on('click', '#delete-secretary', function() {
|
||||||
var secretaryId = $('#secretary-id').val(),
|
var secretaryId = $('#secretary-id').val();
|
||||||
messageBtns = {};
|
var messageBtns = {};
|
||||||
|
|
||||||
messageBtns[EALang['delete']] = function() {
|
messageBtns[EALang['delete']] = function() {
|
||||||
this.delete(secretaryId);
|
this.delete(secretaryId);
|
||||||
|
@ -197,11 +197,11 @@
|
||||||
* then the update operation is going to be executed.
|
* then the update operation is going to be executed.
|
||||||
*/
|
*/
|
||||||
SecretariesHelper.prototype.save = function(secretary) {
|
SecretariesHelper.prototype.save = function(secretary) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_secretary',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_secretary';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
secretary: JSON.stringify(secretary)
|
secretary: JSON.stringify(secretary)
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -220,11 +220,11 @@
|
||||||
* @param {Number} id Record id to be deleted.
|
* @param {Number} id Record id to be deleted.
|
||||||
*/
|
*/
|
||||||
SecretariesHelper.prototype.delete = function(id) {
|
SecretariesHelper.prototype.delete = function(id) {
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_secretary',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_secretary';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
secretary_id: id
|
secretary_id: id
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -361,11 +361,11 @@
|
||||||
SecretariesHelper.prototype.filter = function(key, selectId, display) {
|
SecretariesHelper.prototype.filter = function(key, selectId, display) {
|
||||||
display = display || false;
|
display = display || false;
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_secretaries',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_secretaries';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
key: key
|
key: key
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -400,8 +400,8 @@
|
||||||
* @return {String} The html code that represents the record on the filter results list.
|
* @return {String} The html code that represents the record on the filter results list.
|
||||||
*/
|
*/
|
||||||
SecretariesHelper.prototype.getFilterHtml = function(secretary) {
|
SecretariesHelper.prototype.getFilterHtml = function(secretary) {
|
||||||
var name = secretary.first_name + ' ' + secretary.last_name,
|
var name = secretary.first_name + ' ' + secretary.last_name;
|
||||||
info = secretary.email;
|
var info = secretary.email;
|
||||||
|
|
||||||
info = (secretary.mobile_number != '' && secretary.mobile_number != null)
|
info = (secretary.mobile_number != '' && secretary.mobile_number != null)
|
||||||
? info + ', ' + secretary.mobile_number : info;
|
? info + ', ' + secretary.mobile_number : info;
|
||||||
|
|
|
@ -344,9 +344,9 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
selectedDate = GeneralFunctions.formatDate(selectedDate, GlobalVariables.dateFormat);
|
selectedDate = GeneralFunctions.formatDate(selectedDate, GlobalVariables.dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
var selServiceId = $('#select-service').val(),
|
var selServiceId = $('#select-service').val();
|
||||||
servicePrice,
|
var servicePrice;
|
||||||
serviceCurrency;
|
var serviceCurrency;
|
||||||
|
|
||||||
$.each(GlobalVariables.availableServices, function(index, service) {
|
$.each(GlobalVariables.availableServices, function(index, service) {
|
||||||
if (service.id == selServiceId) {
|
if (service.id == selServiceId) {
|
||||||
|
@ -369,13 +369,13 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
$('#appointment-details').html(html);
|
$('#appointment-details').html(html);
|
||||||
|
|
||||||
// Customer Details
|
// Customer Details
|
||||||
var firstname = GeneralFunctions.escapeHtml($('#first-name').val()),
|
var firstname = GeneralFunctions.escapeHtml($('#first-name').val());
|
||||||
lastname = GeneralFunctions.escapeHtml($('#last-name').val()),
|
var lastname = GeneralFunctions.escapeHtml($('#last-name').val());
|
||||||
phoneNumber = GeneralFunctions.escapeHtml($('#phone-number').val()),
|
var phoneNumber = GeneralFunctions.escapeHtml($('#phone-number').val());
|
||||||
email = GeneralFunctions.escapeHtml($('#email').val()),
|
var email = GeneralFunctions.escapeHtml($('#email').val());
|
||||||
address = GeneralFunctions.escapeHtml($('#address').val()),
|
var address = GeneralFunctions.escapeHtml($('#address').val());
|
||||||
city = GeneralFunctions.escapeHtml($('#city').val()),
|
var city = GeneralFunctions.escapeHtml($('#city').val());
|
||||||
zipCode = GeneralFunctions.escapeHtml($('#zip-code').val()),
|
var zipCode = GeneralFunctions.escapeHtml($('#zip-code').val());
|
||||||
|
|
||||||
html =
|
html =
|
||||||
'<h4>' + firstname + ' ' + lastname + '</h4>' +
|
'<h4>' + firstname + ' ' + lastname + '</h4>' +
|
||||||
|
|
|
@ -45,16 +45,16 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
var appointmentId = FrontendBook.manageMode ? GlobalVariables.appointmentData['id'] : undefined;
|
var appointmentId = FrontendBook.manageMode ? GlobalVariables.appointmentData['id'] : undefined;
|
||||||
|
|
||||||
// Make ajax post request and get the available hours.
|
// Make ajax post request and get the available hours.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/appointments/ajax_get_available_hours',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/appointments/ajax_get_available_hours';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
service_id: $('#select-service').val(),
|
service_id: $('#select-service').val(),
|
||||||
provider_id: $('#select-provider').val(),
|
provider_id: $('#select-provider').val(),
|
||||||
selected_date: selDate,
|
selected_date: selDate,
|
||||||
service_duration: selServiceDuration,
|
service_duration: selServiceDuration,
|
||||||
manage_mode: FrontendBook.manageMode,
|
manage_mode: FrontendBook.manageMode,
|
||||||
appointment_id: appointmentId
|
appointment_id: appointmentId
|
||||||
};
|
};
|
||||||
|
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
|
@ -115,11 +115,11 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var formData = jQuery.parseJSON($('input[name="post_data"]').val()),
|
var formData = jQuery.parseJSON($('input[name="post_data"]').val());
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
post_data: formData
|
post_data: formData
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($captchaText.length > 0) {
|
if ($captchaText.length > 0) {
|
||||||
postData.captcha = $captchaText.val();
|
postData.captcha = $captchaText.val();
|
||||||
|
@ -129,8 +129,8 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
postData.exclude_appointment_id = GlobalVariables.appointmentData.id;
|
postData.exclude_appointment_id = GlobalVariables.appointmentData.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/appointments/ajax_register_appointment',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/appointments/ajax_register_appointment';
|
||||||
$layer = $('<div/>');
|
var $layer = $('<div/>');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: postUrl,
|
url: postUrl,
|
||||||
|
@ -197,13 +197,13 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
* @param {String} selectedDateString Y-m-d value of the selected date.
|
* @param {String} selectedDateString Y-m-d value of the selected date.
|
||||||
*/
|
*/
|
||||||
exports.getUnavailableDates = function(providerId, serviceId, selectedDateString) {
|
exports.getUnavailableDates = function(providerId, serviceId, selectedDateString) {
|
||||||
var url = GlobalVariables.baseUrl + '/index.php/appointments/ajax_get_unavailable_dates',
|
var url = GlobalVariables.baseUrl + '/index.php/appointments/ajax_get_unavailable_dates';
|
||||||
data = {
|
var data = {
|
||||||
provider_id: providerId,
|
provider_id: providerId,
|
||||||
service_id: serviceId,
|
service_id: serviceId,
|
||||||
selected_date: encodeURIComponent(selectedDateString),
|
selected_date: encodeURIComponent(selectedDateString),
|
||||||
csrfToken: GlobalVariables.csrfToken
|
csrfToken: GlobalVariables.csrfToken
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -213,8 +213,8 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
})
|
})
|
||||||
.done(function(response) {
|
.done(function(response) {
|
||||||
// Select first enabled date.
|
// Select first enabled date.
|
||||||
var selectedDate = Date.parse(selectedDateString),
|
var selectedDate = Date.parse(selectedDateString);
|
||||||
numberOfDays = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 0).getDate();
|
var numberOfDays = new Date(selectedDate.getFullYear(), selectedDate.getMonth() + 1, 0).getDate();
|
||||||
|
|
||||||
for (var i=1; i<=numberOfDays; i++) {
|
for (var i=1; i<=numberOfDays; i++) {
|
||||||
var currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), i);
|
var currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), i);
|
||||||
|
|
|
@ -115,9 +115,9 @@ window.GeneralFunctions = window.GeneralFunctions || {};
|
||||||
*/
|
*/
|
||||||
exports.getUrlParameter = function(url, parameterName) {
|
exports.getUrlParameter = function(url, parameterName) {
|
||||||
parameterName = parameterName.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
|
parameterName = parameterName.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
|
||||||
var regexS = '[\\#&]' + parameterName + '=([^&#]*)',
|
var regexS = '[\\#&]' + parameterName + '=([^&#]*)';
|
||||||
regex = new RegExp(regexS),
|
var regex = new RegExp(regexS);
|
||||||
results = regex.exec(url);
|
var results = regex.exec(url);
|
||||||
return (results == null) ? '' : results[1];
|
return (results == null) ? '' : results[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -340,11 +340,11 @@ window.GeneralFunctions = window.GeneralFunctions || {};
|
||||||
|
|
||||||
$(document).on('click', 'li.language', function() {
|
$(document).on('click', 'li.language', function() {
|
||||||
// Change language with ajax call and refresh page.
|
// Change language with ajax call and refresh page.
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_change_language',
|
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_change_language';
|
||||||
postData = {
|
var postData = {
|
||||||
csrfToken: GlobalVariables.csrfToken,
|
csrfToken: GlobalVariables.csrfToken,
|
||||||
language: $(this).attr('data-language'),
|
language: $(this).attr('data-language'),
|
||||||
};
|
};
|
||||||
$.post(postUrl, postData, function(response) {
|
$.post(postUrl, postData, function(response) {
|
||||||
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
if (!GeneralFunctions.handleAjaxExceptions(response)) {
|
||||||
return;
|
return;
|
||||||
|
@ -394,8 +394,8 @@ window.GeneralFunctions = window.GeneralFunctions || {};
|
||||||
* @return {String} Returns the formatted date string.
|
* @return {String} Returns the formatted date string.
|
||||||
*/
|
*/
|
||||||
exports.formatDate = function(date, dateFormatSetting, addHours) {
|
exports.formatDate = function(date, dateFormatSetting, addHours) {
|
||||||
var format, result,
|
var format, result;
|
||||||
hours = addHours ? ' HH:mm' : '';
|
var hours = addHours ? ' HH:mm' : '';
|
||||||
|
|
||||||
switch(dateFormatSetting) {
|
switch(dateFormatSetting) {
|
||||||
case 'DMY':
|
case 'DMY':
|
||||||
|
|
Loading…
Reference in a new issue