feat: tables and orders in the manager on v2 (platform-v2 step 6.9)
- manager: new pages/orders/ (Tables page cards + quick actions, order page with
lines, multi-select pay/discount/cancel/tab, staff + customer, price changes,
history, the menu + cart beside it); a free table opens a new order on first
Send; v1 TablesPage, OrderDetailPage, DesktopOrderingTab, ManagerOrderDrawer
and PaymentMethodModal removed
- ordering by line id like the phones: GET /api/orders/menu (the counter's
product shape, in-store prices); the product dialog, cart rules and quote hook
move to packages/ordering (@xenia/ordering), shared by counter, menu tablet,
manager
- close follows orders.close_with_unpaid (pay first, or write off after saying
so) on the order page and the overview's quick view; paying asks cash or card
- a confirmed booking can keep its table ahead (manager, phones, counter):
POST /api/connect/bookings/{id}/table, reservations create/PATCH; refused with
reservation.table_kept within 2 h of another booking
- tests: test_manager_ordering.py, online bookings +2, manager orders.test.mjs,
@xenia/ordering, e2e manager.mjs (take, change, pay-first close, RESERVED)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,6 +102,25 @@ def cancel(db, r, status: str, reason: str | None) -> None:
|
||||
logger.info("Reservation %s cancelled after its food was fired (order %s)", r.id, r.order_id)
|
||||
|
||||
|
||||
def keep_table(db, r, table_id: int | None) -> None:
|
||||
"""A booking's table ahead (plan step 6.9) or none. Refused when the table is kept for another
|
||||
booking within two hours of this one (reservation.table_kept)."""
|
||||
from datetime import timedelta
|
||||
from core.timeutil import venue_strftime
|
||||
from models.reservation import Reservation
|
||||
from models.table import Table
|
||||
if table_id is not None:
|
||||
if db.query(Table).filter(Table.id == table_id, Table.is_active.is_(True)).first() is None:
|
||||
raise XeniaError("reservation.table_unknown", table_id=table_id)
|
||||
clash = (db.query(Reservation).filter(Reservation.id != r.id, Reservation.table_id == table_id,
|
||||
Reservation.status.in_(("pending", "requested")),
|
||||
Reservation.reserved_for > r.reserved_for - timedelta(hours=2),
|
||||
Reservation.reserved_for < r.reserved_for + timedelta(hours=2)).first())
|
||||
if clash is not None:
|
||||
raise XeniaError("reservation.table_kept", name=clash.guest_name, time=venue_strftime(clash.reserved_for, "%H:%M"))
|
||||
r.table_id = table_id
|
||||
|
||||
|
||||
def table_busy(db, table_id: int, order_id: int | None = None) -> bool:
|
||||
from models.order import Order
|
||||
q = db.query(Order).filter(Order.table_id == table_id, Order.status.in_(("open", "partially_paid")))
|
||||
|
||||
Reference in New Issue
Block a user