WFDASH-WEBAPP/src/lib
Dave c0e6ad2099 fix(delivery-notes): merge cancelled into completed, and fix the search
Tabs
- Cancelled no longer has its own tab. The operator asked for it to
  sit under the done heading with a filter between the two, rather
  than spending a tab on a small cold set nobody visits. Tabs are
  now Active | Completed | All.
- Inside Completed, an always-visible Completed / Cancelled / Both
  sub-filter, each option carrying its own count. It is rendered in
  the open, not behind a click — an invisible control on this screen
  was the original "what does that do?" complaint, so a hidden
  filter would have reintroduced it. Defaults to "both" so the tab's
  count and its rows always reconcile.
- Cancelled keeps a red badge, and no row tint. It now shares a tab
  with Completed, so the two must be distinguishable at a glance
  without opening each row.

Search (was quietly broken)
- It only covered `delivery_note_number` and `notes`. Customer name,
  company and order number were NOT searched — so "what's
  outstanding for Acme", the first thing anyone types on a list
  grouped by company, returned nothing.
- The search term was never escaped into the PocketBase filter,
  while the `repId` clause directly below it escapes its quotes. A
  customer called `Acme "Ltd"`, or any stray double quote, produced
  a malformed filter and a list that failed to load.
- Search is now client-side over the already-fetched notes, which
  carry customer / company / order expanded. Covers DN number, order
  number, customer, company, the customer's own PO and notes. Every
  word in a multi-word query must match somewhere on the row, so
  "acme bolt" narrows rather than returning nothing. No round trip
  per keystroke.

Also removed
- Dead pagination state. The page fetched a single wide page and
  handed the DataTable page={1} totalPages={1} with a no-op
  onPageChange, so page/setPage/totalPages could never do anything.
  That also retires the `setPage(1)` the search handler was calling.

Empty state now distinguishes "nothing matches your search" (and
names what is searchable) from "nothing on this tab".

Tests
- 30 in delivery-note-stage.test.ts, covering the search matcher and
  the tab/sub-filter bucketing. Verified they bite by reverting the
  search to its old two-field coverage: 5 fail.
- matchesDoneFilter refuses an in-flight status even under "both".
  It didn't need to — the filter only runs inside the Completed tab —
  but a function that would return a draft for "both" relies on its
  call site staying correct, so it now guards itself.

