← back to index

U10 — Session History filteringLOCAL

Notion test-run #3 doc item #6 ("To add more filtering controls for Session History"). Adds preset chips (Today / This Week / This Month / Last 3 Months / This Year / All) + Custom date range + Shop multi-select to /cafe/pos/sessions. Default preset = "All" preserves the prior no-date-filter UX. Matches Odoo 17's POS Sessions list filter pattern.

Summary

Status
6/6 local · typecheck clean · awaiting Gate 1 approval
Repo
nix-cafe only — no migration, no backend, no schema
Files
4 modified · ~250 LOC net
URL state
?preset=&from=&to=&shop=id1,id2®ister=&page= — paste-friendly, deep-linkable, page resets on filter change

What ships

Behavior notes

6/6 local checks

period.ts: 3 new presets in PresetKey + PRESET_LABELS + PRESET_ORDER; isUnfilteredPreset helper exported
period.ts runtime: resolveReportPeriod("last_3_months") on 2026-05-27 → 2026-02-27 → 2026-05-27 (calendar-month math via Date arithmetic); "this_year" → 2026-01-01; "all" → 1970-01-01 sentinel; isUnfilteredPreset only true for "all"
listSessions: signature gains fromUtc + toUtc; applied via gte/lte on cafeSessions.openedAt
page.tsx: reads searchParams.{shop,preset,from,to}; calls resolveReportPeriod + isUnfilteredPreset; skipDateFilter ternary on DAO call; scopedShopIds derived from URL ∩ accessible shops
sessions-client.tsx: 11 literal FilterBar testids + 7 preset chip slugs in SESSION_PRESETS + ShopMultiSelect component with outside-click + Escape close
DAO probe on local lumiere: future-window (2099-01-01 → 2099-12-31) returns 0 sessions; wide-window (1970 → 2099) equals unfiltered count — confirms the filter clause is real, not a no-op

Typecheck: npx tsc --noEmit on nix-cafe → 0 errors.

Out of scope (followups)

Gate 2 plan

  1. Commit nix-cafe (single-line message).
  2. Push to karouna-dev → CF auto-deploy.
  3. test-u10-prod.mjs on lumiere: SSO → /cafe/pos/sessions → preset chips fire correctly (click each, assert URL param + result subset) → Custom range → Shop dropdown opens + closes outside-click + selections survive reload → Reset clears all.
  4. Regression sweep 51/51 (phase2-cafe-multishop solo).
  5. Publish prod gallery.