Update how the booking selection displays on the screen

This commit is contained in:
Alex Tselegidis 2024-07-15 16:09:15 +02:00
parent d12d4f125c
commit bdc5782cf4
3 changed files with 17 additions and 13 deletions

View File

@ -15,11 +15,8 @@
</span>
<div class="d-flex justify-content-center justify-content-md-start">
<span class="display-selected-service me-1 pe-1 border-end invisible">
<?= lang('service') ?>
</span>
<span class="display-selected-provider invisible">
<?= lang('provider') ?>
<span class="display-booking-selection">
<?= lang('service') ?> │ <?= lang('provider') ?>
</span>
</div>
</div>

View File

@ -53,8 +53,7 @@ body {
max-height: 56px;
}
.display-selected-service,
.display-selected-provider {
.display-booking-selection {
color: #225d4d;
border-right-color: #225d4d !important;
font-size: 60%;

View File

@ -38,6 +38,7 @@ App.Pages.Booking = (function () {
const $customField3 = $('#custom-field-3');
const $customField4 = $('#custom-field-4');
const $customField5 = $('#custom-field-5');
const $displayBookingSelection = $('.display-booking-selection');
const tippy = window.tippy;
const moment = window.moment;
@ -644,11 +645,20 @@ App.Pages.Booking = (function () {
* customer settings and input for the appointment booking.
*/
function updateConfirmFrame() {
const serviceOptionText = $selectService.find('option:selected').text();
$('.display-selected-service').text(serviceOptionText).removeClass('invisible');
const serviceId = $selectService.val();
const providerId = $selectProvider.val();
const providerOptionText = $selectProvider.find('option:selected').text();
$('.display-selected-provider').text(providerOptionText).removeClass('invisible');
$displayBookingSelection.text(`${lang('service')}${lang('provider')}`); // Notice: "│" is a custom ASCII char
if (serviceId && providerId) {
const serviceOptionText = $selectService.find('option:selected').text();
const providerOptionText = $selectProvider.find('option:selected').text();
$displayBookingSelection.text(`${serviceOptionText}${providerOptionText}`);
}
$('.display-selected-service')
.text(serviceId ? serviceOptionText : lang('service_and_provider'))
.removeClass('invisible');
if (!$availableHours.find('.selected-hour').text()) {
return; // No time is selected, skip the rest of this function...
@ -656,8 +666,6 @@ App.Pages.Booking = (function () {
// Render the appointment details
const serviceId = $selectService.val();
const service = vars('available_services').find(
(availableService) => Number(availableService.id) === Number(serviceId),
);