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">
<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 (manageMode) {
applyAppointmentData(vars('appointment_data'), vars('provider_data'), vars('customer_data'));
$('#wizard-frame-1').css({
'visibility': 'visible',
'display': 'none'
}).fadeIn();
} else {
// Check if a specific service was selected (via URL parameter).
const selectedServiceId = App.Utils.Url.queryParam('service');
@ -160,6 +164,11 @@ App.Pages.Booking = (function () {
(selectedServiceId && selectedProviderId) ||
(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');
$(document).find('.book-step:first').hide();
@ -173,6 +182,11 @@ App.Pages.Booking = (function () {
.find('strong')
.text(index + 1)
);
} else {
$('#wizard-frame-1').css({
'visibility': 'visible',
'display': 'none'
}).fadeIn();
}
prefillFromQueryParam('#first-name', 'first_name');