@flowselections/floriday-verkoop-module 1.0.164 → 1.0.166

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 (125) hide show
  1. package/dist-lib/components/verkoop/CartLayersDialog.d.ts.map +1 -1
  2. package/dist-lib/components/verkoop/CartLayersDialog.js +35 -30
  3. package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
  4. package/dist-lib/components/verkoop/CreateOrderPage.js +31 -45
  5. package/dist-lib/components/verkoop/EditLocalOrderDialog.d.ts.map +1 -1
  6. package/dist-lib/components/verkoop/EditLocalOrderDialog.js +13 -1
  7. package/dist-lib/components/verkoop/KarSlotMelding.d.ts +7 -0
  8. package/dist-lib/components/verkoop/KarSlotMelding.d.ts.map +1 -0
  9. package/dist-lib/components/verkoop/KarSlotMelding.js +32 -0
  10. package/dist-lib/components/verkoop/KarTekeningSection.d.ts.map +1 -1
  11. package/dist-lib/components/verkoop/KarTekeningSection.js +34 -8
  12. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -1
  13. package/dist-lib/components/verkoop/OrderKarindelingCard.js +18 -3
  14. package/dist-lib/components/verkoop/OrderLinePackingCard.d.ts.map +1 -1
  15. package/dist-lib/components/verkoop/OrderLinePackingCard.js +12 -3
  16. package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
  17. package/dist-lib/components/verkoop/SalesOrderDetailPage.js +3 -0
  18. package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
  19. package/dist-lib/components/verkoop/SalesOrderDetailView.js +6 -2
  20. package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
  21. package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -2
  22. package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
  23. package/dist-lib/components/verkoop/VerkoopOrdersPage.js +2 -1
  24. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts +10 -0
  25. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts.map +1 -0
  26. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.js +47 -0
  27. package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts +10 -0
  28. package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts.map +1 -0
  29. package/dist-lib/components/verkoop/correcties/CorrectieChip.js +11 -0
  30. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts +3 -0
  31. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts.map +1 -0
  32. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.js +16 -0
  33. package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts +3 -0
  34. package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts.map +1 -0
  35. package/dist-lib/components/verkoop/correcties/CorrectiesPage.js +31 -0
  36. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts +7 -0
  37. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts.map +1 -0
  38. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.js +17 -0
  39. package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts +5 -0
  40. package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts.map +1 -0
  41. package/dist-lib/components/verkoop/correcties/OudeOrderCard.js +48 -0
  42. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts +5 -0
  43. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts.map +1 -0
  44. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.js +53 -0
  45. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts +5 -0
  46. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts.map +1 -0
  47. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.js +31 -0
  48. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts +11 -0
  49. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts.map +1 -0
  50. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.js +17 -0
  51. package/dist-lib/index.d.ts +1 -0
  52. package/dist-lib/index.d.ts.map +1 -1
  53. package/dist-lib/index.js +1 -0
  54. package/dist-lib/integrations/supabase/types.d.ts +2699 -2
  55. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  56. package/dist-lib/integrations/supabase/types.js +1 -0
  57. package/dist-lib/lib/belading-format.d.ts +3 -2
  58. package/dist-lib/lib/belading-format.d.ts.map +1 -1
  59. package/dist-lib/lib/belading-format.js +5 -3
  60. package/dist-lib/lib/beslis-rollen.server.d.ts +10 -0
  61. package/dist-lib/lib/beslis-rollen.server.d.ts.map +1 -0
  62. package/dist-lib/lib/beslis-rollen.server.js +10 -0
  63. package/dist-lib/lib/cart-layers.functions.d.ts +31 -0
  64. package/dist-lib/lib/cart-layers.functions.d.ts.map +1 -1
  65. package/dist-lib/lib/cart-layers.functions.js +33 -5
  66. package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
  67. package/dist-lib/lib/cart-replan.functions.js +8 -4
  68. package/dist-lib/lib/create-order-customers.d.ts +12 -0
  69. package/dist-lib/lib/create-order-customers.d.ts.map +1 -1
  70. package/dist-lib/lib/create-order-customers.js +36 -0
  71. package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
  72. package/dist-lib/lib/create-order.functions.js +83 -44
  73. package/dist-lib/lib/engine-tijdlijn.d.ts +69 -0
  74. package/dist-lib/lib/engine-tijdlijn.d.ts.map +1 -0
  75. package/dist-lib/lib/engine-tijdlijn.functions.d.ts +30 -0
  76. package/dist-lib/lib/engine-tijdlijn.functions.d.ts.map +1 -0
  77. package/dist-lib/lib/engine-tijdlijn.functions.js +47 -0
  78. package/dist-lib/lib/engine-tijdlijn.js +101 -0
  79. package/dist-lib/lib/engine-tijdlijn.server.d.ts +30 -0
  80. package/dist-lib/lib/engine-tijdlijn.server.d.ts.map +1 -0
  81. package/dist-lib/lib/engine-tijdlijn.server.js +41 -0
  82. package/dist-lib/lib/kar-handmatig.d.ts +52 -0
  83. package/dist-lib/lib/kar-handmatig.d.ts.map +1 -0
  84. package/dist-lib/lib/kar-handmatig.js +106 -0
  85. package/dist-lib/lib/kar-handmatig.server.d.ts +25 -0
  86. package/dist-lib/lib/kar-handmatig.server.d.ts.map +1 -0
  87. package/dist-lib/lib/kar-handmatig.server.js +24 -0
  88. package/dist-lib/lib/kar-tekening.d.ts +58 -5
  89. package/dist-lib/lib/kar-tekening.d.ts.map +1 -1
  90. package/dist-lib/lib/kar-tekening.js +95 -8
  91. package/dist-lib/lib/kar-tekening.server.d.ts +5 -0
  92. package/dist-lib/lib/kar-tekening.server.d.ts.map +1 -1
  93. package/dist-lib/lib/kar-tekening.server.js +18 -0
  94. package/dist-lib/lib/logistics-engine.server.d.ts.map +1 -1
  95. package/dist-lib/lib/logistics-engine.server.js +13 -9
  96. package/dist-lib/lib/order-item-packing.functions.d.ts +23 -0
  97. package/dist-lib/lib/order-item-packing.functions.d.ts.map +1 -1
  98. package/dist-lib/lib/order-item-packing.functions.js +75 -8
  99. package/dist-lib/lib/order-row.server.d.ts.map +1 -1
  100. package/dist-lib/lib/order-row.server.js +9 -6
  101. package/dist-lib/lib/plan-coverage.server.d.ts.map +1 -1
  102. package/dist-lib/lib/plan-coverage.server.js +4 -2
  103. package/dist-lib/lib/sales-corrections.d.ts +44 -0
  104. package/dist-lib/lib/sales-corrections.d.ts.map +1 -0
  105. package/dist-lib/lib/sales-corrections.functions.d.ts +92 -0
  106. package/dist-lib/lib/sales-corrections.functions.d.ts.map +1 -0
  107. package/dist-lib/lib/sales-corrections.functions.js +132 -0
  108. package/dist-lib/lib/sales-corrections.js +129 -0
  109. package/dist-lib/lib/sales-corrections.server.d.ts +27 -0
  110. package/dist-lib/lib/sales-corrections.server.d.ts.map +1 -0
  111. package/dist-lib/lib/sales-corrections.server.js +68 -0
  112. package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
  113. package/dist-lib/lib/salesorders-list.functions.js +17 -11
  114. package/dist-lib/lib/step-timer.server.d.ts +13 -0
  115. package/dist-lib/lib/step-timer.server.d.ts.map +1 -0
  116. package/dist-lib/lib/step-timer.server.js +33 -0
  117. package/dist-lib/lib/stock-product-link.server.d.ts.map +1 -1
  118. package/dist-lib/lib/stock-product-link.server.js +12 -8
  119. package/dist-lib/lib/useOpenCorrections.d.ts +17 -0
  120. package/dist-lib/lib/useOpenCorrections.d.ts.map +1 -0
  121. package/dist-lib/lib/useOpenCorrections.js +34 -0
  122. package/dist-lib/lib/useOrderDetailPrefetch.d.ts +9 -0
  123. package/dist-lib/lib/useOrderDetailPrefetch.d.ts.map +1 -0
  124. package/dist-lib/lib/useOrderDetailPrefetch.js +45 -0
  125. package/package.json +6 -1
