Display the please-select-time warning at the top of the available hours

This commit is contained in:
Alex Tselegidis 2020-12-14 20:40:32 +02:00
parent 5df1bd4902
commit 442ba83296
1 changed files with 13 additions and 10 deletions

View File

@ -249,28 +249,28 @@ window.FrontendBook = window.FrontendBook || {};
* Some special tasks might be performed, depending the current wizard step. * Some special tasks might be performed, depending the current wizard step.
*/ */
$('.button-next').on('click', function () { $('.button-next').on('click', function () {
// If we are on the first step and there is not provider selected do not continue // If we are on the first step and there is not provider selected do not continue with the next step.
// with the next step.
if ($(this).attr('data-step_index') === '1' && !$('#select-provider').val()) { if ($(this).attr('data-step_index') === '1' && !$('#select-provider').val()) {
return; return;
} }
// If we are on the 2nd tab then the user should have an appointment hour // If we are on the 2nd tab then the user should have an appointment hour selected.
// selected.
if ($(this).attr('data-step_index') === '2') { if ($(this).attr('data-step_index') === '2') {
if (!$('.selected-hour').length) { if (!$('.selected-hour').length) {
if (!$('#select-hour-prompt').length) { if (!$('#select-hour-prompt').length) {
$('#available-hours').append('<br><br>' $('<div/>', {
+ '<span id="select-hour-prompt" class="text-danger">' 'id': 'select-hour-prompt',
+ EALang.appointment_hour_missing 'class': 'text-danger mb-4',
+ '</span>'); 'text': EALang.appointment_hour_missing,
})
.prependTo('#available-hours');
} }
return; return;
} }
} }
// 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
// input before proceeding to the next step. // 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.
@ -700,6 +700,9 @@ window.FrontendBook = window.FrontendBook || {};
$('#address').val(customer.address); $('#address').val(customer.address);
$('#city').val(customer.city); $('#city').val(customer.city);
$('#zip-code').val(customer.zip_code); $('#zip-code').val(customer.zip_code);
if (customer.timezone) {
$('#select-timezone').val(customer.timezone)
}
var appointmentNotes = (appointment.notes !== null) var appointmentNotes = (appointment.notes !== null)
? appointment.notes : ''; ? appointment.notes : '';
$('#notes').val(appointmentNotes); $('#notes').val(appointmentNotes);