34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', () => {
|
|
const pickupInput = document.getElementById('pickup_time');
|
|
if (pickupInput && !pickupInput.value) {
|
|
const now = new Date();
|
|
now.setMinutes(now.getMinutes() + 20);
|
|
now.setSeconds(0, 0);
|
|
pickupInput.value = now.toISOString().slice(0, 16);
|
|
}
|
|
|
|
const toastElement = document.getElementById('appToast');
|
|
if (toastElement && typeof bootstrap !== 'undefined') {
|
|
const message = toastElement.dataset.toastMessage || '';
|
|
if (message.trim() !== '') {
|
|
const body = toastElement.querySelector('.toast-body');
|
|
if (body) {
|
|
body.textContent = message;
|
|
}
|
|
const toast = new bootstrap.Toast(toastElement, { delay: 3200 });
|
|
toast.show();
|
|
}
|
|
}
|
|
|
|
document.querySelectorAll('.book-offer-btn').forEach((button) => {
|
|
button.addEventListener('click', () => {
|
|
button.disabled = true;
|
|
button.textContent = 'Confirming booking…';
|
|
const form = button.closest('form');
|
|
if (form) {
|
|
form.submit();
|
|
}
|
|
});
|
|
});
|
|
});
|