feat(terminal): counter POS screen with server-priced cart and shift gate (platform-v2 3.3a)
- Backend /api/pos (pos_counter): session (business day, the cashier's own shift, self-start, who can open the day), menu (sellable products with every kind of choice, no costs; price now from the pricing engine), quote (lines by id → the waiter's selected_options entries with DB prices → resolve_price as orders do; pos.line_invalid). - POS device settings: default order type, start category, receipt printer (new ref sources categories / printers, also in the manager's Devices dialogs). - Terminal apps/pos: shift gate (start shift with drawer cash), categories, search, product grid, price check, options dialog, cart priced by the backend. - Tests: backend test_pos (13), terminal pos.test.mjs, manager refOptions, terminal.mjs +10 POS checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,7 @@ CODES: dict[str, tuple[int, str]] = {
|
||||
"auth.support_not_configured": (503, "Support access isn't set up on this site."),
|
||||
"auth.support_code_invalid": (401, "That support code is wrong or has expired. Ask for a new challenge."),
|
||||
"auth.support_rate_limited": (429, "Too many support challenges. Wait a few minutes and try again."),
|
||||
"pos.line_invalid": (422, "Cart line {line} can't be sold as chosen ({reason})."),
|
||||
"kds.item_not_found": (404, "Item {item_id} not found on this order."),
|
||||
"kds.item_claimed": (409, "{name} is already on this item."),
|
||||
"kds.claim_needs_staff": (403, "Only a staff member can claim an item."),
|
||||
|
||||
@@ -14,7 +14,8 @@ Agent notes:
|
||||
field needs its label in packages/i18n/locales/{en,el}/modules.json
|
||||
(`<app>.config.<key>.label`, plus `.choices.<value>` per choice); test_module_texts fails
|
||||
otherwise. The manager renders the fields generically (DeviceConfigFields.jsx).
|
||||
- `ref` sources: "prep_zones" (PrepZone ids), "devices:<app_key>" (live devices of that app).
|
||||
- `ref` sources: "prep_zones" (PrepZone ids), "categories" (Category ids), "printers" (active
|
||||
Printer ids), "devices:<app_key>" (live devices of that app).
|
||||
- `color` = "#rrggbb" (lower-cased when stored). `after="<key>"` (int fields): the value must be
|
||||
greater than that field's (stored or default) value, e.g. KDS age thresholds; a stored
|
||||
config that breaks the order reads back as the defaults of every ordered field (3.2a).
|
||||
@@ -44,6 +45,13 @@ def _ref_exists(source: str, value: int, db) -> bool:
|
||||
if source == "prep_zones":
|
||||
from models.prep_zone import PrepZone
|
||||
return db.get(PrepZone, value) is not None
|
||||
if source == "categories":
|
||||
from models.product import Category
|
||||
return db.get(Category, value) is not None
|
||||
if source == "printers":
|
||||
from models.printer import Printer
|
||||
p = db.get(Printer, value)
|
||||
return p is not None and bool(p.is_active)
|
||||
if source.startswith("devices:"):
|
||||
from models.device import Device
|
||||
d = db.get(Device, value)
|
||||
|
||||
@@ -70,7 +70,7 @@ class ConfigField:
|
||||
choices: tuple = () # enum, or int limited to these values
|
||||
min: Optional[int] = None # int
|
||||
max: Optional[int] = None # int
|
||||
choices_from: Optional[str] = None # ref: "prep_zones" | "devices:<app_key>"; value = id or None
|
||||
choices_from: Optional[str] = None # ref: "prep_zones" | "categories" | "printers" | "devices:<app_key>"; value = id or None
|
||||
group: Optional[str] = None # section in the manager's dialogs (3.2a)
|
||||
after: Optional[str] = None # int: must be greater than this other field (age thresholds)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user