@flowselections/floriday-verkoop-module 1.0.141 → 1.0.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist-lib/components/verkoop/OrderCarrierPicker.d.ts.map +1 -1
  2. package/dist-lib/components/verkoop/OrderCarrierPicker.js +5 -1
  3. package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
  4. package/dist-lib/components/verkoop/SalesOrderDetailPage.js +20 -3
  5. package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
  6. package/dist-lib/components/verkoop/SalesOrderDetailView.js +22 -5
  7. package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
  8. package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -14
  9. package/dist-lib/components/verkoop/v3/InfoCard.js +1 -1
  10. package/dist-lib/components/verkoop/v3/OrderStepper.d.ts +2 -1
  11. package/dist-lib/components/verkoop/v3/OrderStepper.d.ts.map +1 -1
  12. package/dist-lib/components/verkoop/v3/OrderStepper.js +5 -4
  13. package/dist-lib/lib/delivery-format.check.d.ts +2 -0
  14. package/dist-lib/lib/delivery-format.check.d.ts.map +1 -0
  15. package/dist-lib/lib/delivery-format.check.js +28 -0
  16. package/dist-lib/lib/delivery-format.d.ts +17 -0
  17. package/dist-lib/lib/delivery-format.d.ts.map +1 -0
  18. package/dist-lib/lib/delivery-format.js +42 -0
  19. package/dist-lib/lib/order-progress.server.d.ts +23 -0
  20. package/dist-lib/lib/order-progress.server.d.ts.map +1 -1
  21. package/dist-lib/lib/order-progress.server.js +25 -0
  22. package/dist-lib/lib/salesorders-list.functions.d.ts +20 -0
  23. package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
  24. package/dist-lib/lib/salesorders-list.functions.js +24 -0
  25. package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
  26. package/dist-lib/lib/salesorders-list.server.js +1 -0
  27. package/dist-lib/lib/salesorders-mapping.d.ts +2 -0
  28. package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
  29. package/dist-lib/lib/salesorders-mapping.js +1 -0
  30. package/dist-lib/lib/salesorders.functions.d.ts +8 -0
  31. package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
  32. package/dist-lib/lib/salesorders.functions.js +23 -3
  33. package/dist-lib/lib/useDetailProgressFallback.d.ts +17 -0
  34. package/dist-lib/lib/useDetailProgressFallback.d.ts.map +1 -0
  35. package/dist-lib/lib/useDetailProgressFallback.js +28 -0
  36. package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts +1 -0
  37. package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"OrderCarrierPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderCarrierPicker.tsx"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,aAAqB,EACrB,OAAe,EACf,MAAc,EACd,SAAS,GACV,EAAE;IACD,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,+BAuGA"}
1
+ {"version":3,"file":"OrderCarrierPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderCarrierPicker.tsx"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,aAAqB,EACrB,OAAe,EACf,MAAc,EACd,SAAS,GACV,EAAE;IACD,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,+BA2GA"}
@@ -55,5 +55,9 @@ export function OrderCarrierPicker({ orderId, applyToBuffer = false, compact = f
55
55
  setSaving(false);
56
56
  }
57
57
  }
58
- return (_jsxs("div", { className: compact ? "space-y-1" : "inline-flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [!compact && _jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }), _jsxs("select", { className: "h-9 min-w-[12rem] rounded-md border border-border bg-background px-2 text-sm text-foreground disabled:opacity-60", value: value, disabled: saving || q.isLoading || q.isError, onChange: (e) => onChange(e.target.value), children: [_jsx("option", { value: AUTO, children: "Automatisch" }), options.map((o) => (_jsx("option", { value: o.id, children: o.name }, o.id)))] }), saving && _jsx("span", { className: "text-xs text-muted-foreground", children: "Opslaan\u2026" })] }), q.isError && (_jsx("span", { className: "text-xs text-destructive", children: q.error?.message ?? "Vervoerder kon niet worden geladen" })), resolved && (_jsx("span", { className: `text-xs ${resolved.state === "ok" ? "text-muted-foreground" : "text-destructive"}`, children: carrierLine(resolved) })), resolved?.state === "geen" && (_jsx("a", { href: "/afhandeling/vervoerders", className: "text-xs text-primary underline", children: "Stel een vervoerder in bij Afhandeling \u2192 Vervoerders" })), resolved?.warning && _jsx("span", { className: "text-xs text-muted-foreground", children: resolved.warning }), (resolved?.adminNotice || notice) && (_jsxs("span", { className: "text-xs text-muted-foreground", children: ["Voor beheer: ", notice ?? resolved?.adminNotice] })), (applyToBuffer || (groupSize ?? 0) > 1) && (_jsx("span", { className: "text-xs font-medium text-warning-soft-foreground", children: groupSize && groupSize > 1 ? `Geldt voor alle ${groupSize} orders in deze groep` : "Geldt voor alle orders in deze groep" })), results && (_jsx("ul", { className: "text-xs", children: results.map((r) => (_jsxs("li", { className: r.ok ? "text-muted-foreground" : "text-destructive", children: [r.orderNumber ?? r.orderId, ": ", r.ok ? "gelukt" : `niet gelukt – ${r.error}`] }, r.orderId))) })), error && _jsx("span", { className: "text-xs text-destructive", children: error })] }));
58
+ return (_jsxs("div", { className: compact ? "min-w-0 space-y-1" : "flex min-w-0 max-w-full flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [!compact && _jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }), _jsxs("select", { className: "h-9 w-full min-w-0 max-w-full rounded-md border border-border bg-background px-2 text-sm text-foreground disabled:opacity-60", value: value, disabled: saving || q.isLoading || q.isError, onChange: (e) => onChange(e.target.value), children: [_jsx("option", { value: AUTO, children: "Automatisch" }), options.map((o) => (_jsx("option", { value: o.id, children: o.name }, o.id)))] }), saving && _jsx("span", { className: "text-xs text-muted-foreground", children: "Opslaan\u2026" })] }), q.isError && (_jsx("span", { className: "text-xs text-destructive", children: q.error?.message ?? "Vervoerder kon niet worden geladen" })), resolved && (_jsx("span", { className: `text-xs ${resolved.state === "ok" ? "text-muted-foreground" : "text-destructive"}`, children: resolved.state === "ok"
59
+ ? isManual
60
+ ? `Handmatig gekozen: ${resolved.carrierName ?? "onbekend"}`
61
+ : `Automatisch gekozen: ${resolved.carrierName ?? "onbekend"}`
62
+ : carrierLine(resolved) })), resolved?.state === "geen" && (_jsx("a", { href: "/afhandeling/vervoerders", className: "text-xs text-primary underline", children: "Stel een vervoerder in bij Afhandeling \u2192 Vervoerders" })), resolved?.warning && _jsx("span", { className: "text-xs text-muted-foreground", children: resolved.warning }), (resolved?.adminNotice || notice) && (_jsxs("span", { className: "text-xs text-muted-foreground", children: ["Voor beheer: ", notice ?? resolved?.adminNotice] })), (applyToBuffer || (groupSize ?? 0) > 1) && (_jsx("span", { className: "text-xs font-medium text-warning-soft-foreground", children: groupSize && groupSize > 1 ? `Geldt voor alle ${groupSize} orders in deze groep` : "Geldt voor alle orders in deze groep" })), results && (_jsx("ul", { className: "text-xs", children: results.map((r) => (_jsxs("li", { className: r.ok ? "text-muted-foreground" : "text-destructive", children: [r.orderNumber ?? r.orderId, ": ", r.ok ? "gelukt" : `niet gelukt – ${r.error}`] }, r.orderId))) })), error && _jsx("span", { className: "text-xs text-destructive", children: error })] }));
59
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAqHA,wBAAgB,oBAAoB,gCA8SnC"}
1
+ {"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAsHA,wBAAgB,oBAAoB,gCA+TnC"}
@@ -22,6 +22,7 @@ import { useSalesOrderDetailQuery } from "../../lib/useSalesOrderDetailQuery.js"
22
22
  import { useLocalSalesOrderDetailQuery } from "../../lib/useLocalSalesOrderDetailQuery.js";
23
23
  import { getOrderAddresses } from "../../lib/order-addresses.functions.js";
24
24
  import { orderStageLabel, orderStageBadgeClass } from "../../lib/order-status.js";
25
+ import { useDetailProgressFallback } from "../../lib/useDetailProgressFallback.js";
25
26
  import { toProgressMember } from "../../lib/order-progress.js";
26
27
  import { listHref, markRestore, neighbours } from "../../lib/order-nav.js";
27
28
  import { SourceIcon, sourceLabel } from "./v3/SourceIcon.js";
