fix: rental booking buffer applied to end times + phone mask

- getMaxEndHour now subtracts breakHours from next booking's start,
  so you can't book right up to a slot that needs buffer time before it
- effectiveStartHour moved before availableEndHours so equal start/end
  times are no longer possible
- maskPhone (+7 (XXX) XXX-XX-XX) applied to phone field in RentalBookingModal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 22:16:12 +03:00
parent 31858ca5cc
commit 3961585196
2 changed files with 15 additions and 6 deletions

View File

@@ -108,7 +108,7 @@ export function BookingModal({ open, draft, rooms, bookings = [], onClose, onSav
const rentalGetMaxEnd = (start: number) => {
const next = rentalDayBookings.filter(b => !b.isFullDay && b.startHour >= start + 1)
.sort((a, b) => a.startHour - b.startHour)[0]
return next ? next.startHour : (rentalObj?.closeHour ?? 22)
return next ? next.startHour - rentalBreakH : (rentalObj?.closeHour ?? 22)
}
const rentalEffStart = rentalAvailStarts.includes(rentalStartH) ? rentalStartH : (rentalAvailStarts[0] ?? rentalObj?.openHour ?? 8)
const rentalAvailEnds = rentalHourOptions(rentalEffStart + 1, rentalGetMaxEnd(rentalEffStart))