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:
co-authored by
Claude Opus 5.5
parent
3440188c0f
commit
e3ba51b8e5
@@ -11,9 +11,6 @@
|
||||
# Job ad renamed: ledigestilling.html -> negletekniker.html (2026-07-17)
|
||||
RewriteRule ^ledigestilling/ledigestilling\.html$ /ledigestilling/negletekniker.html [R=301,L]
|
||||
|
||||
# Barber vacancy hidden (2026-10-06): file kept, direct visits go to the listing. 302 so it can be re-opened.
|
||||
RewriteRule ^ledigestilling/barber\.html$ /ledigestilling/ [R=302,L]
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
|
||||
|
||||
@@ -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(){
|
||||
|
||||
@@ -94,14 +94,12 @@
|
||||
|
||||
<div class="positions">
|
||||
|
||||
<!-- Barber position hidden 2026-10-06 (not needed for now). Uncomment to re-open, and remove the barber.html redirect in /.htaccess.
|
||||
<div class="position-card card-barber">
|
||||
<span class="badge">BARBER</span>
|
||||
<h3>Barber</h3>
|
||||
<p>Er du en dyktig barber? Ansettelse, stolleie eller provisjonsbasert samarbeid.</p>
|
||||
<a href="barber.html" class="lesmer">Les mer</a>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="position-card card-beauty">
|
||||
<span class="badge">BEAUTY</span>
|
||||
|
||||
Reference in New Issue
Block a user