@@ -180,11 +181,27 @@ export function SalesOrderDetailPage() {
180
181
  const rawLocalId = isLocal && salesOrderId.startsWith("local:")
181
182
  ? salesOrderId.slice("local:".length)
182
183
  : null;
184
+ // Factuurstand + pickvoortgang komen mee in het detailverzoek (geen tweede ronde).
185
+ const detailProgress = (isFloriday ? detailQuery.data?.progress : isLocal ? localDetailQuery.data?.progress : undefined) ?? null;
186
+ const fallback = useDetailProgressFallback(detailProgress?.invoice === "pending" ? bufferOrders : null);
183
187
  const membersFor = (orders) => {
184
188
  const fromList = cached.row?.progressMembers ?? [];
185
- return orders.map((o) => fromList.find((m) => m.orderNumber === o.orderNumber) ?? toProgressMember(o));
189
+ return orders.map((o) => {
190
+ if (detailProgress) {
191
+ const extra = o.orderRowId ? fallback.byId?.[o.orderRowId] : undefined;
192
+ return toProgressMember({ ...o, ...(extra ? { erpInvoice: extra.erpInvoice ?? o.erpInvoice, pickProgress: extra.pickProgress ?? o.pickProgress } : {}) });
193
+ }
194
+ return fromList.find((m) => m.orderNumber === o.orderNumber) ?? toProgressMember(o);
195
+ });
186
196
  };
187
- const features = cached.features ?? { erpInvoices: false, pickProgress: false };
197
+ const features = fallback.features ?? detailProgress?.features ?? cached.features ?? { erpInvoices: false, pickProgress: false };
198
+ const invoiceLoad = !detailProgress
199
+ ? (cached.features ? "ok" : "loading")
200
+ : detailProgress.invoice === "ok"
201
+ ? "ok"
202
+ : detailProgress.invoice === "failed"
203
+ ? "unknown"
204
+ : fallback.state;
188
205
  const nav = neighbours(salesOrderId);
189
206
  const backHref = listHref();
190
207
  const head = primary ?? (cached.row && !(cached.row.bufferSize && cached.row.bufferSize > 1) ? cached.row : null);
@@ -194,7 +211,7 @@ export function SalesOrderDetailPage() {
194
211
  const fTotal = floridayMembers.reduce((s, m) => s + m.floridayTotal, 0);
195
212
  return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { href: backHref, onClick: () => markRestore(), children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { to: "/floriday-verkoop/verkooporders", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) })) : null, nav.next ? (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming")}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming")) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
196
213
  ? head.customer.name
197
- : `${sourceLabel(sources[0])}-order` }), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
214
+ : `${sourceLabel(sources[0])}-order` }), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features, invoiceLoad: invoiceLoad }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
198
215
  const f = friendlyLoadError(error);
199
216
  return (_jsxs("div", { role: "alert", className: "flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive-soft p-4 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium text-foreground", children: f.text }), _jsxs("details", { className: "mt-1 text-xs text-muted-foreground", children: [_jsx("summary", { className: "cursor-pointer", children: "Technische details" }), f.tech] })] }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => activeQuery.refetch(), children: "Opnieuw" })] }));
200
217
  })(), !isLoading && !error && !primary && (_jsx("div", { className: "rounded-xl border border-border bg-card p-8 text-center text-sm text-muted-foreground shadow-sm", children: "Order niet gevonden." })), primary && isBuffer && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(Euro, {}), label: "Totale omzet", value: eur.format(totals.revenue), sub: `${bufferOrders.length} orders` }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren", value: engineBuffer ? engineBuffer.karren : totals.karren == null ? "Nog niet bekend" : formatLoadUnits(totals.karren, totals.cartType), sub: engineBuffer && engineBuffer.ladingdragers.length > 0 ? ladingdragerSummary(engineBuffer) : undefined }), _jsx(FactTile, { icon: _jsx(Layers, {}), label: "Fust", value: formatLoadUnits(totals.fusten, totals.crateType) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: primary.customer.name, sub: primary.customer.legalName ?? undefined })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsx(InfoCard, { icon: _jsx(Layers, {}), title: `Orders in deze groep (${bufferOrders.length})`, children: _jsx("div", { className: "space-y-3", children: bufferOrders.map((o) => (_jsx(BufferOrderRow, { order: o, member: membersFor([o])[0], sellerFallback: sellerFallback }, o.id))) }) }), _jsxs("div", { children: [_jsx("div", { className: "mb-2 text-sm font-semibold text-foreground", children: "Gecombineerde karindeling" }), _jsx(OrderKarindelingCard, { order: primary })] })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer en ophalen", children: [_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: primary.id, applyToBuffer: true, compact: true, groupSize: bufferOrders.length, locked: bufferOrders.every((o) => !!o.isReservation) }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: primary.id, readOnly: true, compact: true }), _jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", bufferOrders.length, " orders in deze groep"] })] }), _jsx(BufferAddresses, { orderId: primary.id })] }), fTotal > 0 && (_jsxs(InfoCard, { icon: _jsx(ReceiptText, {}), title: "Floriday", children: [_jsx(InfoRow, { label: "Floriday-orders", children: _jsx("span", { className: "flex flex-wrap gap-1.5", children: bufferOrders.filter((o) => !o.isLocal && o.orderNumber).map((o) => (_jsx(Badge, { variant: "outline", className: "text-xs", children: o.orderNumber }, o.id))) }) }), _jsxs(InfoRow, { label: "Afgemeld", children: [fDone, " van ", fTotal] })] }))] })] })] })), inGroup && !singleInGroup && rawLocalId && _jsx(EngineBufferCard, { orderId: rawLocalId }), primary && !isBuffer && (_jsx(SalesOrderDetailView, { order: primary, sellerFallback: sellerFallback, members: membersFor([primary]), features: features, groupSize: inGroup ? bufferOrders.length : undefined })), rawLocalId && _jsx(EditLocalOrderDialog, { orderId: rawLocalId, open: editOpen, onOpenChange: setEditOpen })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGxG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA8JnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAkBA"}
1
+ {"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmC,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGvH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA8JnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAkBA"}
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { formatDelivery, deliveryHasTimeFor } from "../../lib/delivery-format.js";
2
3
  import { formatMoment } from "../../lib/order-departure.js";
3
4
  import { AlertTriangle, Boxes, CalendarDays, CheckCircle2, Clock, ClipboardList, ExternalLink, Flower2, ImageIcon, MapPin, ReceiptText, Truck, User } from "lucide-react";
4
5
  import { InfoCard, InfoRow, FactTile } from "./v3/InfoCard.js";
5
- import { toProgressMember } from "../../lib/order-progress.js";
6
+ import { memberInvoice, toProgressMember } from "../../lib/order-progress.js";
6
7
  import { useQuery } from "@tanstack/react-query";
7
8
  import { useServerFn } from "@tanstack/react-start";
8
9
  import { formatBeladingNotation, formatLoadUnits } from "../../lib/load-carrier-labels.js";
@@ -138,7 +139,7 @@ export function SalesOrderDetailView(props) {
138
139
  : props.order;
139
140
  return _jsx(SalesOrderDetailViewInner, { ...props, order: order, floridayLoading: ids.length > 0 && statusQ.isPending });
140
141
  }
