Commit graph

76 commits

Author SHA1 Message Date
SJCoetz
f15fb5b49f Add collection map date filter and unassign implementation plan 2026-07-10 00:47:11 +02:00
SJCoetz
72b2ec09e2 test(collection-pool): simplify operational sort test + correct spec reasoning 2026-07-10 00:38:31 +02:00
SJCoetz
363cdebe36 test(collection-pool): pin nearby-sort behaviour for missing coords 2026-07-10 00:36:28 +02:00
SJCoetz
7a7ad71ac0 Add collection pool nearby sort implementation plan 2026-07-10 00:34:50 +02:00
SJCoetz
8d742e5e87 Add collection pool nearby sort spec 2026-07-10 00:30:14 +02:00
SJCoetz
e5285e67df chore(collection-pool): rename labels Ready/Pending instead of Ready/Awaiting 2026-07-10 00:24:43 +02:00
SJCoetz
32194e8bb3 feat(collection-pool): require note on Mark Ready 2026-07-10 00:15:24 +02:00
SJCoetz
1698e3d05b test(collection-pool): cover MarkReadyDialog behaviour 2026-07-10 00:11:53 +02:00
SJCoetz
58d7c90e77 feat(collection-pool): add MarkReadyDialog component 2026-07-10 00:08:18 +02:00
SJCoetz
00fb9a38f0 test(collection-map): cover ready_notes required-on-ready 2026-07-10 00:05:54 +02:00
SJCoetz
13165bfb8c feat(collection-map): require ready_notes when marking ready 2026-07-10 00:04:01 +02:00
SJCoetz
4e0d45198b Add collection pool mark-ready notes implementation plan 2026-07-10 00:02:43 +02:00
SJCoetz
dbbb3e2b2c Add collection pool mark-ready notes spec 2026-07-10 00:00:40 +02:00
SJCoetz
0eef0abd92 feat(orders): make Send PO modal wider and two-column, scrollable body 2026-07-09 23:48:26 +02:00
SJCoetz
f44f090351 test(po-attachments): use node env so the 25 MB cap assertion works 2026-07-09 23:39:12 +02:00
SJCoetz
0e59d83107 feat(mcp): add purchase_orders.add_attachment tool 2026-07-09 23:37:42 +02:00
SJCoetz
a6139b7c8a chore(orders): drop unused attachmentsLoading state from Send PO panel 2026-07-09 23:34:51 +02:00
SJCoetz
14e1a12cfe feat(orders): add additional attachments panel to Send PO modal 2026-07-09 23:33:56 +02:00
SJCoetz
2b3b50596c feat(po): include additional_attachments in send-email webhook 2026-07-09 23:25:05 +02:00
SJCoetz
3c32c01bb9 feat(po-attachments): add migration for additional_attachments field 2026-07-09 23:22:23 +02:00
SJCoetz
9bc9d389ce test(po-attachments): use NextRequest instead of any cast 2026-07-09 23:20:10 +02:00
SJCoetz
1477265db9 feat(po-attachments): add delete route for PO additional attachments 2026-07-09 23:18:51 +02:00
SJCoetz
fff095caae test(po-attachments): cover delete route behaviour 2026-07-09 23:16:53 +02:00
SJCoetz
b362d92256 feat(po-attachments): add upload route for PO additional attachments 2026-07-09 23:15:08 +02:00
SJCoetz
a16b8fcdcb test(po-attachments): cover upload route behaviour 2026-07-09 23:01:55 +02:00
SJCoetz
d204a4715b feat(po): add additional_attachments to PurchaseOrder type 2026-07-09 23:01:07 +02:00
SJCoetz
3a1467fc91 Add PO additional attachments implementation plan 2026-07-09 23:00:18 +02:00
SJCoetz
e19bb7dbf7 Add PO additional attachments spec 2026-07-09 22:55:16 +02:00
SJCoetz
dfe52a62d9 fix(orders): seed Send PO body with this PO's line count, not the order's 2026-07-09 22:43:52 +02:00
SJCoetz
44db71e6d7 feat(orders): add n8n shortcut icon to Supplier POs card 2026-07-09 22:34:04 +02:00
SJCoetz
5d222ff281 feat(po-pdf): add token backfill migration script 2026-07-09 22:28:50 +02:00
SJCoetz
f146e42ed0 test(po-pdf): cover token capture + proxy routing 2026-07-09 22:23:49 +02:00
SJCoetz
6a7dcc0af2 fix(po-pdf): capture PB token on upload and route GET through proxy 2026-07-09 22:18:53 +02:00
SJCoetz
1e99d23e8b feat(po-pdf): add token field to PurchaseOrderDocumentEntry 2026-07-09 22:17:21 +02:00
SJCoetz
169c1d82c5 Add PO PDF token-vs-filename implementation plan 2026-07-09 22:15:22 +02:00
SJCoetz
538986d7db Add PO PDF token-vs-filename spec 2026-07-09 22:13:53 +02:00
SJCoetz
2bee7aa4be feat(quotes/process): load customers with company expanded for picker 2026-07-09 21:45:00 +02:00
SJCoetz
87a59fc579 Add customer-search disambiguation implementation plan 2026-07-09 21:33:07 +02:00
SJCoetz
1a3ce560c6 Add customer search company-disambiguation spec 2026-07-09 21:31:45 +02:00
SJCoetz
1992b0f4af Add new quote form redesign spec 2026-07-09 17:53:44 +02:00
SJCoetz
18334721cb feat(invoicing): add QuickBooks invoicing flow and print functionality
Add complete end-to-end QuickBooks invoicing workflow for the invoicing page:
- Add `jspdf` dependency for client-side PDF generation
- Implement updated item status handling with fallback for new invoice statuses
- Add server-side proxy API for secure QuickBooks customer lookup
- Build utilities to combine QuickBooks invoices and picking slips into a single PDF
- Add invoicing view models for row grouping, payload construction, and status checks
- Add full test coverage for all new components, APIs, and utilities
- Include feature design documentation and sample n8n workflow config
2026-07-09 09:44:55 +02:00
SJCoetz
9378685164 feat(collection-confirm): add full collection confirm workflow
Implement the complete collection confirm feature set:
- Add new `/collection-confirm` operational page for reviewing and confirming collected order items
- Add sidebar navigation entries for Collection Confirm and Invoicing
- Add `order_items` to the file proxy API whitelist for attachment access
- Install required testing dependencies and configure Vitest test setup
- Add full design documentation, test suite, and page overview screenshot
- Update package.json and build configuration files
2026-07-08 01:35:00 +02:00
SJCoetz
5f1838051f feat(collection-pool): add nearby supplier cluster sort mode
Add optional nearby-supplier cluster sort mode to the collection pool table, keeping operational sort as the default. Also includes:
- Update UserSearch component to support fallback selected label for pre-selected values
- Refactor AssignDriverDialog into a separate inner component with intent and pre-filled driver label support
- Add assignment badge helper types and functions
- Add full test coverage for new sort logic and component behaviors
- Update implementation plans and documentation files
- Fix minor code consistency and lint issues across touched files
2026-07-07 21:56:29 +02:00
SJCoetz
b9828def38 feat(collection-pool): add unified redesigned collection pool view
Remove redundant Assign Drivers top-level navigation link since driver assignment is now embedded directly in the collection pool page per-row, and add an Other nav section for leftover navigation items
Extract collection pool view logic into a dedicated view-model module with full Vitest test coverage for assignment state classification, row sorting, pool age labeling, and proximity marker grouping
Flatten the collection pool page into a single unified list replacing the old grouped assigned/unassigned layout, with updated row UI showing all required operational details and context-aware actions
Add database migration to add optional `collection_photo` field to order_items for driver pickup proof photos
Add complete design documentation, planning artifacts, and brainstorming session files for the collection pool redesign project
2026-07-07 20:49:31 +02:00
SJCoetz
17ae928331 refactor: update pool UI, fix tiles and config
overhaul the collection pool page's ready status UI: split the clickable chip into a static status indicator and dedicated toggle button with loading state, improving user clarity between status and actionable elements
update all related copy (toast messages, filter labels, button text) to use consistent "awaiting supplier confirmation" terminology across the interface
remove invalid `transparent` prop from traffic tile layers in both the collection map and traffic tiles components, update comments to reflect Leaflet does not support this option
add wildcard to allowedDevOrigins in next.config.ts to simplify local development testing across different network interfaces
add a comprehensive database backfill script to fix assigned order items missing the `ready_for_collection` flag, ensuring drivers see their correct assigned stops in the driver app
2026-07-07 18:01:43 +02:00
SJCoetz
7f924ccc45 refactor: switch hardcoded UI colors to semantic theme tokens
Overhaul the app's color system by replacing all hardcoded Tailwind color classes with semantic theme variables to ensure consistent theming across all components, pages, and tests.

