mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-08 17:12:25 +03:00
Replace custom event handler methods with the use of "on".
This commit is contained in:
parent
6c8fea4ad8
commit
a1c10fc2d3
14 changed files with 52 additions and 52 deletions
|
@ -40,7 +40,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
*
|
||||
* Closes the dialog without saving any changes to the database.
|
||||
*/
|
||||
$('#manage-appointment #cancel-appointment').click(function () {
|
||||
$('#manage-appointment #cancel-appointment').on('click', function () {
|
||||
$('#manage-appointment').modal('hide');
|
||||
});
|
||||
|
||||
|
@ -49,7 +49,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
*
|
||||
* Stores the appointment changes or inserts a new appointment depending the dialog mode.
|
||||
*/
|
||||
$('#manage-appointment #save-appointment').click(function () {
|
||||
$('#manage-appointment #save-appointment').on('click', function () {
|
||||
// Before doing anything the appointment data need to be validated.
|
||||
if (!validateAppointmentForm()) {
|
||||
return;
|
||||
|
@ -124,7 +124,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
* When the user presses this button, the manage appointment dialog opens and lets the user to
|
||||
* create a new appointment.
|
||||
*/
|
||||
$('#insert-appointment').click(function () {
|
||||
$('#insert-appointment').on('click', function () {
|
||||
$('.popover').remove();
|
||||
|
||||
BackendCalendarAppointmentsModal.resetAppointmentDialog();
|
||||
|
@ -178,7 +178,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
/**
|
||||
* Event: Pick Existing Customer Button "Click"
|
||||
*/
|
||||
$('#select-customer').click(function () {
|
||||
$('#select-customer').on('click', function () {
|
||||
var $list = $('#existing-customers-list');
|
||||
|
||||
if (!$list.is(':visible')) {
|
||||
|
@ -229,7 +229,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
/**
|
||||
* Event: Filter Existing Customers "Change"
|
||||
*/
|
||||
$('#filter-existing-customers').keyup(function () {
|
||||
$('#filter-existing-customers').on('keyup', function () {
|
||||
var key = $(this).val().toLowerCase();
|
||||
var $list = $('#existing-customers-list');
|
||||
|
||||
|
@ -292,7 +292,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
* When the user clicks on a service, its available providers should become visible. Also we need to
|
||||
* update the start and end time of the appointment.
|
||||
*/
|
||||
$('#select-service').change(function () {
|
||||
$('#select-service').on('change', function () {
|
||||
var serviceId = $('#select-service').val();
|
||||
|
||||
$('#select-provider').empty();
|
||||
|
@ -329,14 +329,14 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
|
|||
/**
|
||||
* Event: Provider "Change"
|
||||
*/
|
||||
$('#select-provider').change(function () {
|
||||
$('#select-provider').on('change', function () {
|
||||
updateTimezone();
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Enter New Customer Button "Click"
|
||||
*/
|
||||
$('#new-customer').click(function () {
|
||||
$('#new-customer').on('click', function () {
|
||||
$('#manage-appointment').find('#customer-id, #first-name, #last-name, #email, '
|
||||
+ '#phone-number, #address, #city, #zip-code, #customer-notes').val('');
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
*
|
||||
* When the user clicks the reload button an the calendar items need to be refreshed.
|
||||
*/
|
||||
$('#reload-appointments').click(function () {
|
||||
$('#reload-appointments').on('click', function () {
|
||||
refreshCalendarAppointments(
|
||||
$('#calendar'),
|
||||
$('#select-filter-item').val(),
|
||||
|
@ -221,7 +221,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
*
|
||||
* Load the appointments that correspond to the select filter item and display them on the calendar.
|
||||
*/
|
||||
$('#select-filter-item').change(function () {
|
||||
$('#select-filter-item').on('change', function () {
|
||||
// If current value is service, then the sync buttons must be disabled.
|
||||
if ($('#select-filter-item option:selected').attr('type') === FILTER_TYPE_SERVICE) {
|
||||
$('#google-sync, #enable-sync, #insert-appointment, #insert-dropdown').prop('disabled', true);
|
||||
|
|
|
@ -28,7 +28,7 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa
|
|||
*
|
||||
* Stores the extra period changes or inserts a new record.
|
||||
*/
|
||||
$('#manage-extra #save-extra').click(function () {
|
||||
$('#manage-extra #save-extra').on('click', function () {
|
||||
var $dialog = $('#manage-extra');
|
||||
$dialog.find('.has-error').removeClass('has-error');
|
||||
var start = $dialog.find('#extra-start').datetimepicker('getDate');
|
||||
|
@ -99,7 +99,7 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa
|
|||
*
|
||||
* Closes the dialog without saveing any changes to the database.
|
||||
*/
|
||||
$('#manage-extra #cancel-extra').click(function () {
|
||||
$('#manage-extra #cancel-extra').on('click', function () {
|
||||
$('#manage-extra').modal('hide');
|
||||
});
|
||||
|
||||
|
@ -109,7 +109,7 @@ window.BackendCalendarExtraPeriodsModal = window.BackendCalendarExtraPeriodsModa
|
|||
* When the user clicks this button a popup dialog appears and the use can set a time period where
|
||||
* he cannot accept any appointments.
|
||||
*/
|
||||
$('#insert-extra-period').click(function () {
|
||||
$('#insert-extra-period').on('click', function () {
|
||||
BackendCalendarExtraPeriodsModal.resetExtraDialog();
|
||||
var $dialog = $('#manage-extra');
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
|||
* When the user clicks on the "Enable Sync" button, a popup should appear
|
||||
* that is going to follow the web server authorization flow of OAuth.
|
||||
*/
|
||||
$('#enable-sync').click(function () {
|
||||
$('#enable-sync').on('click', function () {
|
||||
if ($('#enable-sync').hasClass('enabled') === false) {
|
||||
// Enable synchronization for selected provider.
|
||||
var authUrl = GlobalVariables.baseUrl + '/index.php/google/oauth/'
|
||||
|
@ -112,7 +112,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
|||
/**
|
||||
* Event: Select Google Calendar "Click"
|
||||
*/
|
||||
$('#select-calendar').click(function () {
|
||||
$('#select-calendar').on('click', function () {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_select_google_calendar';
|
||||
|
||||
var data = {
|
||||
|
@ -131,7 +131,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
|||
/**
|
||||
* Event: Close Google Calendar "Click"
|
||||
*/
|
||||
$('#close-calendar').click(function () {
|
||||
$('#close-calendar').on('click', function () {
|
||||
$('#select-google-calendar').modal('hide');
|
||||
});
|
||||
|
||||
|
@ -140,7 +140,7 @@ window.BackendCalendarGoogleSync = window.BackendCalendarGoogleSync || {};
|
|||
*
|
||||
* Trigger the synchronization algorithm.
|
||||
*/
|
||||
$('#google-sync').click(function () {
|
||||
$('#google-sync').on('click', function () {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/google/sync/' + $('#select-filter-item').val();
|
||||
|
||||
$.ajax({
|
||||
|
|
|
@ -28,7 +28,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
*
|
||||
* Stores the unavailable period changes or inserts a new record.
|
||||
*/
|
||||
$('#manage-unavailable #save-unavailable').click(function () {
|
||||
$('#manage-unavailable #save-unavailable').on('click', function () {
|
||||
var $dialog = $('#manage-unavailable');
|
||||
$dialog.find('.has-error').removeClass('has-error');
|
||||
var start = $dialog.find('#unavailable-start').datetimepicker('getDate');
|
||||
|
@ -76,7 +76,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
*
|
||||
* Closes the dialog without saveing any changes to the database.
|
||||
*/
|
||||
$('#manage-unavailable #cancel-unavailable').click(function () {
|
||||
$('#manage-unavailable #cancel-unavailable').on('click', function () {
|
||||
$('#manage-unavailable').modal('hide');
|
||||
});
|
||||
|
||||
|
@ -86,7 +86,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
|
|||
* When the user clicks this button a popup dialog appears and the use can set a time period where
|
||||
* he cannot accept any appointments.
|
||||
*/
|
||||
$('#insert-unavailable').click(function () {
|
||||
$('#insert-unavailable').on('click', function () {
|
||||
BackendCalendarUnavailabilitiesModal.resetUnavailableDialog();
|
||||
var $dialog = $('#manage-unavailable');
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
/**
|
||||
* Event: Filter Categories Cancel Button "Click"
|
||||
*/
|
||||
$('#filter-categories .clear').click(function () {
|
||||
$('#filter-categories .clear').on('click', function () {
|
||||
$('#filter-categories .key').val('');
|
||||
instance.filter('');
|
||||
instance.resetForm();
|
||||
|
@ -78,7 +78,7 @@
|
|||
/**
|
||||
* Event: Add Category Button "Click"
|
||||
*/
|
||||
$('#add-category').click(function () {
|
||||
$('#add-category').on('click', function () {
|
||||
instance.resetForm();
|
||||
$('#categories .add-edit-delete-group').hide();
|
||||
$('#categories .save-cancel-group').show();
|
||||
|
@ -90,7 +90,7 @@
|
|||
/**
|
||||
* Event: Edit Category Button "Click"
|
||||
*/
|
||||
$('#edit-category').click(function () {
|
||||
$('#edit-category').on('click', function () {
|
||||
$('#categories .add-edit-delete-group').hide();
|
||||
$('#categories .save-cancel-group').show();
|
||||
$('#categories .record-details').find('input, textarea').prop('readonly', false);
|
||||
|
@ -102,7 +102,7 @@
|
|||
/**
|
||||
* Event: Delete Category Button "Click"
|
||||
*/
|
||||
$('#delete-category').click(function () {
|
||||
$('#delete-category').on('click', function () {
|
||||
var categoryId = $('#category-id').val();
|
||||
|
||||
var buttons = [
|
||||
|
@ -128,7 +128,7 @@
|
|||
/**
|
||||
* Event: Categories Save Button "Click"
|
||||
*/
|
||||
$('#save-category').click(function () {
|
||||
$('#save-category').on('click', function () {
|
||||
var category = {
|
||||
name: $('#category-name').val(),
|
||||
description: $('#category-description').val()
|
||||
|
@ -148,7 +148,7 @@
|
|||
/**
|
||||
* Event: Cancel Category Button "Click"
|
||||
*/
|
||||
$('#cancel-category').click(function () {
|
||||
$('#cancel-category').on('click', function () {
|
||||
var id = $('#category-id').val();
|
||||
instance.resetForm();
|
||||
if (id !== '') {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
/**
|
||||
* Event: Filter Customers Clear Button "Click"
|
||||
*/
|
||||
$('#filter-customers .clear').click(function () {
|
||||
$('#filter-customers .clear').on('click', function () {
|
||||
$('#filter-customers .key').val('');
|
||||
instance.filterLimit = 20;
|
||||
instance.filter('');
|
||||
|
@ -101,7 +101,7 @@
|
|||
/**
|
||||
* Event: Add Customer Button "Click"
|
||||
*/
|
||||
$('#add-customer').click(function () {
|
||||
$('#add-customer').on('click', function () {
|
||||
instance.resetForm();
|
||||
$('#add-edit-delete-group').hide();
|
||||
$('#save-cancel-group').show();
|
||||
|
@ -115,7 +115,7 @@
|
|||
/**
|
||||
* Event: Edit Customer Button "Click"
|
||||
*/
|
||||
$('#edit-customer').click(function () {
|
||||
$('#edit-customer').on('click', function () {
|
||||
$('.record-details').find('input, textarea').prop('readonly', false);
|
||||
$('.record-details select').prop('disabled', false);
|
||||
$('#add-edit-delete-group').hide();
|
||||
|
@ -128,7 +128,7 @@
|
|||
/**
|
||||
* Event: Cancel Customer Add/Edit Operation Button "Click"
|
||||
*/
|
||||
$('#cancel-customer').click(function () {
|
||||
$('#cancel-customer').on('click', function () {
|
||||
var id = $('#customer-id').val();
|
||||
instance.resetForm();
|
||||
if (id) {
|
||||
|
@ -139,7 +139,7 @@
|
|||
/**
|
||||
* Event: Save Add/Edit Customer Operation "Click"
|
||||
*/
|
||||
$('#save-customer').click(function () {
|
||||
$('#save-customer').on('click', function () {
|
||||
var customer = {
|
||||
first_name: $('#first-name').val(),
|
||||
last_name: $('#last-name').val(),
|
||||
|
@ -166,7 +166,7 @@
|
|||
/**
|
||||
* Event: Delete Customer Button "Click"
|
||||
*/
|
||||
$('#delete-customer').click(function () {
|
||||
$('#delete-customer').on('click', function () {
|
||||
var customerId = $('#customer-id').val();
|
||||
var buttons = [
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
/**
|
||||
* Event: Filter Service Cancel Button "Click"
|
||||
*/
|
||||
$('#filter-services .clear').click(function () {
|
||||
$('#filter-services .clear').on('click', function () {
|
||||
$('#filter-services .key').val('');
|
||||
instance.filter('');
|
||||
instance.resetForm();
|
||||
|
@ -93,7 +93,7 @@
|
|||
/**
|
||||
* Event: Add New Service Button "Click"
|
||||
*/
|
||||
$('#add-service').click(function () {
|
||||
$('#add-service').on('click', function () {
|
||||
instance.resetForm();
|
||||
$('#services .add-edit-delete-group').hide();
|
||||
$('#services .save-cancel-group').show();
|
||||
|
@ -109,7 +109,7 @@
|
|||
*
|
||||
* Cancel add or edit of a service record.
|
||||
*/
|
||||
$('#cancel-service').click(function () {
|
||||
$('#cancel-service').on('click', function () {
|
||||
var id = $('#service-id').val();
|
||||
instance.resetForm();
|
||||
if (id !== '') {
|
||||
|
@ -120,7 +120,7 @@
|
|||
/**
|
||||
* Event: Save Service Button "Click"
|
||||
*/
|
||||
$('#save-service').click(function () {
|
||||
$('#save-service').on('click', function () {
|
||||
var service = {
|
||||
name: $('#service-name').val(),
|
||||
duration: $('#service-duration').val(),
|
||||
|
@ -152,7 +152,7 @@
|
|||
/**
|
||||
* Event: Edit Service Button "Click"
|
||||
*/
|
||||
$('#edit-service').click(function () {
|
||||
$('#edit-service').on('click', function () {
|
||||
$('#services .add-edit-delete-group').hide();
|
||||
$('#services .save-cancel-group').show();
|
||||
$('#services .record-details').find('input, textarea').prop('disabled', false);
|
||||
|
@ -165,7 +165,7 @@
|
|||
/**
|
||||
* Event: Delete Service Button "Click"
|
||||
*/
|
||||
$('#delete-service').click(function () {
|
||||
$('#delete-service').on('click', function () {
|
||||
var serviceId = $('#service-id').val();
|
||||
var buttons = [
|
||||
{
|
||||
|
|
|
@ -198,7 +198,7 @@ window.BackendSettings = window.BackendSettings || {};
|
|||
*
|
||||
* Store the setting changes into the database.
|
||||
*/
|
||||
$('.save-settings').click(function () {
|
||||
$('.save-settings').on('click', function () {
|
||||
var data = settings.get();
|
||||
settings.save(data);
|
||||
});
|
||||
|
|
|
@ -212,7 +212,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
*
|
||||
* Whenever the provider changes the available appointment date - time periods must be updated.
|
||||
*/
|
||||
$('#select-provider').change(function () {
|
||||
$('#select-provider').on('change', function () {
|
||||
FrontendBookApi.getUnavailableDates($(this).val(), $('#select-service').val(),
|
||||
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
|
||||
FrontendBook.updateConfirmFrame();
|
||||
|
@ -224,7 +224,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
* When the user clicks on a service, its available providers should
|
||||
* become visible.
|
||||
*/
|
||||
$('#select-service').change(function () {
|
||||
$('#select-service').on('change', function () {
|
||||
var serviceId = $('#select-service').val();
|
||||
|
||||
$('#select-provider').empty();
|
||||
|
@ -257,7 +257,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
* This handler is triggered every time the user pressed the "next" button on the book wizard.
|
||||
* Some special tasks might be performed, depending the current wizard step.
|
||||
*/
|
||||
$('.button-next').click(function () {
|
||||
$('.button-next').on('click', function () {
|
||||
// If we are on the first step and there is not provider selected do not continue
|
||||
// with the next step.
|
||||
if ($(this).attr('data-step_index') === '1' && !$('#select-provider').val()) {
|
||||
|
@ -334,7 +334,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
* This handler is triggered every time the user pressed the "back" button on the
|
||||
* book wizard.
|
||||
*/
|
||||
$('.button-back').click(function () {
|
||||
$('.button-back').on('click', function () {
|
||||
var prevTabIndex = parseInt($(this).attr('data-step_index')) - 1;
|
||||
|
||||
$(this).parents().eq(1).hide('fade', function () {
|
||||
|
@ -366,7 +366,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
*
|
||||
* @param {jQuery.Event} event
|
||||
*/
|
||||
$('#cancel-appointment').click(function (event) {
|
||||
$('#cancel-appointment').on('click', function (event) {
|
||||
var buttons = [
|
||||
{
|
||||
text: EALang.cancel,
|
||||
|
@ -433,7 +433,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
*
|
||||
* @param {jQuery.Event} event
|
||||
*/
|
||||
$('#book-appointment-submit').click(function (event) {
|
||||
$('#book-appointment-submit').on('click', function (event) {
|
||||
FrontendBookApi.registerAppointment();
|
||||
});
|
||||
|
||||
|
@ -442,7 +442,7 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
*
|
||||
* @param {jQuery.Event} event
|
||||
*/
|
||||
$('.captcha-title small').click(function (event) {
|
||||
$('.captcha-title small').on('click', function (event) {
|
||||
$('.captcha-image').attr('src', GlobalVariables.baseUrl + '/index.php/captcha?' + Date.now());
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ $(document).ready(function () {
|
|||
* be added to the "primary" calendar. In order to use the API the javascript client library provided by
|
||||
* Google is necessary.
|
||||
*/
|
||||
$('#add-to-google-calendar').click(function () {
|
||||
$('#add-to-google-calendar').on('click', function () {
|
||||
gapi.client.setApiKey(GlobalVariables.googleApiKey);
|
||||
gapi.auth.authorize({
|
||||
client_id: GlobalVariables.googleClientId,
|
||||
|
|
|
@ -264,7 +264,7 @@ window.GeneralFunctions = window.GeneralFunctions || {};
|
|||
trigger: 'manual'
|
||||
});
|
||||
|
||||
$element.click(function () {
|
||||
$element.on('click', function () {
|
||||
if ($('#language-list').length === 0) {
|
||||
$(this).popover('show');
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ $(function () {
|
|||
/**
|
||||
* Event: Install Easy!Appointments Button "Click"
|
||||
*/
|
||||
$install.click(function () {
|
||||
$install.on('click', function () {
|
||||
if (!validate()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@
|
|||
* A new row is added on the table and the user can enter the new break
|
||||
* data. After that he can either press the save or cancel button.
|
||||
*/
|
||||
$('.add-break').click(function () {
|
||||
$('.add-break').on('click', function () {
|
||||
var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
|
||||
|
||||
var $newBreak = $('<tr/>', {
|
||||
|
@ -559,7 +559,7 @@
|
|||
* A new row is added on the table and the user can enter the new extra day
|
||||
* data. After that he can either press the save or cancel button.
|
||||
*/
|
||||
$('.add-extra-periods').click(function () {
|
||||
$('.add-extra-periods').on('click', function () {
|
||||
var today = GeneralFunctions.formatDate(new Date(), GlobalVariables.dateFormat, false);
|
||||
|
||||
var $newExtraPeriod = $('<tr/>', {
|
||||
|
@ -897,7 +897,7 @@
|
|||
/**
|
||||
* This is necessary for translated days.
|
||||
*
|
||||
* @param {String} value Day value could be like "Monday", "Tuesday" etc.
|
||||
* @param {String} day Day value could be like "Monday", "Tuesday" etc.
|
||||
*/
|
||||
WorkingPlan.prototype.convertDayToValue = function (day) {
|
||||
switch (day) {
|
||||
|
|
Loading…
Reference in a new issue