Full suite: 3630 passing. tsc clean. No new lint warnings.
2026-10-04 23:29:48 +02:00
..
pdf fix(delivery-note): signed copy invisible, and a bigger QR in the corner 2026-10-04 17:00:30 +02:00
reports feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
scan fix(scan): the QR was being downscaled below its own resolution 2026-10-04 13:51:44 +02:00
server feat(delivery-notes): review pricing before a quote is created 2026-10-04 21:17:31 +02:00
audit-fetch.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-fetch.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-format.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-format.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
delivery-note-stage.test.ts fix(delivery-notes): merge cancelled into completed, and fix the search 2026-10-04 23:29:48 +02:00
delivery-note-stage.ts fix(delivery-notes): merge cancelled into completed, and fix the search 2026-10-04 23:29:48 +02:00
dev-identity.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
dev-identity.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
file-fields.test.ts fix(delivery-note): signed copy invisible, and a bigger QR in the corner 2026-10-04 17:00:30 +02:00
file-fields.ts fix(delivery-note): signed copy invisible, and a bigger QR in the corner 2026-10-04 17:00:30 +02:00
geo.test.ts feat(visits): batch pin tool — tag every customer on a shaft at once 2026-09-07 08:30:23 +02:00
geo.ts feat(visits): batch pin tool — tag every customer on a shaft at once 2026-09-07 08:30:23 +02:00
giellie-image.ts feat(giellie): chat UI, approval card, photo/file composer, sidebar rename 2026-10-01 00:06:50 +02:00
giellie-sse.test.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-sse.ts feat(giellie): shared types and SSE codec 2026-09-30 23:34:53 +02:00
giellie-types.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
item-status-ui.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
item-status-ui.ts Revert "feat(orders): add Duplicates tab surfacing flagged duplicate orders" 2026-08-31 16:34:37 +02:00
letterhead.test.ts feat(delivery-notes): standardize delivery-note letterhead across PDFs 2026-08-18 11:53:25 +02:00
letterhead.ts fix(pdf): render through renderToBuffer, not pdf().toString() 2026-10-04 13:14:59 +02:00
order-age.test.ts feat(orders): add order-age util with bucket thresholds 2026-09-01 01:58:46 +02:00
order-age.ts feat(orders): add order-age util with bucket thresholds 2026-09-01 01:58:46 +02:00
order-color.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
order-color.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
order-invoices.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
order-invoices.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
order-item-qty.test.ts fix(orders): bill the customer quantity, not the supplier order_qty 2026-08-30 18:28:33 +02:00
order-item-qty.ts fix(orders): bill the customer quantity, not the supplier order_qty 2026-08-30 18:28:33 +02:00
order-rep.test.ts feat(orders): show resolved sales rep name on order list and sprint 2026-08-04 08:50:54 +02:00
order-rep.ts feat(orders): show resolved sales rep name on order list and sprint 2026-08-04 08:50:54 +02:00
pb-helpers-duplicate.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
pb-helpers.ts fix(delivery-notes): merge cancelled into completed, and fix the search 2026-10-04 23:29:48 +02:00
pin-model.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
placeholder-customers.ts feat: collection-map updates, todays-stops, quote/approval rework, buyer-tasks, e2e 2026-08-03 09:33:45 +02:00
pocketbase.ts fix(tests): mock scaffold destructure + collection-pool + pocketbase startup 2026-07-31 00:01:24 +02:00
pos-inline-handlers.test.ts fix(pos): revive the dead "Print cash-up" button, add 20c/10c denominations 2026-09-19 07:30:11 +02:00
price-list-search.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
quote-pricing.test.ts feat(delivery-notes): review pricing before a quote is created 2026-10-04 21:17:31 +02:00
quote-pricing.ts feat(delivery-notes): review pricing before a quote is created 2026-10-04 21:17:31 +02:00
quote-status.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
quote-status.ts feat(quotes): allow resubmit from any post-submit status, not just rejected 2026-09-07 16:51:55 +02:00
rep-visibility.test.ts feat: add isRepUser helper for rep-scoped list filtering 2026-08-31 23:24:25 +02:00
rep-visibility.ts feat: add isRepUser helper for rep-scoped list filtering 2026-08-31 23:24:25 +02:00
repair-document-stage.test.ts feat(stock): update pricing logic and transform script for fasteners 2026-09-21 12:32:44 +02:00
repair-document-stage.ts feat(stock): update pricing logic and transform script for fasteners 2026-09-21 12:32:44 +02:00
safe-next-path.ts fix: preserve destination through the login redirect 2026-09-01 15:47:27 +02:00
sops.ts feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
stock-fulfillment.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-fulfillment.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-low-stock.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-match.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-status.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-status.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
supplier-color.test.ts fix(buyer-tasks): generate PO succeeds + supplier stripe + PO badge 2026-07-30 15:00:18 +02:00
supplier-color.ts fix(buyer-tasks): generate PO succeeds + supplier stripe + PO badge 2026-07-30 15:00:18 +02:00
theme-types.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
themes.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
tracker-parsing.test.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
tracker-parsing.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
types.ts fix(delivery-note): signed copy invisible, and a bigger QR in the corner 2026-10-04 17:00:30 +02:00
use-boolean-preference.ts feat(invoicing): implement detailed view toggle for supplier and PO number 2026-08-16 11:01:52 +02:00
use-split-ratio.test.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
use-split-ratio.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
use-theme-id.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
user-color.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
utils.test.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
utils.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
visit-matching.test.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
visit-matching.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
visit-stops.test.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
visit-stops.ts feat(rep-visits): FleetAI tracker adapter, nearby-customer matching, stop detection 2026-09-06 14:22:28 +02:00
working-days.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00