WFDASH-WEBAPP/src/app
Dave 924f7b764e fix: uploads to an order line add files instead of replacing them
A PocketBase file PATCH under the bare field name replaces the whole
list. On 2026-10-19 a buyer's "Add supplier invoice" on PO202610008LIF
deleted the driver's delivery-note photo (uploaded 14:38, read by the AI
14:40, replaced 14:41). Generating or regenerating a delivery-note PDF
did the same to every line on the DN.

- New src/lib/server/order-item-files.ts: addAttachmentForm() adds with
  `order_item_attachements+` and removes (`-`) only older stored copies
  of the same document; pickStoredCopy() finds a file by its uploaded
  name (PB stores "DN26101913.pdf" as "dn26101913_<10>.pdf").
- Used by the Collection Confirm invoice upload, DN create, DN regenerate
  (replaces only its own previous PDF) and /api/invoicing/delivery-note.
- /api/invoicing/delivery-note-pdf finds the DN PDF by name instead of
  taking the line's first file (falls back to the old behaviour for
  legacy names).
- AGENTS.md: always add, never replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:46:37 +02:00
..
(app) feat(collection-confirm): Delete photo; drop the Run agent scan button 2026-10-19 14:26:10 +02:00
(auth) fix: preserve destination through the login redirect 2026-09-01 15:47:27 +02:00
(counter) fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
(mobile) feat(mobile-dashboard): add light/dark toggle, switch accent to red, bigger numbers 2026-09-07 15:02:10 +02:00
(print) feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
(rep)/rep feat(rep): add /rep/visits map with heatmap, per-customer clusters 2026-09-20 23:50:03 +02:00
(tv) feat(tv-dashboard): enhance TV dashboard with driver stops and performance metrics 2026-08-19 10:16:49 +02:00
api fix: uploads to an order line add files instead of replacing them 2026-10-19 14:46:37 +02:00
scan fix(scan): speed up QR recognition and keep scanning 2026-10-05 09:43:53 +02:00
favicon.ico
globals.css feat(quote-assistant): ai colour token, marker, fill button 2026-10-16 19:45:44 +02:00
layout.tsx fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
offline.tsx
page.tsx