mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-26 01:43:06 +03:00
removed leading underscore from javascript function names.
This commit is contained in:
parent
c670c023a7
commit
80b53b2dd0
12 changed files with 69 additions and 69 deletions
|
@ -25,7 +25,7 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
/**
|
/**
|
||||||
* Bind common event handlers.
|
* Bind common event handlers.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
var $calendarPage = $('#calendar-page');
|
var $calendarPage = $('#calendar-page');
|
||||||
|
|
||||||
$calendarPage.on('click', '#toggle-fullscreen', function () {
|
$calendarPage.on('click', '#toggle-fullscreen', function () {
|
||||||
|
@ -87,7 +87,7 @@ window.BackendCalendar = window.BackendCalendar || {};
|
||||||
BackendCalendarUnavailabilitiesModal.initialize();
|
BackendCalendarUnavailabilitiesModal.initialize();
|
||||||
BackendCalendarExtraPeriodsModal.initialize();
|
BackendCalendarExtraPeriodsModal.initialize();
|
||||||
|
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window.BackendCalendar);
|
})(window.BackendCalendar);
|
||||||
|
|
|
@ -22,7 +22,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _updateTimezone() {
|
function updateTimezone() {
|
||||||
var providerId = $('#select-provider').val();
|
var providerId = $('#select-provider').val();
|
||||||
|
|
||||||
var provider = GlobalVariables.availableProviders.filter(function(availableProvider) {
|
var provider = GlobalVariables.availableProviders.filter(function(availableProvider) {
|
||||||
|
@ -34,7 +34,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Manage Appointments Dialog Cancel Button "Click"
|
* Event: Manage Appointments Dialog Cancel Button "Click"
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
*/
|
*/
|
||||||
$('#manage-appointment #save-appointment').click(function () {
|
$('#manage-appointment #save-appointment').click(function () {
|
||||||
// Before doing anything the appointment data need to be validated.
|
// Before doing anything the appointment data need to be validated.
|
||||||
if (!_validateAppointmentForm()) {
|
if (!validateAppointmentForm()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
* Event: Provider "Change"
|
* Event: Provider "Change"
|
||||||
*/
|
*/
|
||||||
$('#select-provider').change(function () {
|
$('#select-provider').change(function () {
|
||||||
_updateTimezone();
|
updateTimezone();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -488,7 +488,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
*
|
*
|
||||||
* @return {Boolean} Returns the validation result.
|
* @return {Boolean} Returns the validation result.
|
||||||
*/
|
*/
|
||||||
function _validateAppointmentForm() {
|
function validateAppointmentForm() {
|
||||||
var $dialog = $('#manage-appointment');
|
var $dialog = $('#manage-appointment');
|
||||||
|
|
||||||
// Reset previous validation css formatting.
|
// Reset previous validation css formatting.
|
||||||
|
@ -532,7 +532,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.initialize = function () {
|
exports.initialize = function () {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window.BackendCalendarAppointmentsModal);
|
})(window.BackendCalendarAppointmentsModal);
|
||||||
|
|
|
@ -31,7 +31,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
/**
|
/**
|
||||||
* Bind event handlers for the calendar view.
|
* Bind event handlers for the calendar view.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
var $calendarPage = $('#calendar-page');
|
var $calendarPage = $('#calendar-page');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +40,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* When the user clicks the reload button an the calendar items need to be refreshed.
|
* When the user clicks the reload button an the calendar items need to be refreshed.
|
||||||
*/
|
*/
|
||||||
$('#reload-appointments').click(function () {
|
$('#reload-appointments').click(function () {
|
||||||
_refreshCalendarAppointments(
|
refreshCalendarAppointments(
|
||||||
$('#calendar'),
|
$('#calendar'),
|
||||||
$('#select-filter-item').val(),
|
$('#select-filter-item').val(),
|
||||||
$('#select-filter-item').find('option:selected').attr('type'),
|
$('#select-filter-item').find('option:selected').attr('type'),
|
||||||
|
@ -264,7 +264,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
*
|
*
|
||||||
* @return {Number} Returns the calendar element height in pixels.
|
* @return {Number} Returns the calendar element height in pixels.
|
||||||
*/
|
*/
|
||||||
function _getCalendarHeight() {
|
function getCalendarHeight() {
|
||||||
var result = window.innerHeight - $('#footer').outerHeight() - $('#header').outerHeight()
|
var result = window.innerHeight - $('#footer').outerHeight() - $('#header').outerHeight()
|
||||||
- $('#calendar-toolbar').outerHeight() - 60; // 60 for fine tuning
|
- $('#calendar-toolbar').outerHeight() - 60; // 60 for fine tuning
|
||||||
return (result > 500) ? result : 500; // Minimum height is 500px
|
return (result > 500) ? result : 500; // Minimum height is 500px
|
||||||
|
@ -276,7 +276,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* When the user clicks on an appointment object on the calendar, then a data preview popover is display
|
* When the user clicks on an appointment object on the calendar, then a data preview popover is display
|
||||||
* above the calendar item.
|
* above the calendar item.
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
|
@ -427,7 +427,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
*
|
*
|
||||||
* @see updateAppointmentData()
|
* @see updateAppointmentData()
|
||||||
*/
|
*/
|
||||||
function _calendarEventResize(event, delta, revertFunc, jsEvent, ui, view) {
|
function calendarEventResize(event, delta, revertFunc, jsEvent, ui, view) {
|
||||||
if (GlobalVariables.user.privileges.appointments.edit === false) {
|
if (GlobalVariables.user.privileges.appointments.edit === false) {
|
||||||
revertFunc();
|
revertFunc();
|
||||||
Backend.displayNotification(EALang.no_privileges_edit_appointments);
|
Backend.displayNotification(EALang.no_privileges_edit_appointments);
|
||||||
|
@ -550,10 +550,10 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* The calendar element needs to be re-sized too in order to fit into the window. Nevertheless, if the window
|
* The calendar element needs to be re-sized too in order to fit into the window. Nevertheless, if the window
|
||||||
* becomes very small the the calendar won't shrink anymore.
|
* becomes very small the the calendar won't shrink anymore.
|
||||||
*
|
*
|
||||||
* @see _getCalendarHeight()
|
* @see getCalendarHeight()
|
||||||
*/
|
*/
|
||||||
function _calendarWindowResize(view) {
|
function calendarWindowResize(view) {
|
||||||
$('#calendar').fullCalendar('option', 'height', _getCalendarHeight());
|
$('#calendar').fullCalendar('option', 'height', getCalendarHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,7 +562,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* When the user clicks on a day square on the calendar, then he will automatically be transferred to that
|
* When the user clicks on a day square on the calendar, then he will automatically be transferred to that
|
||||||
* day view calendar.
|
* day view calendar.
|
||||||
*/
|
*/
|
||||||
function _calendarDayClick(date, jsEvent, view) {
|
function calendarDayClick(date, jsEvent, view) {
|
||||||
if (!date.hasTime()) {
|
if (!date.hasTime()) {
|
||||||
$('#calendar').fullCalendar('changeView', 'agendaDay');
|
$('#calendar').fullCalendar('changeView', 'agendaDay');
|
||||||
$('#calendar').fullCalendar('gotoDate', date);
|
$('#calendar').fullCalendar('gotoDate', date);
|
||||||
|
@ -575,7 +575,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* This event handler is triggered whenever the user drags and drops an event into a different position
|
* This event handler is triggered whenever the user drags and drops an event into a different position
|
||||||
* on the calendar. We need to update the database with this change. This is done via an ajax call.
|
* on the calendar. We need to update the database with this change. This is done via an ajax call.
|
||||||
*/
|
*/
|
||||||
function _calendarEventDrop(event, delta, revertFunc, jsEvent, ui, view) {
|
function calendarEventDrop(event, delta, revertFunc, jsEvent, ui, view) {
|
||||||
if (GlobalVariables.user.privileges.appointments.edit === false) {
|
if (GlobalVariables.user.privileges.appointments.edit === false) {
|
||||||
revertFunc();
|
revertFunc();
|
||||||
Backend.displayNotification(EALang.no_privileges_edit_appointments);
|
Backend.displayNotification(EALang.no_privileges_edit_appointments);
|
||||||
|
@ -710,12 +710,12 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* Whenever the calendar changes or refreshes its view certain actions need to be made, in order to
|
* Whenever the calendar changes or refreshes its view certain actions need to be made, in order to
|
||||||
* display proper information to the user.
|
* display proper information to the user.
|
||||||
*/
|
*/
|
||||||
function _calendarViewRender() {
|
function calendarViewRender() {
|
||||||
if ($('#select-filter-item').val() === null) {
|
if ($('#select-filter-item').val() === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_refreshCalendarAppointments(
|
refreshCalendarAppointments(
|
||||||
$('#calendar'),
|
$('#calendar'),
|
||||||
$('#select-filter-item').val(),
|
$('#select-filter-item').val(),
|
||||||
$('#select-filter-item option:selected').attr('type'),
|
$('#select-filter-item option:selected').attr('type'),
|
||||||
|
@ -743,7 +743,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* not the $.html() method. So in order for the title to display the html properly we convert all the
|
* not the $.html() method. So in order for the title to display the html properly we convert all the
|
||||||
* .fc-event-titles where needed into html.
|
* .fc-event-titles where needed into html.
|
||||||
*/
|
*/
|
||||||
function _convertTitlesToHtml() {
|
function convertTitlesToHtml() {
|
||||||
// Convert the titles to html code.
|
// Convert the titles to html code.
|
||||||
$('.fc-custom').each(function () {
|
$('.fc-custom').each(function () {
|
||||||
var title = $(this).find('.fc-event-title').text();
|
var title = $(this).find('.fc-event-title').text();
|
||||||
|
@ -764,7 +764,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
* @param {Date} startDate Visible start date of the calendar.
|
* @param {Date} startDate Visible start date of the calendar.
|
||||||
* @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 url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_appointments';
|
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_get_calendar_appointments';
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
|
@ -1165,7 +1165,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
// Initialize page calendar
|
// Initialize page calendar
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
defaultView: defaultView,
|
defaultView: defaultView,
|
||||||
height: _getCalendarHeight(),
|
height: getCalendarHeight(),
|
||||||
editable: true,
|
editable: true,
|
||||||
firstDay: firstWeekdayNumber,
|
firstDay: firstWeekdayNumber,
|
||||||
snapDuration: '00:30:00',
|
snapDuration: '00:30:00',
|
||||||
|
@ -1248,17 +1248,17 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
// Calendar events need to be declared on initialization.
|
// Calendar events need to be declared on initialization.
|
||||||
windowResize: _calendarWindowResize,
|
windowResize: calendarWindowResize,
|
||||||
viewRender: _calendarViewRender,
|
viewRender: calendarViewRender,
|
||||||
dayClick: _calendarDayClick,
|
dayClick: calendarDayClick,
|
||||||
eventClick: _calendarEventClick,
|
eventClick: calendarEventClick,
|
||||||
eventResize: _calendarEventResize,
|
eventResize: calendarEventResize,
|
||||||
eventDrop: _calendarEventDrop,
|
eventDrop: calendarEventDrop,
|
||||||
eventAfterAllRender: _convertTitlesToHtml
|
eventAfterAllRender: convertTitlesToHtml
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trigger once to set the proper footer position after calendar initialization.
|
// Trigger once to set the proper footer position after calendar initialization.
|
||||||
_calendarWindowResize();
|
calendarWindowResize();
|
||||||
|
|
||||||
// Fill the select list boxes of the page.
|
// Fill the select list boxes of the page.
|
||||||
if (GlobalVariables.availableProviders.length > 0) {
|
if (GlobalVariables.availableProviders.length > 0) {
|
||||||
|
@ -1327,7 +1327,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind the default event handlers.
|
// Bind the default event handlers.
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
|
|
||||||
$('#select-filter-item').trigger('change');
|
$('#select-filter-item').trigger('change');
|
||||||
|
|
||||||
|
@ -1400,7 +1400,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
||||||
var $selectFilterItem = $('#select-filter-item');
|
var $selectFilterItem = $('#select-filter-item');
|
||||||
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
_refreshCalendarAppointments(
|
refreshCalendarAppointments(
|
||||||
$calendar,
|
$calendar,
|
||||||
$selectFilterItem.val(),
|
$selectFilterItem.val(),
|
||||||
$selectFilterItem.find('option:selected').attr('type'),
|
$selectFilterItem.find('option:selected').attr('type'),
|
||||||
|
|
|
@ -22,7 +22,7 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Manage extra Dialog Save Button "Click"
|
* Event: Manage extra Dialog Save Button "Click"
|
||||||
*
|
*
|
||||||
|
@ -226,7 +226,7 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa
|
||||||
extraProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
|
extraProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window.BackendCalendarExtraPeriodsModal);
|
})(window.BackendCalendarExtraPeriodsModal);
|
||||||
|
|
|
@ -25,7 +25,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
||||||
/**
|
/**
|
||||||
* Bind event handlers.
|
* Bind event handlers.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Enable - Disable Synchronization Button "Click"
|
* Event: Enable - Disable Synchronization Button "Click"
|
||||||
*
|
*
|
||||||
|
@ -97,7 +97,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
||||||
provider.settings.google_sync = '0';
|
provider.settings.google_sync = '0';
|
||||||
provider.settings.google_token = null;
|
provider.settings.google_token = null;
|
||||||
|
|
||||||
_disableProviderSync(provider.id);
|
disableProviderSync(provider.id);
|
||||||
|
|
||||||
$('#enable-sync').removeClass('btn-danger enabled');
|
$('#enable-sync').removeClass('btn-danger enabled');
|
||||||
$('#enable-sync span:eq(1)').text(EALang.enable_sync);
|
$('#enable-sync span:eq(1)').text(EALang.enable_sync);
|
||||||
|
@ -166,7 +166,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
||||||
*
|
*
|
||||||
* @param {Number} providerId The selected provider record ID.
|
* @param {Number} providerId The selected provider record ID.
|
||||||
*/
|
*/
|
||||||
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 url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_disable_provider_sync';
|
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_disable_provider_sync';
|
||||||
|
@ -182,7 +182,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
||||||
|
|
||||||
|
|
||||||
exports.initialize = function () {
|
exports.initialize = function () {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window.BackendCalendarGoogleSync);
|
})(window.BackendCalendarGoogleSync);
|
||||||
|
|
|
@ -22,7 +22,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Manage Unavailable Dialog Save Button "Click"
|
* Event: Manage Unavailable Dialog Save Button "Click"
|
||||||
*
|
*
|
||||||
|
@ -230,7 +230,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
||||||
$unavailabilityProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
|
$unavailabilityProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
};
|
};
|
||||||
|
|
||||||
})(window.BackendCalendarUnavailabilitiesModal);
|
})(window.BackendCalendarUnavailabilitiesModal);
|
||||||
|
|
|
@ -47,14 +47,14 @@ window.BackendCustomers = window.BackendCustomers || {};
|
||||||
helper.filter('');
|
helper.filter('');
|
||||||
|
|
||||||
if (defaultEventHandlers) {
|
if (defaultEventHandlers) {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default event handlers declaration for backend customers page.
|
* Default event handlers declaration for backend customers page.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
helper.bindEventHandlers();
|
helper.bindEventHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ window.BackendServices = window.BackendServices || {};
|
||||||
/**
|
/**
|
||||||
* Default initialize method of the page.
|
* Default initialize method of the page.
|
||||||
*
|
*
|
||||||
* @param {Boolean} bindEventHandlers Optional (true), determines whether to bind the default event handlers.
|
* @param {Boolean} [defaultEventHandlers] Optional (true), determines whether to bind the default event handlers.
|
||||||
*/
|
*/
|
||||||
exports.initialize = function (bindEventHandlers) {
|
exports.initialize = function (defaultEventHandlers) {
|
||||||
bindEventHandlers = bindEventHandlers || true;
|
defaultEventHandlers = defaultEventHandlers || true;
|
||||||
|
|
||||||
// Fill available service categories listbox.
|
// Fill available service categories listbox.
|
||||||
$.each(GlobalVariables.categories, function (index, category) {
|
$.each(GlobalVariables.categories, function (index, category) {
|
||||||
|
@ -52,8 +52,8 @@ window.BackendServices = window.BackendServices || {};
|
||||||
helper.resetForm();
|
helper.resetForm();
|
||||||
helper.filter('');
|
helper.filter('');
|
||||||
|
|
||||||
if (bindEventHandlers) {
|
if (defaultEventHandlers) {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ window.BackendServices = window.BackendServices || {};
|
||||||
*
|
*
|
||||||
* Do not use this method if you include the "BackendServices" namespace on another page.
|
* Do not use this method if you include the "BackendServices" namespace on another page.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Page Tab Button "Click"
|
* Event: Page Tab Button "Click"
|
||||||
*
|
*
|
||||||
|
|
|
@ -136,7 +136,7 @@ window.BackendSettings = window.BackendSettings || {};
|
||||||
settings = new SystemSettings();
|
settings = new SystemSettings();
|
||||||
|
|
||||||
if (bindEventHandlers) {
|
if (bindEventHandlers) {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
var $link = $('#settings-page .nav li').not('.hidden').first().find('a');
|
var $link = $('#settings-page .nav li').not('.hidden').first().find('a');
|
||||||
$link.tab('show');
|
$link.tab('show');
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ window.BackendSettings = window.BackendSettings || {};
|
||||||
*
|
*
|
||||||
* This method depends on the backend/settings html, so do not use this method on a different page.
|
* This method depends on the backend/settings html, so do not use this method on a different page.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
exports.wp.bindEventHandlers();
|
exports.wp.bindEventHandlers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -102,7 +102,7 @@ window.BackendUsers = window.BackendUsers || {};
|
||||||
|
|
||||||
// Bind event handlers.
|
// Bind event handlers.
|
||||||
if (defaultEventHandlers) {
|
if (defaultEventHandlers) {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ window.BackendUsers = window.BackendUsers || {};
|
||||||
* Binds the default backend users event handlers. Do not use this method on a different
|
* Binds the default backend users event handlers. Do not use this method on a different
|
||||||
* page because it needs the backend users page DOM.
|
* page because it needs the backend users page DOM.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Page Tab Button "Click"
|
* Event: Page Tab Button "Click"
|
||||||
*
|
*
|
||||||
|
|
|
@ -53,8 +53,8 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
* @param {Boolean} manageMode (OPTIONAL) Determines whether the customer is going
|
* @param {Boolean} manageMode (OPTIONAL) Determines whether the customer is going
|
||||||
* to make changes to an existing appointment rather than booking a new one.
|
* to make changes to an existing appointment rather than booking a new one.
|
||||||
*/
|
*/
|
||||||
exports.initialize = function (bindEventHandlers, manageMode) {
|
exports.initialize = function (defaultEventHandlers, manageMode) {
|
||||||
bindEventHandlers = bindEventHandlers || true;
|
defaultEventHandlers = defaultEventHandlers || true;
|
||||||
manageMode = manageMode || false;
|
manageMode = manageMode || false;
|
||||||
|
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
|
@ -147,13 +147,13 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
$('#select-timezone').val(Intl.DateTimeFormat().resolvedOptions().timeZone);
|
$('#select-timezone').val(Intl.DateTimeFormat().resolvedOptions().timeZone);
|
||||||
|
|
||||||
// Bind the event handlers (might not be necessary every time we use this class).
|
// Bind the event handlers (might not be necessary every time we use this class).
|
||||||
if (bindEventHandlers) {
|
if (defaultEventHandlers) {
|
||||||
_bindEventHandlers();
|
bindEventHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the manage mode is true, the appointments data should be loaded by default.
|
// If the manage mode is true, the appointments data should be loaded by default.
|
||||||
if (FrontendBook.manageMode) {
|
if (FrontendBook.manageMode) {
|
||||||
_applyAppointmentData(GlobalVariables.appointmentData,
|
applyAppointmentData(GlobalVariables.appointmentData,
|
||||||
GlobalVariables.providerData, GlobalVariables.customerData);
|
GlobalVariables.providerData, GlobalVariables.customerData);
|
||||||
} else {
|
} else {
|
||||||
var $selectProvider = $('#select-provider');
|
var $selectProvider = $('#select-provider');
|
||||||
|
@ -196,7 +196,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
/**
|
/**
|
||||||
* This method binds the necessary event handlers for the book appointments page.
|
* This method binds the necessary event handlers for the book appointments page.
|
||||||
*/
|
*/
|
||||||
function _bindEventHandlers() {
|
function bindEventHandlers() {
|
||||||
/**
|
/**
|
||||||
* Event: Timezone "Changed"
|
* Event: Timezone "Changed"
|
||||||
*/
|
*/
|
||||||
|
@ -253,7 +253,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(),
|
FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(),
|
||||||
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
|
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
|
||||||
FrontendBook.updateConfirmFrame();
|
FrontendBook.updateConfirmFrame();
|
||||||
_updateServiceDescription($('#select-service').val(), $('#service-description'));
|
updateServiceDescription($('#select-service').val(), $('#service-description'));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,7 +286,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
// If we are on the 3rd tab then we will need to validate the user's
|
// If we are on the 3rd tab then we will need to validate the user's
|
||||||
// input before proceeding to the next step.
|
// input before proceeding to the next step.
|
||||||
if ($(this).attr('data-step_index') === '3') {
|
if ($(this).attr('data-step_index') === '3') {
|
||||||
if (!_validateCustomerForm()) {
|
if (!validateCustomerForm()) {
|
||||||
return; // Validation failed, do not continue.
|
return; // Validation failed, do not continue.
|
||||||
} else {
|
} else {
|
||||||
FrontendBook.updateConfirmFrame();
|
FrontendBook.updateConfirmFrame();
|
||||||
|
@ -457,7 +457,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
*
|
*
|
||||||
* @return {Boolean} Returns the validation result.
|
* @return {Boolean} Returns the validation result.
|
||||||
*/
|
*/
|
||||||
function _validateCustomerForm() {
|
function validateCustomerForm() {
|
||||||
$('#wizard-frame-3 .has-error').removeClass('has-error');
|
$('#wizard-frame-3 .has-error').removeClass('has-error');
|
||||||
$('#wizard-frame-3 label.text-danger').removeClass('text-danger');
|
$('#wizard-frame-3 label.text-danger').removeClass('text-danger');
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
data.appointment = {
|
data.appointment = {
|
||||||
start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')
|
start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')
|
||||||
+ ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00',
|
+ ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00',
|
||||||
end_datetime: _calcEndDatetime(),
|
end_datetime: calculateEndDatetime(),
|
||||||
notes: $('#notes').val(),
|
notes: $('#notes').val(),
|
||||||
is_unavailable: false,
|
is_unavailable: false,
|
||||||
id_users_provider: $('#select-provider').val(),
|
id_users_provider: $('#select-provider').val(),
|
||||||
|
@ -606,7 +606,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
*
|
*
|
||||||
* @return {String} Returns the end datetime in string format.
|
* @return {String} Returns the end datetime in string format.
|
||||||
*/
|
*/
|
||||||
function _calcEndDatetime() {
|
function calculateEndDatetime() {
|
||||||
// Find selected service duration.
|
// Find selected service duration.
|
||||||
var serviceId = $('#select-service').val();
|
var serviceId = $('#select-service').val();
|
||||||
var serviceDuration;
|
var serviceDuration;
|
||||||
|
@ -643,7 +643,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
*
|
*
|
||||||
* @return {Boolean} Returns the operation result.
|
* @return {Boolean} Returns the operation result.
|
||||||
*/
|
*/
|
||||||
function _applyAppointmentData(appointment, provider, customer) {
|
function applyAppointmentData(appointment, provider, customer) {
|
||||||
try {
|
try {
|
||||||
// Select Service & Provider
|
// Select Service & Provider
|
||||||
$('#select-service').val(appointment.id_services).trigger('change');
|
$('#select-service').val(appointment.id_services).trigger('change');
|
||||||
|
@ -683,7 +683,7 @@ window.FrontendBook = window.FrontendBook || {};
|
||||||
* @param {Object} $div The destination div jquery object (e.g. provide $('#div-id')
|
* @param {Object} $div The destination div jquery object (e.g. provide $('#div-id')
|
||||||
* object as value).
|
* object as value).
|
||||||
*/
|
*/
|
||||||
function _updateServiceDescription(serviceId, $div) {
|
function updateServiceDescription(serviceId, $div) {
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
$.each(GlobalVariables.availableServices, function (index, service) {
|
$.each(GlobalVariables.availableServices, function (index, service) {
|
||||||
|
|
|
@ -255,16 +255,16 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
unavailableDatesBackup = response;
|
unavailableDatesBackup = response;
|
||||||
selectedDateStringBackup = selectedDateString;
|
selectedDateStringBackup = selectedDateString;
|
||||||
_applyUnavailableDates(response, selectedDateString, true);
|
applyUnavailableDates(response, selectedDateString, true);
|
||||||
})
|
})
|
||||||
.fail(GeneralFunctions.ajaxFailureHandler);
|
.fail(GeneralFunctions.ajaxFailureHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.applyPreviousUnavailableDates = function () {
|
exports.applyPreviousUnavailableDates = function () {
|
||||||
_applyUnavailableDates(unavailableDatesBackup, selectedDateStringBackup);
|
applyUnavailableDates(unavailableDatesBackup, selectedDateStringBackup);
|
||||||
};
|
};
|
||||||
|
|
||||||
function _applyUnavailableDates(unavailableDates, selectedDateString, setDate) {
|
function applyUnavailableDates(unavailableDates, selectedDateString, setDate) {
|
||||||
setDate = setDate || false;
|
setDate = setDate || false;
|
||||||
|
|
||||||
processingUnavailabilities = true;
|
processingUnavailabilities = true;
|
||||||
|
|
Loading…
Reference in a new issue