141
- function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hideKarindeling = false, members, groupSize, }) {
142
+ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hideKarindeling = false, members, features, groupSize, }) {
142
143
  const o = order.raw.order ?? {};
143
144
  const c = order.raw.customer ?? {};
144
145
  const cRaw = c?.raw ?? {};
@@ -305,11 +306,27 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
305
306
  const verkoopwijze = [tradingType !== "—" ? tradingType : null, financial !== "—" ? financial : null].filter(Boolean).join(" · ") || "—";
306
307
  const showIncoterm = !!fe && incoterm !== "niet opgegeven" && incoterm !== "—";
307
308
  const hasExternal = !!order.floridayExternalFulfilledAt || (order.floridayExternalFulfilledIds?.length ?? 0) > 0;
308
- return (_jsxs("div", { className: "space-y-4", children: [order.needsManualReview ? (_jsxs(Notice, { tone: "destructive", title: "Handmatige controle nodig", children: [order.needsManualReview.reason, order.needsManualReview.at ? ` (gezien op ${new Date(order.needsManualReview.at).toLocaleString("nl-NL")})` : ""] })) : null, isFlorinOrder && order.mixedDeliveryDates ? (_jsx(Notice, { tone: "muted", title: "Bestellingen met verschillende leverdatums", children: "Deze order bestaat uit Floriday-bestellingen met verschillende leverdatums. De vroegste leverdatum is aangehouden." })) : null, isFlorinOrder && (order.unlinkedProducts?.length ?? 0) > 0 ? (_jsxs(Notice, { tone: "destructive", title: "Artikel uit Floriday nog niet gekoppeld aan een eigen product", children: [_jsx("ul", { className: "mt-1 space-y-0.5", children: order.unlinkedProducts.map((u, i) => (_jsx("li", { children: u.name }, i))) }), _jsx("div", { className: "mt-1 text-xs", children: "Koppel het artikel aan een eigen product; bij de volgende update wordt het overgenomen." })] })) : null, order.floridayMissingLineKeyNotice && (_jsx(Notice, { tone: "destructive", title: "Let op", children: order.floridayMissingLineKeyNotice })), _jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(CalendarDays, {}), label: "Leverdatum", value: order.deliveryAt ? new Date(order.deliveryAt).toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short", year: "numeric" }) : "—", sub: order.deliveryAt ? (_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Clock, { className: "h-3.5 w-3.5" }), new Date(order.deliveryAt).toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit" }), order.pickupLabel ? ` · ${order.pickupLabel}` : ""] })) : order.pickupLabel ?? undefined }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren / fusten", value: _jsx("span", { className: "inline-flex items-center gap-1.5", children: formatLoadUnits(order.karCount, order.cartTypeName) }), sub: `${formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName)} fust${order.karShared ? " · kar gedeeld met andere orders" : ""}` })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Flower2, {}), title: "Artikelen", attention: priceProblem, children: [_jsx("div", { className: "-mx-4 overflow-x-auto sm:-mx-5", children: _jsxs("table", { className: "w-full min-w-[520px] text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Artikel" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Aantal" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Fust" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Prijs" }), _jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Totaal" })] }) }), _jsx("tbody", { children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: order.productName }), _jsx("div", { className: "text-xs text-muted-foreground", children: order.mixedPacking
309
+ return (_jsxs("div", { className: "space-y-4", children: [order.needsManualReview ? (_jsxs(Notice, { tone: "destructive", title: "Handmatige controle nodig", children: [order.needsManualReview.reason, order.needsManualReview.at ? ` (gezien op ${new Date(order.needsManualReview.at).toLocaleString("nl-NL")})` : ""] })) : null, isFlorinOrder && order.mixedDeliveryDates ? (_jsx(Notice, { tone: "muted", title: "Bestellingen met verschillende leverdatums", children: "Deze order bestaat uit Floriday-bestellingen met verschillende leverdatums. De vroegste leverdatum is aangehouden." })) : null, isFlorinOrder && (order.unlinkedProducts?.length ?? 0) > 0 ? (_jsxs(Notice, { tone: "destructive", title: "Artikel uit Floriday nog niet gekoppeld aan een eigen product", children: [_jsx("ul", { className: "mt-1 space-y-0.5", children: order.unlinkedProducts.map((u, i) => (_jsx("li", { children: u.name }, i))) }), _jsx("div", { className: "mt-1 text-xs", children: "Koppel het artikel aan een eigen product; bij de volgende update wordt het overgenomen." })] })) : null, order.floridayMissingLineKeyNotice && (_jsx(Notice, { tone: "destructive", title: "Let op", children: order.floridayMissingLineKeyNotice })), _jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(CalendarDays, {}), label: "Leverdatum", value: order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { year: true }).date : "—", sub: (() => {
310
+ const t = order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order)).time : "";
311
+ if (!t)
312
+ return order.pickupLabel ?? undefined;
313
+ return _jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Clock, { className: "h-3.5 w-3.5" }), t, order.pickupLabel ? ` · ${order.pickupLabel}` : ""] });
314
+ })() }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined }), (() => {
315
+ const noCarrier = !order.cartTypeName || /geen ladingdrager/i.test(order.cartTypeName);
316
+ const fust = order.fustCount > 0 ? `${formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName)} fust` : "";
317
+ return (_jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren / fusten", value: noCarrier ? (fust || "Geen ladingdrager") : formatLoadUnits(order.karCount, order.cartTypeName), sub: [noCarrier ? (fust ? "Geen ladingdrager" : "") : fust, order.karShared ? "kar gedeeld met andere orders" : ""].filter(Boolean).join(" · ") || undefined }));
318
+ })()] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Flower2, {}), title: "Artikelen", attention: priceProblem, children: [_jsx("div", { className: "-mx-4 overflow-x-auto sm:-mx-5", children: _jsxs("table", { className: "w-full min-w-[520px] text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Artikel" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Aantal" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Fust" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Prijs" }), _jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Totaal" })] }) }), _jsx("tbody", { children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: order.productName }), _jsx("div", { className: "text-xs text-muted-foreground", children: order.mixedPacking
309
319
  ? (order.articleCount ?? 0) > 1 ? `Gemengd (${order.articleCount} artikelen)` : "Gemengd"
310
- : `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] }) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines }), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(ClipboardList, {}), title: "Orderinformatie", children: [_jsx(InfoRow, { label: "Ordernummer", children: order.orderNumber || "—" }), _jsx(InfoRow, { label: "Status", children: _jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(order.stage ?? "incoming")}`, children: bestellingLabel }) }), _jsx(InfoRow, { label: "Besteld op", children: fmtDateTime(order.orderedAt) }), _jsx(InfoRow, { label: "Klantreferentie", children: klantReferentie }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopkanaal", children: verkoopkanaal }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopwijze", children: verkoopwijze }), isFlorinOrder && _jsx(InfoRow, { label: "Floriday-referentie", children: floridayRef }), _jsx(InfoRow, { label: "Verkoper", children: sellerName ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground", children: initials(sellerName) }), sellerName] })) : "—" }), hasExternal && (_jsx(InfoRow, { label: "Afhandeling", children: order.floridayExternalFulfilledAt
320
+ : `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] }) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines }), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && member?.pickProgress && (member.pickProgress.cartsTotal ?? 0) > 0 && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 rounded-xl border border-border bg-card px-5 py-3 text-sm shadow-sm", children: [_jsx("span", { className: "font-medium text-foreground", children: "Pickstatus" }), _jsxs("span", { className: "tabular-nums text-muted-foreground", children: [member.pickProgress.cartsPrinted ?? 0, " van ", member.pickProgress.cartsTotal, " karren geprint"] }), _jsxs("span", { className: "tabular-nums text-muted-foreground", children: [member.pickProgress.cartsScanned ?? 0, " van ", member.pickProgress.cartsTotal, " karren gepickt"] }), member.pickProgress.blocked && _jsx("span", { className: "text-destructive", children: member.pickProgress.blockedReason ?? "Geblokkeerd" })] })), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(ClipboardList, {}), title: "Orderinformatie", children: [_jsx(InfoRow, { label: "Ordernummer", children: order.orderNumber || "—" }), _jsx(InfoRow, { label: "Status", children: _jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(order.stage ?? "incoming")}`, children: bestellingLabel }) }), _jsx(InfoRow, { label: "Besteld op", children: fmtDateTime(order.orderedAt) }), _jsx(InfoRow, { label: "Klantreferentie", children: klantReferentie }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopkanaal", children: verkoopkanaal }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopwijze", children: verkoopwijze }), isFlorinOrder && _jsx(InfoRow, { label: "Floriday-referentie", children: floridayRef }), _jsx(InfoRow, { label: "Verkoper", children: sellerName ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground", children: initials(sellerName) }), sellerName] })) : "—" }), hasExternal && (_jsx(InfoRow, { label: "Afhandeling", children: order.floridayExternalFulfilledAt
311
321
  ? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
312
- : `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), _jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: String(order.id), locked: !!order.isReservation, compact: true, groupSize: groupSize }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: String(order.id) }), (groupSize ?? 0) > 1 && (_jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", groupSize, " orders in deze groep"] }))] }), showIncoterm && _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm })] }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), fs && (_jsx(InfoRow, { label: "Floriday", children: _jsx(FloridayStageLine, { status: fs, stage: order.stage, floridayFulfilled: order.floridayFulfilled, isFloriday: true, loading: floridayLoading }) })), !fs && (order.floridayIds?.length ?? 0) > 0 && (_jsx(FloridayStageLine, { status: null, stage: order.stage, floridayFulfilled: order.floridayFulfilled, isFloriday: true }))] })) : (_jsxs(_Fragment, { children: [order.invoiceState && (_jsxs(InfoRow, { label: "Stand", children: [order.invoiceState, order.invoiceNote ? _jsx("span", { className: "block text-xs text-muted-foreground", children: order.invoiceNote }) : null] })), member?.erpInvoice && (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Factuurnummer", children: member.erpInvoice.number ?? "—" }), _jsx(InfoRow, { label: "Status", children: member.erpInvoice.status ?? "—" }), _jsx(InfoRow, { label: "Verstuurd", children: member.erpInvoice.sentAt ? fmtDateTime(member.erpInvoice.sentAt) : "—" })] })), invoiceOrderId && _jsx(OrderInvoiceCard, { orderId: invoiceOrderId })] })) }), o?.salesOrderId ? (_jsxs(_Fragment, { children: [_jsx(OrderControlStatusCard, { floridayId: String(o.salesOrderId), isControlled: order.status.isControlled, controlledAt: order.status.controlledAt }), _jsx(OrderAfleverbrievenCard, { salesOrderId: String(o.salesOrderId), orderNumber: order.orderNumber ?? undefined })] })) : null, _jsxs(InfoCard, { icon: _jsx(User, {}), title: "Klant", children: [_jsxs(InfoRow, { label: "Naam", children: [_jsx("span", { className: "font-medium", children: customerName }), customerLegalName && _jsx("div", { className: "text-xs text-muted-foreground", children: customerLegalName })] }), _jsx(InfoRow, { label: "Telefoon", children: customerPhone }), _jsxs("details", { className: "group pt-2 text-sm", children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground", children: "Meer klantgegevens" }), _jsx(InfoRow, { label: "GLN", children: customerGln }), _jsx(InfoRow, { label: "Administratienummer", children: customerAdmin }), deliveryGln && _jsx(InfoRow, { label: "GLN afleveradres", children: deliveryGln })] })] })] })] }), _jsxs("details", { className: "rounded-xl border border-border bg-card px-4 py-3 text-sm shadow-sm sm:px-5", children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground", children: "Technische details" }), _jsxs("div", { className: "mt-2 space-y-2 text-xs text-muted-foreground", children: [_jsxs("div", { children: ["Herkomst status: ", order.statusOrigin === "floriday" ? "Floriday" : "ERP", order.statusChangedAt ? ` · ${fmtDateTime(order.statusChangedAt)}` : ""] }), o.tradeItemVersion ? _jsxs("div", { children: ["Artikelversie: v", o.tradeItemVersion] }) : null, order.floridayFulfilled && _jsx("div", { children: "Administratief doorgegeven aan Floriday (bepaalt de orderstatus niet)." }), (order.unlinkedProducts ?? []).map((u, i) => (_jsxs("div", { children: ["Niet gekoppeld: ", u.name, " \u2014 trade-item-id ", u.tradeItemId ?? "onbekend"] }, i))), fs?.entries.map((e) => (_jsxs("div", { className: "rounded-md border border-border p-2", children: [_jsxs("div", { children: ["Bestelling ", e.salesOrderId] }), _jsxs("div", { children: ["Floriday-status: ", e.salesOrderStatus ?? "—", " \u00B7 Afleververzoeken: ", e.fulfillmentRequests.length, " \u00B7 Afhandelingen: ", e.fulfillmentOrders.length ? e.fulfillmentOrders.map((f) => f.status ?? "?").join(", ") : "geen"] }), _jsxs("div", { children: ["Verkoopkanaal: ", e.salesChannel ?? "—", " \u00B7 Handelsvorm: ", e.tradeInstrument ?? "—", " \u00B7 Incoterm: ", e.incoterm ?? "niet opgegeven"] }), _jsxs("div", { children: ["Klantreferentie: ", e.customerOrderId ?? "—", " \u00B7 Floriday-referentie: ", e.salesChannelOrderId ?? "—"] }), _jsxs("div", { children: ["Koper: ", e.customerOrganizationId ?? "—", " \u00B7 GLN: ", e.customerGln ?? "—"] }), _jsxs("div", { children: ["Laatst gewijzigd: ", e.lastModifiedDateTime ? fmtDateTime(e.lastModifiedDateTime) : "—", " \u00B7 Ververst: ", e.cachedAt ? fmtDateTime(e.cachedAt) : "—"] })] }, e.salesOrderId)))] })] })] }));
322
+ : `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), _jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: String(order.id), locked: !!order.isReservation, compact: true, groupSize: groupSize }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: String(order.id) }), (groupSize ?? 0) > 1 && (_jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", groupSize, " orders in deze groep"] }))] }), showIncoterm && _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm })] }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: invoiceStandText(member, features) }), _jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), fs && (_jsx(InfoRow, { label: "Floriday", children: _jsx(FloridayStageLine, { status: fs, stage: order.stage, floridayFulfilled: order.floridayFulfilled, isFloriday: true, loading: floridayLoading }) })), !fs && (order.floridayIds?.length ?? 0) > 0 && (_jsx(FloridayStageLine, { status: null, stage: order.stage, floridayFulfilled: order.floridayFulfilled, isFloriday: true }))] })) : (_jsxs(_Fragment, { children: [_jsxs(InfoRow, { label: "Stand", children: [invoiceStandText(member, features), !member?.erpInvoice && order.invoiceState ? (_jsxs("span", { className: "block text-xs text-muted-foreground", children: [order.invoiceState, order.invoiceNote ? ` · ${order.invoiceNote}` : ""] })) : null] }), order.missingPrice && order.stage !== "cancelled" && !member?.erpInvoice && (_jsx("div", { className: "mt-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-soft-foreground", children: "Prijs ontbreekt: vul de prijs in voordat er gefactureerd kan worden." })), member?.erpInvoice && (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Factuurnummer", children: member.erpInvoice.number ?? "—" }), _jsx(InfoRow, { label: "Status", children: member.erpInvoice.status ?? "—" }), _jsx(InfoRow, { label: "Verstuurd", children: member.erpInvoice.sentAt ? fmtDateTime(member.erpInvoice.sentAt) : "—" })] })), invoiceOrderId && _jsx(OrderInvoiceCard, { orderId: invoiceOrderId })] })) }), o?.salesOrderId ? (_jsxs(_Fragment, { children: [_jsx(OrderControlStatusCard, { floridayId: String(o.salesOrderId), isControlled: order.status.isControlled, controlledAt: order.status.controlledAt }), _jsx(OrderAfleverbrievenCard, { salesOrderId: String(o.salesOrderId), orderNumber: order.orderNumber ?? undefined })] })) : null, _jsxs(InfoCard, { icon: _jsx(User, {}), title: "Klant", children: [_jsxs(InfoRow, { label: "Naam", children: [_jsx("span", { className: "font-medium", children: customerName }), customerLegalName && _jsx("div", { className: "text-xs text-muted-foreground", children: customerLegalName })] }), _jsx(InfoRow, { label: "Telefoon", children: customerPhone }), _jsxs("details", { className: "group pt-2 text-sm", children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground", children: "Meer klantgegevens" }), _jsx(InfoRow, { label: "GLN", children: customerGln }), _jsx(InfoRow, { label: "Administratienummer", children: customerAdmin }), deliveryGln && _jsx(InfoRow, { label: "GLN afleveradres", children: deliveryGln })] })] })] })] })] }));
323
+ }
324
+ /** Zelfde stand als het factuuricoon in de lijst (memberInvoice). */
325
+ function invoiceStandText(member, features) {
326
+ if (!member)
327
+ return "Onbekend";
328
+ const st = memberInvoice(member, features ?? { erpInvoices: false, pickProgress: false });
329
+ return st === "done" ? "Gefactureerd" : st === "attention" ? "Aandacht nodig" : st === "hidden" ? "Onbekend" : st === "error" ? "Fout" : "Nog niet";
313
330
  }
314
331
  function props_member(order, members) {
315
332
  const own = members?.find((m) => m.orderNumber === order.orderNumber) ?? null;
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAiClC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aA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AAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAmJA"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatDelivery, deliveryHasTimeFor } from "../../lib/delivery-format.js";
2
3
  import { memo, useEffect, useMemo, useRef, useState } from "react";
3
4
  import { Checkbox, Skeleton, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@flowselections/core";
4
5
  import { AlertCircle, ArrowDown, Clock, Eye, SearchX } from "lucide-react";
@@ -22,18 +23,6 @@ function fmtOrdered(iso) {
22
23
  time: d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
23
24
  };
24
25
  }
25
- function fmtDelivery(iso) {
26
- if (!iso)
27
- return { date: "—", time: "" };
28
- const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(iso.trim());
29
- const d = new Date(dateOnly ? `${iso.trim()}T00:00:00` : iso);
30
- if (Number.isNaN(d.getTime()))
31
- return { date: iso, time: "" };
32
- return {
33
- date: d.toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short" }),
34
- time: dateOnly ? "" : d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
35
- };
36
- }
37
26
  /** Stabiele rij-id: buffers zijn serverside al samengevouwen tot één rij. */
38
27
  export function salesOrderRowId(row) {
39
28
  const bufferSize = row.bufferSize ?? 1;
@@ -98,7 +87,7 @@ const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, hig
98
87
  const isBuffer = !!row.bufferId && size > 1;
99
88
  const members = membersOf(row);
100
89
  const ordered = fmtOrdered(row.orderedAt);
101
- const delivery = fmtDelivery(row.deliveryAt);
90
+ const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row));
102
91
  const d2 = deliveryLine2(row, delivery.time);
103
92
  const cancelled = row.stage === "cancelled";
104
93
  const place = row.customer.city || row.deliveryLocationLabel || "—";
@@ -123,7 +112,7 @@ const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, hig
123
112
  const size = row.bufferSize ?? 1;
124
113
  const isBuffer = !!row.bufferId && size > 1;
125
114
  const members = membersOf(row);
126
- const delivery = fmtDelivery(row.deliveryAt);
115
+ const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row));
127
116
  const d2 = deliveryLine2(row, delivery.time);
128
117
  const cancelled = row.stage === "cancelled";
129
118
  const h = handlers.current;
@@ -13,7 +13,7 @@ export function InfoCard({ icon, title, action, children, attention = false, cla
13
13
  }
14
14
  /** Label-waarde-regel binnen een InfoCard. */
15
15
  export function InfoRow({ label, children }) {
16
- return (_jsxs("div", { className: "grid grid-cols-[120px_minmax(0,1fr)] items-start gap-3 border-b border-border/60 py-2 text-sm last:border-b-0", children: [_jsx("div", { className: "text-muted-foreground", children: label }), _jsx("div", { className: "min-w-0 break-words text-foreground", children: children })] }));
16
+ return (_jsxs("div", { className: "grid grid-cols-[minmax(0,152px)_minmax(0,1fr)] items-start gap-4 border-b border-border/60 py-2 text-sm last:border-b-0", children: [_jsx("div", { className: "min-w-0 break-words text-muted-foreground", children: label }), _jsx("div", { className: "min-w-0 break-words text-foreground", children: children })] }));
17
17
  }
18
18
  /** Kerntegel boven de kaarten. */
19
19
  export function FactTile({ icon, label, value, sub }) {
@@ -1,6 +1,7 @@
1
1
  import { type ProgressFeatures, type ProgressMember } from "../../../lib/order-progress.js";
2
- export declare function OrderStepper({ members, features }: {
2
+ export declare function OrderStepper({ members, features, invoiceLoad }: {
3
3
  members: ProgressMember[];
4
4
  features: ProgressFeatures;
5
+ invoiceLoad?: "loading" | "ok" | "unknown";
5
6
  }): import("react").JSX.Element;
6
7
  //# sourceMappingURL=OrderStepper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/OrderStepper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,sBAAsB,CAAC;AA0B9B,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,+BAgF5G"}
1
+ {"version":3,"file":"OrderStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/OrderStepper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,sBAAsB,CAAC;AA0B9B,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAkB,EAAE,EAAE;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAC;IAAC,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,+BAuF5K"}
@@ -21,9 +21,9 @@ const STATE_TEXT = {
21
21
  late: "Te laat",
22
22
  error: "Fout",
23
23
  attention: "Aandacht nodig",
24
- hidden: "",
24
+ hidden: "Onbekend",
25
25
  };
26
- export function OrderStepper({ members, features }) {
26
+ export function OrderStepper({ members, features, invoiceLoad = "ok" }) {
27
27
  const active = members.filter((m) => !m.cancelled);
28
28
  if (active.length === 0) {
29
29
  return (_jsx("div", { className: "rounded-xl border border-border bg-card px-5 py-4 text-sm text-muted-foreground shadow-sm", children: "Deze order is geannuleerd." }));
@@ -60,7 +60,8 @@ export function OrderStepper({ members, features }) {
60
60
  at: allDone(s.invoiced) ? latest(active.map((m) => m.erpInvoice?.sentAt ?? null)) : null,
61
61
  },
62
62
  ];
63
- const shown = steps.filter((st) => st.state !== "hidden");
63
+ // Altijd alle vier stappen; een stap zonder stand toont "Onbekend".
64
+ const shown = steps;
64
65
  return (_jsx("ol", { "aria-label": "Voortgang", className: "grid gap-3 rounded-xl border border-border bg-card px-4 py-4 shadow-sm sm:px-6", style: { gridTemplateColumns: `repeat(${shown.length}, minmax(0, 1fr))` }, children: shown.map((st, i) => {
65
66
  const tone = st.state === "done"
66
67
  ? "bg-primary text-primary-foreground border-primary"
@@ -71,6 +72,6 @@ export function OrderStepper({ members, features }) {
71
72
  : "bg-muted text-muted-foreground border-border";
72
73
  const Icon = st.state === "done" ? _jsx(Check, { className: "h-4 w-4" }) : st.state === "error" ? _jsx(AlertTriangle, { className: "h-4 w-4" }) : st.state === "late" ? _jsx(Clock, { className: "h-4 w-4" }) : st.icon;
73
74
  const nextDone = shown[i + 1]?.state === "done";
74
- return (_jsxs("li", { className: "relative flex min-w-0 flex-col items-center text-center", children: [i < shown.length - 1 && (_jsx("span", { "aria-hidden": true, className: "absolute left-[calc(50%+1.25rem)] right-[calc(-50%+1.25rem)] top-4 " + (st.state === "done" && nextDone ? "h-0.5 rounded-full bg-primary" : "border-t-2 border-dashed border-border") })), _jsx("span", { className: "relative z-10 inline-flex h-8 w-8 items-center justify-center rounded-full border " + tone, children: Icon }), _jsx("span", { className: "mt-2 text-xs font-medium leading-tight sm:text-sm " + (st.state === "todo" ? "text-muted-foreground" : "text-foreground"), children: st.title }), _jsx("span", { className: "mt-0.5 text-[11px] tabular-nums " + (st.state === "error" || st.state === "late" ? "text-destructive" : "text-muted-foreground"), children: st.state === "done" ? (fmt(st.at) ?? STATE_TEXT.done) : STATE_TEXT[st.state] })] }, st.key));
75
+ return (_jsxs("li", { className: "relative flex min-w-0 flex-col items-center text-center", children: [i < shown.length - 1 && (_jsx("span", { "aria-hidden": true, className: "absolute left-[calc(50%+1.25rem)] right-[calc(-50%+1.25rem)] top-4 " + (st.state === "done" && nextDone ? "h-0.5 rounded-full bg-primary" : "border-t-2 border-dashed border-border") })), st.key === "invoiced" && invoiceLoad === "loading" ? (_jsx("span", { "aria-label": "Factuurstand laden", className: "relative z-10 inline-flex h-8 w-8 animate-pulse rounded-full border border-border bg-muted" })) : (_jsx("span", { className: "relative z-10 inline-flex h-8 w-8 items-center justify-center rounded-full border " + tone, children: Icon })), _jsx("span", { className: "mt-2 text-xs font-medium leading-tight sm:text-sm " + (st.state === "todo" ? "text-muted-foreground" : "text-foreground"), children: st.title }), _jsx("span", { className: "mt-0.5 text-[11px] tabular-nums " + (st.state === "error" || st.state === "late" ? "text-destructive" : "text-muted-foreground"), children: st.key === "invoiced" && invoiceLoad === "loading" ? (_jsx("span", { className: "inline-block h-2.5 w-12 animate-pulse rounded bg-muted align-middle" })) : st.state === "done" ? (fmt(st.at) ?? STATE_TEXT.done) : STATE_TEXT[st.state] })] }, st.key));
75
76
  }) }));
76
77
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=delivery-format.check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-format.check.d.ts","sourceRoot":"","sources":["../../src/lib/delivery-format.check.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { formatDelivery } from "./delivery-format.js";
2
+ let fail = 0;
3
+ const eq = (name, a, b) => {
4
+ const ok = JSON.stringify(a) === JSON.stringify(b);
5
+ if (!ok)
6
+ fail++;
7
+ console.log(`${ok ? "OK " : "FOUT"} ${name}: ${JSON.stringify(a)}${ok ? "" : ` ≠ ${JSON.stringify(b)}`}`);
8
+ };
9
+ // AO-2601450: delivery_date "2026-10-26" (datumveld, geen tijd).
10
+ eq("AO kale datum → geen tijd", formatDelivery("2026-10-26", false, { year: true }), { date: "ma 26 okt 2026", time: "" });
11
+ // Zelfde veld, ooit als UTC-middernacht doorgegeven: het veld zegt datum → geen tijd, geen verschoven dag.
12
+ eq("datumveld als UTC-middernacht", formatDelivery("2026-10-26T00:00:00+00:00", false), { date: "ma 26 okt", time: "" });
13
+ // FO-2601462: echt tijdstip 06:00 NL (winter = UTC+1).
14
+ eq("FO echt tijdstip 06:00", formatDelivery("2026-10-28T05:00:00Z", true), { date: "wo 28 okt", time: "06:00" });
15
+ // Echt tijdstip op middernacht UTC blijft zichtbaar.
16
+ eq("echt tijdstip middernacht UTC winter → 01:00", formatDelivery("2026-10-27T00:00:00Z", true), { date: "di 27 okt", time: "01:00" });
17
+ eq("echt tijdstip middernacht UTC zomer → 02:00", formatDelivery("2026-10-24T00:00:00Z", true), { date: "za 24 okt", time: "02:00" });
18
+ // Wisseling zomer→winter (zo 25 okt 03:00 → 02:00).
19
+ eq("25 okt 00:30Z (zomer) → 02:30", formatDelivery("2026-10-25T00:30:00Z", true), { date: "zo 25 okt", time: "02:30" });
20
+ eq("25 okt 01:30Z (winter) → 02:30", formatDelivery("2026-10-25T01:30:00Z", true), { date: "zo 25 okt", time: "02:30" });
21
+ eq("25 okt 23:30Z → ma 26 00:30", formatDelivery("2026-10-25T23:30:00Z", true), { date: "ma 26 okt", time: "00:30" });
22
+ eq("kale datum 25 okt", formatDelivery("2026-10-25", false), { date: "zo 25 okt", time: "" });
23
+ // Lokaal tijdstip zonder zone (eigen order met aanlevertijd) blijft gelijk aan nu.
24
+ eq("eigen order met aanlevertijd", formatDelivery("2026-10-26T08:00:00", true), { date: "ma 26 okt", time: "08:00" });
25
+ if (fail) {
26
+ console.error(`${fail} fout(en)`);
27
+ process.exit(1);
28
+ }
@@ -0,0 +1,17 @@
1
+ export declare function formatDelivery(value: string | null | undefined, hasTime: boolean, opts?: {
2
+ year?: boolean;
3
+ }): {
4
+ date: string;
5
+ time: string;
6
+ };
7
+ /**
8
+ * Bronregel: heeft de leverwaarde van dit veld een tijd?
9
+ * - Floriday latestDeliveryDateTime: altijd een tijdstip.
10
+ * - Eigen orders: delivery_date is een datumveld; alleen met custom_fields.delivery_time
11
+ * (of een als tijdstip opgeslagen waarde) is er een tijd.
12
+ */
13
+ export declare function deliveryHasTimeFor(dto: {
14
+ deliveryHasTime?: boolean;
15
+ deliveryAt?: string;
16
+ }): boolean;
17
+ //# sourceMappingURL=delivery-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-format.d.ts","sourceRoot":"","sources":["../../src/lib/delivery-format.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAmBhC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAInG"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Leverdatum/-tijd opmaken voor lijst en orderdetail.
3
+ * Of er een tijd is, bepaalt het bronveld (deliveryHasTime), nooit de waarde:
4
+ * een echt tijdstip op middernacht UTC (01:00/02:00 NL) blijft een tijd.
5
+ * Een kale datum wordt zonder tijdzone-omrekening getoond.
6
+ */
7
+ const TZ = "Europe/Amsterdam";
8
+ export function formatDelivery(value, hasTime, opts = {}) {
9
+ const v = String(value ?? "").trim();
10
+ if (!v)
11
+ return { date: "—", time: "" };
12
+ if (!hasTime) {
13
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(v);
14
+ if (!m)
15
+ return { date: v, time: "" };
16
+ // Kalenderdatum: rekenen in UTC zodat de dag nooit verschuift.
17
+ const d = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], 12));
18
+ return {
19
+ date: d.toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short", ...(opts.year ? { year: "numeric" } : {}), timeZone: "UTC" }),
20
+ time: "",
21
+ };
22
+ }
23
+ const d = new Date(v);
24
+ if (Number.isNaN(d.getTime()))
25
+ return { date: v, time: "" };
26
+ return {
27
+ date: d.toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short", ...(opts.year ? { year: "numeric" } : {}), timeZone: TZ }),
28
+ time: d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: TZ }),
29
+ };
30
+ }
31
+ /**
32
+ * Bronregel: heeft de leverwaarde van dit veld een tijd?
33
+ * - Floriday latestDeliveryDateTime: altijd een tijdstip.
34
+ * - Eigen orders: delivery_date is een datumveld; alleen met custom_fields.delivery_time
35
+ * (of een als tijdstip opgeslagen waarde) is er een tijd.
36
+ */
37
+ export function deliveryHasTimeFor(dto) {
38
+ if (typeof dto.deliveryHasTime === "boolean")
39
+ return dto.deliveryHasTime;
40
+ // Oude gecachte rijen zonder vlag: gedrag van vóór de vlag (kale datum = geen tijd).
41
+ return !/^\d{4}-\d{2}-\d{2}$/.test(String(dto.deliveryAt ?? "").trim());
42
+ }
@@ -25,6 +25,10 @@ export interface InvoiceResult {
25
25
  invoices: Map<string, ErpInvoiceInfo>;
26
26
  available: boolean;
27
27
  warnings: string[];
28
+ /** Tijdslimiet overschreden (stand nog onbekend, niet "niet beschikbaar"). */
29
+ timedOut?: boolean;
30
+ /** Echte fout (geen ontbrekende module of geen recht). */
31
+ failed?: boolean;
28
32
  }
29
33
  export interface PickResult {
30
34
  pick: Map<string, PickProgress>;
@@ -37,5 +41,24 @@ export declare function loadInvoiceStatuses(client: RpcClient, orderIds: string[
37
41
  export declare function loadPickProgress(client: RpcClient, orderIds: string[], ms?: number): Promise<PickResult>;
38
42
  /** Oude samengestelde aanroep (blijft bestaan voor bestaande gebruikers). */
39
43
  export declare function loadInvoiceAndPickProgress(client: RpcClient, orderIds: string[]): Promise<InvoicePickResult>;
44
+ /** Stand van de factuurgegevens voor het orderdetail. */
45
+ export type DetailInvoiceState = "ok" | "pending" | "failed";
46
+ export interface DetailProgress {
47
+ features: {
48
+ erpInvoices: boolean;
49
+ pickProgress: boolean;
50
+ };
51
+ invoice: DetailInvoiceState;
52
+ }
53
+ /**
54
+ * Orderdetail: factuurstand + pickvoortgang voor de order en zijn groepsleden,
55
+ * tegelijk en met dezelfde bronnen als de lijst. Zet erpInvoice/pickProgress
56
+ * direct op de meegegeven orders. Alleen lezen.
57
+ */
58
+ export declare function attachDetailProgress(client: RpcClient, orders: {
59
+ orderRowId?: string | null;
60
+ erpInvoice?: ErpInvoiceInfo | null;
61
+ pickProgress?: PickProgress | null;
62
+ }[], ms?: number): Promise<DetailProgress>;
40
63
  export {};
41
64
  //# sourceMappingURL=order-progress.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-progress.server.d.ts","sourceRoot":"","sources":["../../src/lib/order-progress.server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrE,KAAK,SAAS,GAAG;IAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA;CAAE,CAAC;AASvD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAChC,YAAY,E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AE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CA6B/H;AAED,6EAA6E;AAC7E,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6BzH;AAED,6EAA6E;AAC7E,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,iBAAiB,CAAC,CAS5B;AAED,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE;QAAE,WAAW,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAC1D,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,EAAE,EAChH,EAAE,SAAoB,GACrB,OAAO,CAAC,cAAc,CAAC,CAazB"}
@@ -64,10 +64,12 @@ export async function loadInvoiceStatuses(client, orderIds, ms = ENRICH_TIMEOUT_
64
64
  const r = await withTimeout(inChunks(client, "erp_invoice_status_for_orders", ids), ms);
65
65
  if (r.timedOut) {
66
66
  out.warnings.push(`Factuurstand kwam niet binnen ${ms / 1000} s; het factuuricoon toont de gewone weergave.`);
67
+ out.timedOut = true;
67
68
  return out;
68
69
  }
69
70
  const inv = r.value;
70
71
  out.available = inv.available;
72
+ out.failed = !inv.available && !!inv.warning && inv.warning !== "missing";
71
73
  if (inv.warning === "missing")
72
74
  out.warnings.push("Factuurstand is niet beschikbaar (Facturatie-module ontbreekt of is te oud); het factuuricoon is verborgen voor ERP-orders.");
73
75
  else if (inv.warning)
@@ -134,3 +136,26 @@ export async function loadInvoiceAndPickProgress(client, orderIds) {
134
136
  warnings: [...inv.warnings, ...pick.warnings],
135
137
  };
136
138
  }
139
+ /**
140
+ * Orderdetail: factuurstand + pickvoortgang voor de order en zijn groepsleden,
141
+ * tegelijk en met dezelfde bronnen als de lijst. Zet erpInvoice/pickProgress
142
+ * direct op de meegegeven orders. Alleen lezen.
143
+ */
144
+ export async function attachDetailProgress(client, orders, ms = ENRICH_TIMEOUT_MS) {
145
+ const ids = Array.from(new Set(orders.map((o) => o.orderRowId).filter((v) => !!v)));
146
+ if (!ids.length)
147
+ return { features: { erpInvoices: false, pickProgress: false }, invoice: "ok" };
148
+ const [inv, pick] = await Promise.all([loadInvoiceStatuses(client, ids, ms), loadPickProgress(client, ids, ms)]);
149
+ for (const o of orders) {
150
+ if (!o.orderRowId)
151
+ continue;
152
+ if (inv.available)
153
+ o.erpInvoice = inv.invoices.get(o.orderRowId) ?? null;
154
+ if (pick.available && pick.pick.has(o.orderRowId))
155
+ o.pickProgress = pick.pick.get(o.orderRowId) ?? null;
156
+ }
157
+ return {
158
+ features: { erpInvoices: inv.available, pickProgress: pick.available },
159
+ invoice: inv.timedOut ? "pending" : inv.failed ? "failed" : "ok",
160
+ };
161
+ }
@@ -24,6 +24,7 @@ export declare const getLocalSalesOrderDetail: import("@tanstack/start-client-co
24
24
  id: string;
25
25
  }, Promise<{
26
26
  order: import("./salesorders-mapping.js").SalesOrderDTO | null;
27
+ progress: import("./order-progress.server.js").DetailProgress | undefined;
27
28
  bufferId: string | null;
28
29
  bufferSiblings: import("./salesorders-mapping.js").SalesOrderDTO[];
29
30
  sellerFallback: string | null;
@@ -46,4 +47,23 @@ export declare const getFloridayStatusesForRows: import("@tanstack/start-client-
46
47
  statuses: Record<string, import("./floriday-status.js").FloridayStatusSummary>;
47
48
  error: string | null;
48
49
  }>>;
50
+ /**
51
+ * Orderdetail-vangnet: factuurstand + pickvoortgang opnieuw lezen als die in
52
+ * het detailverzoek niet binnen de tijdslimiet kwam. Hooguit 10 s, alleen lezen.
53
+ */
54
+ export declare const getOrderDetailProgress: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
55
+ supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
56
+ userId: string;
57
+ claims: import("@supabase/auth-js").User;
58
+ }, undefined, undefined, undefined>], (input: unknown) => {
59
+ orderRowIds: string[];
60
+ }, Promise<{
61
+ progress: import("./order-progress.server.js").DetailProgress;
62
+ byId: {
63
+ [k: string]: {
64
+ erpInvoice: any;
65
+ pickProgress: any;
66
+ };
67
+ };
68
+ }>>;
49
69
  //# sourceMappingURL=salesorders-list.functions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"salesorders-list.functions.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-list.functions.ts"],"names":[],"mappings":"AA4DA,eAAO,MAAM,eAAe;;;;8CAEF,OAAO;;;;;;;;;;;;;2DAQ7B,CAAC;AAML,eAAO,MAAM,wBAAwB;;;;8CAEX,OAAO;;;;;;;;GA+B7B,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;8CAEb,OAAO;;;;;;;;GAiB7B,CAAC"}
1
+ {"version":3,"file":"salesorders-list.functions.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-list.functions.ts"],"names":[],"mappings":"AA4DA,eAAO,MAAM,eAAe;;;;8CAEF,OAAO;;;;;;;;;;;;;2DAQ7B,CAAC;AAML,eAAO,MAAM,wBAAwB;;;;8CAEX,OAAO;;;;;;;;;GAuC7B,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;8CAEb,OAAO;;;;;;;;GAiB7B,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;8CAET,OAAO;;;;;;;;;;GAW7B,CAAC"}
@@ -91,8 +91,16 @@ export const getLocalSalesOrderDetail = createServerFn({ method: "POST" })
91
91
  order.bufferCartCount = b.count;
92
92
  order.bufferCartTypeName = b.typeName;
93
93
  }
94
+ const { attachDetailProgress } = await import("./order-progress.server.js");
95
+ const progress = order
96
+ ? await attachDetailProgress(context.supabase, [order, ...bufferSiblings]).catch(() => ({
97
+ features: { erpInvoices: false, pickProgress: false },
98
+ invoice: "failed",
99
+ }))
100
+ : undefined;
94
101
  return {
95
102
  order,
103
+ progress,
96
104
  bufferId: order?.bufferId ?? null,
97
105
  bufferSiblings,
98
106
  sellerFallback: result.sellerFallback,
@@ -122,3 +130,19 @@ export const getFloridayStatusesForRows = createServerFn({ method: "POST" })
122
130
  out[r.key] = summarizeFloridayStatus(r.ids, res.entries, res.error);
123
131
  return { statuses: out, error: res.error };
124
132
  });
133
+ /**
134
+ * Orderdetail-vangnet: factuurstand + pickvoortgang opnieuw lezen als die in
135
+ * het detailverzoek niet binnen de tijdslimiet kwam. Hooguit 10 s, alleen lezen.
136
+ */
137
+ export const getOrderDetailProgress = createServerFn({ method: "POST" })
138
+ .middleware([requireSupabaseAuth])
139
+ .inputValidator((input) => z.object({ orderRowIds: z.array(z.string().uuid()).min(1).max(50) }).parse(input))
140
+ .handler(async ({ data, context }) => {
141
+ const { attachDetailProgress } = await import("./order-progress.server.js");
142
+ const rows = data.orderRowIds.map((id) => ({ orderRowId: id, erpInvoice: null, pickProgress: null }));
143
+ const progress = await attachDetailProgress(context.supabase, rows, 10000);
144
+ return {
145
+ progress,
146
+ byId: Object.fromEntries(rows.map((r) => [r.orderRowId, { erpInvoice: r.erpInvoice, pickProgress: r.pickProgress }])),
147
+ };
148
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"salesorders-list.server.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-list.server.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA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EAAkE;IAClE,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AA6GD,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,GAAG,IAAW,QAEjE;AAkBD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvC;AAoDD;+EAC+E;AAC/E,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAgB3G;AA+BD,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,UAAU,EAClB,kBAAkB,GAAE,cAAyB,GAC5C,OAAO,CAAC,UAAU,CAAC,CA20CrB;AAsDD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACzC,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,qBAAqB,CAIvB"}
@@ -863,6 +863,7 @@ export async function buildSalesOrdersList(supabase, params, connectionSupabase
863
863
  imageUrl: null,
864
864
  orderedAt,
865
865
  deliveryAt,
866
+ deliveryHasTime: rawDeliveryDate.includes("T") || !!(rawDeliveryDate && deliveryTime),
866
867
  quantity: {
867
868
  multiplier: totalQuantity > 0 ? Math.ceil(totalQuantity / firstPlantsPerCrate) : 1,
868
869
  count: firstPlantsPerCrate,
@@ -23,6 +23,8 @@ export interface SalesOrderDTO {
23
23
  imageUrl: string | null;
24
24
  orderedAt: string;
25
25
  deliveryAt: string;
26
+ /** Bronveld heeft een tijd (Floriday: altijd; eigen order: alleen met aanlevertijd). */
27
+ deliveryHasTime?: boolean;
26
28
  quantity: {
27
29
  multiplier: number;
28
30
  count: number;
@@ -1 +1 @@
1
- {"version":3,"file":"salesorders-mapping.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-mapping.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,kBAAkB,EAAE,SAAS,GAAG,IAAI,CAAC;IACrD,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,kBAAkB,EAAE,YAAY,CAAC;IACvD,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,kBAAkB,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9D,8EAA8E;IAC9E,YAAY,CAAC,EAAE,OAAO,kBAAkB,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9D,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uFAAuF;IACvF,eAAe,CAAC,EAAE,OAAO,kBAAkB,EAAE,cAAc,EAAE,CAAC;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC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QAAQ,EAAE,MAAM,CAAA;CAAE,CA2CtF"}
@@ -146,6 +146,7 @@ export function mapJsonbToSalesOrderDTO(o, customerLookup, tradeItemLookup, crat
146
146
  imageUrl: tradeItem?.imageUrl ?? null,
147
147
  orderedAt,
148
148
  deliveryAt,
149
+ deliveryHasTime: true,
149
150
  quantity: { multiplier: numberOfPackages, count: piecesPerPackage, unitPrice },
150
151
  revenue,
151
152
  fustCount: numberOfPackages,
@@ -61,6 +61,14 @@ export type SalesOrderDetailResult = {
61
61
  environment: "staging" | "live";
62
62
  bufferId: string | null;
63
63
  bufferSiblings: SalesOrderDTO[];
64
+ /** Factuurstand + pickvoortgang (zelfde bronnen als de lijst), in hetzelfde verzoek. */
65
+ progress?: {
66
+ features: {
67
+ erpInvoices: boolean;
68
+ pickProgress: boolean;
69
+ };
70
+ invoice: "ok" | "pending" | "failed";
71
+ };
64
72
  };
65
73
  export declare const getSalesOrderDetail: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
66
74
  supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
@@ -1 +1 @@
1
- {"version":3,"file":"salesorders.functions.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders.functions.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAgC/B,eAAO,MAAM,kBAAkB;;;;;;;;GAK3B,CAAC;AA6BL,eAAO,MAAM,gBAAgB;;;;6CAEJ,OAAO;;;;;;;;;;;;;GAmC5B,CAAC;AAGL,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDnC,CAAC;AASL,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC;IAChC,Q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E,aAAa,EAAE,CAAC;IAChC,wFAAwF;IACxF,QAAQ,CAAC,EAAE;QAAE,QAAQ,EAAE;YAAE,WAAW,EAAE,OAAO,CAAC;YAAC,YAAY,EAAE,OAAO,CAAA;SAAE,CAAC;QAAC,OAAO,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC;CAChH,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;0CAEV,OAAO;;mCAqbzB,CAAC;AAQL,eAAO,MAAM,uBAAuB;;;;0CAEd,OAAO;;;;;GAQzB,CAAC;AAOL,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qEAAqE;IACrE,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAIF,eAAO,MAAM,qBAAqB;;;;6EA4E9B,CAAC"}
@@ -7,6 +7,7 @@ import { z } from "zod";
7
7
  import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
8
8
  import { mapJsonbToSalesOrderDTO, packingConfigFromFloridayPacking, } from "./salesorders-mapping.js";
9
9
  import { resolveOrderStage } from "./order-status.js";
10
+ import { invoiceRoute } from "./order-progress.js";
10
11
  import { engineLoadCarrierLabel, normalizeLoadCarrierCode } from "./load-carriers.js";
11
12
  import { resolveOrderNumbers } from "./order-numbers.server.js";
12
13
  const CANONICAL_ENTITY_TYPE = "sales-orders";
@@ -291,7 +292,7 @@ export const getSalesOrderDetail = createServerFn({ method: "POST" })
291
292
  try {
292
293
  const ownRes = await supabase
293
294
  .from("orders")
294
- .select("id, buffer_id, status, is_reservation, custom_fields, invoice_due_at, invoice_ready_at, invoice_ready_note, order_items(product_id, product_name, source_line_key, quarantined_at, quantity, unit_price)")
295
+ .select("id, buffer_id, status, is_reservation, order_source, floriday_sales_order_id, custom_fields, invoice_due_at, invoice_ready_at, invoice_ready_note, order_items(product_id, product_name, source_line_key, quarantined_at, quantity, unit_price)")
295
296
  .eq("floriday_sales_order_id", data.id)
296
297
  .maybeSingle();
297
298
  const ownRow = ownRes.data ?? null;
@@ -310,6 +311,12 @@ export const getSalesOrderDetail = createServerFn({ method: "POST" })
310
311
  });
311
312
  dto.invoiceState = ownRow ? invoiceStateLabel(ownRow) : null;
312
313
  dto.invoiceNote = ownRow?.invoice_ready_note ?? null;
314
+ // Zelfde factuurroute en ids als de lijst (salesorders-list.server).
315
+ dto.orderRowId = ownRow?.id ? String(ownRow.id) : null;
316
+ dto.invoiceRoute = invoiceRoute({
317
+ floridaySalesOrderId: ownRow?.floriday_sales_order_id ?? String(data.id),
318
+ orderSource: ownRow?.order_source ?? "floriday",
319
+ });
313
320
  dto.floridayFulfilled = Boolean((ownRow?.custom_fields ?? {})?.floriday_fulfilled);
314
321
  dto.floridayExternalFulfilledAt = (ownRow?.custom_fields ?? {})?.floriday_external_fulfilled_at ?? null;
315
322
  {
@@ -383,12 +390,13 @@ export const getSalesOrderDetail = createServerFn({ method: "POST" })
383
390
  // de stand los na via getFloridayStatusesForRows, net als de lijst.
384
391
  if (foIds.length)
385
392
  dto.floridayStatusIds = foIds;
393
+ dto.floridayIds = foIds.length ? foIds : [String(data.id)];
386
394
  }
387
395
  if (bufferId) {
388
396
  dto.bufferId = bufferId;
389
397
  const sibRes = await supabase
390
398
  .from("orders")
391
- .select("floriday_sales_order_id, status, is_reservation, custom_fields")
399
+ .select("id, floriday_sales_order_id, status, is_reservation, order_source, custom_fields")
392
400
  .eq("buffer_id", bufferId)
393
401
  .not("floriday_sales_order_id", "is", null);
394
402
  const sibLocalByFoId = new Map();
@@ -503,6 +511,13 @@ export const getSalesOrderDetail = createServerFn({ method: "POST" })
503
511
  isReservation: sLocal ? !!sLocal.is_reservation : false,
504
512
  });
505
513
  sDto.floridayFulfilled = Boolean((sLocal?.custom_fields ?? {})?.floriday_fulfilled);
514
+ sDto.floridayExternalFulfilledIds = (sLocal?.custom_fields ?? {})?.floriday_external_fulfilled_sales_order_ids ?? [];
515
+ sDto.orderRowId = sLocal?.id ? String(sLocal.id) : null;
516
+ sDto.invoiceRoute = invoiceRoute({
517
+ floridaySalesOrderId: String(sr.floriday_id),
518
+ orderSource: sLocal?.order_source ?? "floriday",
519
+ });
520
+ sDto.floridayIds = [String(sr.floriday_id)];
506
521
  bufferSiblings.push(sDto);
507
522
  }
508
523
  }
@@ -511,7 +526,12 @@ export const getSalesOrderDetail = createServerFn({ method: "POST" })
511
526
  catch (err) {
512
527
  console.warn("[getSalesOrderDetail] buffer-siblings lookup faalde:", err.message);
513
528
  }
514
- return { order: dto, sellerFallback, environment, bufferId, bufferSiblings };
529
+ const { attachDetailProgress } = await import("./order-progress.server.js");
530
+ const progress = await attachDetailProgress(supabase, [dto, ...bufferSiblings]).catch(() => ({
531
+ features: { erpInvoices: false, pickProgress: false },
532
+ invoice: "failed",
533
+ }));
534
+ return { order: dto, sellerFallback, environment, bufferId, bufferSiblings, progress };
515
535
  });
516
536
  // ─── Handmatige controle na orderpicken ───────────────────────────────────
517
537
  const ControlInputSchema = z.object({
@@ -0,0 +1,17 @@
1
+ import type { ErpInvoiceInfo, PickProgress, ProgressFeatures } from "./order-progress.js";
2
+ /**
3
+ * Alleen als de factuurstand in het detailverzoek niet op tijd kwam: één keer
4
+ * opnieuw lezen (server wacht hooguit 10 s). Tot dan "loading"; mislukt of te
5
+ * laat → "unknown". Er flitst dus nooit "Onbekend".
6
+ */
7
+ export declare function useDetailProgressFallback(orders: {
8
+ orderRowId?: string | null;
9
+ }[] | null): {
10
+ state: "loading" | "ok" | "unknown";
11
+ features: ProgressFeatures | null;
12
+ byId: Record<string, {
13
+ erpInvoice: ErpInvoiceInfo | null;
14
+ pickProgress: PickProgress | null;
15
+ }> | null;
16
+ };
17
+ //# sourceMappingURL=useDetailProgressFallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDetailProgressFallback.d.ts","sourceRoot":"","sources":["../../src/lib/useDetailProgressFallback.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,GAAG,IAAI,GAAG;IAC1F,KAAK,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CACvG,CAeA"}
@@ -0,0 +1,28 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { useServerFn } from "@tanstack/react-start";
3
+ import { getOrderDetailProgress } from "./salesorders-list.functions.js";
4
+ /**
5
+ * Alleen als de factuurstand in het detailverzoek niet op tijd kwam: één keer
6
+ * opnieuw lezen (server wacht hooguit 10 s). Tot dan "loading"; mislukt of te
7
+ * laat → "unknown". Er flitst dus nooit "Onbekend".
8
+ */
9
+ export function useDetailProgressFallback(orders) {
10
+ const fn = useServerFn(getOrderDetailProgress);
11
+ const ids = Array.from(new Set((orders ?? []).map((o) => o.orderRowId).filter((v) => !!v))).slice(0, 50);
12
+ const q = useQuery({
13
+ queryKey: ["salesorders", "detail-progress", ids],
14
+ enabled: !!orders && ids.length > 0,
15
+ retry: false,
16
+ staleTime: 30000,
17
+ queryFn: () => fn({ data: { orderRowIds: ids } }),
18
+ });
19
+ if (!orders)
20
+ return { state: "ok", features: null, byId: null };
21
+ if (!ids.length || q.isError)
22
+ return { state: "unknown", features: null, byId: null };
23
+ if (!q.data)
24
+ return { state: "loading", features: null, byId: null };
25
+ if (q.data.progress.invoice !== "ok")
26
+ return { state: "unknown", features: q.data.progress.features, byId: q.data.byId };
27
+ return { state: "ok", features: q.data.progress.features, byId: q.data.byId };
28
+ }
@@ -1,5 +1,6 @@
1
1
  export declare function useLocalSalesOrderDetailQuery(id: string | null | undefined): import("@tanstack/react-query").UseQueryResult<{
2
2
  order: import("./salesorders-mapping.js").SalesOrderDTO | null;
3
+ progress: import("./order-progress.server.js").DetailProgress | undefined;
3
4
  bufferId: string | null;
4
5
  bufferSiblings: import("./salesorders-mapping.js").SalesOrderDTO[];
5
6
  sellerFallback: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useLocalSalesOrderDetailQuery.d.ts","sourceRoot":"","sources":["../../src/lib/useLocalSalesOrderDetailQuery.ts"],"names":[],"mappings":"AAQA,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;UA2C1E"}
1
+ {"version":3,"file":"useLocalSalesOrderDetailQuery.d.ts","sourceRoot":"","sources":["../../src/lib/useLocalSalesOrderDetailQuery.ts"],"names":[],"mappings":"AAQA,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;UA2C1E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-verkoop-module",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",