feat: printing problems shown and handled; printing set-up on v2 (platform-v2 step 6.10)

- a ticket that doesn't print is a problem for whoever sent it and the managers:
  GET /api/print-problems (the order, table, dishes, printer, since when, tries,
  last error, who sent it) and three ways out: print again, send to another
  printer, handled (services/print_problems.py; print_jobs.resolved_by /
  redirected_to, Alembic 0036); live event print.problems from the print paths
- phone: the red printer button opens the problems sheet, the table page warns
  (usePrintProblems replaces the 8 s poll); counter POS: a red button under the
  modes with the shared panel (@xenia/ordering PrintProblemsPanel + pure rules);
  manager: a card on the overview (top), the Tables page and the order page
- manager: Settings -> Printing (printers with reachability, test print, network
  scan; ticket layout + test ticket, beep, fonts with previews, dot leader,
  dividers) and Management -> Prep zones (cards + zone dialog with the ticket
  language, printers, copies, sorting, category order, kitchen screen) rebuilt in
  src/pages/printing; v1 PrintFontsTab, PrepZonesConfigPage, PendingPrints and
  /api/orders/pending-prints removed
- access: printer add/edit/delete/scan need core.settings.manage, prep zone
  changes catalog.menu.manage (were any dashboard user)
- tests: test_print_problems.py, @xenia/ordering printProblems, manager
  printing.test.mjs, e2e print_problems.mjs (done-when) + manager.mjs printing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 01:40:07 +02:00
co-authored by Claude Opus 5.5
parent 070c9cf625
commit f31bdf42aa
57 changed files with 2557 additions and 2221 deletions
+44
View File
@@ -1056,6 +1056,50 @@ try {
await page.screenshot({ path: path.join(OUT, 'manager-tables.png'), fullPage: true })
await api('PATCH', `/api/reservations/${kept.id}/status`, { token: boss, body: { status: 'cancelled' } }).catch(() => {})
// ── 6.10: printers, the ticket's look and prep zones on v2 ───────────────────
const pz = 'printing:'
const settingValue2 = async key => (await api('GET', '/api/settings/', { token: boss }))[key]?.value
await page.goto(`${APP}/settings`)
await page.getByText('Printing', { exact: true }).click()
await page.getByTestId('printers-card').waitFor({ timeout: 10_000 }).catch(() => {})
await page.getByTestId('printer-new').click()
await page.getByTestId('printer-save').click()
r.check(`${pz} a printer without a name or address isn't saved (the form says why)`, await page.getByTestId('printer-dialog').count() === 1
&& (await page.getByTestId('printer-dialog').textContent()).includes('192.168.1.50'))
await page.getByTestId('printer-name').fill('E2E Grill')
await page.getByTestId('printer-ip').fill('192.168.77.9')
await page.getByTestId('printer-save').click()
const grillRow = page.locator('[data-testid="printer-row"][data-name="E2E Grill"]')
const listed = await grillRow.waitFor({ timeout: 8000 }).then(() => true).catch(() => false)
const grill = (await api('GET', '/api/system/printers', { token: boss })).find(p => p.name === 'E2E Grill')
r.check(`${pz} a printer is added in Settings → Printing`, listed && grill?.ip_address === '192.168.77.9' && grill.port === 9100, JSON.stringify(grill))
await page.getByTestId('font-item_name').getByRole('button', { name: 'CAPITALS' }).click()
await page.getByTestId('ticket-beep').locator('[data-value="triple"]').click()
let fontNow = null
for (let i = 0; i < 20 && fontNow !== '16:1:1'; i++) { await sleep(250); fontNow = await settingValue2('print.font_item_name') }
r.check(`${pz} the dish name in capitals and a triple beep are saved`, fontNow === '16:1:1' && await settingValue2('print.beep_pattern') === 'triple', fontNow)
await page.screenshot({ path: path.join(OUT, 'manager-printing.png'), fullPage: true })
await api('PUT', '/api/settings/print.font_item_name', { token: boss, body: { value: '16:1:0' } })
await api('PUT', '/api/settings/print.beep_pattern', { token: boss, body: { value: 'double' } })
// a prep zone printing on it, ticket in Greek, grouped by category
await page.goto(`${APP}/management/prep-zones`)
await page.getByTestId('zone-new').click()
await page.getByTestId('zone-save').click()
r.check(`${pz} a zone needs a name`, await page.getByTestId('zone-dialog').count() === 1)
await page.getByTestId('zone-name').fill('E2E Grill zone')
await page.getByTestId('zone-main').selectOption(String(grill.id))
await page.getByTestId('zone-language').selectOption('el')
await page.getByTestId('zone-dialog').getByRole('switch', { name: 'Grouped by category' }).click()
await page.getByTestId('zone-save').click()
const zoneCard = page.locator('[data-testid="zone-card"][data-name="E2E Grill zone"]')
await zoneCard.waitFor({ timeout: 8000 }).catch(() => {})
const savedZone = (await api('GET', '/api/prep-zones', { token: boss })).find(z => z.name === 'E2E Grill zone')
r.check(`${pz} the zone is made: main printer, Greek tickets, grouped by category`, await zoneCard.waitFor({ timeout: 8000 }).then(() => true).catch(() => false)
&& savedZone?.master_printer_id === grill.id && savedZone.language === 'el' && savedZone.group_by_category === true && savedZone.auto_print === 'master', JSON.stringify(savedZone))
await page.screenshot({ path: path.join(OUT, 'manager-prep-zones.png'), fullPage: true })
if (savedZone) await api('DELETE', `/api/prep-zones/${savedZone.id}`, { token: boss })
if (grill) await api('DELETE', `/api/system/printers/${grill.id}`, { token: boss })
await api('PUT', '/api/platform/modules/connect_orders', { token: boss, body: { enabled: true } })
await page.goto(`${APP}/online-orders`)
await page.getByTestId('online-orders').waitFor({ timeout: 10_000 }).catch(() => {})