fix: checkout form defaults to planned checkOut date, not today

Previously earlyOutDate defaulted to today, which caused bookings checked
out on their first day (checkIn == today) to become 0-night invisible blocks
in the calendar. Now defaults to the planned checkOut date so the bar stays
visible; manager explicitly sets an earlier date for early departure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 19:39:24 +03:00
parent c0a086a7b8
commit 5cab0ce8da

View File

@@ -141,6 +141,9 @@ export function BookingDetailPanel({ booking, room, rooms, allBookings, slug, on
setShowGuestForm(false)
setEditingBg(null)
setBgForm({})
setEarlyOutOpen(false)
setEarlyOutDate(booking.checkOut.slice(0, 10))
setEarlyOpen(false)
}, [booking.id])
// Debounced guest autocomplete
@@ -288,7 +291,7 @@ export function BookingDetailPanel({ booking, room, rooms, allBookings, slug, on
const [earlySaving, setEarlySaving] = useState(false)
const [earlyOutOpen, setEarlyOutOpen] = useState(false)
const [earlyOutDate, setEarlyOutDate] = useState(today)
const [earlyOutDate, setEarlyOutDate] = useState(checkOutDate)
const [earlyOutMethod, setEarlyOutMethod] = useState<'cash' | 'card' | 'transfer'>('cash')
const [earlyOutSaving, setEarlyOutSaving] = useState(false)
@@ -1353,7 +1356,7 @@ export function BookingDetailPanel({ booking, room, rooms, allBookings, slug, on
}])
}
setEarlyOutOpen(true)
setEarlyOutDate(today)
setEarlyOutDate(checkOutDate)
}}
className="w-full btn-primary justify-center bg-emerald-600 hover:bg-emerald-700"
>