@@ -22,6 +22,10 @@ import { OrderControlStatusCard } from "./OrderControlStatusCard.js";
22
22
  import { OrderTransportCard, ownPickupText, useOrderTransport } from "./OrderTransportCard.js";
23
23
  import { KLANT_HAALT_ZELF_OP } from "../../lib/own-transport.js";
24
24
  import { getFloridayStatusesForRows } from "../../lib/salesorders-list.functions.js";
25
+ import { OrderCorrectiesCard } from "./correcties/OrderCorrectiesCard.js";
26
+ import { OudeOrderCard } from "./correcties/OudeOrderCard.js";
27
+ import { GewijzigdNaPrintCard } from "./tijdlijn/GewijzigdNaPrintCard.js";
28
+ import { OrderTijdlijnCard } from "./tijdlijn/OrderTijdlijnCard.js";
25
29
  function AddressCard({ icon, lines, extra, }) {
26
30
  return (_jsxs("div", { className: "inline-flex max-w-xs items-start gap-3 rounded-md border border-border bg-card p-3", children: [_jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-md bg-primary/10 text-primary", children: icon }), _jsxs("div", { className: "text-sm", children: [lines.length > 0 ? lines.map((l, i) => _jsx("div", { children: l }, i)) : _jsx("div", { children: "\u2014" }), extra && _jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: extra })] })] }));
27
31
  }
@@ -317,9 +321,9 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
317
321
  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
322
  })()] }), _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
