Fix: drag ghost visual, check-in date auto-fill, backend room_id patch

- BookingCalendar: replace tiny ghost badge with full-size booking block
  (same color, correct width based on nights × cell width, centered on cursor)
- BookingModal: auto-set check-out to check-in+1 day when check-in changes
- Backend PATCH /bookings/🆔 add room_id to allowed fields so drag-to-move saves correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 00:56:49 +03:00
parent 97b2ca1f91
commit 80e3b21827
3 changed files with 29 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
import { useState } from 'react'
import { format } from 'date-fns'
import { format, addDays } from 'date-fns'
import { Star, Banknote, CreditCard, AlertCircle, Map, Plus, Trash2, Tag, Minus, BedDouble, Tv2, Send, Loader2, CheckCircle2 } from 'lucide-react'
import { MOCK_DISCOUNTS } from '../../pages/DiscountsPage'
import type { Discount } from '../../pages/DiscountsPage'
@@ -298,7 +298,13 @@ export function BookingModal({ open, draft, rooms, bookings = [], onClose, onSav
<input
type="date" className="input"
value={form.checkIn}
onChange={e => set('checkIn', e.target.value)}
onChange={e => {
const newCheckIn = e.target.value
set('checkIn', newCheckIn)
if (newCheckIn && (!form.checkOut || form.checkOut <= newCheckIn)) {
set('checkOut', format(addDays(new Date(newCheckIn), 1), 'yyyy-MM-dd'))
}
}}
/>
</div>
<div>