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:
@@ -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 { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import useThemeStore from '../store/themeStore'
|
||||
import useTableViewStore from '../store/tableViewStore'
|
||||
import useTableColourStore from '../store/tableColourStore'
|
||||
import { assetUrl } from '../config/server'
|
||||
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 ────────────────────────────────────────────────────────────
|
||||
|
||||
// 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,
|
||||
position: 'relative', zIndex: 2,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</div>
|
||||
|
||||
{/* 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,
|
||||
position: 'relative', zIndex: 2,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
@@ -397,7 +417,7 @@ function Card2x2({ table, order, flags, _waiterObjects, cfg, statusKey, kdsBadge
|
||||
fontSize: 'clamp(22px, 5.5vw, 36px)', fontWeight: 800,
|
||||
lineHeight: 1.05, color: cfg.nameText, letterSpacing: -0.5,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</span>
|
||||
<div style={{ marginTop: 5 }}>
|
||||
<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,
|
||||
position: 'relative', zIndex: 2,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</div>
|
||||
|
||||
{/* separator dot */}
|
||||
@@ -506,7 +526,7 @@ function Card4x2({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
fontWeight: 800, fontSize: 'clamp(30px, 7vw, 44px)',
|
||||
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</div>
|
||||
{groupName && (
|
||||
<div style={{
|
||||
@@ -604,7 +624,7 @@ function Card4x3({ table, order, flags, waiterObjects, groupName, cfg, statusKey
|
||||
fontWeight: 800, fontSize: 'clamp(28px, 6vw, 40px)',
|
||||
letterSpacing: -1.5, lineHeight: 1, color: cfg.nameText,
|
||||
}}>
|
||||
{table.label || `T${table.number}`}
|
||||
{table.label || `T${table.number}`}<SeatCount table={table} />
|
||||
</div>
|
||||
{groupName && (
|
||||
<div style={{
|
||||
|
||||
Reference in New Issue
Block a user