Additional changes:
- Add assigned date support for order item status updates: add `assignedDate` field to the order item status PATCH API, implement server-side normalization/validation, and add corresponding tests
- Refactor purchase order PDF workflows to use the consolidated `purchase_orders.documents` field instead of the legacy separate `purchase_order_pdfs` collection
- Fix quote number parsing and formatting to support both dashed (Q-YYYY-MM-NNN) and dashless (QYYYYMMNNN) formats
- Rename `driver_pool` item status to `collection_pool` across the codebase
- Add null handling for order item quantities and pricing to display "—" for missing values
- Improve filter tab styling: make mobile tabs scrollable, prevent text wrapping, hide scrollbar
- Add new utility scripts, API routes, migrations, and polish small UI/UX fixes including tsconfig updates and theme hook improvements
2026-07-07 17:22:03 +02:00
SJCoetz
235c0ad39b fix(attachment-counts api): surface real error details instead of generic PB admin message
capture the thrown error, extract its message if available, and append it to the base "PB admin unavailable" error response. fall back to a generic unknown error message for non-Error failures, revealing actionable debugging details like missing env vars or invalid PB credentials.
2026-07-03 22:52:39 +02:00
SJCoetz
05abe499b0 feat(sprint): add new sprint pricing workflow and supporting code
Add full sprint pricing workflow and supporting infrastructure:
- New sidebar navigation entry for the sprint dashboard
- PocketBase category collection schema and migration script
- Server API routes for sprint item claims, attachments, counts, and file proxying
- Dev identity utilities and UI switcher for multi-user testing
- Reusable FilterTabs component replacing ItemStatusTabs
- Updated TypeScript types for sprint-related entities

