feat: right-click context menu for room status + bed type capacity

- Add RoomContextMenu component (portal, Escape/click-outside to close)
  - Change room status: available / maintenance / blocked
  - Change housekeeping status: clean / dirty / cleaning / inspect
  - Open room edit (optional)
- Calendar: right-click on room label → context menu; onRoomUpdate prop
  wired to CalendarPage (calls api.rooms.update); show 🔧/🔒 badge on label
- Rooms page: right-click on any room card → same context menu;
  show orange "ремонт" badge on maintenance rooms
- BedTypesContext: add capacity field (max guests per bed type)
- BedTypes reference UI: add capacity input to add/edit form; show "N чел."

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 14:30:14 +03:00
parent 8c6cdfb1c7
commit fd50e02be0
6 changed files with 252 additions and 33 deletions

View File

@@ -140,6 +140,15 @@ export function CalendarPage() {
send({ type: 'unlock', roomId })
}, [send])
const handleRoomUpdate = useCallback(async (roomId: string, patch: Partial<Room>) => {
try {
const updated = await api.rooms.update(slug, roomId, patch)
setRooms(prev => prev.map(r => r.id === updated.id ? updated : r))
} catch (err) {
console.error('Failed to update room:', err)
}
}, [slug])
const handleRentalBookingCreate = useCallback(async (b: RentalBooking) => {
try {
const created = await api.rental.createBooking(slug, {
@@ -174,6 +183,7 @@ export function CalendarPage() {
onBookingCreate={handleCreate}
onBookingUpdate={handleUpdate}
onBookingBulkUpdate={handleBulkUpdate}
onRoomUpdate={handleRoomUpdate}
fadingBookingIds={fadingBookings}
rentalObjects={isRentalActive ? rentalObjects as unknown as import('../data/rentalData').RentalObject[] : undefined}
rentalBookings={isRentalActive ? rentalBookings as unknown as RentalBooking[] : undefined}