Define local variables for UMD libraries

This commit is contained in:
Alex Tselegidis 2023-02-21 08:05:55 +01:00
parent a8996b6b99
commit 2999dcda87

View file

@ -34,6 +34,8 @@ App.Pages.Booking = (function () {
const $availableHours = $('#available-hours');
const $bookAppointmentSubmit = $('#book-appointment-submit');
const $deletePersonalInformation = $('#delete-personal-information');
const tippy = window.tippy;
const moment = window.moment;
/**
* 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 label.text-danger').removeClass('text-danger');
try {
// Validate required fields.
let missingRequiredField = false;
@ -506,13 +507,15 @@ App.Pages.Booking = (function () {
});
if (missingRequiredField) {
throw new Error(lang('fields_are_required'));
$('#form-message').text(lang('fields_are_required'));
return false;
}
// Validate email address.
if ($email.val() && !App.Utils.Validation.email($email.val())) {
$email.addClass('is-invalid');
throw new Error(lang('invalid_email'));
$('#form-message').text(lang('invalid_email'));
return false;
}
// Validate phone number.
@ -520,14 +523,11 @@ App.Pages.Booking = (function () {
if (phoneNumber && !App.Utils.Validation.phone(phoneNumber)) {
$phoneNumber.addClass('is-invalid');
throw new Error(lang('invalid_phone'));
$('#form-message').text(lang('invalid_phone'));
return false;
}
return true;
} catch (error) {
$('#form-message').text(error.message);
return false;
}
}
/**