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
This commit is contained in:
2026-05-10 11:53:22 +01:00
parent 41666b0739
commit 1c237cc97b
@@ -499,7 +499,8 @@
function generateGroupedTimeSlots(
duration: number,
date: CalendarDate | undefined
date: CalendarDate | undefined,
lunchProtection: Map<string, { isBlocked: boolean; showWarning: boolean; warningMessage?: string }> = 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(