Toggle the first booking step

This commit is contained in:
Alex Tselegidis 2023-02-21 08:32:30 +01:00
parent 9681e7d6ad
commit 6226e0f86c
2 changed files with 15 additions and 1 deletions

View file

@ -6,7 +6,7 @@
*/ */
?> ?>
<div id="wizard-frame-1" class="wizard-frame"> <div id="wizard-frame-1" class="wizard-frame" style="visibility: hidden;">
<div class="frame-container"> <div class="frame-container">
<h2 class="frame-title"><?= lang('service_and_provider') ?></h2> <h2 class="frame-title"><?= lang('service_and_provider') ?></h2>

View file

@ -128,6 +128,10 @@ App.Pages.Booking = (function () {
// If the manage mode is true, the appointment data should be loaded by default. // If the manage mode is true, the appointment data should be loaded by default.
if (manageMode) { if (manageMode) {
applyAppointmentData(vars('appointment_data'), vars('provider_data'), vars('customer_data')); applyAppointmentData(vars('appointment_data'), vars('provider_data'), vars('customer_data'));
$('#wizard-frame-1').css({
'visibility': 'visible',
'display': 'none'
}).fadeIn();
} else { } else {
// Check if a specific service was selected (via URL parameter). // Check if a specific service was selected (via URL parameter).
const selectedServiceId = App.Utils.Url.queryParam('service'); const selectedServiceId = App.Utils.Url.queryParam('service');
@ -160,6 +164,11 @@ App.Pages.Booking = (function () {
(selectedServiceId && selectedProviderId) || (selectedServiceId && selectedProviderId) ||
(vars('available_services').length === 1 && vars('available_providers').length === 1) (vars('available_services').length === 1 && vars('available_providers').length === 1)
) { ) {
$('.active-step').removeClass('active-step');
$('#step-2').addClass('active-step');
$('#wizard-frame-1').hide();
$('#wizard-frame-2').fadeIn();
$selectService.closest('.wizard-frame').find('.button-next').trigger('click'); $selectService.closest('.wizard-frame').find('.button-next').trigger('click');
$(document).find('.book-step:first').hide(); $(document).find('.book-step:first').hide();
@ -173,6 +182,11 @@ App.Pages.Booking = (function () {
.find('strong') .find('strong')
.text(index + 1) .text(index + 1)
); );
} else {
$('#wizard-frame-1').css({
'visibility': 'visible',
'display': 'none'
}).fadeIn();
} }
prefillFromQueryParam('#first-name', 'first_name'); prefillFromQueryParam('#first-name', 'first_name');