feat(backend,terminal): tables at the counter, shared live with the waiter phones (platform-v2 3.3c)
- POS: GET /api/pos/tables (the cashier's zones as in the waiter app, each open order's
totals, people, ready items, flags, reservation), POST /api/pos/tables/{id}/items (into
the table's order or a new one via orders.open_order + add_items), POST
/api/pos/orders/{id}/pay (chosen items, cash/card/split, drawer on cash), POST
/api/pos/orders/{id}/close (only when nothing is unpaid). Quote takes order_id so the
order's items count for cart conditions (shared pos_cart.order_cart, used by add_items).
- New codes pos.table_not_found, pos.table_not_yours, pos.items_changed, pos.order_unpaid.
- Fix: item cancels (DELETE item, cancel-items) now broadcast order_updated, so phones and
kitchen screens see them at once.
- Terminal: Sale | Tables switch, zone list, table cards by zone, TablePanel (order lines,
new lines, send, pay selected/all, cancel with approval, close), generic PaymentDialog.
- Tests: test_pos_tables.py (8), terminal unit, terminal.mjs +17 with a live phone socket.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -197,6 +197,21 @@ def price_lines(db, lines: list[Line], order_type: str, existing_cart: list | No
|
||||
return out
|
||||
|
||||
|
||||
def order_cart(order) -> list[dict]:
|
||||
"""An order's active items as the pricing engine's cart context (what POST
|
||||
/api/orders/{id}/items starts from, and what a table's quote starts from, 3.3c)."""
|
||||
return [
|
||||
{
|
||||
"product_id": i.product_id,
|
||||
"category_id": i.product.primary_category_id if i.product else None,
|
||||
"category_ids": i.product.category_ids if i.product else [],
|
||||
"quantity": i.quantity,
|
||||
"unit_price": i.unit_price,
|
||||
}
|
||||
for i in order.items if i.status == "active"
|
||||
]
|
||||
|
||||
|
||||
def discount_adjustment(unit_price: float, pct) -> float:
|
||||
"""A line's discount (percent of its unit price) as the order item's price_adjustment
|
||||
(negative, rounded to cents)."""
|
||||
|
||||
Reference in New Issue
Block a user