Fix takeaway/pickup toggle not saving in Firefox

Wire onchange listener via JS instead of inline attribute,
matching the hiring toggle pattern. The zero-sized hidden
checkbox wasn't firing inline onchange reliably.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-10 18:07:54 -07:00
parent dfe2313ec5
commit 87eb5fa1f0
2 changed files with 5 additions and 2 deletions

View file

@ -705,7 +705,7 @@
</div> </div>
<div style="display: flex; align-items: center; gap: 12px;"> <div style="display: flex; align-items: center; gap: 12px;">
<label class="toggle"> <label class="toggle">
<input type="checkbox" id="orderTypeTakeaway" onchange="Portal.saveOrderTypes()"> <input type="checkbox" id="orderTypeTakeaway">
<span class="toggle-slider"></span> <span class="toggle-slider"></span>
</label> </label>
<span>Takeaway / Pickup</span> <span>Takeaway / Pickup</span>

View file

@ -868,7 +868,10 @@ const Portal = {
// Order types // Order types
const orderTypes = (biz.ORDERTYPES || biz.OrderTypes || '1').split(','); const orderTypes = (biz.ORDERTYPES || biz.OrderTypes || '1').split(',');
const takeawayCheckbox = document.getElementById('orderTypeTakeaway'); const takeawayCheckbox = document.getElementById('orderTypeTakeaway');
if (takeawayCheckbox) takeawayCheckbox.checked = orderTypes.includes('2'); if (takeawayCheckbox) {
takeawayCheckbox.checked = orderTypes.includes('2');
takeawayCheckbox.onchange = () => this.saveOrderTypes();
}
} }
} catch (err) { } catch (err) {
console.error('[Portal] Error loading business info:', err); console.error('[Portal] Error loading business info:', err);