feat: call a waiter from a menu tablet at a table (platform-v2 step 5.7b)
- backend: menu tablet device config `table` (ref, validated against active
tables) and `call_waiter`; GET /api/menu-tablet/menu gives the table and
whether it can call; POST /api/menu-tablet/call sends a `table_call` staff
message ("Table 5: the guests call a waiter.", venue language) to the table's
waiters (its open order's, else the zone's), at most once a minute per tablet
(menu_tablet.call_too_soon with the seconds left; menu_tablet.no_table).
- terminal: "Call a waiter" only on a tablet at a table; "A waiter is on the
way to table 5", then a countdown before it can call again; a failed call
says to ask at the counter.
- waiter: the call shows with its own look and "Open the table".
- manager: tables as the choices of a device setting.
- tests: backend +2 (535 → 533 passed total), e2e menu_tablet.mjs +3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import client from '../../api/client'
|
||||
import { configGroups, configValue, refOptions } from './devicesLogic'
|
||||
|
||||
// Where a `ref` field's choices come from (the device list is passed in)
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers', display_looks: '/api/display/looks', signage_playlists: '/api/signage/playlists', signage_schedules: '/api/signage/schedules' }
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers', display_looks: '/api/display/looks', signage_playlists: '/api/signage/playlists', signage_schedules: '/api/signage/schedules', tables: '/api/tables/' }
|
||||
|
||||
export default function DeviceConfigFields({ appKey, fields = [], value, onChange, devices = [], selfId = null }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -31,6 +31,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
const looks = lists.display_looks ?? []
|
||||
const playlists = lists.signage_playlists ?? []
|
||||
const schedules = lists.signage_schedules ?? []
|
||||
const tables = lists.tables ?? []
|
||||
|
||||
if (!fields.length) return null
|
||||
const base = key => `modules:${appKey}.config.${key}`
|
||||
@@ -56,7 +57,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
<Field key={f.key} label={label} hint={hint}>
|
||||
<Select value={v == null ? '' : String(v)} onChange={e => set(f, e.target.value)} data-config={f.key}
|
||||
options={[{ value: '', label: t(`${base(f.key)}.none`, { defaultValue: t('devices.form.none') }) },
|
||||
...refOptions(f, { zones, categories, printers, looks, playlists, schedules, devices, selfId })]} />
|
||||
...refOptions(f, { zones, categories, printers, looks, playlists, schedules, tables, devices, selfId })]} />
|
||||
</Field>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ export function configGroups(fields = []) {
|
||||
}
|
||||
|
||||
/** Options of a `ref` field: prep zones, categories, printers, customer display looks, or live devices of one app ("devices:<app>"). */
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], looks = [], playlists = [], schedules = [], devices = [], selfId = null } = {}) {
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], looks = [], playlists = [], schedules = [], tables = [], devices = [], selfId = null } = {}) {
|
||||
if (field.choices_from === 'tables') return tables.filter(x => x.is_active !== false).map(x => ({ value: String(x.id), label: x.label || String(x.number) }))
|
||||
if (field.choices_from === 'signage_schedules') return schedules.map(s => ({ value: String(s.id), label: s.name }))
|
||||
if (field.choices_from === 'signage_playlists') return playlists.map(p => ({ value: String(p.id), label: p.name }))
|
||||
if (field.choices_from === 'display_looks') return looks.map(l => ({ value: String(l.id), label: l.name }))
|
||||
|
||||
Reference in New Issue
Block a user