319
323
  ? (order.articleCount ?? 0) > 1 ? `Gemengd (${order.articleCount} artikelen)` : "Gemengd"
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: [klantHaaltOp ? (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border p-4", children: [_jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:h-5 [&_svg]:w-5", "aria-hidden": true, children: _jsx(MapPin, {}) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "mb-1 text-sm font-semibold text-foreground", children: "Afleveradres" }), _jsx("span", { className: "text-foreground", children: KLANT_HAALT_ZELF_OP })] })] })) : (_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, pickProgress: member?.pickProgress ?? null })] }), _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
324
+ : `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: [klantHaaltOp ? (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border p-4", children: [_jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:h-5 [&_svg]:w-5", "aria-hidden": true, children: _jsx(MapPin, {}) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "mb-1 text-sm font-semibold text-foreground", children: "Afleveradres" }), _jsx("span", { className: "text-foreground", children: KLANT_HAALT_ZELF_OP })] })] })) : (_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines })), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(GewijzigdNaPrintCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderCorrectiesCard, { salesOrderIds: Array.from(new Set([...(order.floridayIds ?? []), ...(o?.salesOrderId ? [String(o.salesOrderId)] : [])])), floridayOrder: o, orderRowId: invoiceOrderId }), _jsx(OudeOrderCard, { orderRowId: invoiceOrderId }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order, pickProgress: member?.pickProgress ?? null })] }), _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
321
325
  ? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
322
- : `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined }), _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." })), (() => {
326
+ : `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsx(OrderTijdlijnCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined }), _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." })), (() => {
323
327
  const line = floridayInvoiceState(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0, {
324
328
  full: !!order.floridayExternalFulfilledAt,
325
329
  count: order.floridayExternalFulfilledIds?.length ?? 0,
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AACA,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;AAwBlC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAG1D;AAqZD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,QAA2B,EAC3B,SAAmC,EACnC,cAAc,EACd,YAAgB,EAChB,OAAO,EACP,KAAa,EACb,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAc,GACf,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,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
+ {"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AAEA,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;AAwBlC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAG1D;AAuZD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,QAA2B,EAC3B,SAAmC,EACnC,cAAc,EACd,YAAgB,EAChB,OAAO,EACP,KAAa,EACb,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAc,GACf,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,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 { CorrectieChip } from "./correcties/CorrectieChip.js";
2
3
  import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
3
4
  import { memo, useEffect, useMemo, useRef, useState } from "react";
4
5
  import { Checkbox, Skeleton, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@flowselections/core";
@@ -105,7 +106,7 @@ const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, hig
105
106
  e.stopPropagation();
106
107
  handlers.current.onSelectOrder?.(row);
107
108
  }, className: "min-w-0 truncate rounded-sm font-medium tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
108
- (cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }), _jsx(TableCell, { className: "min-w-0 py-0", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { "aria-hidden": true, className: "hidden h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary lg:inline-flex", children: initials(row.customer.name) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", title: row.customer.name || undefined, children: _jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }) }), _jsx(Line, { text: place, className: "text-xs text-muted-foreground" })] })] }) }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: ordered.date, className: "text-sm text-foreground" }), _jsx(Line, { text: ordered.time, className: "text-xs text-muted-foreground tabular-nums" })] }), _jsxs(TableCell, { className: "py-0 text-left", children: [row.articleLines?.length ? (_jsx(ArticleNames, { row: row })) : (_jsx(ArticlesHover, { ids: row.bufferOrderIds?.length ? row.bufferOrderIds : [row.id], count: row.articleCount ?? 1, children: _jsx("span", { className: "text-sm text-foreground", children: `${articlesLabel(row.articleCount ?? 1)} · ${row.fustCount} fust` }) })), _jsx("div", { className: "text-xs text-muted-foreground", children: _jsx(Money, { value: row.revenue ?? 0 }) })] }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: delivery.date, className: "text-sm text-foreground" }), d2.text ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1 text-xs tabular-nums " + (d2.late ? "font-medium text-destructive" : "text-muted-foreground"), children: [d2.late ? _jsx(AlertCircle, { className: "h-3 w-3 shrink-0", "aria-hidden": true }) : _jsx(Clock, { className: "h-3 w-3 shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: d2.text })] })) : (_jsx("div", { children: "\u00a0" }))] }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [_jsx("button", { type: "button", "aria-label": `Open ${row.orderNumber || "order"}`, title: "Openen", onClick: () => handlers.current.onSelectOrder?.(row), className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 " +
109
+ (cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) }), _jsx(CorrectieChip, { row: row })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }), _jsx(TableCell, { className: "min-w-0 py-0", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { "aria-hidden": true, className: "hidden h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary lg:inline-flex", children: initials(row.customer.name) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", title: row.customer.name || undefined, children: _jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }) }), _jsx(Line, { text: place, className: "text-xs text-muted-foreground" })] })] }) }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: ordered.date, className: "text-sm text-foreground" }), _jsx(Line, { text: ordered.time, className: "text-xs text-muted-foreground tabular-nums" })] }), _jsxs(TableCell, { className: "py-0 text-left", children: [row.articleLines?.length ? (_jsx(ArticleNames, { row: row })) : (_jsx(ArticlesHover, { ids: row.bufferOrderIds?.length ? row.bufferOrderIds : [row.id], count: row.articleCount ?? 1, children: _jsx("span", { className: "text-sm text-foreground", children: `${articlesLabel(row.articleCount ?? 1)} · ${row.fustCount} fust` }) })), _jsx("div", { className: "text-xs text-muted-foreground", children: _jsx(Money, { value: row.revenue ?? 0 }) })] }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: delivery.date, className: "text-sm text-foreground" }), d2.text ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1 text-xs tabular-nums " + (d2.late ? "font-medium text-destructive" : "text-muted-foreground"), children: [d2.late ? _jsx(AlertCircle, { className: "h-3 w-3 shrink-0", "aria-hidden": true }) : _jsx(Clock, { className: "h-3 w-3 shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: d2.text })] })) : (_jsx("div", { children: "\u00a0" }))] }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [_jsx("button", { type: "button", "aria-label": `Open ${row.orderNumber || "order"}`, title: "Openen", onClick: () => handlers.current.onSelectOrder?.(row), className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 " +
109
110
  (focused ? "opacity-100" : "opacity-0"), children: _jsx(Eye, { className: "h-4 w-4", "aria-hidden": true }) }), _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined })] }) })] }));
110
111
  });
111
112
  const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, highlight, features, linkable, fulfillingId, handlers, }) {
@@ -123,7 +124,7 @@ const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, hig
123
124
  const d2 = deliveryLine2(row, delivery.time);
124
125
  const cancelled = row.stage === "cancelled";
125
126
  const h = handlers.current;
126
- return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 cursor-pointer gap-3 px-3 py-3.5 transition-colors active:bg-muted/70 " + (selected ? "bg-muted/50" : ""), style: { ...transitionStyle("opacity", 150), opacity: leaving ? 0 : 1 }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs("div", { className: "flex shrink-0 flex-col items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) }), _jsx(SourceIcon, { sources: members.map((m) => m.source) })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium tabular-nums " + (cancelled ? "line-through text-muted-foreground" : "text-foreground"), title: row.orderNumber || undefined, children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), _jsxs("div", { className: "truncate text-sm", title: row.customer.name || undefined, children: [_jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }), row.customer.city && _jsxs("span", { className: "text-muted-foreground", children: [" \u00B7 ", row.customer.city] })] })] }), _jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined }) })] }), _jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsxs("span", { className: "truncate", children: [articlesLabel(row.articleCount ?? 1), " \u00B7 ", row.fustCount, " fust"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "shrink-0 font-medium tabular-nums text-foreground", children: ["\u20AC ", amount(row.revenue ?? 0)] })] }), _jsxs("div", { className: "mt-2.5 flex min-w-0 flex-nowrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 truncate text-xs text-foreground", children: [delivery.date, d2.text ? (_jsxs("span", { className: d2.late ? "font-medium text-destructive" : "text-muted-foreground", children: [" ", d2.text] })) : null] }), _jsx("div", { className: "shrink-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) })] })] })] }));
127
+ return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 cursor-pointer gap-3 px-3 py-3.5 transition-colors active:bg-muted/70 " + (selected ? "bg-muted/50" : ""), style: { ...transitionStyle("opacity", 150), opacity: leaving ? 0 : 1 }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs("div", { className: "flex shrink-0 flex-col items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) }), _jsx(SourceIcon, { sources: members.map((m) => m.source) })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium tabular-nums " + (cancelled ? "line-through text-muted-foreground" : "text-foreground"), title: row.orderNumber || undefined, children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) }), _jsx(CorrectieChip, { row: row })] }), _jsxs("div", { className: "truncate text-sm", title: row.customer.name || undefined, children: [_jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }), row.customer.city && _jsxs("span", { className: "text-muted-foreground", children: [" \u00B7 ", row.customer.city] })] })] }), _jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined }) })] }), _jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsxs("span", { className: "truncate", children: [articlesLabel(row.articleCount ?? 1), " \u00B7 ", row.fustCount, " fust"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "shrink-0 font-medium tabular-nums text-foreground", children: ["\u20AC ", amount(row.revenue ?? 0)] })] }), _jsxs("div", { className: "mt-2.5 flex min-w-0 flex-nowrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 truncate text-xs text-foreground", children: [delivery.date, d2.text ? (_jsxs("span", { className: d2.late ? "font-medium text-destructive" : "text-muted-foreground", children: [" ", d2.text] })) : null] }), _jsx("div", { className: "shrink-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) })] })] })] }));
127
128
  });
128
129
  /**
129
130
  * Houdt bij een achtergrondverversing verdwenen rijen 150 ms zichtbaar
@@ -1 +1 @@
1
- {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAqRA,wBAAgB,iBAAiB,gCAyjChC"}
1
+ {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAsRA,wBAAgB,iBAAiB,gCA4jChC"}
@@ -29,6 +29,7 @@ import { SalesOrdersFilterPanel, countActiveFilters, } from "./SalesOrdersFilter
29
29
  import { SalesOrdersTable, salesOrderRowId } from "./SalesOrdersTable.js";
30
30
  import { EditLocalOrderDialog } from "./EditLocalOrderDialog.js";
31
31
  import { StockConsumptionAlertsBanner } from "./StockConsumptionAlertsBanner.js";
32
+ import { CorrectiesBalk } from "./correcties/CorrectiesBalk.js";
32
33
  import { KPI_GRID_CLASS, KpiTile } from "./v3/KpiTile.js";
33
34
  import { FilterChip } from "./v3/FilterChip.js";
34
35
  import { markeerGeannuleerd } from "../../lib/order-cancel-view.js";
@@ -657,7 +658,7 @@ export function VerkoopOrdersPage() {
657
658
  const t = amsterdamYmd();
658
659
  const from = ymdString({ ...t, y: t.y - 1, d: t.m === 2 && t.d === 29 ? 28 : t.d });
659
660
  setFilters({ ...filters, period: "custom", customFrom: from, customTo: ymdString(t) });
660
- }, children: "Zoek in het laatste jaar" })), (filters.search || activeFilterCount > 0) && (_jsx(Button, { variant: "ghost", size: "sm", onClick: clearAll, children: "Alles wissen" }))] }), _jsx("div", { className: "shrink-0", children: _jsx(StockConsumptionAlertsBanner, {}) }), error && !data && (_jsxs("div", { role: "alert", className: "shrink-0 flex items-start gap-3 rounded-lg 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: "flex-1", children: [_jsx("div", { className: "font-medium text-destructive-soft-foreground", children: isSessionError(error) ? "Je inlogsessie is verlopen" : "Orders konden niet geladen worden" }), _jsx("div", { className: "mt-1 text-muted-foreground", children: isSessionError(error) ? "Log opnieuw in om de orders te zien." : error.message })] }), isSessionError(error) ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => navigate({ to: "/login" }), children: "Opnieuw inloggen" })) : (_jsx(Button, { size: "sm", variant: "outline", onClick: () => refetch(), disabled: isFetching, children: "Opnieuw proberen" }))] })), _jsx(NoticeBar, { items: notices }), selectedRows.length === 0 && (_jsx("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/90 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:hidden", children: _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { className: "h-12 flex-1 text-base", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders/nieuw" }), children: [_jsx(Plus, { className: "mr-2 h-5 w-5" }), " Nieuwe order"] }), klokZichtbaar && (_jsx(Button, { variant: "outline", className: "h-12 px-4", "aria-label": "Klokorder (veilbrief)", onClick: () => navigate({ to: "/floriday-verkoop/klok/nieuw" }), children: _jsx(Gavel, { className: "h-5 w-5" }) }))] }) })), selectedRows.length > 0 && (_jsxs("div", { ref: (el) => {
661
+ }, children: "Zoek in het laatste jaar" })), (filters.search || activeFilterCount > 0) && (_jsx(Button, { variant: "ghost", size: "sm", onClick: clearAll, children: "Alles wissen" }))] }), _jsx("div", { className: "shrink-0", children: _jsx(StockConsumptionAlertsBanner, {}) }), _jsx("div", { className: "shrink-0", children: _jsx(CorrectiesBalk, {}) }), error && !data && (_jsxs("div", { role: "alert", className: "shrink-0 flex items-start gap-3 rounded-lg 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: "flex-1", children: [_jsx("div", { className: "font-medium text-destructive-soft-foreground", children: isSessionError(error) ? "Je inlogsessie is verlopen" : "Orders konden niet geladen worden" }), _jsx("div", { className: "mt-1 text-muted-foreground", children: isSessionError(error) ? "Log opnieuw in om de orders te zien." : error.message })] }), isSessionError(error) ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => navigate({ to: "/login" }), children: "Opnieuw inloggen" })) : (_jsx(Button, { size: "sm", variant: "outline", onClick: () => refetch(), disabled: isFetching, children: "Opnieuw proberen" }))] })), _jsx(NoticeBar, { items: notices }), selectedRows.length === 0 && (_jsx("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/90 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:hidden", children: _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { className: "h-12 flex-1 text-base", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders/nieuw" }), children: [_jsx(Plus, { className: "mr-2 h-5 w-5" }), " Nieuwe order"] }), klokZichtbaar && (_jsx(Button, { variant: "outline", className: "h-12 px-4", "aria-label": "Klokorder (veilbrief)", onClick: () => navigate({ to: "/floriday-verkoop/klok/nieuw" }), children: _jsx(Gavel, { className: "h-5 w-5" }) }))] }) })), selectedRows.length > 0 && (_jsxs("div", { ref: (el) => {
661
662
  if (el && !el.dataset.shown) {
662
663
  el.dataset.shown = "1";
663
664
  animateIn(el, { duration: 180, y: 8 });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Accepteren / Afwijzen. Is er al geprint (of onbekend), dan eerst de keuze
3
+ * "Kar aanpassen" (nieuwe pakbon) of "Laten zo" — nooit een stille wijziging.
4
+ */
5
+ export declare function CorrectieBesluitKnoppen({ id, orderRowId, onDone }: {
6
+ id: string;
7
+ orderRowId?: string | null;
8
+ onDone?: () => void;
9
+ }): import("react").JSX.Element;
10
+ //# sourceMappingURL=CorrectieBesluitKnoppen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrectieBesluitKnoppen.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectieBesluitKnoppen.tsx"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,+BA+ClI"}
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useQueryClient } from "@tanstack/react-query";
4
+ import { useServerFn } from "@tanstack/react-start";
5
+ import { Button } from "@flowselections/core";
6
+ import { decideSalesCorrection } from "../../../lib/sales-corrections.functions.js";
7
+ import { OPEN_CORRECTIONS_KEY } from "../../../lib/useOpenCorrections.js";
8
+ /**
9
+ * Accepteren / Afwijzen. Is er al geprint (of onbekend), dan eerst de keuze
10
+ * "Kar aanpassen" (nieuwe pakbon) of "Laten zo" — nooit een stille wijziging.
11
+ */
12
+ export function CorrectieBesluitKnoppen({ id, orderRowId, onDone }) {
13
+ const decide = useServerFn(decideSalesCorrection);
14
+ const qc = useQueryClient();
15
+ const [bezig, setBezig] = useState(null);
16
+ const [vraag, setVraag] = useState(null);
17
+ const [fout, setFout] = useState(null);
18
+ const [klaar, setKlaar] = useState(null);
19
+ async function run(besluit, keuzeNaPrint) {
20
+ setBezig(besluit);
21
+ setFout(null);
22
+ try {
23
+ const r = await decide({ data: { id, besluit, orderRowId: orderRowId ?? null, keuzeNaPrint: keuzeNaPrint ?? null } });
24
+ if (r.code === "confirm_print") {
25
+ setVraag(r.vraag);
26
+ return;
27
+ }
28
+ if (!r.ok) {
29
+ setFout(r.melding);
30
+ return;
31
+ }
32
+ setVraag(null);
33
+ setKlaar(r.melding);
34
+ await qc.invalidateQueries({ queryKey: OPEN_CORRECTIONS_KEY });
35
+ await qc.invalidateQueries({ queryKey: ["sales-corrections"] });
36
+ onDone?.();
37
+ }
38
+ catch (e) {
39
+ console.error("[correcties] besluit", e);
40
+ setFout("Het besluit kon niet worden verstuurd. Probeer het opnieuw of neem contact op met de beheerder.");
41
+ }
42
+ finally {
43
+ setBezig(null);
44
+ }
45
+ }
46
+ return (_jsxs("div", { className: "space-y-2", children: [vraag ? (_jsxs("div", { role: "alert", className: "space-y-2 rounded-md border border-border bg-warning-soft p-3 text-sm text-warning-soft-foreground", children: [_jsx("div", { className: "font-medium", children: vraag }), _jsx("div", { children: "Wil je de kar aanpassen (met een nieuwe pakbon) of de geprinte kar laten zoals hij is?" }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { size: "sm", disabled: !!bezig, onClick: () => run("accept", "kar_aanpassen"), children: "Kar aanpassen" }), _jsx(Button, { size: "sm", variant: "outline", disabled: !!bezig, onClick: () => run("accept", "laten_zo"), children: "Laten zo" }), _jsx(Button, { size: "sm", variant: "ghost", disabled: !!bezig, onClick: () => setVraag(null), children: "Annuleren" })] })] })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { size: "sm", disabled: !!bezig, onClick: () => run("accept"), children: bezig === "accept" ? "Bezig…" : "Accepteren" }), _jsx(Button, { size: "sm", variant: "outline", disabled: !!bezig, onClick: () => run("decline"), children: bezig === "decline" ? "Bezig…" : "Afwijzen" })] })), fout && _jsx("div", { role: "alert", className: "text-sm text-destructive", children: fout }), klaar && _jsx("div", { role: "status", className: "text-sm text-muted-foreground", children: klaar })] }));
47
+ }
@@ -0,0 +1,10 @@
1
+ /** Label "Correctie gevraagd" bij een order met een open correctieverzoek. */
2
+ export declare function CorrectieChip({ row }: {
3
+ row: {
4
+ floridayIds?: string[];
5
+ raw?: {
6
+ order?: any;
7
+ };
8
+ };
9
+ }): import("react").JSX.Element | null;
10
+ //# sourceMappingURL=CorrectieChip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrectieChip.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectieChip.tsx"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,GAAG,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,sCAUhG"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MessageSquareWarning } from "lucide-react";
3
+ import { floridayIdsOf, useOpenCorrections } from "../../../lib/useOpenCorrections.js";
4
+ /** Label "Correctie gevraagd" bij een order met een open correctieverzoek. */
5
+ export function CorrectieChip({ row }) {
6
+ const { bySalesOrder } = useOpenCorrections();
7
+ const has = floridayIdsOf(row).some((id) => bySalesOrder.has(id));
8
+ if (!has)
9
+ return null;
10
+ return (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning-soft-foreground", children: [_jsx(MessageSquareWarning, { className: "h-3 w-3", "aria-hidden": true }), "Correctie gevraagd"] }));
11
+ }
@@ -0,0 +1,3 @@
1
+ /** Balk bovenaan Verkoop: open correctieverzoeken met de eerste deadline. */
2
+ export declare function CorrectiesBalk(): import("react").JSX.Element | null;
3
+ //# sourceMappingURL=CorrectiesBalk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrectiesBalk.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectiesBalk.tsx"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,wBAAgB,cAAc,uCAmB7B"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from "@tanstack/react-router";
3
+ import { AlertTriangle } from "lucide-react";
4
+ import { balkTekst } from "../../../lib/sales-corrections.js";
5
+ import { useOpenCorrections } from "../../../lib/useOpenCorrections.js";
6
+ /** Balk bovenaan Verkoop: open correctieverzoeken met de eerste deadline. */
7
+ export function CorrectiesBalk() {
8
+ const { items, failed, error } = useOpenCorrections();
9
+ const tekst = balkTekst(items);
10
+ if (failed) {
11
+ return (_jsxs("div", { role: "status", className: "flex items-center gap-2 rounded-lg border border-border bg-muted p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), error || "Correctieverzoeken konden niet worden gecontroleerd."] }));
12
+ }
13
+ if (!tekst)
14
+ return null;
15
+ return (_jsxs("div", { role: "alert", className: "flex flex-wrap items-center gap-2 rounded-lg border border-border bg-warning-soft p-3 text-sm text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), _jsx("span", { className: "font-medium", children: tekst }), _jsx(Link, { to: "/floriday-verkoop/correcties", className: "ml-auto font-medium underline underline-offset-2", children: "Bekijk correctieverzoeken" })] }));
16
+ }
@@ -0,0 +1,3 @@
1
+ /** Lijst "Correctieverzoeken" van kopers (per 25, zoeken en status op de server). */
2
+ export declare function CorrectiesPage(): import("react").JSX.Element;
3
+ //# sourceMappingURL=CorrectiesPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrectiesPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectiesPage.tsx"],"names":[],"mappings":"AAiBA,qFAAqF;AACrF,wBAAgB,cAAc,gCAsD7B"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Link } from "@tanstack/react-router";
4
+ import { keepPreviousData, useQuery } from "@tanstack/react-query";
5
+ import { useServerFn } from "@tanstack/react-start";
6
+ import { Button, Input } from "@flowselections/core";
7
+ import { MessageSquareWarning } from "lucide-react";
8
+ import { listSalesCorrections } from "../../../lib/sales-corrections.functions.js";
9
+ import { bijnaVerlopen, deadlineTekst, isOpen, parseCorrection } from "../../../lib/sales-corrections.js";
10
+ const STATUSSEN = [
11
+ { id: "PENDING", label: "Wacht op reactie" },
12
+ { id: "ACCEPTED", label: "Geaccepteerd" },
13
+ { id: "DECLINED", label: "Afgewezen" },
14
+ { id: "EXPIRED", label: "Verlopen" },
15
+ { id: null, label: "Alles" },
16
+ ];
17
+ /** Lijst "Correctieverzoeken" van kopers (per 25, zoeken en status op de server). */
18
+ export function CorrectiesPage() {
19
+ const fetchList = useServerFn(listSalesCorrections);
20
+ const [status, setStatus] = useState("PENDING");
21
+ const [zoek, setZoek] = useState("");
22
+ const [offset, setOffset] = useState(0);
23
+ const q = useQuery({
24
+ queryKey: ["sales-corrections", status, zoek, offset],
25
+ placeholderData: keepPreviousData,
26
+ queryFn: () => fetchList({ data: { status, zoek: zoek || undefined, offset } }),
27
+ });
28
+ const items = (q.data?.items ?? []).map(parseCorrection).filter((c) => !!c);
29
+ const totaal = q.data?.totaal ?? 0;
30
+ return (_jsxs("div", { className: "space-y-4 p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MessageSquareWarning, { className: "h-5 w-5 text-primary", "aria-hidden": true }), _jsx("h1", { className: "text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: "Correctieverzoeken" })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [STATUSSEN.map((s) => (_jsx(Button, { size: "sm", variant: status === s.id ? "default" : "outline", onClick: () => { setStatus(s.id); setOffset(0); }, children: s.label }, String(s.id)))), _jsx(Input, { className: "ml-auto w-full sm:w-64", placeholder: "Zoek op ordernummer of reden", value: zoek, onChange: (e) => { setZoek(e.target.value); setOffset(0); } })] }), q.data && !q.data.ok && _jsx("div", { role: "alert", className: "text-sm text-destructive", children: q.data.error }), q.isLoading ? _jsx("div", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) : items.length === 0 ? (_jsx("div", { className: "text-sm text-muted-foreground", children: "Geen correctieverzoeken gevonden." })) : (_jsx("ul", { className: "divide-y divide-border rounded-lg border border-border bg-card", children: items.map((c) => (_jsxs("li", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 p-3 text-sm", children: [_jsx("span", { className: "font-medium " + (bijnaVerlopen(c) ? "text-destructive" : "text-foreground"), children: deadlineTekst(c) }), _jsx("span", { className: "text-muted-foreground", children: c.isCancelRequest ? "Annuleren gevraagd" : "Wijziging gevraagd" }), c.reason && _jsx("span", { className: "min-w-0 truncate text-muted-foreground", children: c.reason }), c.besluitDoor && !isOpen(c) && _jsxs("span", { className: "text-muted-foreground", children: ["door ", c.besluitDoor] }), c.salesOrderId && (_jsx(Link, { className: "ml-auto font-medium text-primary underline underline-offset-2", to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: c.salesOrderId }, children: "Order openen" }))] }, c.id))) })), totaal > 25 && (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: offset === 0, onClick: () => setOffset(Math.max(0, offset - 25)), children: "Vorige" }), _jsxs("span", { className: "text-muted-foreground", children: [offset + 1, "\u2013", Math.min(offset + 25, totaal), " van ", totaal] }), _jsx(Button, { size: "sm", variant: "outline", disabled: offset + 25 >= totaal, onClick: () => setOffset(offset + 25), children: "Volgende" })] }))] }));
31
+ }
@@ -0,0 +1,7 @@
1
+ /** Orderpagina: open correctieverzoeken met "oud → nieuw" en Accepteren/Afwijzen. */
2
+ export declare function OrderCorrectiesCard({ salesOrderIds, floridayOrder, orderRowId }: {
3
+ salesOrderIds: string[];
4
+ floridayOrder: any;
5
+ orderRowId: string | null;
6
+ }): import("react").JSX.Element | null;
7
+ //# sourceMappingURL=OrderCorrectiesCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderCorrectiesCard.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/OrderCorrectiesCard.tsx"],"names":[],"mappings":"AAMA,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAmC3J"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MessageSquareWarning } from "lucide-react";
3
+ import { InfoCard } from "../v3/InfoCard.js";
4
+ import { deadlineTekst, verschillen } from "../../../lib/sales-corrections.js";
5
+ import { useOpenCorrections } from "../../../lib/useOpenCorrections.js";
6
+ import { CorrectieBesluitKnoppen } from "./CorrectieBesluitKnoppen.js";
7
+ /** Orderpagina: open correctieverzoeken met "oud → nieuw" en Accepteren/Afwijzen. */
8
+ export function OrderCorrectiesCard({ salesOrderIds, floridayOrder, orderRowId }) {
9
+ const { bySalesOrder } = useOpenCorrections();
10
+ const lijst = salesOrderIds.flatMap((id) => bySalesOrder.get(id) ?? []);
11
+ if (!lijst.length)
12
+ return null;
13
+ return (_jsx(InfoCard, { icon: _jsx(MessageSquareWarning, {}), title: "Correctie gevraagd", attention: true, children: _jsx("div", { className: "space-y-4", children: lijst.map((c) => {
14
+ const v = verschillen(floridayOrder, c);
15
+ return (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-sm font-medium", children: deadlineTekst(c) }), c.reason && _jsxs("div", { className: "text-sm text-muted-foreground", children: ["Reden van de koper: ", c.reason] }), v.length ? (_jsx("ul", { className: "space-y-1 text-sm", children: v.map((x) => (_jsxs("li", { className: "flex flex-wrap gap-x-2", children: [_jsxs("span", { className: "text-muted-foreground", children: [x.veld, ":"] }), _jsx("span", { className: "line-through", children: x.oud }), _jsx("span", { "aria-hidden": true, children: "\u2192" }), _jsx("span", { className: "font-medium", children: x.nieuw })] }, x.veld))) })) : (_jsx("div", { className: "text-sm text-muted-foreground", children: "De koper vraagt geen andere waarden dan nu op de order staan." })), c.besluitFout && _jsxs("div", { className: "text-sm text-destructive", children: ["Vorige poging mislukt: ", c.besluitFout] }), _jsx(CorrectieBesluitKnoppen, { id: c.id, orderRowId: orderRowId })] }, c.id));
16
+ }) }) }));
17
+ }
@@ -0,0 +1,5 @@
1
+ /** "Oude order, niet ingedeeld": zichtbare status met reden en knop "Toch indelen". */
2
+ export declare function OudeOrderCard({ orderRowId }: {
3
+ orderRowId: string | null;
4
+ }): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=OudeOrderCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OudeOrderCard.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/OudeOrderCard.tsx"],"names":[],"mappings":"AAQA,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAoC1E"}
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
4
+ import { useServerFn } from "@tanstack/react-start";
5
+ import { Button } from "@flowselections/core";
6
+ import { History } from "lucide-react";
7
+ import { InfoCard } from "../v3/InfoCard.js";
8
+ import { getBackfillIndeelStand, tochIndelen } from "../../../lib/sales-corrections.functions.js";
9
+ /** "Oude order, niet ingedeeld": zichtbare status met reden en knop "Toch indelen". */
10
+ export function OudeOrderCard({ orderRowId }) {
11
+ const fetchStand = useServerFn(getBackfillIndeelStand);
12
+ const indelen = useServerFn(tochIndelen);
13
+ const qc = useQueryClient();
14
+ const [bezig, setBezig] = useState(false);
15
+ const [fout, setFout] = useState(null);
16
+ const q = useQuery({
17
+ queryKey: ["order-backfill-stand", orderRowId],
18
+ enabled: !!orderRowId,
19
+ staleTime: 30000,
20
+ queryFn: () => fetchStand({ data: { orderRowId: orderRowId } }),
21
+ });
22
+ const d = q.data;
23
+ if (!d || (!d.oud && !d.fout))
24
+ return null;
25
+ if (!d.oud)
26
+ return _jsx("div", { role: "status", className: "text-sm text-muted-foreground", children: d.fout });
27
+ return (_jsx(InfoCard, { icon: _jsx(History, {}), title: "Oude order, niet ingedeeld", attention: true, children: _jsxs("div", { className: "space-y-2 text-sm", children: [_jsx("div", { children: d.reden ?? d.fout ?? "Deze order is gemarkeerd als ingehaald en krijgt geen kar." }), _jsx(Button, { size: "sm", variant: "outline", disabled: bezig, onClick: async () => {
28
+ setBezig(true);
29
+ setFout(null);
30
+ try {
31
+ const r = await indelen({ data: { orderRowId: orderRowId } });
32
+ if (!r.ok) {
33
+ setFout(r.melding);
34
+ return;
35
+ }
36
+ setFout(null);
37
+ await qc.invalidateQueries({ queryKey: ["order-backfill-stand", orderRowId] });
38
+ await qc.invalidateQueries({ queryKey: ["order-plan-coverage"] });
39
+ }
40
+ catch (e) {
41
+ console.error("[toch-indelen]", e);
42
+ setFout("Toch indelen lukte niet. Probeer het opnieuw of neem contact op met de beheerder.");
43
+ }
44
+ finally {
45
+ setBezig(false);
46
+ }
47
+ }, children: bezig ? "Bezig…" : "Toch indelen" }), fout && _jsx("div", { role: "alert", className: "text-destructive", children: fout })] }) }));
48
+ }
@@ -0,0 +1,5 @@
1
+ export declare function GewijzigdNaPrintCard({ orderRowId, floriday }: {
2
+ orderRowId: string | null;
3
+ floriday: boolean;
4
+ }): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=GewijzigdNaPrintCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GewijzigdNaPrintCard.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/tijdlijn/GewijzigdNaPrintCard.tsx"],"names":[],"mappings":"AAeA,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,sCAkD9G"}
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Floriday-order gewijzigd na het printen, zonder correctieverzoek
3
+ // (logistics_order_gewijzigd_na_print). Planner/beheerder kiest "Kar aanpassen"
4
+ // of "Laten zo" (logistics_order_gewijzigd_na_print_besluit); na de keuze
5
+ // verdwijnt de melding. Verkoop past de kar niet zelf aan.
6
+ import { useState } from "react";
7
+ import { useQueryClient } from "@tanstack/react-query";
8
+ import { useServerFn } from "@tanstack/react-start";
9
+ import { Button, toast } from "@flowselections/core";
10
+ import { PrinterCheck } from "lucide-react";
11
+ import { InfoCard } from "../v3/InfoCard.js";
12
+ import { fmtNL } from "../../../lib/nl-datetime.js";
13
+ import { geprintZin, toonGewijzigdMelding } from "../../../lib/engine-tijdlijn.js";
14
+ import { beslisGewijzigdNaPrint } from "../../../lib/engine-tijdlijn.functions.js";
15
+ import { tijdlijnKey, useOrderTijdlijn } from "./useOrderTijdlijn.js";
16
+ export function GewijzigdNaPrintCard({ orderRowId, floriday }) {
17
+ const q = useOrderTijdlijn(orderRowId, floriday);
18
+ const beslis = useServerFn(beslisGewijzigdNaPrint);
19
+ const qc = useQueryClient();
20
+ const [bezig, setBezig] = useState(null);
21
+ const [fout, setFout] = useState(null);
22
+ const g = q.data?.gewijzigd;
23
+ if (!floriday || !g || !g.beschikbaar)
24
+ return null;
25
+ if (!g.ok)
26
+ return _jsx("div", { role: "status", className: "text-sm text-muted-foreground", children: g.fout });
27
+ const w = g.waarde;
28
+ if (!toonGewijzigdMelding(w))
29
+ return null;
30
+ const keuzes = w.keuzes.length ? w.keuzes : ["kar_aanpassen", "laten_zo"];
31
+ const wanneer = w.wanneer ? fmtNL(w.wanneer, { weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }) : null;
32
+ const kies = async (besluit) => {
33
+ setBezig(besluit);
34
+ setFout(null);
35
+ try {
36
+ const r = await beslis({ data: { orderId: orderRowId, besluit } });
37
+ if (!r.ok) {
38
+ setFout(r.melding);
39
+ return;
40
+ }
41
+ toast.success(r.melding);
42
+ await qc.invalidateQueries({ queryKey: tijdlijnKey(orderRowId) });
43
+ }
44
+ catch (e) {
45
+ console.error("[gewijzigd-na-print] besluit:", e);
46
+ setFout("Je keuze is niet vastgelegd. Probeer het opnieuw of neem contact op met de beheerder.");
47
+ }
48
+ finally {
49
+ setBezig(null);
50
+ }
51
+ };
52
+ return (_jsx(InfoCard, { icon: _jsx(PrinterCheck, {}), title: "Gewijzigd na printen", attention: true, children: _jsxs("div", { className: "space-y-2 text-sm", children: [_jsx("div", { className: "text-foreground", children: w.wat ?? "De order is na het printen gewijzigd." }), _jsxs("div", { className: "text-muted-foreground", children: [wanneer ? `Sinds ${wanneer}. ` : "", geprintZin(w.karrenGeprint), " De planning deelt geprinte karren niet opnieuw in; kies wat er met de kar gebeurt."] }), q.data?.magBeslissen ? (_jsxs("div", { className: "flex flex-wrap gap-2 pt-1", children: [keuzes.includes("kar_aanpassen") && (_jsx(Button, { size: "sm", disabled: !!bezig, onClick: () => void kies("kar_aanpassen"), children: bezig === "kar_aanpassen" ? "Bezig…" : "Kar aanpassen" })), keuzes.includes("laten_zo") && (_jsx(Button, { size: "sm", variant: "outline", disabled: !!bezig, onClick: () => void kies("laten_zo"), children: bezig === "laten_zo" ? "Bezig…" : "Laten zo" }))] })) : (_jsx("div", { className: "text-xs text-muted-foreground", children: "Een planner of beheerder kiest \"Kar aanpassen\" of \"Laten zo\"." })), fout && _jsx("div", { role: "alert", className: "text-destructive", children: fout })] }) }));
53
+ }
@@ -0,0 +1,5 @@
1
+ export declare function OrderTijdlijnCard({ orderRowId, floriday }: {
2
+ orderRowId: string | null;
3
+ floriday: boolean;
4
+ }): import("react").JSX.Element | null;
5
+ //# sourceMappingURL=OrderTijdlijnCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderTijdlijnCard.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/tijdlijn/OrderTijdlijnCard.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,sCAwC3G"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Order-tijdlijn uit de Logistiek Engine (logistics_order_tijdlijn), inclusief
3
+ // de regel "Floriday gelijk". Alleen weergave; ontbreekt de functie, dan geen blok.
4
+ import { CheckCircle2, Circle, CircleDot, ListChecks, AlertTriangle, MinusCircle } from "lucide-react";
5
+ import { InfoCard } from "../v3/InfoCard.js";
6
+ import { fmtNL } from "../../../lib/nl-datetime.js";
7
+ import { huidigeStap } from "../../../lib/engine-tijdlijn.js";
8
+ import { useOrderTijdlijn } from "./useOrderTijdlijn.js";
9
+ const tijd = (iso) => (iso ? fmtNL(iso, { weekday: "short", day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" }) : null);
10
+ function FloridayRegel({ f }) {
11
+ const Icon = f.kleur === "groen" ? CheckCircle2 : f.kleur === "oranje" ? AlertTriangle : MinusCircle;
12
+ const kleur = f.kleur === "groen" ? "text-success" : f.kleur === "oranje" ? "text-warning" : "text-muted-foreground";
13
+ return (_jsxs("div", { className: "mt-3 flex items-start gap-2 border-t border-border pt-3 text-sm", children: [_jsx(Icon, { className: `mt-0.5 h-4 w-4 shrink-0 ${kleur}`, "aria-hidden": true }), _jsx("span", { className: "text-foreground", children: f.tekst })] }));
14
+ }
15
+ export function OrderTijdlijnCard({ orderRowId, floriday }) {
16
+ const q = useOrderTijdlijn(orderRowId, floriday);
17
+ const t = q.data?.tijdlijn;
18
+ if (!t || !t.beschikbaar)
19
+ return null;
20
+ if (!t.ok) {
21
+ return (_jsx(InfoCard, { icon: _jsx(ListChecks, {}), title: "Tijdlijn", children: _jsx("p", { className: "text-sm text-muted-foreground", children: t.fout }) }));
22
+ }
23
+ const w = t.waarde;
24
+ const nu = huidigeStap(w.stappen);
25
+ return (_jsxs(InfoCard, { icon: _jsx(ListChecks, {}), title: w.geannuleerd ? "Tijdlijn · geannuleerd" : "Tijdlijn", children: [_jsx("ol", { className: "space-y-2", children: w.stappen.map((s, i) => {
26
+ const Icon = s.klaar ? CheckCircle2 : i === nu && !w.geannuleerd ? CircleDot : Circle;
27
+ const kleur = s.klaar ? "text-success" : i === nu && !w.geannuleerd ? "text-primary" : "text-muted-foreground";
28
+ const wanneer = tijd(s.tijd);
29
+ return (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(Icon, { className: `mt-0.5 h-4 w-4 shrink-0 ${kleur}`, "aria-hidden": true }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-x-2", children: [_jsxs("span", { className: s.klaar || i === nu ? "font-medium text-foreground" : "text-muted-foreground", children: [s.naam, _jsx("span", { className: "sr-only", children: s.klaar ? " (klaar)" : " (nog niet)" })] }), wanneer && _jsx("span", { className: "text-xs tabular-nums text-muted-foreground", children: wanneer })] }), s.reden && _jsx("div", { className: "break-words text-xs text-muted-foreground", children: s.reden })] })] }, s.stap));
30
+ }) }), w.floriday && _jsx(FloridayRegel, { f: w.floriday })] }));
31
+ }
@@ -0,0 +1,11 @@
1
+ export declare const tijdlijnKey: (orderRowId: string | null) => readonly ["order-engine-tijdlijn", string | null];
2
+ /** Tijdlijn + "gewijzigd na printen" in één aanroep; gedeeld door beide blokken. */
3
+ export declare function useOrderTijdlijn(orderRowId: string | null, floriday: boolean): import("@tanstack/react-query").UseQueryResult<{
4
+ orderDbId: string;
5
+ tijdlijn: import("../../../lib/engine-tijdlijn.server.js").Lezen<import("../../../lib/engine-tijdlijn.js").Tijdlijn>;
6
+ gewijzigd: import("../../../lib/engine-tijdlijn.server.js").Lezen<import("../../../lib/engine-tijdlijn.js").GewijzigdNaPrint> | {
7
+ readonly beschikbaar: false;
8
+ };
9
+ magBeslissen: boolean;
10
+ }, Error>;
11
+ //# sourceMappingURL=useOrderTijdlijn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOrderTijdlijn.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/tijdlijn/useOrderTijdlijn.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,YAAY,MAAM,GAAG,IAAI,sDAAmD,CAAC;AAEzG,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO;;;;;;;UAU5E"}
@@ -0,0 +1,17 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { useServerFn } from "@tanstack/react-start";
3
+ import { getOrderTijdlijn } from "../../../lib/engine-tijdlijn.functions.js";
4
+ export const tijdlijnKey = (orderRowId) => ["order-engine-tijdlijn", orderRowId];
5
+ /** Tijdlijn + "gewijzigd na printen" in één aanroep; gedeeld door beide blokken. */
6
+ export function useOrderTijdlijn(orderRowId, floriday) {
7
+ const fetchFn = useServerFn(getOrderTijdlijn);
8
+ const q = useQuery({
9
+ queryKey: [...tijdlijnKey(orderRowId), floriday],
10
+ enabled: !!orderRowId,
11
+ staleTime: 30000,
12
+ queryFn: () => fetchFn({ data: { orderId: orderRowId, floriday } }),
13
+ });
14
+ if (q.isError)
15
+ console.error("[tijdlijn]", q.error);
16
+ return q;
17
+ }
@@ -4,6 +4,7 @@ export { VerkoopOrdersPage } from "./components/verkoop/VerkoopOrdersPage.js";
4
4
  export { SalesOrderDetailPage } from "./components/verkoop/SalesOrderDetailPage.js";
5
5
  export { CreateOrderPage } from "./components/verkoop/CreateOrderPage.js";
6
6
  export { KlokPage } from "./components/verkoop/klok/KlokPage.js";
7
+ export { CorrectiesPage } from "./components/verkoop/correcties/CorrectiesPage.js";
7
8
  export { KlokOrderPage } from "./components/verkoop/klok/KlokOrderPage.js";
8
9
  export declare const floridayVerkoopModule: FlowModule;
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAIxE,eAAO,MAAM,qBAAqB,EAAE,UA4BnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAIxE,eAAO,MAAM,qBAAqB,EAAE,UA4BnC,CAAC"}
package/dist-lib/index.js CHANGED
@@ -8,6 +8,7 @@ export { VerkoopOrdersPage } from "./components/verkoop/VerkoopOrdersPage.js";
8
8
  export { SalesOrderDetailPage } from "./components/verkoop/SalesOrderDetailPage.js";
9
9
  export { CreateOrderPage } from "./components/verkoop/CreateOrderPage.js";
10
10
  export { KlokPage } from "./components/verkoop/klok/KlokPage.js";
11
+ export { CorrectiesPage } from "./components/verkoop/correcties/CorrectiesPage.js";
11
12
  export { KlokOrderPage } from "./components/verkoop/klok/KlokOrderPage.js";
12
13
  export const floridayVerkoopModule = {
13
14
  id: "verkoop",