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