feat(waiter): where each line came from; QR lines marked, the QR message opens the table (platform-v2 step 4.8b)

- order_items.source (Alembic 0025): waiter | counter | qr | online, set by the server
  (orders.add_priced_items: the phone / manager 'waiter', the counter 'counter'; the QR
  menu's lines 'qr', online orders 'online'; a split line keeps its source); lines of
  existing online orders backfilled 'online'; in the order's item output.
- Waiter: lines the guests sent from the QR menu (or an online order) carry a "📱 QR" /
  "🌐 Online" mark; the qr_order message's banner has "Open the table", and in the bell's
  list the message opens it.
- Tests: source per channel, migration 0025, QR placement marks 'qr'; waiter e2e +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 09:59:57 +02:00
co-authored by Claude Opus 5.5
parent 198f8ff571
commit 1e8271e370
15 changed files with 124 additions and 9 deletions
+12 -1
View File
@@ -7,7 +7,8 @@
// node waiter.mjs
import path from 'node:path'
import { chromium } from 'playwright'
import { BROWSER_CHANNEL, OUT, reporter, sleep, waitFor } from './lib/env.mjs'
import { execFileSync } from 'node:child_process'
import { BROWSER_CHANNEL, OUT, PYTHON, reporter, sleep, waitFor } from './lib/env.mjs'
import { login, startBackend, startViteNative } from './lib/proc.mjs'
const backend = await startBackend({ port: 8061, siteId: 'test-site-1', env: { LICENSE_MODE: 'off' } })
@@ -301,6 +302,16 @@ try {
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')
// a line the guests sent from the QR menu is marked on the phone (the QR flow itself: qr_table.mjs)
const o7 = await api('POST', '/api/orders/', { token: tokenA, body: { table_id: t6.id } })
await api('POST', `/api/orders/${o7.id}/items`, { token: tokenA, body: { lines: [{ product_id: plain.id, quantity: 1 }, { product_id: other.id, quantity: 1 }] } })
execFileSync(PYTHON, ['-c', `import sqlite3; c = sqlite3.connect(r"${path.join(backend.dataDir, 'pos.db')}"); c.execute("update order_items set source = 'qr' where order_id = ${o7.id} and product_id = ${other.id}"); c.commit()`])
await a.goto(`${APP}/tables/${t6.id}`)
r.check("4.8: the QR menu's lines are marked on the waiter's order", await shown(a, 'item-source', 10_000)
&& await a.getByTestId('item-source').count() === 1 && await a.getByTestId('item-source').getAttribute('data-source') === 'qr')
await setting(boss, 'orders.close_with_unpaid', 'true')
await api('POST', `/api/orders/${o7.id}/close`, { token: boss })
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`)