feat: the table map (platform-v2 step 6.8, D-31)

- floor_plans / floor_items (0035), tables' plan_id + width/height/rotation/shape;
  /api/floor-plans (set-up, catalog.tables.manage, floor_plans.changed) and
  /api/floor-plans/live (each table's state, guests, waiters, time; zone rule)
- @xenia/floorplan: the drawing (Floor, Item, TableShape, FloorView) and its geometry
  (grid snap in whole cells, outlines, chairs), tested
- manager: Management -> Tables -> Floor plans (editor: drag, grid, irregular floor,
  walls/bar/labels/areas, background picture), Tables page List / Map
- counter POS: Tables List / Map; waiter: Map mode, the list stays the default
- tests: test_floor_plans.py, floor + geometry unit tests, manager/waiter/terminal e2e

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 17:00:45 +02:00
co-authored by Claude Opus 5.5
parent fd3254aa31
commit f4aae6abbc
47 changed files with 2102 additions and 8 deletions
+20
View File
@@ -522,6 +522,26 @@ try {
return card?.dataset.state === 'open' && card.textContent.includes(due)
}, [phoneTable.id, (2 * simple.price).toFixed(2)], { timeout: 8000 }).then(() => true).catch(() => false))
await page.screenshot({ path: path.join(OUT, 'terminal-pos-tables.png') })
// ── 6.8: the floor plan at the counter, with live states ──────────────────
const third = counterTables.find(t => !t.order && mariaTables.has(t.id) && t.id !== shared.id && t.id !== phoneTable.id)
const fp = await api('POST', '/api/floor-plans', { token: boss, body: { name: 'E2E floor', width: 1000, height: 600, grid_on: true, grid_size: 50 } })
await api('PUT', `/api/floor-plans/${fp.id}/layout`, { token: boss, body: {
tables: [shared, phoneTable, third].map((t, i) => ({ id: t.id, x: 200 + i * 250, y: 300, width: 100, height: 100, shape: i === 1 ? 'round' : 'square', seats: 4 })),
items: [{ kind: 'bar', x: 500, y: 60, width: 400, height: 60 }] } })
await page.getByTestId('pos-tables-map').click()
const mapTable = id => page.locator(`[data-testid="pos-floor"] [data-testid="floor-table"][data-table="${id}"]`)
r.check("6.8: the counter shows the floor plan: the phone's table open, the others free", await mapTable(phoneTable.id).waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
&& await mapTable(phoneTable.id).getAttribute('data-state') === 'open' && await mapTable(shared.id).getAttribute('data-state') === 'free')
const thirdOrder = await api('POST', '/api/orders/', { token: maria, body: { table_id: third.id } })
await api('POST', `/api/orders/${thirdOrder.id}/items`, { token: maria, body: { lines: [{ product_id: simple.id, quantity: 1 }] } })
r.check("6.8: a table opened on the phone turns open on the counter's map at once", await page.waitForFunction(id =>
document.querySelector(`[data-testid="pos-floor"] [data-testid="floor-table"][data-table="${id}"]`)?.dataset.state === 'open', third.id, { timeout: 8000 }).then(() => true).catch(() => false))
await page.screenshot({ path: path.join(OUT, 'terminal-pos-floor.png') })
await mapTable(third.id).click()
r.check('6.8: a tap on the map opens the table', await shown(page, 'table-panel', 5000) && Number(await page.getByTestId('table-panel').getAttribute('data-order')) === thirdOrder.id)
await page.getByTestId('mode-tables').click()
await page.getByTestId('pos-tables-list').click().catch(() => {})
phoneWs.close()
// ── 3.3d: online orders on the POS ──────────────────────────────────────