From 1c237cc97b65ed5a64b62affff2919c9193e70d0 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 10 May 2026 11:53:22 +0100 Subject: [PATCH] fix: merge lunch-blocked slots into single unavailable group - generateGroupedTimeSlots now accepts lunchProtection map parameter - Lunch-blocked slots treated as unavailable during grouping, not after - Consecutive lunch-blocked slots merge into one unavailable button - Admin BookingCreateModal already had this fix; BookingFlow now matches --- frontend/src/lib/components/booking/BookingFlow.svelte | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/booking/BookingFlow.svelte b/frontend/src/lib/components/booking/BookingFlow.svelte index 4743e77..e40d367 100644 --- a/frontend/src/lib/components/booking/BookingFlow.svelte +++ b/frontend/src/lib/components/booking/BookingFlow.svelte @@ -499,7 +499,8 @@ function generateGroupedTimeSlots( duration: number, - date: CalendarDate | undefined + date: CalendarDate | undefined, + lunchProtection: Map = new Map() ): Array<{ type: 'available' | 'unavailable'; startTime: string; @@ -549,7 +550,7 @@ const minute = minutes % 60; const timeStr = `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`; - const isAvailable = availableSlots.includes(timeStr); + const isAvailable = availableSlots.includes(timeStr) && !lunchProtection.get(timeStr)?.isBlocked; if (isAvailable) { if (currentUnavailableStart !== null) { @@ -749,7 +750,7 @@ const formattedTotalDuration = $derived(formatDuration(getTotalDuration())); const groupedTimeSlots = $derived( currentStep === 2 && selectedServices.length > 0 && selectedDate - ? generateGroupedTimeSlots(getTotalDuration(), selectedDate) + ? generateGroupedTimeSlots(getTotalDuration(), selectedDate, lunchProtectionStatus()) : [] ); const formattedSelectedDate = $derived(