feat(deliveries): enrich DN row subline with customer/order/paperclip

The /deliveries To Load + Back from Driver + Checked In tabs each
render delivery-note rows showing only 'DN {number}' + a one-line
status subline. Operators couldn't identify the customer or tell
whether the signed copy was back without scrolling up to the
customer/order group header.

Replace the existing subline with a compact pieces list:
customer name (truncated, with title tooltip) · company name ·
parent order number · signed-copy indicator (paperclip icon +
filenames in title=) · delivery date (if set). Counter-pickup DNs
(no parent order) collapse to 'Counter pickup' in italic.

All data is already on the row payload from /api/v1/deliveries —
no server or schema changes.

Also removed the now-unused 'subline' const that the prior
implementation used for the old single-line status subline.

Verified visually via dev server: counter-pickup fallback renders
correctly ('Counter pickup' italic). Order-attached and signed-copy
code paths are structurally correct per the spec — would need a
DN with order + signed files in the live data to exercise them,
but no such DN was visible in the current dev data.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Dave 2026-09-01 02:09:49 +02:00
parent 1fc3580aed
commit bd328d40dc

View file

@ -87,6 +87,7 @@ import {
FileText,
Loader2,
PackageOpen,
Paperclip,
Pencil,
Square,
Truck,
@ -1518,12 +1519,6 @@ function DeliveryNoteRowComponent({
// abandoned DN would be misleading.
const canUploadSignedCopy = dn.status !== "cancelled";
const subline = (() => {
if (dn.status === "draft") return "Not yet sent";
if (dn.customer_po) return `PO ${dn.customer_po}`;
return "Awaiting customer response";
})();
return (
<div
className="flex items-start gap-3 bg-amber-50/40 px-4 py-2.5 dark:bg-amber-950/10"
@ -1535,15 +1530,45 @@ function DeliveryNoteRowComponent({
<span className="font-mono">DN {dn.delivery_note_number}</span>
</p>
<p className="mt-0.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground tabular-nums">
{dn.delivery_date && (
{dn.order ? (
<>
<span className="truncate max-w-[40ch]" title={dn.order.customer_name ?? ""}>
{dn.order.customer_name}
</span>
{dn.order.company_name && (
<>
<span aria-hidden>·</span>
<span>{dn.order.company_name}</span>
</>
)}
{dn.order.order_number && (
<>
<span aria-hidden>·</span>
<span className="font-mono">{dn.order.order_number}</span>
</>
)}
</>
) : (
<span className="italic">Counter pickup</span>
)}
{dn.signed_copy && dn.signed_copy.length > 0 && (
<>
<span>Delivery {dn.delivery_date}</span>
<span aria-hidden>·</span>
<span
className="inline-flex items-center gap-1"
title={dn.signed_copy.join(", ")}
>
<Paperclip className="h-3 w-3" aria-hidden />
signed copy
</span>
</>
)}
{dn.delivery_date && (
<>
<span aria-hidden>·</span>
<span>Delivery {dn.delivery_date}</span>
</>
)}
<span className={subline.startsWith("Not yet") ? "italic" : ""}>
{subline}
</span>
</p>
</div>
<div className="flex shrink-0 flex-col items-end gap-1.5">