feat(orders): render order-number and item-duplicate pills

This commit is contained in:
Dave 2026-08-30 22:26:50 +02:00
parent d9f0925d83
commit 51a53851de

View file

@ -755,6 +755,50 @@ function OrderCard({
{order.potential_delivery_note_number}
</span>
)}
{/* Order-number-duplicate pill — set by
suggestOrderNumberDuplicate when another order (any
status, no time limit) shares this exact order_number.
Red — this is the one most likely to indicate an
actual accident (a repeated internal ORD- number, or
an operator not realizing a PO was already entered),
as opposed to the item-duplicate pill below which is
routinely legitimate (split PO deliveries). */}
{order.order_number_duplicate && (
<span
title="Another order already uses this exact order number"
className="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium"
style={{
background: "rgba(239, 68, 68, 0.10)",
color: "#ef4444",
boxShadow: "inset 0 0 0 1px rgba(239, 68, 68, 0.30)",
}}
aria-label="Duplicate order number"
>
Dup #
</span>
)}
{/* Item-duplicate pill — set by suggestOrderDuplicate when
this order's line items exactly match another order
for the same company within the last 60 days,
regardless of status. Amber, distinct from the DN
pill's blue (a repeat ORDER, not a repeat DELIVERY)
and from the order-number pill's red (this one is
routinely legitimate — a customer re-ordering the
same basket — not necessarily a mistake). */}
{order.potential_duplicate_order_number && (
<span
title={`Same items as order ${order.potential_duplicate_order_number} (same company, last 60 days)`}
className="inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium"
style={{
background: "rgba(245, 158, 11, 0.10)",
color: "#f59e0b",
boxShadow: "inset 0 0 0 1px rgba(245, 158, 11, 0.30)",
}}
aria-label={`Duplicate of order ${order.potential_duplicate_order_number}`}
>
Dup of {order.potential_duplicate_order_number}
</span>
)}
{complete && <CompleteBadge />}
<span className="text-muted-foreground">·</span>
<span className="truncate">