Masalar (/masalar)

Live floor: open tables, take orders, merge/move tables, seat reservations, and close checks. This is the default landing page for every role after login. Internal tab id: orders.

Who can open it

Garson, barkasa, patron.

Garson’s only nav tab is Masalar. Barkasa/patron still do most operational work here via dialogs.

Purpose

  • Show table status across areas (free / occupied / reserved overlays)
  • Open or continue an order on a table
  • Add products (subject to availability and pricing/sale windows)
  • Approve orders (barkasa/patron — order.approve)
  • Take payments (cash, card, meal voucher-style paths, discounts, service, rounding, charge to müdavim account)
  • Flag lines as ikram / iptal / zayi where permitted
  • Merge / unmerge / move tables and move items between orders
  • Auto-activate due reservations onto tables
  • Respect business day open/closed state

Key files

Area Paths
Host tab src/features/pos/AdminPage.tsx
Grid src/components/pos/MasaGrid.tsx (+ helpers, card, drag/drop pieces)
Order UI OrderDetailDialog.tsx, AddItemDialog.tsx
Reservations on floor ReservationPreviewDialog.tsx, auto-activate hooks
Day gate BusinessDayGate.tsx, EndOfDayButton.tsx
Orders lib src/lib/orders/*, src/lib/*.functions.ts order helpers
Queries useActiveOrdersQuery, table groups, settings, availability

Data & APIs

Call Role
GET /api/orders/active/… Live open orders (polled ~10s when day open)
GET|POST|DELETE /api/table-groups/ Visual/logical table grouping
POST /api/orders/submit/ New / additional items
POST /api/orders/:id/patch/ Status, payments, line flags, rounds
POST /api/orders/move-table/, /orders/move-items/ Move flows
POST /api/orders/:id/charge-account/ Charge müdavim
Day closures / restaurant settings Gate mutations when day closed
Product availability Hide/disable unavailable items in add-item
Reservations activate Seat prep → live table
Push notify Alert other clients of new order activity

State

  • React Query: active orders, table groups, settings, availability (poll)
  • Large local UI state in AdminPage (selected table, dialogs, merge mode, live indicator)
  • Chime + “Canlı” behavior after notification permission when new activity arrives

UX details

  • Drag-and-drop merge/move on the grid; dedicated merge edit mode
  • Closed business day dims the grid and shows a gate overlay; most table mutations blocked
  • Reservation overlays and wake timers on cards
  • Header day controls: garson generally cannot start/close day from here (patron/barkasa day tools live mainly under Raporlar)
  • Permissions gate approve vs add vs pay vs merge (hasPermission)

Development notes

  • Prefer new floor UI in components/pos/ and thin query hooks; avoid dumping more logic into AdminPage
  • When adding a mutation, write an operation log where other POS actions do (/operation-logs/)
  • Keep poll intervals aligned with FETCH_INTERVAL_MS unless you have a reason not to
  • Test drag/merge helpers with existing Vitest coverage patterns under MasaGrid tests