forked from mirrors/easyappointments
Define local variables for UMD libraries
This commit is contained in:
parent
a8996b6b99
commit
2999dcda87
1 changed files with 29 additions and 29 deletions
|
@ -34,6 +34,8 @@ App.Pages.Booking = (function () {
|
||||||
const $availableHours = $('#available-hours');
|
const $availableHours = $('#available-hours');
|
||||||
const $bookAppointmentSubmit = $('#book-appointment-submit');
|
const $bookAppointmentSubmit = $('#book-appointment-submit');
|
||||||
const $deletePersonalInformation = $('#delete-personal-information');
|
const $deletePersonalInformation = $('#delete-personal-information');
|
||||||
|
const tippy = window.tippy;
|
||||||
|
const moment = window.moment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the functionality of the page.
|
* Determines the functionality of the page.
|
||||||
|
@ -494,7 +496,6 @@ App.Pages.Booking = (function () {
|
||||||
$('#wizard-frame-3 .is-invalid').removeClass('is-invalid');
|
$('#wizard-frame-3 .is-invalid').removeClass('is-invalid');
|
||||||
$('#wizard-frame-3 label.text-danger').removeClass('text-danger');
|
$('#wizard-frame-3 label.text-danger').removeClass('text-danger');
|
||||||
|
|
||||||
try {
|
|
||||||
// Validate required fields.
|
// Validate required fields.
|
||||||
let missingRequiredField = false;
|
let missingRequiredField = false;
|
||||||
|
|
||||||
|
@ -506,13 +507,15 @@ App.Pages.Booking = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (missingRequiredField) {
|
if (missingRequiredField) {
|
||||||
throw new Error(lang('fields_are_required'));
|
$('#form-message').text(lang('fields_are_required'));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate email address.
|
// Validate email address.
|
||||||
if ($email.val() && !App.Utils.Validation.email($email.val())) {
|
if ($email.val() && !App.Utils.Validation.email($email.val())) {
|
||||||
$email.addClass('is-invalid');
|
$email.addClass('is-invalid');
|
||||||
throw new Error(lang('invalid_email'));
|
$('#form-message').text(lang('invalid_email'));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate phone number.
|
// Validate phone number.
|
||||||
|
@ -520,14 +523,11 @@ App.Pages.Booking = (function () {
|
||||||
|
|
||||||
if (phoneNumber && !App.Utils.Validation.phone(phoneNumber)) {
|
if (phoneNumber && !App.Utils.Validation.phone(phoneNumber)) {
|
||||||
$phoneNumber.addClass('is-invalid');
|
$phoneNumber.addClass('is-invalid');
|
||||||
throw new Error(lang('invalid_phone'));
|
$('#form-message').text(lang('invalid_phone'));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
|
||||||
$('#form-message').text(error.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue