Re-open the barber vacancy and stop repeat submits on manage-booking

The barber ad (hidden 2026-10-06) is back on the listing page and its
redirect is removed, now that the salon is hiring a barber again.

On the guest manage-booking page, "Bekreft endring" and "Avbestill"
could be clicked repeatedly while the slow POST (Google Calendar +
e-mails) was in flight, sending the request again each time. Both
forms now lock after the first submit, mirroring the booking form, and
the page reloads when restored from the back-forward cache so the
buttons are usable again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ubuntu
2026-11-23 10:32:45 +00:00
co-authored by Claude Opus 5.5
parent 3440188c0f
commit e3ba51b8e5
3 changed files with 37 additions and 7 deletions
+37 -2
View File
@@ -29,6 +29,7 @@
'next' => 'Neste',
'back' => 'Tilbake',
'send' => 'Bekreft endring',
'sending' => 'Sender...',
'no_times' => 'Ingen ledige tider denne dagen!',
'no_workers' => 'Ingen medarbeidere utfører alle de valgte tjenestene.',
'expired_msg' => 'Denne bestillingen er allerede passert og kan ikke endres.',
@@ -53,6 +54,7 @@
'next' => 'Tovább',
'back' => 'Vissza',
'send' => 'Módosítás megerősítése',
'sending' => 'Küldés...',
'no_times' => 'Ezen a napon nincs szabad időpont!',
'no_workers' => 'Egyik kolléga sem végzi el az összes kiválasztott szolgáltatást.',
'expired_msg' => 'Ez a foglalás már elmúlt, nem módosítható.',
@@ -77,6 +79,7 @@
'next' => 'Next',
'back' => 'Back',
'send' => 'Confirm changes',
'sending' => 'Sending...',
'no_times' => 'There is no available time on this day!',
'no_workers' => 'No staff member performs all of the selected services.',
'expired_msg' => 'This booking has already passed and cannot be modified.',
@@ -245,8 +248,7 @@
<!-- Cancel -->
<div class="manage-cancel-bar">
<form method="post" action="<?php echo SITEURL; ?>manage-booking-cancel"
onsubmit="return confirm('<?php echo addslashes($l['cancel_confirm']); ?>');">
<form method="post" action="<?php echo SITEURL; ?>manage-booking-cancel" id="manageCancelForm">
<input type="hidden" name="token" value="<?php echo htmlspecialchars($token); ?>">
<input type="hidden" name="lang" value="<?php echo htmlspecialchars($lang); ?>">
<input type="hidden" name="subpage" value="<?php echo htmlspecialchars($subpage); ?>">
@@ -450,8 +452,41 @@
<script>
var noTimesMsg = '<?php echo addslashes($l['no_times']); ?>';
var noWorkersMsg = '<?php echo addslashes($l['no_workers']); ?>';
var cancelConfirmMsg = '<?php echo addslashes($l['cancel_confirm']); ?>';
var sendingLabel = '<?php echo addslashes($l['sending']); ?>';
$(document).ready(function(){
// Prevent double submission (same guard as the public booking form).
// Both POSTs stay open for several seconds (Google Calendar + e-mails),
// so repeated taps used to send the request again and again.
var manageSubmitInProgress = false;
$('#manageForm').on('submit', function(e){
if(manageSubmitInProgress){
e.preventDefault();
return false;
}
manageSubmitInProgress = true;
$('#sendManageBtn').prop('disabled', true).val(sendingLabel);
});
var cancelSubmitInProgress = false;
$('#manageCancelForm').on('submit', function(e){
if(cancelSubmitInProgress || !confirm(cancelConfirmMsg)){
e.preventDefault();
return false;
}
cancelSubmitInProgress = true;
$(this).find('button[type=submit]').prop('disabled', true).text(sendingLabel);
});
// Back button can restore this page from the browser cache with the
// buttons still locked - reload so the guest gets a fresh, usable form.
$(window).on('pageshow', function(e){
if(e.originalEvent && e.originalEvent.persisted){
window.location.reload();
}
});
recalcServices();
$('#totalPanelBtn').click(function(){