Also include:
- Fix PocketBase file URL method casing (getUrl → getURL) across codebase
- Add development utility, smoke test, and helper scripts
- Update package.json with new sprint migration command
2026-07-03 07:29:43 +02:00
SJCoetz
9cdcb3b096 feat: implement sku-based catalogue pricing matching workflow
This commit adds the full end-to-end SKU pricing match flow for quote items:
- Add new QuoteItem and PriceListRow fields for SKU and pricing metadata
- Add sku_normalised to price_list for robust format-agnostic SKU matching
- Refactor price list search to use modular search builder and filter helpers
- Add database migrations, backfill scripts, and new package commands
- Update catalogue search UI and fix quote list accidental click behavior
- Add comprehensive unit, smoke, and end-to-end test suites
- Update documentation for the new price search and extraction logic
2026-06-30 21:20:53 +02:00
SJCoetz
1fb67efaee feat(pricelist): Catalogue search hits every field (incl. synonyms)
The Catalogue tab's search box used to OR across just sku,
description, and brand. Now it hits:

  - sku, description, brand, supplier, category, subcategory
    (PB's case-insensitive `~` operator, each indexed)
  - search_text (a denormalised text blob)

The denormalised column is the key part: PB can't substring-
match a JSON field, so without this, synonyms from
`specifications.synonyms` ("slugger cutter", "turbo tough",
etc.) would never match in the search box. The n8n workflow's
Code node now flattens every searchable bit — including the
synonyms array — into search_text on every POST. The 46 pre-
existing rows were backfilled once with the same formula.

The `price_list.supplier` field also stored the PB id on the
46 pre-existing rows (n8n was setting the resolved name, but
the original LLM tests that seeded the table didn't). Fixed
that in the same backfill — supplier now reads 'JEISA -
WESTSCOTT GROUP' instead of 'q6hpwbxsicyoiuu', which makes
the supplier filter dropdown work AND makes
'supplier ~ "jeisa"' match.

Migration `2026-06-30-add-price-list-search-text`:
  - Adds `search_text` (text) column
  - Adds `idx_pl_search_text` non-unique index
  - Idempotent — re-runs are safe and self-heal the index

Updates:
  - `getPriceLists` helper ORs across all 6 columns + search_text
  - `PriceList` TS type gains `search_text: string`
  - `pricelist-extraction.md` Code node snippet shows how the
    n8n workflow should populate `search_text` on every POST
  - Search input placeholder reads 'Search anything — SKU,
    description, brand, supplier, synonyms…'

Tests: 229/230 (same pre-existing failure, unrelated).
TypeScript clean.
2026-06-30 12:10:27 +02:00