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
+10 -4
View File
@@ -10,7 +10,8 @@ import useChatStore from '../store/chatStore'
import useKdsReadyStore from '../store/kdsReadyStore'
import useInstallPromptStore, { apkAvailable } from '../store/installPromptStore'
import useOfflineQueueCount from '../hooks/useOfflineQueueCount'
import useFailedPrintCount from '../hooks/useFailedPrintCount'
import usePrintProblems from '../hooks/usePrintProblems'
import PrintProblemsSheet from './PrintProblemsSheet'
import { fade } from '../logic/colour'
// ─── Nav item registry ────────────────────────────────────────────────────────
@@ -148,6 +149,7 @@ function FailedPrintButton({ count, onClick }) {
return (
<button
onClick={onClick}
data-testid="print-problems-button"
style={{
position: 'relative',
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
@@ -650,7 +652,8 @@ export default function AppShell({ children, title, rightActions }) {
const { totalUnread: chatUnread } = useChatStore()
const { readyCount } = useKdsReadyStore()
const offlineCacheCount = useOfflineQueueCount()
const failedPrintCount = useFailedPrintCount()
const prints = usePrintProblems() // 6.10: tickets that didn't print, live
const [showPrints, setShowPrints] = useState(false)
function openNotifs() {
setShowNotifs(true)
@@ -690,8 +693,8 @@ export default function AppShell({ children, title, rightActions }) {
{/* Offline cache badge — visible only when ops are pending */}
<CacheButton count={offlineCacheCount} />
{/* Failed print badge — navigates to order log */}
<FailedPrintButton count={failedPrintCount} onClick={() => navigate('/order-log?filter=failed')} />
{/* Tickets that didn't print (6.10): opens them with what can be done */}
<FailedPrintButton count={prints.problems.length} onClick={() => setShowPrints(true)} />
{/* Bell */}
<BellButton onClick={openNotifs} count={unreadCount || 0} />
@@ -700,6 +703,9 @@ export default function AppShell({ children, title, rightActions }) {
<UserMenu />
</header>
{showPrints && <PrintProblemsSheet problems={prints.problems} printers={prints.printers}
onChanged={prints.reload} onClose={() => setShowPrints(false)} />}
{/* ── Side drawer ───────────────────────────────────────── */}
<SideDrawer open={drawerOpen} onClose={() => setDrawerOpen(false)} />