feat(tills): per-till activity log, wash bucket on the booth Z-report, wash-desk printer role
Closes the three known follow-ups of the Tills decision (venue-modules.md): - Activity log per till: `tillOfEvent(type, payload)` in @parking/shared (money events by payload till, other events by their owning module's till, everything else booth), applied by `/api/events?till=` in SQL and passed by the hub log, the Drawer "today" panel and the booth feed (history + live pushes). The events route admits a role that holds a module feed permission without event:read and returns only that module's event types — the live-socket rule. - Booth Z-report: `chargesByModuleMinor` sums the chargeLines on the till's payments by module; the ticket bucket excludes them (Bileta = parking only); printed "Lavazh (në biletë)" only when any was taken. The wash till's slip prints "Lavazh:". - Printer role `wash-desk`: the wash till's Z-report and vouchers print there, falling back to the booth printer; nothing falls back to the desk. `printerRoleOf()` is the one reading of the role field (the entry/booth loaders treated any non-booth role as an entry dispenser). Footer label "at wash desk". Also: `GET /api/carwash/settings` opens to carwash:read OR site:read (new requireAnyPermission) — the Wash operator job could not load the desk's category and service pickers. Tests for all four; wiki (shift, printer-roles-failover, venue-modules, log) updated. Claude-Session: https://claude.ai/code/session_01FWncR69HgGPuei1dLrW3cU
This commit is contained in:
@@ -1926,6 +1926,17 @@ export function watchPermissions(effective: readonly ModuleId[]): Permission[] {
|
||||
}
|
||||
|
||||
/** Which tills a role may work more than one of — the composer's "mixes desks" lint. */
|
||||
/** The till an event's ACTIVITY belongs to, for a shift's log: a money event names its
|
||||
* till (`tillOf`); any other event belongs to the till of the module that owns its type
|
||||
* (a `carwash_order` is wash-desk activity even though no money moved); everything
|
||||
* else — entries, exits, barrier commands, pre-till events — is the booth's. The
|
||||
* server's `/api/events?till=` filter and the web feeds share this one rule. */
|
||||
export function tillOfEvent(type: LedgerEventType, payload: { till?: TillId } | null | undefined): TillId {
|
||||
if (payload?.till) return payload.till;
|
||||
const m = MODULES.find((x) => x.ledgerEventTypes.includes(type));
|
||||
return m?.till ?? BOOTH_TILL;
|
||||
}
|
||||
|
||||
export function tillsWorkableBy(effective: readonly ModuleId[], has: (p: Permission) => boolean): TillId[] {
|
||||
return tillsFor(effective, has, "shift");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user