feat(waiter): close with unpaid items as a setting, combine lines, seats (platform-v2 step 4.8a)
The owner's choices for 4.8 (2026-11-18), all configurable:
- Setting orders.close_with_unpaid (default off): when off, the server refuses to close
an order with unpaid items (pos.order_unpaid) and the phone's CLOSE takes the payment
first ("instant-pay close"); when on, CLOSE confirms and the items stay unpaid. Manager
Settings → Operation, next to "auto-close after full payment" (unchanged).
- POST /api/orders/{id}/items/combine: unpaid lines of the same item (choices, note,
price, course, kitchen state; no discount / deal / tab) become one line; the phone
offers "Combine into one line" for selected lines or a grouped line. The grouping
views (identical / same item) stay as they were.
- Seats: the table's seats next to its name on the cards (waiter Settings → Layout, on by
default) and in the guests dialog, where more guests than seats only shows a hint.
- The table screen's last English-only labels (ADD, PAY, CLOSE, ACTIONS, SERVED, CLEAR,
ALL) are keys too.
- Tests: test_close_and_combine.py (5), waiter e2e +5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,7 @@ CODES: dict[str, tuple[int, str]] = {
|
|||||||
"pos.table_not_yours": (403, "{table} isn't in your zones. A manager can add the zone to your account."),
|
"pos.table_not_yours": (403, "{table} isn't in your zones. A manager can add the zone to your account."),
|
||||||
"pos.items_changed": (409, "Some of these items were paid or cancelled in the meantime. Check the order and try again."),
|
"pos.items_changed": (409, "Some of these items were paid or cancelled in the meantime. Check the order and try again."),
|
||||||
"pos.order_unpaid": (409, "Items still unpaid: {count}. Take the payment or cancel them first."),
|
"pos.order_unpaid": (409, "Items still unpaid: {count}. Take the payment or cancel them first."),
|
||||||
|
"order.items_not_combinable": (422, "These lines can't be combined: only unpaid lines of the same item, with the same choices, note, price and kitchen state, and no discount, deal or tab."),
|
||||||
"order.not_sold_here": (422, "{name} isn't sold for this kind of order."),
|
"order.not_sold_here": (422, "{name} isn't sold for this kind of order."),
|
||||||
"order.lines_required": (422, "This app sent the order in an old format. Update the app and send it again."),
|
"order.lines_required": (422, "This app sent the order in an old format. Update the app and send it again."),
|
||||||
"order.line.product_unavailable": (422, "{name} isn't available any more (line {line})."),
|
"order.line.product_unavailable": (422, "{name} isn't available any more (line {line})."),
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ MODULE = Module(
|
|||||||
SettingDef('business_day.force_close_allowed', 'true', 'Allow force-closing business day with open tables', type='bool'),
|
SettingDef('business_day.force_close_allowed', 'true', 'Allow force-closing business day with open tables', type='bool'),
|
||||||
SettingDef('business_day.rollover_hour', '6', 'Hour (0-23, venue time) before which a newly opened business day counts as the previous date. Default 6.', type='int'),
|
SettingDef('business_day.rollover_hour', '6', 'Hour (0-23, venue time) before which a newly opened business day counts as the previous date. Default 6.', type='int'),
|
||||||
SettingDef('orders.auto_close_on_full_payment', 'false', "Automatically close the table order when all items have been paid: 'true' | 'false'", type='bool'),
|
SettingDef('orders.auto_close_on_full_payment', 'false', "Automatically close the table order when all items have been paid: 'true' | 'false'", type='bool'),
|
||||||
|
SettingDef('orders.close_with_unpaid', 'false', "Allow closing an order that still has unpaid items (they are written off as unpaid): 'true' | 'false'. When 'false', closing asks for the payment first (plan step 4.8).", type='bool'),
|
||||||
SettingDef('orders.bypass_kds_serve', 'false', "Skip KDS pending/serve flow — new orders and items are immediately marked as served: 'true' | 'false'", type='bool'),
|
SettingDef('orders.bypass_kds_serve', 'false', "Skip KDS pending/serve flow — new orders and items are immediately marked as served: 'true' | 'false'", type='bool'),
|
||||||
SettingDef('orders.courses', '[]', 'JSON array of course objects [{id, name, color}] defining available courses', type='json'),
|
SettingDef('orders.courses', '[]', 'JSON array of course objects [{id, name, color}] defining available courses', type='json'),
|
||||||
SettingDef('orders.courses_enabled', 'false', "Enable per-item course assignment when ordering: 'true' | 'false'", type='bool'),
|
SettingDef('orders.courses_enabled', 'false', "Enable per-item course assignment when ordering: 'true' | 'false'", type='bool'),
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class MoveItemsRequest(BaseModel):
|
|||||||
item_ids: List[int]
|
item_ids: List[int]
|
||||||
target_order_id: int
|
target_order_id: int
|
||||||
|
|
||||||
|
class CombineItemsRequest(BaseModel):
|
||||||
|
item_ids: List[int] = Field(min_length=2, max_length=200)
|
||||||
|
|
||||||
class RevertPaymentRequest(BaseModel):
|
class RevertPaymentRequest(BaseModel):
|
||||||
item_ids: List[int]
|
item_ids: List[int]
|
||||||
|
|
||||||
@@ -1095,6 +1098,12 @@ def close_order(order_id: int, request: Request, db: Session = Depends(get_db),
|
|||||||
OrderItem.order_id == order_id,
|
OrderItem.order_id == order_id,
|
||||||
OrderItem.status == "active",
|
OrderItem.status == "active",
|
||||||
).all()
|
).all()
|
||||||
|
# 4.8: the venue decides whether an order may be closed with unpaid items (written off);
|
||||||
|
# when not, the apps take the payment first ("instant-pay close")
|
||||||
|
if active_items:
|
||||||
|
row = db.query(PosSettings).filter(PosSettings.key == "orders.close_with_unpaid").first()
|
||||||
|
if not (row and row.value == "true"):
|
||||||
|
raise XeniaError("pos.order_unpaid", count=len(active_items))
|
||||||
closed_item_ids = []
|
closed_item_ids = []
|
||||||
for item in active_items:
|
for item in active_items:
|
||||||
item.status = "closed"
|
item.status = "closed"
|
||||||
@@ -2064,3 +2073,66 @@ def put_item_on_tab(
|
|||||||
db.commit()
|
db.commit()
|
||||||
broadcast_sync("order_updated", {"order_id": order.id, "table_id": order.table_id, "status": order.status, "action": "item_tabbed"})
|
broadcast_sync("order_updated", {"order_id": order.id, "table_id": order.table_id, "status": order.status, "action": "item_tabbed"})
|
||||||
return {"status": "tabbed", "tab_id": tab.id, "entry_amount": entry.amount}
|
return {"status": "tabbed", "tab_id": tab.id, "entry_amount": entry.amount}
|
||||||
|
|
||||||
|
|
||||||
|
# ── Combine selected items (plan step 4.8) ────────────────────────────────────
|
||||||
|
|
||||||
|
def _combine_key(i: OrderItem):
|
||||||
|
"""What must be the same for two lines to become one: the product, every choice, the note,
|
||||||
|
the price, the course, the kitchen state, and nothing attached to the line on its own."""
|
||||||
|
import json as _json
|
||||||
|
|
||||||
|
def norm(raw):
|
||||||
|
try:
|
||||||
|
return _json.dumps(_json.loads(raw), sort_keys=True) if raw else "[]"
|
||||||
|
except ValueError:
|
||||||
|
return raw
|
||||||
|
return (i.product_id, norm(i.selected_options), norm(i.removed_ingredients), (i.notes or "").strip(),
|
||||||
|
round(i.unit_price or 0.0, 4), round(i.price_adjustment or 0.0, 4), i.course_id, i.kds_status or "pending")
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/{order_id}/items/combine")
|
||||||
|
def combine_items(order_id: int, body: CombineItemsRequest, request: Request, db: Session = Depends(get_db),
|
||||||
|
user: User = Depends(get_current_user)):
|
||||||
|
"""Combine unpaid lines of the same item into one (2 + 2 + 2 beers ordered at different
|
||||||
|
times → one line of 6): the first line keeps its id and gets the quantities, the others are
|
||||||
|
removed, their price events move to it. Only lines that are the same in every way that
|
||||||
|
matters (_combine_key), unpaid, without a discount, a deal, a tab or a linked line.
|
||||||
|
Needs ordering.orders.open (like moving and splitting)."""
|
||||||
|
from models.pricing import PriceEventLog
|
||||||
|
from models.tabs import TabEntry
|
||||||
|
order = db.get(Order, order_id)
|
||||||
|
if order is None:
|
||||||
|
raise XeniaError("order.not_found", order_id=order_id)
|
||||||
|
_need(request, db, user, "ordering.orders.open", target=f"order:{order_id}")
|
||||||
|
if not _can_access_order(order, user, db):
|
||||||
|
raise HTTPException(status_code=403, detail="Access denied")
|
||||||
|
ids = sorted(set(body.item_ids))
|
||||||
|
items = db.query(OrderItem).filter(OrderItem.order_id == order_id, OrderItem.id.in_(ids)).order_by(OrderItem.id).all()
|
||||||
|
if len(items) != len(ids) or len(items) < 2:
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="not_found")
|
||||||
|
if any(i.status != "active" for i in items):
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="not_unpaid")
|
||||||
|
if any(i.deal_id or i.linked_item_id for i in items) or \
|
||||||
|
db.query(OrderItem).filter(OrderItem.linked_item_id.in_(ids)).first() is not None:
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="deal")
|
||||||
|
if db.query(OrderDiscount).filter(OrderDiscount.item_id.in_(ids)).first() is not None:
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="discount")
|
||||||
|
if db.query(TabEntry).filter(TabEntry.order_item_id.in_(ids)).first() is not None:
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="tab")
|
||||||
|
if len({_combine_key(i) for i in items}) != 1:
|
||||||
|
raise XeniaError("order.items_not_combinable", reason="different")
|
||||||
|
keep, rest = items[0], items[1:]
|
||||||
|
keep.quantity = round(sum(i.quantity for i in items), 3)
|
||||||
|
keep.printed = all(i.printed for i in items)
|
||||||
|
rest_ids = [i.id for i in rest]
|
||||||
|
db.query(PriceEventLog).filter(PriceEventLog.order_item_id.in_(rest_ids)).update(
|
||||||
|
{PriceEventLog.order_item_id: keep.id}, synchronize_session=False)
|
||||||
|
for i in rest:
|
||||||
|
db.delete(i)
|
||||||
|
_audit(db, order_id, "ITEMS_COMBINED", waiter_id=user.id, item_ids=[keep.id] + rest_ids,
|
||||||
|
note=f"into #{keep.id}, quantity {keep.quantity:g}")
|
||||||
|
db.commit()
|
||||||
|
broadcast_sync("order_updated", {"order_id": order_id, "table_id": order.table_id, "status": order.status,
|
||||||
|
"action": "items_combined", "item_ids": [keep.id]})
|
||||||
|
return {"item_id": keep.id, "quantity": keep.quantity, "removed": rest_ids}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
"""Owner's choices of plan step 4.8: closing with unpaid items is a venue setting, and unpaid
|
||||||
|
lines of the same item can be combined into one."""
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from tests.test_live import err, owner_h, pair, terminal_login # noqa: F401 (fixtures)
|
||||||
|
from tests.test_pos import burger_line, drawer_printer, menu, on_shift, till # noqa: F401 (fixtures)
|
||||||
|
from tests.test_pos_tables import floor, phone # noqa: F401 (fixtures)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def _no_printing(monkeypatch):
|
||||||
|
import routers.orders as orders
|
||||||
|
monkeypatch.setattr(orders, "route_and_print_sync", lambda *a, **k: [])
|
||||||
|
|
||||||
|
|
||||||
|
def order_with(client, phone, floor, lines):
|
||||||
|
oid = client.post("/api/orders/", headers=phone["h"], json={"table_id": floor["t1"].id, "order_type": "here"}).json()["id"]
|
||||||
|
for line in lines:
|
||||||
|
assert client.post(f"/api/orders/{oid}/items", headers=phone["h"], json={"lines": [line]}).status_code == 200
|
||||||
|
return oid
|
||||||
|
|
||||||
|
|
||||||
|
def items(db, oid):
|
||||||
|
from models.order import OrderItem
|
||||||
|
db.expire_all()
|
||||||
|
return db.query(OrderItem).filter(OrderItem.order_id == oid).order_by(OrderItem.id).all()
|
||||||
|
|
||||||
|
|
||||||
|
def test_closing_with_unpaid_items_follows_the_setting(client, db, menu, phone, floor, owner_h):
|
||||||
|
beer = {"product_id": menu["coffee"].id, "quantity": 2}
|
||||||
|
oid = order_with(client, phone, floor, [beer])
|
||||||
|
r = client.post(f"/api/orders/{oid}/close", headers=phone["h"])
|
||||||
|
assert r.status_code == 409 and err(r) == "pos.order_unpaid" and r.json()["error"]["params"]["count"] == 1
|
||||||
|
assert client.put("/api/settings/orders.close_with_unpaid", headers=owner_h, json={"value": "true"}).status_code == 200
|
||||||
|
assert client.post(f"/api/orders/{oid}/close", headers=phone["h"]).status_code == 200
|
||||||
|
assert [i.status for i in items(db, oid)] == ["closed"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_combine_the_same_item_ordered_at_different_times(client, db, menu, phone, floor):
|
||||||
|
from models.order import OrderAuditLog
|
||||||
|
beer = {"product_id": menu["coffee"].id, "quantity": 2}
|
||||||
|
oid = order_with(client, phone, floor, [beer, beer, beer])
|
||||||
|
ids = [i.id for i in items(db, oid)]
|
||||||
|
r = client.post(f"/api/orders/{oid}/items/combine", headers=phone["h"], json={"item_ids": ids})
|
||||||
|
assert r.status_code == 200, r.text
|
||||||
|
left = items(db, oid)
|
||||||
|
assert [(i.id, i.quantity) for i in left] == [(ids[0], 6)]
|
||||||
|
assert db.query(OrderAuditLog).filter(OrderAuditLog.event_type == "ITEMS_COMBINED").count() == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("second,reason", [
|
||||||
|
(lambda m: {"product_id": m["coffee"].id, "quantity": 1, "notes": "no ice"}, "different"),
|
||||||
|
(lambda m: burger_line(m), "different"),
|
||||||
|
])
|
||||||
|
def test_only_lines_that_are_the_same(client, db, menu, phone, floor, second, reason):
|
||||||
|
oid = order_with(client, phone, floor, [{"product_id": menu["coffee"].id, "quantity": 1}, second(menu)])
|
||||||
|
r = client.post(f"/api/orders/{oid}/items/combine", headers=phone["h"], json={"item_ids": [i.id for i in items(db, oid)]})
|
||||||
|
assert r.status_code == 422 and err(r) == "order.items_not_combinable" and r.json()["error"]["params"]["reason"] == reason
|
||||||
|
assert len(items(db, oid)) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_paid_lines_are_not_combined(client, db, menu, phone, floor):
|
||||||
|
beer = {"product_id": menu["coffee"].id, "quantity": 1}
|
||||||
|
oid = order_with(client, phone, floor, [beer, beer])
|
||||||
|
first, second = items(db, oid)
|
||||||
|
assert client.post(f"/api/orders/{oid}/pay", headers=phone["h"], json={"item_ids": [first.id], "payment_method": "cash"}).status_code == 200
|
||||||
|
r = client.post(f"/api/orders/{oid}/items/combine", headers=phone["h"], json={"item_ids": [first.id, second.id]})
|
||||||
|
assert err(r) == "order.items_not_combinable" and r.json()["error"]["params"]["reason"] == "not_unpaid"
|
||||||
@@ -3,6 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
|||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import client from '../../../api/client'
|
import client from '../../../api/client'
|
||||||
import RolePermissions from '../sections/RolePermissions'
|
import RolePermissions from '../sections/RolePermissions'
|
||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
function Toggle({ checked, onChange, disabled }) {
|
function Toggle({ checked, onChange, disabled }) {
|
||||||
return (
|
return (
|
||||||
@@ -372,6 +373,7 @@ function CloudSyncSection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TableOrderSettingsSection() {
|
function TableOrderSettingsSection() {
|
||||||
|
const { t } = useTranslation('manager')
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient()
|
||||||
const { data: settings, isLoading } = useQuery({
|
const { data: settings, isLoading } = useQuery({
|
||||||
queryKey: ['pos-settings'],
|
queryKey: ['pos-settings'],
|
||||||
@@ -387,6 +389,7 @@ function TableOrderSettingsSection() {
|
|||||||
updateMut.mutate({ key, value: current === 'true' ? 'false' : 'true' })
|
updateMut.mutate({ key, value: current === 'true' ? 'false' : 'true' })
|
||||||
}
|
}
|
||||||
const autoClose = settings?.['orders.auto_close_on_full_payment']?.value ?? 'false'
|
const autoClose = settings?.['orders.auto_close_on_full_payment']?.value ?? 'false'
|
||||||
|
const closeUnpaid = settings?.['orders.close_with_unpaid']?.value ?? 'false'
|
||||||
const bypassKds = settings?.['orders.bypass_kds_serve']?.value ?? 'false'
|
const bypassKds = settings?.['orders.bypass_kds_serve']?.value ?? 'false'
|
||||||
return (
|
return (
|
||||||
<SectionCard title="Ρυθμίσεις Τραπεζιών και Παραγγελιών" description="Συμπεριφορά τραπεζιών και παραγγελιών">
|
<SectionCard title="Ρυθμίσεις Τραπεζιών και Παραγγελιών" description="Συμπεριφορά τραπεζιών και παραγγελιών">
|
||||||
@@ -399,6 +402,10 @@ function TableOrderSettingsSection() {
|
|||||||
>
|
>
|
||||||
<Toggle checked={autoClose === 'true'} onChange={() => toggle('orders.auto_close_on_full_payment', autoClose)} disabled={updateMut.isPending} />
|
<Toggle checked={autoClose === 'true'} onChange={() => toggle('orders.auto_close_on_full_payment', autoClose)} disabled={updateMut.isPending} />
|
||||||
</OptionRow>
|
</OptionRow>
|
||||||
|
{/* 4.8: closing with unpaid items; when off, the phones take the payment first */}
|
||||||
|
<OptionRow label={t('settings.operation.closeUnpaid')} description={t('settings.operation.closeUnpaidHint')}>
|
||||||
|
<Toggle checked={closeUnpaid === 'true'} onChange={() => toggle('orders.close_with_unpaid', closeUnpaid)} disabled={updateMut.isPending} data-testid="setting-orders.close_with_unpaid" />
|
||||||
|
</OptionRow>
|
||||||
<OptionRow
|
<OptionRow
|
||||||
label="Παράκαμψη KDS και Κατάστασης Σερβιρίσματος"
|
label="Παράκαμψη KDS και Κατάστασης Σερβιρίσματος"
|
||||||
description="Οι νέες παραγγελίες σημειώνονται άμεσα ως σερβιρισμένες — δεν απαιτείται επιβεβαίωση από σερβιτόρο"
|
description="Οι νέες παραγγελίες σημειώνονται άμεσα ως σερβιρισμένες — δεν απαιτείται επιβεβαίωση από σερβιτόρο"
|
||||||
|
|||||||
@@ -71,7 +71,8 @@
|
|||||||
"quantity": "«{{name}}»: αυτή η ποσότητα δεν επιτρέπεται (γραμμή {{line}}).",
|
"quantity": "«{{name}}»: αυτή η ποσότητα δεν επιτρέπεται (γραμμή {{line}}).",
|
||||||
"price": "«{{name}}»: αυτή η αλλαγή τιμής δεν επιτρέπεται (γραμμή {{line}}).",
|
"price": "«{{name}}»: αυτή η αλλαγή τιμής δεν επιτρέπεται (γραμμή {{line}}).",
|
||||||
"client_price": "«{{name}}»: η εφαρμογή έστειλε δικές της τιμές, ενώ οι τιμές έρχονται από τον server (γραμμή {{line}}). Ενημερώστε την εφαρμογή."
|
"client_price": "«{{name}}»: η εφαρμογή έστειλε δικές της τιμές, ενώ οι τιμές έρχονται από τον server (γραμμή {{line}}). Ενημερώστε την εφαρμογή."
|
||||||
}
|
},
|
||||||
|
"items_not_combinable": "Αυτές οι γραμμές δεν συνδυάζονται: μόνο απλήρωτες γραμμές του ίδιου είδους, με ίδιες επιλογές, σημείωση, τιμή και κατάσταση κουζίνας, χωρίς έκπτωση, προσφορά ή καρτέλα."
|
||||||
},
|
},
|
||||||
"notification": {
|
"notification": {
|
||||||
"not_found": "Η ειδοποίηση {{notification_id}} δεν βρέθηκε."
|
"not_found": "Η ειδοποίηση {{notification_id}} δεν βρέθηκε."
|
||||||
|
|||||||
@@ -378,6 +378,10 @@
|
|||||||
"never": "Μόνο όταν εγκαταλειφθεί",
|
"never": "Μόνο όταν εγκαταλειφθεί",
|
||||||
"after_one": "Μετά από {{count}} αποτυχία",
|
"after_one": "Μετά από {{count}} αποτυχία",
|
||||||
"after_other": "Μετά από {{count}} αποτυχίες"
|
"after_other": "Μετά από {{count}} αποτυχίες"
|
||||||
|
},
|
||||||
|
"operation": {
|
||||||
|
"closeUnpaid": "Κλείσιμο τραπεζιού με απλήρωτα",
|
||||||
|
"closeUnpaidHint": "Ανενεργό: το κλείσιμο τραπεζιού με απλήρωτα ζητά πρώτα την πληρωμή και μετά το κλείνει. Ενεργό: κλείνει και τα απλήρωτα καταγράφονται ως απλήρωτα."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logs": {
|
"logs": {
|
||||||
|
|||||||
@@ -311,7 +311,12 @@
|
|||||||
"operation": "Λειτουργία",
|
"operation": "Λειτουργία",
|
||||||
"favorites": "Αγαπημένα"
|
"favorites": "Αγαπημένα"
|
||||||
},
|
},
|
||||||
"max": "μέγιστο"
|
"max": "μέγιστο",
|
||||||
|
"seats": {
|
||||||
|
"title": "Θέσεις",
|
||||||
|
"label": "Εμφάνιση θέσεων τραπεζιού",
|
||||||
|
"desc": "Στις κάρτες τραπεζιών, δίπλα στο όνομα (τις ορίζει ο διαχειριστής ανά τραπέζι)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"venues": {
|
"venues": {
|
||||||
"active": "ΕΝΕΡΓΟ",
|
"active": "ΕΝΕΡΓΟ",
|
||||||
@@ -457,7 +462,10 @@
|
|||||||
"moveSub": "Μεταφορά επιλεγμένων αντικειμένων",
|
"moveSub": "Μεταφορά επιλεγμένων αντικειμένων",
|
||||||
"splitSub": "Χώρισμα σε δύο γραμμές",
|
"splitSub": "Χώρισμα σε δύο γραμμές",
|
||||||
"cancel": "Ακύρωση παραγγελίας",
|
"cancel": "Ακύρωση παραγγελίας",
|
||||||
"cancelSub": "Ακύρωση επιλεγμένων αντικειμένων"
|
"cancelSub": "Ακύρωση επιλεγμένων αντικειμένων",
|
||||||
|
"combine": "Συνδυασμός σε μία γραμμή",
|
||||||
|
"combineSub_one": "{{count}} γραμμή του ίδιου είδους",
|
||||||
|
"combineSub_other": "{{count}} γραμμές του ίδιου είδους"
|
||||||
},
|
},
|
||||||
"withApproval": "Με έγκριση διαχειριστή (PIN)",
|
"withApproval": "Με έγκριση διαχειριστή (PIN)",
|
||||||
"cancelNotAllowed": "Δεν επιτρέπεται η ακύρωση",
|
"cancelNotAllowed": "Δεν επιτρέπεται η ακύρωση",
|
||||||
@@ -517,7 +525,8 @@
|
|||||||
"noTargetOrder": "Δεν βρέθηκε παραγγελία στο τραπέζι",
|
"noTargetOrder": "Δεν βρέθηκε παραγγελία στο τραπέζι",
|
||||||
"merge": "Σφάλμα συγχώνευσης",
|
"merge": "Σφάλμα συγχώνευσης",
|
||||||
"moveItems": "Σφάλμα μεταφοράς αντικειμένων",
|
"moveItems": "Σφάλμα μεταφοράς αντικειμένων",
|
||||||
"flags": "Σφάλμα αποθήκευσης σημαιών"
|
"flags": "Σφάλμα αποθήκευσης σημαιών",
|
||||||
|
"combine": "Σφάλμα συνδυασμού"
|
||||||
},
|
},
|
||||||
"openOrder": "Άνοιγμα Παραγγελίας",
|
"openOrder": "Άνοιγμα Παραγγελίας",
|
||||||
"noPaid": "Δεν υπάρχουν πληρωμένα αντικείμενα",
|
"noPaid": "Δεν υπάρχουν πληρωμένα αντικείμενα",
|
||||||
@@ -540,7 +549,9 @@
|
|||||||
},
|
},
|
||||||
"close": {
|
"close": {
|
||||||
"title": "Κλείσιμο παραγγελίας;",
|
"title": "Κλείσιμο παραγγελίας;",
|
||||||
"body": "Αυτή η ενέργεια δεν αναιρείται."
|
"body": "Αυτή η ενέργεια δεν αναιρείται.",
|
||||||
|
"unpaid_one": "{{count}} αντικείμενο είναι απλήρωτο: θα κλείσει ως απλήρωτο.",
|
||||||
|
"unpaid_other": "{{count}} αντικείμενα είναι απλήρωτα: θα κλείσουν ως απλήρωτα."
|
||||||
},
|
},
|
||||||
"move": {
|
"move": {
|
||||||
"pickFree": "Επιλέξτε κενό τραπέζι",
|
"pickFree": "Επιλέξτε κενό τραπέζι",
|
||||||
@@ -574,6 +585,15 @@
|
|||||||
"tabs": {
|
"tabs": {
|
||||||
"unpaid": "Εκκρεμή",
|
"unpaid": "Εκκρεμή",
|
||||||
"paid": "Πληρωμένα"
|
"paid": "Πληρωμένα"
|
||||||
|
},
|
||||||
|
"btn": {
|
||||||
|
"close": "ΚΛΕΙΣΙΜΟ",
|
||||||
|
"add": "ΠΡΟΣΘΗΚΗ",
|
||||||
|
"pay": "€ ΠΛΗΡΩΜΗ",
|
||||||
|
"served": "ΣΕΡΒΙΡΙΣΤΗΚΕ",
|
||||||
|
"actions": "ΕΝΕΡΓΕΙΕΣ",
|
||||||
|
"clear": "ΚΑΘΑΡΙΣΜΟΣ",
|
||||||
|
"all": "ΟΛΑ"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
@@ -779,5 +799,10 @@
|
|||||||
"cancelled": "ΑΚΥΡΩΜΕΝΗ",
|
"cancelled": "ΑΚΥΡΩΜΕΝΗ",
|
||||||
"limit_one": "Το πακέτο σας δείχνει την τελευταία {{count}} ημέρα",
|
"limit_one": "Το πακέτο σας δείχνει την τελευταία {{count}} ημέρα",
|
||||||
"limit_other": "Το πακέτο σας δείχνει τις τελευταίες {{count}} ημέρες"
|
"limit_other": "Το πακέτο σας δείχνει τις τελευταίες {{count}} ημέρες"
|
||||||
|
},
|
||||||
|
"seats": {
|
||||||
|
"table_one": "Τραπέζι για {{count}}",
|
||||||
|
"table_other": "Τραπέζι για {{count}}",
|
||||||
|
"over": "{{count}} άτομα σε τραπέζι για {{seats}}: εντάξει, είναι μόνο ένδειξη"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@
|
|||||||
"quantity": "{{name}}: that quantity isn't allowed (line {{line}}).",
|
"quantity": "{{name}}: that quantity isn't allowed (line {{line}}).",
|
||||||
"price": "{{name}}: that price change isn't allowed (line {{line}}).",
|
"price": "{{name}}: that price change isn't allowed (line {{line}}).",
|
||||||
"client_price": "{{name}}: the app sent its own prices, but prices come from the server (line {{line}}). Update the app."
|
"client_price": "{{name}}: the app sent its own prices, but prices come from the server (line {{line}}). Update the app."
|
||||||
}
|
},
|
||||||
|
"items_not_combinable": "These lines can't be combined: only unpaid lines of the same item, with the same choices, note, price and kitchen state, and no discount, deal or tab."
|
||||||
},
|
},
|
||||||
"notification": {
|
"notification": {
|
||||||
"not_found": "Notification {{notification_id}} not found."
|
"not_found": "Notification {{notification_id}} not found."
|
||||||
|
|||||||
@@ -378,6 +378,10 @@
|
|||||||
"never": "Only when it is given up",
|
"never": "Only when it is given up",
|
||||||
"after_one": "After {{count}} failed attempt",
|
"after_one": "After {{count}} failed attempt",
|
||||||
"after_other": "After {{count}} failed attempts"
|
"after_other": "After {{count}} failed attempts"
|
||||||
|
},
|
||||||
|
"operation": {
|
||||||
|
"closeUnpaid": "Close a table with unpaid items",
|
||||||
|
"closeUnpaidHint": "Off: closing a table with unpaid items asks for the payment first, then closes it. On: it closes and the unpaid items are recorded as unpaid."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"logs": {
|
"logs": {
|
||||||
|
|||||||
@@ -311,7 +311,12 @@
|
|||||||
"operation": "Operation",
|
"operation": "Operation",
|
||||||
"favorites": "Favourites"
|
"favorites": "Favourites"
|
||||||
},
|
},
|
||||||
"max": "maximum"
|
"max": "maximum",
|
||||||
|
"seats": {
|
||||||
|
"title": "Seats",
|
||||||
|
"label": "Show each table's seats",
|
||||||
|
"desc": "On the table cards, next to the name (set by the manager per table)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"venues": {
|
"venues": {
|
||||||
"active": "ACTIVE",
|
"active": "ACTIVE",
|
||||||
@@ -457,7 +462,10 @@
|
|||||||
"moveSub": "Move the selected items",
|
"moveSub": "Move the selected items",
|
||||||
"splitSub": "Split into two lines",
|
"splitSub": "Split into two lines",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"cancelSub": "Cancel the selected items"
|
"cancelSub": "Cancel the selected items",
|
||||||
|
"combine": "Combine into one line",
|
||||||
|
"combineSub_one": "{{count}} line of the same item",
|
||||||
|
"combineSub_other": "{{count}} lines of the same item"
|
||||||
},
|
},
|
||||||
"withApproval": "With a manager's approval (PIN)",
|
"withApproval": "With a manager's approval (PIN)",
|
||||||
"cancelNotAllowed": "Cancelling is not allowed",
|
"cancelNotAllowed": "Cancelling is not allowed",
|
||||||
@@ -517,7 +525,8 @@
|
|||||||
"noTargetOrder": "No order found on that table",
|
"noTargetOrder": "No order found on that table",
|
||||||
"merge": "Couldn't merge",
|
"merge": "Couldn't merge",
|
||||||
"moveItems": "Couldn't move the items",
|
"moveItems": "Couldn't move the items",
|
||||||
"flags": "Couldn't save the flags"
|
"flags": "Couldn't save the flags",
|
||||||
|
"combine": "Couldn't combine the lines"
|
||||||
},
|
},
|
||||||
"openOrder": "Open an order",
|
"openOrder": "Open an order",
|
||||||
"noPaid": "No paid items",
|
"noPaid": "No paid items",
|
||||||
@@ -540,7 +549,9 @@
|
|||||||
},
|
},
|
||||||
"close": {
|
"close": {
|
||||||
"title": "Close the order?",
|
"title": "Close the order?",
|
||||||
"body": "This can't be undone."
|
"body": "This can't be undone.",
|
||||||
|
"unpaid_one": "{{count}} item is unpaid: it will be closed as unpaid.",
|
||||||
|
"unpaid_other": "{{count}} items are unpaid: they will be closed as unpaid."
|
||||||
},
|
},
|
||||||
"move": {
|
"move": {
|
||||||
"pickFree": "Choose a free table",
|
"pickFree": "Choose a free table",
|
||||||
@@ -574,6 +585,15 @@
|
|||||||
"tabs": {
|
"tabs": {
|
||||||
"unpaid": "Unpaid",
|
"unpaid": "Unpaid",
|
||||||
"paid": "Paid"
|
"paid": "Paid"
|
||||||
|
},
|
||||||
|
"btn": {
|
||||||
|
"close": "CLOSE",
|
||||||
|
"add": "ADD",
|
||||||
|
"pay": "€ PAY",
|
||||||
|
"served": "SERVED",
|
||||||
|
"actions": "ACTIONS",
|
||||||
|
"clear": "CLEAR",
|
||||||
|
"all": "ALL"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
@@ -779,5 +799,10 @@
|
|||||||
"cancelled": "CANCELLED",
|
"cancelled": "CANCELLED",
|
||||||
"limit_one": "Your plan shows the last {{count}} day",
|
"limit_one": "Your plan shows the last {{count}} day",
|
||||||
"limit_other": "Your plan shows the last {{count}} days"
|
"limit_other": "Your plan shows the last {{count}} days"
|
||||||
|
},
|
||||||
|
"seats": {
|
||||||
|
"table_one": "Table for {{count}}",
|
||||||
|
"table_other": "Table for {{count}}",
|
||||||
|
"over": "{{count}} guests at a table for {{seats}}: fine, it is only a suggestion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-1
@@ -15,7 +15,7 @@ const vite = await startViteNative({ port: 5181, backendUrl: backend.url })
|
|||||||
const APP = 'http://localhost:5181'
|
const APP = 'http://localhost:5181'
|
||||||
const TOKEN_KEY = 'xenia:dev:token'
|
const TOKEN_KEY = 'xenia:dev:token'
|
||||||
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
|
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
|
||||||
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7), look (4.6)')
|
const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7), look (4.6), owner choices (4.8)')
|
||||||
const errors = []
|
const errors = []
|
||||||
let failures = 0
|
let failures = 0
|
||||||
|
|
||||||
@@ -274,6 +274,43 @@ try {
|
|||||||
await a.getByTestId('menu-language-en').click()
|
await a.getByTestId('menu-language-en').click()
|
||||||
await waitFor(async () => (await navText()).includes('Tables'), 8000, 300)
|
await waitFor(async () => (await navText()).includes('Tables'), 8000, 300)
|
||||||
|
|
||||||
|
// ── 4.8: the owner's choices: combine lines, close with unpaid items, seats ─────────
|
||||||
|
const t6 = free.find(t => t.id !== t4.id && t.id !== t5.id)
|
||||||
|
const o6 = await api('POST', '/api/orders/', { token: tokenA, body: { table_id: t6.id } })
|
||||||
|
for (let i = 0; i < 3; i++) await api('POST', `/api/orders/${o6.id}/items`, { token: tokenA, body: { lines: [{ product_id: plain.id, quantity: 2 }] } })
|
||||||
|
await a.goto(`${APP}/tables/${t6.id}`)
|
||||||
|
await a.locator('.order-item').first().waitFor({ timeout: 10_000 })
|
||||||
|
for (let i = 0; i < 3; i++) await a.locator('.order-item').nth(i).click()
|
||||||
|
await a.getByRole('button', { name: 'ACTIONS', exact: true }).last().click()
|
||||||
|
await a.getByText('Combine into one line').click()
|
||||||
|
const combined = await waitFor(async () => {
|
||||||
|
const o = await api('GET', `/api/orders/${o6.id}`, { token: boss })
|
||||||
|
const live = o.items.filter(i => i.status === 'active')
|
||||||
|
return live.length === 1 && live[0].quantity === 6 && o
|
||||||
|
}, 10_000, 500)
|
||||||
|
r.check('4.8: three lines of the same item (2 + 2 + 2) combined into one line of 6', !!combined)
|
||||||
|
// closing with an unpaid item: by default the payment comes first; the venue may allow closing
|
||||||
|
await a.goto(`${APP}/tables/${t6.id}`)
|
||||||
|
await a.getByRole('button', { name: /CLOSE/ }).last().click()
|
||||||
|
r.check('4.8: CLOSE with unpaid items asks for the payment first (default)', await a.getByText('Confirm payment and close').isVisible().catch(() => false))
|
||||||
|
await a.keyboard.press('Escape').catch(() => {})
|
||||||
|
await setting(boss, 'orders.close_with_unpaid', 'true')
|
||||||
|
await a.goto(`${APP}/tables/${t6.id}`)
|
||||||
|
await a.getByRole('button', { name: /CLOSE/ }).last().click()
|
||||||
|
await a.getByTestId('close-confirm').click({ timeout: 10_000 })
|
||||||
|
const closed = await waitFor(async () => (await api('GET', `/api/orders/${o6.id}`, { token: boss })).status === 'closed', 10_000, 500)
|
||||||
|
r.check('4.8: with "close with unpaid items" on, CLOSE closes and the item stays unpaid', !!closed)
|
||||||
|
await setting(boss, 'orders.close_with_unpaid', 'false')
|
||||||
|
// seats: a suggestion on the card and in the guests dialog
|
||||||
|
await api('PUT', `/api/tables/${t6.id}`, { token: boss, body: { seat_count: 4 } })
|
||||||
|
await a.goto(`${APP}/tables`)
|
||||||
|
r.check("4.8: the table's seats show on its card", await shown(a, 'table-seats', 10_000))
|
||||||
|
await a.goto(`${APP}/tables/${t6.id}/add?new=1`)
|
||||||
|
await a.getByTitle('Number of guests').click()
|
||||||
|
for (let i = 0; i < 6; i++) await a.locator('.qty-btn').last().click()
|
||||||
|
r.check('4.8: more guests than seats is allowed, with a hint (not a limit)', await a.getByTestId('seats-hint').getAttribute('data-over') === 'true')
|
||||||
|
await a.goto(`${APP}/tables`)
|
||||||
|
|
||||||
// ── 4.6: the look on the shared tokens: the venue's colour and light / dark reach the phone ──
|
// ── 4.6: the look on the shared tokens: the venue's colour and light / dark reach the phone ──
|
||||||
const accentOf = () => a.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--x-accent-rgb').trim())
|
const accentOf = () => a.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--x-accent-rgb').trim())
|
||||||
r.check('4.6: the venue colour (default amber) is on the phone', await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'amber')
|
r.check('4.6: the venue colour (default amber) is on the phone', await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'amber')
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { useTranslation } from '@xenia/i18n'
|
||||||
|
|
||||||
|
// The table's seats next to the number of guests (plan step 4.8): a suggestion, never a limit
|
||||||
|
// — a table for 4 may seat 5 with a chair from another table.
|
||||||
|
export default function SeatsHint({ seats, count }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
|
if (!seats) return null
|
||||||
|
const over = count > seats
|
||||||
|
return (
|
||||||
|
<p data-testid="seats-hint" data-over={over ? 'true' : 'false'}
|
||||||
|
style={{ textAlign: 'center', fontSize: 13, margin: '-12px 0 16px', color: over ? 'var(--x-warning)' : 'var(--muted)', fontWeight: over ? 600 : 400 }}>
|
||||||
|
{over ? t('seats.over', { count, seats }) : t('seats.table', { count: seats })}
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useRef, useState, useEffect } from 'react'
|
import { useRef, useState, useEffect } from 'react'
|
||||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||||
import useThemeStore from '../store/themeStore'
|
import useThemeStore from '../store/themeStore'
|
||||||
|
import useTableViewStore from '../store/tableViewStore'
|
||||||
import useTableColourStore from '../store/tableColourStore'
|
import useTableColourStore from '../store/tableColourStore'
|
||||||
import { assetUrl } from '../config/server'
|
import { assetUrl } from '../config/server'
|
||||||
import { fade } from '../logic/colour'
|
import { fade } from '../logic/colour'
|
||||||
@@ -283,6 +284,25 @@ function Amount({ value, size = 22, color }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ─── Seats (plan step 4.8) ───────────────────────────────────────────────────
|
||||||
|
// The table's seats next to its name: a suggestion for seating, never a limit. Shown unless the
|
||||||
|
// waiter turned it off (Settings → Layout).
|
||||||
|
function SeatCount({ table }) {
|
||||||
|
const { t } = useTranslation('waiter')
|
||||||
|
const show = useTableViewStore(s => s.showSeats)
|
||||||
|
if (!show || !table.seat_count) return null
|
||||||
|
return (
|
||||||
|
<span data-testid="table-seats" title={t('seats.table', { count: table.seat_count })}
|
||||||
|
style={{ marginLeft: 5, fontSize: '0.55em', fontWeight: 700, opacity: 0.6, verticalAlign: 'middle', whiteSpace: 'nowrap' }}>
|
||||||
|
<svg width="0.9em" height="0.9em" viewBox="0 0 24 24" fill="none" style={{ verticalAlign: '-0.1em', marginRight: 1 }}>
|
||||||
|
<circle cx="12" cy="7" r="4" stroke="currentColor" strokeWidth="2.4" />
|
||||||
|
<path d="M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" />
|
||||||
|
</svg>
|
||||||
|
{table.seat_count}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// ─── Card variants ────────────────────────────────────────────────────────────
|
// ─── Card variants ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// 1x1 — square-ish, 4 per row. Badges top (up to 2 + +N), name center, KDS badge bottom (replaces status).
|
// 1x1 — square-ish, 4 per row. Badges top (up to 2 + +N), name center, KDS badge bottom (replaces status).
|
||||||
@@ -311,7 +331,7 @@ function Card1x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
|||||||
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1,
|
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1,
|
||||||
position: 'relative', zIndex: 2,
|
position: 'relative', zIndex: 2,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* bottom strip: KDS badge if present, else status */}
|
{/* bottom strip: KDS badge if present, else status */}
|
||||||
@@ -353,7 +373,7 @@ function Card2x1({ table, _order, flags, _waiterObjects, cfg, statusKey, kdsBadg
|
|||||||
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1, flexShrink: 0,
|
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1, flexShrink: 0,
|
||||||
position: 'relative', zIndex: 2,
|
position: 'relative', zIndex: 2,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -397,7 +417,7 @@ function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
|||||||
fontSize: 'clamp(22px, 5.5vw, 36px)', fontWeight: 800,
|
fontSize: 'clamp(22px, 5.5vw, 36px)', fontWeight: 800,
|
||||||
lineHeight: 1.05, color: cfg.nameText, letterSpacing: -0.5,
|
lineHeight: 1.05, color: cfg.nameText, letterSpacing: -0.5,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</span>
|
</span>
|
||||||
<div style={{ marginTop: 5 }}>
|
<div style={{ marginTop: 5 }}>
|
||||||
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
<StatusPill label={t(STATUS_LABELS[statusKey])} badgeBg={cfg.badgeBg} badgeText={cfg.badgeText} small />
|
||||||
@@ -448,7 +468,7 @@ function Card4x1({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
|||||||
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1, flexShrink: 0,
|
letterSpacing: -0.5, color: cfg.nameText, lineHeight: 1, flexShrink: 0,
|
||||||
position: 'relative', zIndex: 2,
|
position: 'relative', zIndex: 2,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* separator dot */}
|
{/* separator dot */}
|
||||||
@@ -506,7 +526,7 @@ function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
|||||||
fontWeight: 800, fontSize: 'clamp(30px, 7vw, 44px)',
|
fontWeight: 800, fontSize: 'clamp(30px, 7vw, 44px)',
|
||||||
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</div>
|
</div>
|
||||||
{groupName && (
|
{groupName && (
|
||||||
<div style={{
|
<div style={{
|
||||||
@@ -604,7 +624,7 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
|||||||
fontWeight: 800, fontSize: 'clamp(28px, 6vw, 40px)',
|
fontWeight: 800, fontSize: 'clamp(28px, 6vw, 40px)',
|
||||||
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
||||||
}}>
|
}}>
|
||||||
{table.label || `T${table.number}`}
|
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||||
</div>
|
</div>
|
||||||
{groupName && (
|
{groupName && (
|
||||||
<div style={{
|
<div style={{
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { money } from '../i18n'
|
|||||||
import { LineError, estimate, wireLine } from '@xenia/api'
|
import { LineError, estimate, wireLine } from '@xenia/api'
|
||||||
import { useTranslation } from '@xenia/i18n'
|
import { useTranslation } from '@xenia/i18n'
|
||||||
import { fade } from '../logic/colour'
|
import { fade } from '../logic/colour'
|
||||||
|
import SeatsHint from '../components/SeatsHint'
|
||||||
|
|
||||||
// A cart item whose option is not on the menu any more (4.4: lines go by id)
|
// A cart item whose option is not on the menu any more (4.4: lines go by id)
|
||||||
const lineErrorText = (err, t) => t('add.optionGone', { product: err.product, what: err.what })
|
const lineErrorText = (err, t) => t('add.optionGone', { product: err.product, what: err.what })
|
||||||
@@ -71,7 +72,7 @@ function GlobalCourseModal({ courses, selected, onSelect, onClose }) {
|
|||||||
|
|
||||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function CustomerCountModal({ value, onChange, onClose }) {
|
function CustomerCountModal({ value, seats, onChange, onClose }) {
|
||||||
const { t } = useTranslation('waiter')
|
const { t } = useTranslation('waiter')
|
||||||
const [count, setCount] = useState(value ?? 0)
|
const [count, setCount] = useState(value ?? 0)
|
||||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||||
@@ -84,6 +85,7 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||||
{t('detail.guests.question')}
|
{t('detail.guests.question')}
|
||||||
</p>
|
</p>
|
||||||
|
<SeatsHint seats={seats} count={count} />
|
||||||
|
|
||||||
{/* Quick pick */}
|
{/* Quick pick */}
|
||||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
||||||
@@ -181,6 +183,7 @@ export default function AddItemsPage() {
|
|||||||
const [searchQuery, setSearchQuery] = useState('')
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
const [quickToast, setQuickToast] = useState(null) // { product, count }
|
const [quickToast, setQuickToast] = useState(null) // { product, count }
|
||||||
const [customerCount, setCustomerCount] = useState(null) // number of people at table
|
const [customerCount, setCustomerCount] = useState(null) // number of people at table
|
||||||
|
const [seats, setSeats] = useState(null) // the table's seats: a suggestion (4.8)
|
||||||
const [customerCountOpen, setCustomerCountOpen] = useState(false)
|
const [customerCountOpen, setCustomerCountOpen] = useState(false)
|
||||||
const [courses, setCourses] = useState([])
|
const [courses, setCourses] = useState([])
|
||||||
const [quickNotes, setQuickNotes] = useState(null) // null = not yet fetched; use drawer's fallback
|
const [quickNotes, setQuickNotes] = useState(null) // null = not yet fetched; use drawer's fallback
|
||||||
@@ -206,7 +209,7 @@ export default function AddItemsPage() {
|
|||||||
const statusRes = await client.get(`/api/tables/${tableId}/status`)
|
const statusRes = await client.get(`/api/tables/${tableId}/status`)
|
||||||
setOrderId(statusRes.data.active_order_id)
|
setOrderId(statusRes.data.active_order_id)
|
||||||
const tbl = statusRes.data.table
|
const tbl = statusRes.data.table
|
||||||
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
if (tbl) { setTableLabel(tbl.label || `T${tbl.number}`); setSeats(tbl.seat_count ?? null) }
|
||||||
// Load existing customer count from the active order
|
// Load existing customer count from the active order
|
||||||
if (statusRes.data.active_order_id) {
|
if (statusRes.data.active_order_id) {
|
||||||
const { data: o } = await client.get(`/api/orders/${statusRes.data.active_order_id}`)
|
const { data: o } = await client.get(`/api/orders/${statusRes.data.active_order_id}`)
|
||||||
@@ -215,7 +218,7 @@ export default function AddItemsPage() {
|
|||||||
} catch {
|
} catch {
|
||||||
// Offline — read table label from IDB snapshot
|
// Offline — read table label from IDB snapshot
|
||||||
const tbl = await db.pos_tables.get(Number(tableId))
|
const tbl = await db.pos_tables.get(Number(tableId))
|
||||||
if (tbl) setTableLabel(tbl.label || `T${tbl.number}`)
|
if (tbl) { setTableLabel(tbl.label || `T${tbl.number}`); setSeats(tbl.seat_count ?? null) }
|
||||||
// orderId stays null — offline orders don't need a pre-existing server order
|
// orderId stays null — offline orders don't need a pre-existing server order
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -934,6 +937,7 @@ export default function AddItemsPage() {
|
|||||||
{customerCountOpen && (
|
{customerCountOpen && (
|
||||||
<CustomerCountModal
|
<CustomerCountModal
|
||||||
value={customerCount}
|
value={customerCount}
|
||||||
|
seats={seats}
|
||||||
onChange={v => setCustomerCount(v)}
|
onChange={v => setCustomerCount(v)}
|
||||||
onClose={() => setCustomerCountOpen(false)}
|
onClose={() => setCustomerCountOpen(false)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ const ORDER_ITEM_LAYOUT_OPTIONS = [
|
|||||||
|
|
||||||
function LayoutTab() {
|
function LayoutTab() {
|
||||||
const { t } = useTranslation('waiter')
|
const { t } = useTranslation('waiter')
|
||||||
const { density, setDensity, chipStyle, setChipStyle, kdsDisplayStyle, setKdsDisplayStyle, orderItemLayout, setOrderItemLayout, mergePersist, setMergePersist } = useTableViewStore()
|
const { density, setDensity, chipStyle, setChipStyle, kdsDisplayStyle, setKdsDisplayStyle, orderItemLayout, setOrderItemLayout, mergePersist, setMergePersist, showSeats, setShowSeats } = useTableViewStore()
|
||||||
const { dark, toggle } = useThemeStore()
|
const { dark, toggle } = useThemeStore()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -217,6 +217,14 @@ function LayoutTab() {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
{/* Card density */}
|
{/* Card density */}
|
||||||
|
{/* Seats on the table cards (4.8) */}
|
||||||
|
<section>
|
||||||
|
<h2 style={sectionTitle}>{t('settings.seats.title')}</h2>
|
||||||
|
<div style={{ marginTop: 14 }}>
|
||||||
|
<ToggleRow label={t('settings.seats.label')} desc={t('settings.seats.desc')} checked={showSeats !== false} onChange={() => setShowSeats(!(showSeats !== false))} />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2 style={sectionTitle}>{t('settings.density.title')}</h2>
|
<h2 style={sectionTitle}>{t('settings.density.title')}</h2>
|
||||||
<p style={sectionSub}>{t('settings.density.sub')}</p>
|
<p style={sectionSub}>{t('settings.density.sub')}</p>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import usePaymentSettingsStore from '../store/paymentSettingsStore'
|
|||||||
import useTableViewStore from '../store/tableViewStore'
|
import useTableViewStore from '../store/tableViewStore'
|
||||||
import { useTranslation } from '@xenia/i18n'
|
import { useTranslation } from '@xenia/i18n'
|
||||||
import { fade } from '../logic/colour'
|
import { fade } from '../logic/colour'
|
||||||
|
import SeatsHint from '../components/SeatsHint'
|
||||||
|
|
||||||
const fmtPrice = money
|
const fmtPrice = money
|
||||||
|
|
||||||
@@ -24,6 +25,11 @@ const MERGE_OFF = 'off'
|
|||||||
const MERGE_IDENTICAL = 'identical' // same product + options + price
|
const MERGE_IDENTICAL = 'identical' // same product + options + price
|
||||||
const MERGE_SAME_ITEM = 'same_item' // same product + same effective unit price
|
const MERGE_SAME_ITEM = 'same_item' // same product + same effective unit price
|
||||||
|
|
||||||
|
// The real order lines behind what's on screen (a grouped line stands for several)
|
||||||
|
function combineIds(items) {
|
||||||
|
return items.flatMap(i => i._sourceIds ?? [i.id]).filter(id => typeof id === 'number')
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a stable string key for grouping under MERGE_IDENTICAL
|
// Returns a stable string key for grouping under MERGE_IDENTICAL
|
||||||
function identicalKey(item) {
|
function identicalKey(item) {
|
||||||
const effPrice = ((item.unit_price ?? 0) + (item.price_adjustment ?? 0)).toFixed(4)
|
const effPrice = ((item.unit_price ?? 0) + (item.price_adjustment ?? 0)).toFixed(4)
|
||||||
@@ -243,7 +249,7 @@ function PriceAdjustModal({ item, onConfirm, onClose }) {
|
|||||||
|
|
||||||
// ─── Item action modal (long-press) ──────────────────────────────────────────
|
// ─── Item action modal (long-press) ──────────────────────────────────────────
|
||||||
|
|
||||||
function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCancel, canCancel, cancelNeedsApproval, priceAdjAllowed, priceNeedsApproval, canMove, onAdjustPrice, onClose }) {
|
function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCancel, onCombine, canCancel, cancelNeedsApproval, priceAdjAllowed, priceNeedsApproval, canMove, onAdjustPrice, onClose }) {
|
||||||
const { t } = useTranslation('waiter')
|
const { t } = useTranslation('waiter')
|
||||||
const { items, singleStacked, multiSelect } = target
|
const { items, singleStacked, multiSelect } = target
|
||||||
const label = multiSelect
|
const label = multiSelect
|
||||||
@@ -295,6 +301,22 @@ function ItemActionModal({ target, onOrderAgain, onSplit, onMoveToTable, onCance
|
|||||||
onClick: onMoveToTable,
|
onClick: onMoveToTable,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
}] : []),
|
}] : []),
|
||||||
|
// 4.8: lines of the same item ordered at different times become one (the server checks
|
||||||
|
// they really are the same: choices, note, price, kitchen state)
|
||||||
|
...(canMove && combineIds(items).length > 1 && items.every(i => i.product_id === items[0].product_id && i.status === 'active') ? [{
|
||||||
|
key: 'combine',
|
||||||
|
color: 'var(--x-info)',
|
||||||
|
iconBg: 'rgb(var(--x-info-rgb) / 0.15)',
|
||||||
|
label: t('detail.item.combine'),
|
||||||
|
sub: t('detail.item.combineSub', { count: combineIds(items).length }),
|
||||||
|
icon: (
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
|
||||||
|
<path d="M4 6h10M4 12h16M4 18h10M17 4l3 2-3 2M17 16l3 2-3 2" stroke="var(--x-info)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
),
|
||||||
|
onClick: onCombine,
|
||||||
|
enabled: true,
|
||||||
|
}] : []),
|
||||||
...(canMove && singleStacked && !multiSelect ? [{
|
...(canMove && singleStacked && !multiSelect ? [{
|
||||||
key: 'split',
|
key: 'split',
|
||||||
color: 'var(--x-info)',
|
color: 'var(--x-info)',
|
||||||
@@ -578,7 +600,7 @@ function ActionsSheet({ order, _tableId, isStandalone, onClose, onTransfer, onMe
|
|||||||
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
<div className="modal-overlay modal-overlay--top" onClick={onClose}>
|
||||||
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()} style={{ gap: 0 }}>
|
<div className="modal-sheet modal-sheet--top" onClick={e => e.stopPropagation()} style={{ gap: 0 }}>
|
||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title" style={{ marginBottom: 16 }}>ACTIONS</h2>
|
<h2 className="modal-title" style={{ marginBottom: 16 }}>{t('detail.btn.actions')}</h2>
|
||||||
{actions.map((a, i) => (
|
{actions.map((a, i) => (
|
||||||
<button
|
<button
|
||||||
key={i}
|
key={i}
|
||||||
@@ -1009,7 +1031,7 @@ function PayConfirmModal({ payAll, payIds, activeItems, andClose, cardEnabled, o
|
|||||||
|
|
||||||
// ─── Customer count modal ─────────────────────────────────────────────────────
|
// ─── Customer count modal ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
function CustomerCountModal({ value, onChange, onClose }) {
|
function CustomerCountModal({ value, seats, onChange, onClose }) {
|
||||||
const { t } = useTranslation('waiter')
|
const { t } = useTranslation('waiter')
|
||||||
const [count, setCount] = useState(value ?? 0)
|
const [count, setCount] = useState(value ?? 0)
|
||||||
const QUICK = [1, 2, 3, 4, 5, 6]
|
const QUICK = [1, 2, 3, 4, 5, 6]
|
||||||
@@ -1021,6 +1043,7 @@ function CustomerCountModal({ value, onChange, onClose }) {
|
|||||||
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
<p style={{ textAlign: 'center', color: 'var(--muted)', fontSize: 13, margin: '0 0 20px' }}>
|
||||||
{t('detail.guests.question')}
|
{t('detail.guests.question')}
|
||||||
</p>
|
</p>
|
||||||
|
<SeatsHint seats={seats} count={count} />
|
||||||
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
<div style={{ display: 'flex', gap: 8, justifyContent: 'center', marginBottom: 20 }}>
|
||||||
{QUICK.map(n => (
|
{QUICK.map(n => (
|
||||||
<button key={n} onClick={() => setCount(n)} style={{
|
<button key={n} onClick={() => setCount(n)} style={{
|
||||||
@@ -1057,6 +1080,7 @@ export default function TableDetailPage() {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const [table, setTable] = useState(null)
|
const [table, setTable] = useState(null)
|
||||||
|
const [closeUnpaidAllowed, setCloseUnpaidAllowed] = useState(false) // 4.8: venue setting
|
||||||
const [order, setOrder] = useState(null)
|
const [order, setOrder] = useState(null)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [paying, setPaying] = useState(false)
|
const [paying, setPaying] = useState(false)
|
||||||
@@ -1246,7 +1270,10 @@ export default function TableDetailPage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getVenueSettings()
|
getVenueSettings()
|
||||||
.then(r => setCardEnabled(r.data?.['payments.card_enabled']?.value === 'true'))
|
.then(r => {
|
||||||
|
setCardEnabled(r.data?.['payments.card_enabled']?.value === 'true')
|
||||||
|
setCloseUnpaidAllowed(r.data?.['orders.close_with_unpaid']?.value === 'true')
|
||||||
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -1648,7 +1675,7 @@ export default function TableDetailPage() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ fontSize: 14 }}>⚡</span>
|
<span style={{ fontSize: 14 }}>⚡</span>
|
||||||
<span>ACTIONS</span>
|
<span>{t('detail.btn.actions')}</span>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1867,7 +1894,7 @@ export default function TableDetailPage() {
|
|||||||
border: 'none', cursor: 'pointer',
|
border: 'none', cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>CLEAR</button>
|
>{t('detail.btn.clear')}</button>
|
||||||
|
|
||||||
{/* ALL */}
|
{/* ALL */}
|
||||||
{!allActiveSelected && (
|
{!allActiveSelected && (
|
||||||
@@ -1881,7 +1908,7 @@ export default function TableDetailPage() {
|
|||||||
border: 'none', cursor: 'pointer',
|
border: 'none', cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>ALL</button>
|
>{t('detail.btn.all')}</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* SERVED — mark selected as served */}
|
{/* SERVED — mark selected as served */}
|
||||||
@@ -1896,7 +1923,7 @@ export default function TableDetailPage() {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>SERVED</button>
|
>{t('detail.btn.served')}</button>
|
||||||
|
|
||||||
{/* ACTIONS — opens item action modal */}
|
{/* ACTIONS — opens item action modal */}
|
||||||
<button
|
<button
|
||||||
@@ -1913,7 +1940,7 @@ export default function TableDetailPage() {
|
|||||||
border: 'none', cursor: 'pointer',
|
border: 'none', cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>ACTIONS</button>
|
>{t('detail.btn.actions')}</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -1957,7 +1984,7 @@ export default function TableDetailPage() {
|
|||||||
border: 'none', cursor: 'pointer',
|
border: 'none', cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>CLEAR</button>
|
>{t('detail.btn.clear')}</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => doMarkServed(paidSelectedIds)}
|
onClick={() => doMarkServed(paidSelectedIds)}
|
||||||
@@ -1970,7 +1997,7 @@ export default function TableDetailPage() {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
fontSize: 13, fontWeight: 700, letterSpacing: 0.5,
|
||||||
}}
|
}}
|
||||||
>SERVED</button>
|
>{t('detail.btn.served')}</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -2029,7 +2056,7 @@ export default function TableDetailPage() {
|
|||||||
onClick={() => navigate(addItemsPath)}
|
onClick={() => navigate(addItemsPath)}
|
||||||
style={{ borderRadius: 999, flex: 1 }}
|
style={{ borderRadius: 999, flex: 1 }}
|
||||||
>
|
>
|
||||||
<span style={{ marginRight: 6 }}>+</span>ADD
|
<span style={{ marginRight: 6 }}>+</span>{t('detail.btn.add')}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{canPay && (
|
{canPay && (
|
||||||
@@ -2042,7 +2069,7 @@ export default function TableDetailPage() {
|
|||||||
>
|
>
|
||||||
{paying ? '…' : (
|
{paying ? '…' : (
|
||||||
<>
|
<>
|
||||||
<span>€ PAY</span>
|
<span>{t('detail.btn.pay')}</span>
|
||||||
{selectedIds.length > 0 && (
|
{selectedIds.length > 0 && (
|
||||||
<span style={{
|
<span style={{
|
||||||
background: 'rgb(var(--x-scrim-rgb) / 0.25)', color: 'var(--x-on-colour)',
|
background: 'rgb(var(--x-scrim-rgb) / 0.25)', color: 'var(--x-on-colour)',
|
||||||
@@ -2060,14 +2087,16 @@ export default function TableDetailPage() {
|
|||||||
className="btn btn--danger"
|
className="btn btn--danger"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isOffline) return
|
if (isOffline) return
|
||||||
if (!allPaid) setConfirmPayAndClose(true)
|
// unpaid items: take the payment first ("instant-pay close"), unless the venue lets
|
||||||
|
// an order close with unpaid items (they are written off; 4.8 setting)
|
||||||
|
if (!allPaid && !closeUnpaidAllowed) setConfirmPayAndClose(true)
|
||||||
else setConfirmClose(true)
|
else setConfirmClose(true)
|
||||||
}}
|
}}
|
||||||
disabled={isOffline}
|
disabled={isOffline}
|
||||||
style={{ borderRadius: 999, flex: 1, opacity: isOffline ? 0.4 : 1 }}
|
style={{ borderRadius: 999, flex: 1, opacity: isOffline ? 0.4 : 1 }}
|
||||||
title={isOffline ? t('detail.notOffline') : undefined}
|
title={isOffline ? t('detail.notOffline') : undefined}
|
||||||
>
|
>
|
||||||
<span style={{ marginRight: 6 }}>✕</span>CLOSE
|
<span style={{ marginRight: 6 }}>✕</span>{t('detail.btn.close')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -2168,6 +2197,18 @@ export default function TableDetailPage() {
|
|||||||
setItemActionTarget(null)
|
setItemActionTarget(null)
|
||||||
setCancelConfirm({ mode: 'items', ids })
|
setCancelConfirm({ mode: 'items', ids })
|
||||||
}}
|
}}
|
||||||
|
onCombine={async () => {
|
||||||
|
const ids = combineIds(itemActionTarget.items)
|
||||||
|
setItemActionTarget(null)
|
||||||
|
try {
|
||||||
|
await client.post(`/api/orders/${order.id}/items/combine`, { item_ids: ids })
|
||||||
|
setSelectedIds([])
|
||||||
|
setVirtualItems(null)
|
||||||
|
await load()
|
||||||
|
} catch (err) {
|
||||||
|
setError(apiError(err, t('detail.err.combine')))
|
||||||
|
}
|
||||||
|
}}
|
||||||
onClose={() => setItemActionTarget(null)}
|
onClose={() => setItemActionTarget(null)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -2217,6 +2258,7 @@ export default function TableDetailPage() {
|
|||||||
{customerCountOpen && (
|
{customerCountOpen && (
|
||||||
<CustomerCountModal
|
<CustomerCountModal
|
||||||
value={customerCount}
|
value={customerCount}
|
||||||
|
seats={table?.seat_count}
|
||||||
onChange={async (v) => {
|
onChange={async (v) => {
|
||||||
setCustomerCount(v)
|
setCustomerCount(v)
|
||||||
if (order) {
|
if (order) {
|
||||||
@@ -2288,14 +2330,14 @@ export default function TableDetailPage() {
|
|||||||
<div className="modal-handle" />
|
<div className="modal-handle" />
|
||||||
<h2 className="modal-title">{t('detail.close.title')}</h2>
|
<h2 className="modal-title">{t('detail.close.title')}</h2>
|
||||||
<p style={{ color: 'var(--x-ink-2)', textAlign: 'center', marginBottom: 24 }}>
|
<p style={{ color: 'var(--x-ink-2)', textAlign: 'center', marginBottom: 24 }}>
|
||||||
{t('detail.close.body')}
|
{allPaid ? t('detail.close.body') : t('detail.close.unpaid', { count: activeItems.length })}
|
||||||
</p>
|
</p>
|
||||||
<div style={{ display: 'flex', gap: 12 }}>
|
<div style={{ display: 'flex', gap: 12 }}>
|
||||||
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setConfirmClose(false)}>
|
<button className="btn btn--secondary" style={{ flex: 1 }} onClick={() => setConfirmClose(false)}>
|
||||||
{t('common.cancel')}
|
{t('common.cancel')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn--danger" style={{ flex: 1 }} onClick={closeOrder}>
|
<button className="btn btn--danger" style={{ flex: 1 }} onClick={closeOrder} data-testid="close-confirm">
|
||||||
CLOSE
|
{t('detail.btn.close')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const useTableViewStore = create(
|
|||||||
activeZoneTab: 'all',
|
activeZoneTab: 'all',
|
||||||
chipStyle: 'icon_short', // 'full' | 'short' | 'icon_full' | 'icon_short' | 'icon'
|
chipStyle: 'icon_short', // 'full' | 'short' | 'icon_full' | 'icon_short' | 'icon'
|
||||||
tabSwitcherStyle: 'text', // 'text' | 'icon'
|
tabSwitcherStyle: 'text', // 'text' | 'icon'
|
||||||
|
showSeats: true, // the table's seats on its card (4.8)
|
||||||
|
|
||||||
// Footer nav settings
|
// Footer nav settings
|
||||||
// navStyle: 'triple' | 'icon_navbar'
|
// navStyle: 'triple' | 'icon_navbar'
|
||||||
@@ -35,6 +36,7 @@ const useTableViewStore = create(
|
|||||||
setActiveZoneTab: (activeZoneTab) => set({ activeZoneTab }),
|
setActiveZoneTab: (activeZoneTab) => set({ activeZoneTab }),
|
||||||
setChipStyle: (chipStyle) => set({ chipStyle }),
|
setChipStyle: (chipStyle) => set({ chipStyle }),
|
||||||
setTabSwitcherStyle: (tabSwitcherStyle) => set({ tabSwitcherStyle }),
|
setTabSwitcherStyle: (tabSwitcherStyle) => set({ tabSwitcherStyle }),
|
||||||
|
setShowSeats: (showSeats) => set({ showSeats }),
|
||||||
setNavStyle: (navStyle) => set({ navStyle }),
|
setNavStyle: (navStyle) => set({ navStyle }),
|
||||||
setNavItems: (navItems) => set({ navItems }),
|
setNavItems: (navItems) => set({ navItems }),
|
||||||
setTripleItems: (tripleItems) => set({ tripleItems }),
|
setTripleItems: (tripleItems) => set({ tripleItems }),
|
||||||
|
|||||||
Reference in New Issue
Block a user