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:
@@ -47,15 +47,21 @@ def create_reservation(
|
||||
email=body.email,
|
||||
note=body.note,
|
||||
reserved_for=body.reserved_for,
|
||||
table_id=body.table_id,
|
||||
source=body.source,
|
||||
online_customer_id=body.online_customer_id,
|
||||
created_by_user_id=user.id,
|
||||
status="pending",
|
||||
)
|
||||
if body.table_id:
|
||||
from services.online_reservations import keep_table
|
||||
keep_table(db, r, body.table_id) # not kept for another booking close by (6.9)
|
||||
db.add(r)
|
||||
db.commit()
|
||||
db.refresh(r)
|
||||
from services.ws_bus import broadcast_sync
|
||||
broadcast_sync("reservation_updated", {"reservation_id": r.id, "status": r.status, "table_id": r.table_id})
|
||||
if r.table_id:
|
||||
broadcast_sync("table_list_changed", {})
|
||||
return _enrich(r)
|
||||
|
||||
|
||||
@@ -123,10 +129,11 @@ def update_reservation(
|
||||
raise XeniaError("reservation.not_found", reservation_id=reservation_id)
|
||||
|
||||
updates = body.model_dump(exclude_none=True)
|
||||
|
||||
if "table_id" in updates and updates["table_id"] is not None:
|
||||
if not db.query(Table).filter(Table.id == updates["table_id"], Table.is_active == True).first():
|
||||
raise XeniaError("table.not_found", status=400)
|
||||
# the table: set, changed or taken back (null) — kept for one booking at a time (6.9)
|
||||
if "table_id" in body.model_fields_set:
|
||||
from services.online_reservations import keep_table
|
||||
keep_table(db, r, body.table_id)
|
||||
updates.pop("table_id", None)
|
||||
|
||||
if "status" in updates and updates["status"] not in VALID_STATUSES:
|
||||
raise XeniaError("validation.choice", field='status', value=updates['status'])
|
||||
@@ -137,6 +144,9 @@ def update_reservation(
|
||||
r.updated_at = utcnow()
|
||||
db.commit()
|
||||
db.refresh(r)
|
||||
from services.ws_bus import broadcast_sync
|
||||
broadcast_sync("reservation_updated", {"reservation_id": r.id, "status": r.status, "table_id": r.table_id})
|
||||
broadcast_sync("table_list_changed", {})
|
||||
return _enrich(r)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user