← All tests

Ticket number format + metric card padding STAGING

Narong's Order Management item 10 (red-flagged 2026-07-24) and item 5. nix-cafe only. No migration.

His asks:

The ticket number

Order numbers are stored as {prefix}-{seq}POS07-0003 (Pro), BKK1-0003 (Starter shop code) or F-0003 (operator register prefix). Every surface was rendering the whole string. Now the sequence leads, because that's the number staff and customers actually say out loud.

SurfaceBeforeAfter
Order Management table#POS1000000000-0002#0002 + Register 1000000000
Order details modalsame, in the header#0002 (large) + register
Kitchen Display (wall screen)POS1000000000-0002#0002 + register
Printed customer receiptOrder: POS…-0002Order: #0002 (1000000000)
Printed kitchen ticket (KOT)Order: POS…-0002same treatment

Why the register prefix is kept, not dropped

The sequence resets per register per day — and every shop on staging runs two registers. A bare #0002 would therefore appear on two different live tickets in the same shop on the same day, which staff couldn't tell apart. So the sequence is shown prominently with the register beside it rather than the prefix being removed outright.

Order Management with short ticket numbers
Order Management on get-coffee.staging — the Ticket # column leads with the sequence, register underneath, and the metric cards have padding again.
customer receipt preview
Printed customer receipt — verified through its print preview, so the actual paper output is asserted, not just the screen.
kitchen ticket preview
Printed kitchen ticket (KOT) — same, via its preview.

The metric cards — a real defect, not a style tweak

The shared Card component ships with no padding of its own; every caller supplies it (p-10 for the empty state, an explicit padding: 0 for the table). The Metric card passed none, so its content sat flush against the border — exactly "chopped off/have no margins". Now p-5, matching the dashboard KPI cards. The test asserts computed paddingLeft rather than eyeballing it.

One parser, not two

A helper for this already existed — shortenOrderNumber in lib/order-number.ts, used by the POS tab strip and orders history. Its docstring even recorded the old policy: "receipts, Kitchen Display and exports stay on the full prefixed form" — precisely what Narong reversed. So the new parseTicketNumber lives in that same file and shortenOrderNumber now delegates to it, rather than a second copy being introduced. (A duplicated date helper is what forced this morning's timezone bug to be fixed in two places.)

Legacy order numbers pass through untouched

Real rows exist with a dash inside the prefix and a non-numeric suffix — e.g. LEGACY-1778337843955-A, UNIQ-1778337843955-B. These don't match {prefix}-{digits} and are rendered unchanged rather than mangled. There's an explicit test for it, and one is visible in the local screenshot as #UNIQ-….

Checks

SuiteResult
Local — parser across all 3 shapes + legacy + nullish, shortenOrderNumber regression guard, DOM + computed padding7/7
Staging — table, register qualifier, padding, printed receipt, printed KOT6/6
Staging smoke5/5
tsc --noEmitclean

The assertions are self-proving: each checks that no cell or printed body still matches POS\d+-\d+, which would have failed outright on the old code.

nix-cafe staging 7df13ac (Worker 2ff313d7). No migration. Parked for the scheduled prod promote. ⚠️ This is the first change in the bundle that alters printed output customers physically receive — worth Narong printing one on staging before the promote.