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:
2026-11-18 21:58:46 +02:00
co-authored by Claude Opus 5.5
parent f4aae6abbc
commit 070c9cf625
56 changed files with 2339 additions and 3846 deletions
@@ -200,3 +200,42 @@ def test_reservation_settings(client, owner_h):
assert r.json()["reservations"]["hours"] == {"4": [["19:00", "23:30"]]} and r.json()["reservations"]["fire_minutes"] == 25
body["reservations"]["party_max"] = 0
assert client.put("/api/connect/fees/ordering", headers=owner_h, json=body).status_code == 422
def test_a_confirmed_booking_keeps_its_table_ahead(client, db, counter, menu, cloud, owner_h):
"""Plan step 6.9 (from 4.8): a confirmed booking can be given a table ahead, so the table shows
RESERVED and the pickers see it; one table isn't kept for two bookings close together."""
from models.table import Table
t5 = Table(number=5, seat_count=4)
db.add(t5)
db.commit()
rid, _ = book(db, menu, cloud_id=711, food=False, minutes=90)
assert err(client.post(f"/api/connect/bookings/{rid}/table", headers=counter["h"], json={"table_id": t5.id})) == "reservation.status_changed"
client.post(f"/api/connect/bookings/{rid}/confirm", headers=counter["h"])
kept = client.post(f"/api/connect/bookings/{rid}/table", headers=counter["h"], json={"table_id": t5.id})
assert kept.status_code == 200 and kept.json()["table_label"] == "T5"
table = next(t for t in client.get("/api/tables/", headers=owner_h).json() if t["id"] == t5.id)
assert table["upcoming_reservation"]["guest_name"] == "Eleni" # RESERVED
live = next(t for t in client.get("/api/floor-plans/live", headers=owner_h).json()["tables"] if t["id"] == t5.id)
assert live["state"] == "reserved"
rid2, _ = book(db, menu, cloud_id=712, food=False, minutes=150)
client.post(f"/api/connect/bookings/{rid2}/confirm", headers=counter["h"])
assert err(client.post(f"/api/connect/bookings/{rid2}/table", headers=counter["h"], json={"table_id": t5.id})) == "reservation.table_kept"
assert client.post(f"/api/connect/bookings/{rid}/table", headers=counter["h"], json={"table_id": None}).json()["table_id"] is None
assert client.post(f"/api/connect/bookings/{rid2}/table", headers=counter["h"], json={"table_id": t5.id}).status_code == 200
def test_the_managers_booking_dialog_keeps_and_frees_a_table(client, db, owner_h):
from core.timeutil import utcnow
from datetime import timedelta
from models.table import Table
t7 = Table(number=7)
db.add(t7)
db.commit()
when = (utcnow() + timedelta(hours=1)).isoformat()
a = client.post("/api/reservations/", headers=owner_h, json={"guest_name": "Nikos", "party_size": 2, "reserved_for": when, "table_id": t7.id})
assert a.status_code == 201, a.text
b = client.post("/api/reservations/", headers=owner_h, json={"guest_name": "Maria", "party_size": 2, "reserved_for": when, "table_id": t7.id})
assert err(b) == "reservation.table_kept"
freed = client.patch(f"/api/reservations/{a.json()['id']}", headers=owner_h, json={"table_id": None})
assert freed.status_code == 200 and freed.json()["table_id"] is None