@flowselections/floriday-verkoop-module 1.0.165 → 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 (107) hide show
  1. package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
  2. package/dist-lib/components/verkoop/CreateOrderPage.js +31 -45
  3. package/dist-lib/components/verkoop/KarTekeningSection.d.ts.map +1 -1
  4. package/dist-lib/components/verkoop/KarTekeningSection.js +31 -7
  5. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -1
  6. package/dist-lib/components/verkoop/OrderKarindelingCard.js +18 -3
  7. package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
  8. package/dist-lib/components/verkoop/SalesOrderDetailPage.js +3 -0
  9. package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
  10. package/dist-lib/components/verkoop/SalesOrderDetailView.js +6 -2
  11. package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
  12. package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -2
  13. package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
  14. package/dist-lib/components/verkoop/VerkoopOrdersPage.js +2 -1
  15. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts +10 -0
  16. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts.map +1 -0
  17. package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.js +47 -0
  18. package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts +10 -0
  19. package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts.map +1 -0
  20. package/dist-lib/components/verkoop/correcties/CorrectieChip.js +11 -0
  21. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts +3 -0
  22. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts.map +1 -0
  23. package/dist-lib/components/verkoop/correcties/CorrectiesBalk.js +16 -0
  24. package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts +3 -0
  25. package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts.map +1 -0
  26. package/dist-lib/components/verkoop/correcties/CorrectiesPage.js +31 -0
  27. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts +7 -0
  28. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts.map +1 -0
  29. package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.js +17 -0
  30. package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts +5 -0
  31. package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts.map +1 -0
  32. package/dist-lib/components/verkoop/correcties/OudeOrderCard.js +48 -0
  33. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts +5 -0
  34. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts.map +1 -0
  35. package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.js +53 -0
  36. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts +5 -0
  37. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts.map +1 -0
  38. package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.js +31 -0
  39. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts +11 -0
  40. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts.map +1 -0
  41. package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.js +17 -0
  42. package/dist-lib/index.d.ts +1 -0
  43. package/dist-lib/index.d.ts.map +1 -1
  44. package/dist-lib/index.js +1 -0
  45. package/dist-lib/integrations/supabase/types.d.ts +1391 -2
  46. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  47. package/dist-lib/integrations/supabase/types.js +1 -0
  48. package/dist-lib/lib/belading-format.d.ts +3 -2
  49. package/dist-lib/lib/belading-format.d.ts.map +1 -1
  50. package/dist-lib/lib/belading-format.js +5 -3
  51. package/dist-lib/lib/beslis-rollen.server.d.ts +10 -0
  52. package/dist-lib/lib/beslis-rollen.server.d.ts.map +1 -0
  53. package/dist-lib/lib/beslis-rollen.server.js +10 -0
  54. package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
  55. package/dist-lib/lib/cart-replan.functions.js +8 -4
  56. package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
  57. package/dist-lib/lib/create-order.functions.js +75 -40
  58. package/dist-lib/lib/engine-tijdlijn.d.ts +69 -0
  59. package/dist-lib/lib/engine-tijdlijn.d.ts.map +1 -0
  60. package/dist-lib/lib/engine-tijdlijn.functions.d.ts +30 -0
  61. package/dist-lib/lib/engine-tijdlijn.functions.d.ts.map +1 -0
  62. package/dist-lib/lib/engine-tijdlijn.functions.js +47 -0
  63. package/dist-lib/lib/engine-tijdlijn.js +101 -0
  64. package/dist-lib/lib/engine-tijdlijn.server.d.ts +30 -0
  65. package/dist-lib/lib/engine-tijdlijn.server.d.ts.map +1 -0
  66. package/dist-lib/lib/engine-tijdlijn.server.js +41 -0
  67. package/dist-lib/lib/kar-handmatig.d.ts +2 -1
  68. package/dist-lib/lib/kar-handmatig.d.ts.map +1 -1
  69. package/dist-lib/lib/kar-handmatig.js +3 -2
  70. package/dist-lib/lib/kar-tekening.d.ts +54 -4
  71. package/dist-lib/lib/kar-tekening.d.ts.map +1 -1
  72. package/dist-lib/lib/kar-tekening.js +92 -8
  73. package/dist-lib/lib/kar-tekening.server.d.ts +5 -0
  74. package/dist-lib/lib/kar-tekening.server.d.ts.map +1 -1
  75. package/dist-lib/lib/kar-tekening.server.js +18 -0
  76. package/dist-lib/lib/logistics-engine.server.d.ts.map +1 -1
  77. package/dist-lib/lib/logistics-engine.server.js +13 -9
  78. package/dist-lib/lib/order-item-packing.functions.d.ts +20 -0
  79. package/dist-lib/lib/order-item-packing.functions.d.ts.map +1 -1
  80. package/dist-lib/lib/order-item-packing.functions.js +73 -8
  81. package/dist-lib/lib/order-row.server.d.ts.map +1 -1
  82. package/dist-lib/lib/order-row.server.js +9 -6
  83. package/dist-lib/lib/plan-coverage.server.d.ts.map +1 -1
  84. package/dist-lib/lib/plan-coverage.server.js +4 -2
  85. package/dist-lib/lib/sales-corrections.d.ts +44 -0
  86. package/dist-lib/lib/sales-corrections.d.ts.map +1 -0
  87. package/dist-lib/lib/sales-corrections.functions.d.ts +92 -0
  88. package/dist-lib/lib/sales-corrections.functions.d.ts.map +1 -0
  89. package/dist-lib/lib/sales-corrections.functions.js +132 -0
  90. package/dist-lib/lib/sales-corrections.js +129 -0
  91. package/dist-lib/lib/sales-corrections.server.d.ts +27 -0
  92. package/dist-lib/lib/sales-corrections.server.d.ts.map +1 -0
  93. package/dist-lib/lib/sales-corrections.server.js +68 -0
  94. package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
  95. package/dist-lib/lib/salesorders-list.functions.js +17 -11
  96. package/dist-lib/lib/step-timer.server.d.ts +13 -0
  97. package/dist-lib/lib/step-timer.server.d.ts.map +1 -0
  98. package/dist-lib/lib/step-timer.server.js +33 -0
  99. package/dist-lib/lib/stock-product-link.server.d.ts.map +1 -1
  100. package/dist-lib/lib/stock-product-link.server.js +12 -8
  101. package/dist-lib/lib/useOpenCorrections.d.ts +17 -0
  102. package/dist-lib/lib/useOpenCorrections.d.ts.map +1 -0
  103. package/dist-lib/lib/useOpenCorrections.js +34 -0
  104. package/dist-lib/lib/useOrderDetailPrefetch.d.ts +9 -0
  105. package/dist-lib/lib/useOrderDetailPrefetch.d.ts.map +1 -0
  106. package/dist-lib/lib/useOrderDetailPrefetch.js +45 -0
  107. package/package.json +6 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA0GA,wBAAgB,eAAe,gCAk2C9B"}
1
+ {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA0GA,wBAAgB,eAAe,gCAu1C9B"}
@@ -11,7 +11,7 @@ import { Button, Input, Label, Textarea, toast, Dialog, DialogContent, DialogDes
11
11
  import { Link, useBlocker, useNavigate } from "@tanstack/react-router";
12
12
  import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
13
13
  import { useDebouncedValue } from "../../lib/use-debounced-value.js";
14
- import { korteMelding, tekortMelding } from "../../lib/korte-melding.js";
14
+ import { korteMelding } from "../../lib/korte-melding.js";
15
15
  import { AlertTriangle, ArrowLeft, CheckCircle2, ChevronUp, Loader2, Plus, Trash2 } from "lucide-react";
16
16
  import { isOwnTransportKind, ownPickupLabel, vervoerSoort, vervoerderKeuzes, vertrekControle, vervoerFout, datumLabel, klantHaaltOpTekst, AFLEVER_NIET_NODIG, OPHAALTIJD_ONTBREEKT, EIGEN_VERVOER_WERKWIJZE } from "../../lib/own-transport.js";
17
17
  import { missingItems, lineTotal, dateWithWeekday, eur, attentionItems, selectionKey, resetOnSelectionChange, applyFirstFeasible, prijsSleutel, PRIJS_FOUT_TEXT, PRIJS_ONBEKEND_TEXT, bekendePrijs, regelMistPrijs, groepLeden, groepZonderLedenTekst } from "../../lib/create-order-form.js";
@@ -211,18 +211,11 @@ export function CreateOrderPage() {
211
211
  const withSticker = new Set(customerId ? (stickerQ.data?.productIds ?? []) : []);
212
212
  if (customerId && stickerQ.isFetching)
213
213
  return;
214
- let changed = false;
215
- const next = lines.map((l) => {
216
- if (!l.product_id || l.sticker_manual_for === l.product_id)
217
- return l;
218
- const want = withSticker.has(l.product_id);
219
- if (!!l.needs_sticker === want)
220
- return l;
221
- changed = true;
222
- return { ...l, needs_sticker: want };
223
- });
224
- if (changed)
225
- setLines(next);
214
+ // Altijd op de nieuwste regels werken: een verouderde kopie wiste eerder een
215
+ // net binnengekomen automatische prijs (bijv. bij "Klant haalt zelf op").
216
+ const want = (l) => !!l.product_id && l.sticker_manual_for !== l.product_id && !!l.needs_sticker !== withSticker.has(l.product_id);
217
+ if (lines.some(want))
218
+ setLines((cur) => cur.map((l) => (want(l) ? { ...l, needs_sticker: withSticker.has(l.product_id) } : l)));
226
219
  // eslint-disable-next-line react-hooks/exhaustive-deps
227
220
  }, [customerId, stickerQ.data, stickerQ.isFetching, lines]);
228
221
  // Beladingen die daadwerkelijk bij de gekozen producten horen.
@@ -288,31 +281,32 @@ export function CreateOrderPage() {
288
281
  useEffect(() => {
289
282
  if (!beladingQ.data)
290
283
  return;
291
- let changed = false;
292
- const next = lines.map((l) => {
293
- if (!l.product_id)
294
- return l;
295
- const opts = beladingByProduct[l.product_id];
296
- if (!opts || opts.length === 0) {
297
- if (!l.belading)
284
+ setLines((cur) => {
285
+ let changed = false;
286
+ const next = cur.map((l) => {
287
+ if (!l.product_id)
288
+ return l;
289
+ const opts = beladingByProduct[l.product_id];
290
+ if (!opts || opts.length === 0) {
291
+ if (!l.belading)
292
+ return l;
293
+ changed = true;
294
+ return { ...l, belading: null };
295
+ }
296
+ const cur = l.belading ? beladingKey(l.belading) : null;
297
+ if (cur && opts.some((o) => beladingKey(o) === cur))
298
298
  return l;
299
+ const def = opts.find((o) => o.is_default) ?? opts[0];
299
300
  changed = true;
300
- return { ...l, belading: null };
301
- }
302
- const cur = l.belading ? beladingKey(l.belading) : null;
303
- if (cur && opts.some((o) => beladingKey(o) === cur))
304
- return l;
305
- const def = opts.find((o) => o.is_default) ?? opts[0];
306
- changed = true;
307
- const crates = Math.max(1, Math.ceil(Number(l.quantity ?? 0) / Math.max(1, l.belading?.plants_per_crate ?? def.plants_per_crate)));
308
- return {
309
- ...l,
310
- belading: { plants_per_crate: def.plants_per_crate, crates_per_layer: def.crates_per_layer, layers_per_cart: def.layers_per_cart, crate_code: def.crate_code ?? null, cart_code: def.cart_code ?? null, is_default: true },
311
- quantity: crates * def.plants_per_crate,
312
- };
301
+ const crates = Math.max(1, Math.ceil(Number(l.quantity ?? 0) / Math.max(1, l.belading?.plants_per_crate ?? def.plants_per_crate)));
302
+ return {
303
+ ...l,
304
+ belading: { plants_per_crate: def.plants_per_crate, crates_per_layer: def.crates_per_layer, layers_per_cart: def.layers_per_cart, crate_code: def.crate_code ?? null, cart_code: def.cart_code ?? null, is_default: true },
305
+ quantity: crates * def.plants_per_crate,
306
+ };
307
+ });
308
+ return changed ? next : cur;
313
309
  });
314
- if (changed)
315
- setLines(next);
316
310
  // eslint-disable-next-line react-hooks/exhaustive-deps
317
311
  }, [beladingQ.data]);
318
312
  // Afleverlocaties van gekozen klant
@@ -542,16 +536,8 @@ export function CreateOrderPage() {
542
536
  throw new Error(`Vul bij regel ${lines.indexOf(l) + 1} een aantal in per hele fust, dus een veelvoud van ${ppc}.`);
543
537
  }
544
538
  }
545
- // Verse voorraadcontrole vlak vóór opslaan (nooit gecachet).
546
- const check = await fetchStockCheck({
547
- data: {
548
- lines: validLines.map((l) => ({ productId: l.product_id, quantity: Number(l.quantity) })),
549
- },
550
- });
551
- if (check.allowed === false) {
552
- console.error("[voorraadcontrole]", check.shortages);
553
- throw new Error(tekortMelding(check.shortages));
554
- }
539
+ // Verse voorraadcontrole gebeurt bij het opslaan zelf op de server (createManualOrder,
540
+ // zelfde tekst via tekortMelding); een aparte controle vooraf kostte een extra ronde.
555
541
  const customer = customers.find((c) => c.id === customerId);
556
542
  if (!idempotencyKeyRef.current)
557
543
  idempotencyKeyRef.current = crypto.randomUUID();
@@ -1 +1 @@
1
- {"version":3,"file":"KarTekeningSection.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/KarTekeningSection.tsx"],"names":[],"mappings":"AAUA,OAAO,EAA4G,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAoB,MAAM,oBAAoB,CAAC;AAO/L,wBAAgB,mBAAmB,gCAiBlC;AAED,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE;IACJ,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACjC,2FAA2F;IAC3F,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;CAC3C,GACA,gBAAgB,CAqGlB"}
1
+ {"version":3,"file":"KarTekeningSection.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/KarTekeningSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAgJ,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAoB,MAAM,oBAAoB,CAAC;AAOnO,wBAAgB,mBAAmB,gCAiBlC;AAED,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE;IACJ,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACjC,2FAA2F;IAC3F,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;CAC3C,GACA,gBAAgB,CAqGlB"}
@@ -7,9 +7,11 @@ import { useEffect, useState } from "react";
7
7
  import { keepPreviousData, useQuery, useQueryClient } from "@tanstack/react-query";
8
8
  import { useServerFn } from "@tanstack/react-start";
9
9
  import { Badge, Button, Dialog, DialogContent, DialogHeader, DialogTitle, Skeleton, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@flowselections/core";
10
- import { AlertTriangle, Loader2 } from "lucide-react";
10
+ import { AlertTriangle, Info, Loader2, PencilRuler } from "lucide-react";
11
+ import { useRouter } from "@tanstack/react-router";
12
+ import { karBewerkenPad, karBewerkenStand } from "../../lib/engine-tijdlijn.js";
11
13
  import { getIndelingStand, getKarTekening } from "../../lib/kar-tekening.functions.js";
12
- import { dragerTitel, dragersKop, gedeeldTekst, lagenTekst, langBezig, POLL_MS, statusLabel, toonDozen, toonStand } from "../../lib/kar-tekening.js";
14
+ import { dragerTitel, dragersKop, gedeeldTekst, markeringTekst, lagenTekst, langBezig, POLL_MS, regelBeladingTekst, statusLabel, toonDozen, toonStand } from "../../lib/kar-tekening.js";
13
15
  import { bezigKey } from "../../lib/indeling-bezig.js";
14
16
  import { korteMelding } from "../../lib/korte-melding.js";
15
17
  import { SafeSvg } from "./SafeSvg.js";
@@ -94,7 +96,7 @@ export function useKarTekening(orderId, opts) {
94
96
  }
95
97
  else if (shown === "bezig") {
96
98
  const sinds = stand?.stand === "bezig" ? (stand.bezig_sinds ?? markAt) : markAt;
97
- node = (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm text-foreground", role: "status", "aria-live": "polite", children: [_jsx(Loader2, { className: "mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary" }), _jsxs("div", { children: [_jsx("div", { children: "Indeling wordt gemaakt\u2026 meestal binnen een minuut" }), langBezig(sinds, now) && (_jsx("div", { className: "mt-0.5 text-xs text-muted-foreground", children: "Dit duurt langer dan normaal. Je kunt gewoon verder werken; de indeling verschijnt vanzelf." }))] })] }), tek && tek.dragers.length > 0 && (_jsxs("div", { className: "relative opacity-50 transition-opacity duration-300", children: [_jsx(Badge, { variant: "secondary", className: "absolute right-2 top-2 z-10", children: "Wordt bijgewerkt" }), _jsx(TekeningInhoud, { tek: tek, orderId: orderId, floriday: opts.floriday, onLagen: opts.onLagen, regels: opts.regelsPerDrager })] }))] }));
99
+ node = (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm text-foreground", role: "status", "aria-live": "polite", children: [_jsx(Loader2, { className: "mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary" }), _jsxs("div", { children: [_jsx("div", { children: "Indeling wordt gemaakt\u2026 meestal binnen een minuut" }), langBezig(sinds, now) && (_jsx("div", { className: "mt-0.5 text-xs text-muted-foreground", children: "Dit duurt langer dan normaal. Je kunt gewoon verder werken; de indeling verschijnt vanzelf." }))] })] }), tek && tek.dragers.length > 0 && (_jsxs("div", { className: "relative opacity-50 transition-opacity duration-300", children: [_jsx(Badge, { variant: "secondary", className: "absolute right-2 top-2 z-10", children: "Wordt bijgewerkt" }), _jsx(TekeningInhoud, { tek: tek, orderId: orderId, orderDbId: null, floriday: opts.floriday, onLagen: opts.onLagen, regels: opts.regelsPerDrager })] }))] }));
98
100
  }
99
101
  else if (tekeningQ.isPending || !tekeningQ.data) {
100
102
  node = _jsx(KarindelingSkeleton, {});
@@ -106,16 +108,37 @@ export function useKarTekening(orderId, opts) {
106
108
  node = _jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen artikelen, dus nog geen indeling." });
107
109
  }
108
110
  else {
109
- node = _jsx("div", { className: "animate-in fade-in duration-300", children: _jsx(TekeningInhoud, { tek: tek, orderId: orderId, floriday: opts.floriday, onLagen: opts.onLagen, regels: opts.regelsPerDrager }) });
111
+ node = _jsx("div", { className: "animate-in fade-in duration-300", children: _jsx(TekeningInhoud, { tek: tek, orderId: orderId, orderDbId: dbId, floriday: opts.floriday, onLagen: opts.onLagen, regels: opts.regelsPerDrager }) });
110
112
  }
111
113
  return { beschikbaar: true, kop, node };
112
114
  }
113
115
  function Melding({ tekst }) {
114
116
  return (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }), _jsx("span", { children: tekst })] }));
115
117
  }
116
- function TekeningInhoud({ tek, orderId, floriday, onLagen, regels }) {
118
+ /**
119
+ * Knop "Indeling aanpassen" naar het Engine-scherm Kar bewerken (?order=<orders.id>).
120
+ * Alleen als logistics_kar_bewerkbaar (via de tekening) minstens één drager
121
+ * toestaat; anders de reden. Bestaat de route niet in de shell: niets.
122
+ */
123
+ function IndelingAanpassen({ tek, orderDbId }) {
124
+ const router = useRouter();
125
+ const pad = karBewerkenPad(router, orderDbId);
126
+ const stand = karBewerkenStand(tek.dragers.map((d) => ({ bewerkbaar: d.bewerkbaar, niet_bewerkbaar_reden: d.niet_bewerkbaar_reden, titel: dragerTitel(d) })));
127
+ if (!pad || stand.soort === "onbekend")
128
+ return null;
129
+ if (stand.soort === "kan") {
130
+ return (_jsx("div", { className: "flex justify-end", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "h-8", children: _jsxs("a", { href: pad, onClick: (e) => {
131
+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0)
132
+ return;
133
+ e.preventDefault();
134
+ router.history.push(pad);
135
+ }, children: [_jsx(PencilRuler, { className: "mr-2 h-4 w-4" }), " Indeling aanpassen"] }) }) }));
136
+ }
137
+ return (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: [_jsx(Info, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": true }), _jsxs("div", { className: "min-w-0", children: [_jsx("span", { className: "font-medium text-foreground", children: "Indeling aanpassen kan nu niet." }), " ", stand.redenen.length === 1 ? stand.redenen[0] : (_jsx("ul", { className: "mt-0.5 space-y-0.5", children: stand.redenen.map((r, i) => _jsx("li", { children: r }, i)) }))] })] }));
138
+ }
139
+ function TekeningInhoud({ tek, orderId, orderDbId, floriday, onLagen, regels }) {
117
140
  const [groot, setGroot] = useState(null);
118
- return (_jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "-mx-1 flex gap-2 overflow-x-auto px-1 pb-1", children: tek.dragers.map((d) => (_jsx("button", { type: "button", onClick: () => setGroot(d), className: "shrink-0 rounded-lg border border-border bg-card p-1 transition-shadow hover:border-ring/50 hover:shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", "aria-label": `Grote tekening van ${dragerTitel(d)}`, title: dragerTitel(d), children: d.svg ? _jsx(SafeSvg, { svg: d.svg, className: "h-16 w-12 [&>svg]:h-full [&>svg]:w-full", label: dragerTitel(d) }) : _jsx("div", { className: "flex h-16 w-12 items-center justify-center text-xs tabular-nums text-muted-foreground", children: d.nummer ?? "—" }) }, d.id))) }), tek.dragers.length === 0 && tek.svg_rij && _jsx(SafeSvg, { svg: tek.svg_rij, className: "overflow-x-auto", label: "Overzicht van de indeling" }), _jsx("div", { className: "grid gap-3 md:grid-cols-2", children: tek.dragers.map((d) => _jsx(DragerKaart, { d: d, orderId: orderId, regels: regels?.get(d.id) ?? [], floriday: floriday, onGroot: () => setGroot(d), onLagen: onLagen }, d.id)) }), _jsx(Dialog, { open: !!groot, onOpenChange: (v) => { if (!v)
141
+ return (_jsxs("div", { className: "space-y-3", children: [tek.meldingen.length > 0 && (_jsx("ul", { className: "space-y-1 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-foreground", children: tek.meldingen.map((m, i) => (_jsxs("li", { className: "flex items-start gap-1.5", children: [_jsx(Info, { className: "mt-0.5 h-3 w-3 shrink-0 text-muted-foreground", "aria-hidden": true }), m] }, i))) })), _jsx(IndelingAanpassen, { tek: tek, orderDbId: orderDbId }), _jsx("div", { className: "-mx-1 flex gap-2 overflow-x-auto px-1 pb-1", children: tek.dragers.map((d) => (_jsx("button", { type: "button", onClick: () => setGroot(d), className: "shrink-0 rounded-lg border border-border bg-card p-1 transition-shadow hover:border-ring/50 hover:shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", "aria-label": `Grote tekening van ${dragerTitel(d)}`, title: dragerTitel(d), children: d.svg ? _jsx(SafeSvg, { svg: d.svg, className: "h-16 w-12 [&>svg]:h-full [&>svg]:w-full", label: dragerTitel(d) }) : _jsx("div", { className: "flex h-16 w-12 items-center justify-center text-xs tabular-nums text-muted-foreground", children: d.nummer ?? "—" }) }, d.id))) }), tek.dragers.length === 0 && tek.svg_rij && _jsx(SafeSvg, { svg: tek.svg_rij, className: "overflow-x-auto", label: "Overzicht van de indeling" }), _jsx("div", { className: "grid gap-3 md:grid-cols-2", children: tek.dragers.map((d) => _jsx(DragerKaart, { d: d, orderId: orderId, regels: regels?.get(d.id) ?? [], floriday: floriday, onGroot: () => setGroot(d), onLagen: onLagen }, d.id)) }), _jsx(Dialog, { open: !!groot, onOpenChange: (v) => { if (!v)
119
142
  setGroot(null); }, children: _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: groot ? dragerTitel(groot) : "" }) }), groot?.svg ? _jsx(SafeSvg, { svg: groot.svg, className: "max-h-[70vh] overflow-auto [&>svg]:h-auto [&>svg]:w-full", label: dragerTitel(groot) }) : _jsx("p", { className: "text-sm text-muted-foreground", children: "Geen tekening beschikbaar." })] }) })] }));
120
143
  }
121
144
  function DragerKaart({ d, orderId, regels, floriday, onGroot, onLagen }) {
@@ -124,5 +147,6 @@ function DragerKaart({ d, orderId, regels, floriday, onGroot, onLagen }) {
124
147
  const dozen = toonDozen(regels);
125
148
  const gedeeld = gedeeldTekst(d.gedeeld_met);
126
149
  const lagen = lagenTekst(d.lagen_gebruikt, d.lagen_max);
127
- return (_jsxs("div", { className: "min-w-0 space-y-2 rounded-xl border border-border bg-card p-3 shadow-sm", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-medium text-foreground", children: dragerTitel(d) }), status && _jsx(Badge, { variant: "outline", className: "rounded-full", children: status }), floriday && d.floriday_gelijk === true && _jsx(Badge, { variant: "secondary", className: "rounded-full", children: "Floriday gelijk" }), gedeeld && _jsx(Badge, { variant: "outline", className: "rounded-full", children: gedeeld })] }), (d.nummer != null || d.letters.length > 0) && (_jsx("div", { className: "text-xs tabular-nums text-muted-foreground", children: karKop({ nummer: d.nummer, vulgraad_pct: d.vulgraad_pct, letters: d.letters }) })), _jsx(KarSlotMelding, { slot: d, orderId: orderId, compact: true }), pct != null && (_jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [_jsx("div", { className: "h-2 flex-1 overflow-hidden rounded-full bg-muted", role: "progressbar", "aria-valuenow": pct, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": "Vulgraad", children: _jsx("div", { className: "h-full rounded-full bg-primary", style: { width: `${pct}%` } }) }), _jsxs("span", { className: "tabular-nums", children: [pct, "%"] })] })), lagen && _jsx("div", { className: "text-xs tabular-nums text-muted-foreground", children: lagen }), d.waarschuwingen.length > 0 && (_jsx("ul", { className: "space-y-0.5 text-xs text-foreground", children: d.waarschuwingen.map((w, i) => (_jsxs("li", { className: "flex items-start gap-1", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-3 w-3 shrink-0 text-warning" }), w] }, i))) })), d.svg && (_jsx("button", { type: "button", onClick: onGroot, className: "block w-full rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", "aria-label": `Grote tekening van ${dragerTitel(d)}`, children: _jsx(SafeSvg, { svg: d.svg, className: "max-h-64 overflow-hidden [&>svg]:mx-auto [&>svg]:h-auto [&>svg]:max-h-64 [&>svg]:w-full", label: dragerTitel(d) }) })), regels.length > 0 && (_jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Artikel" }), _jsx(TableHead, { children: "Fusten" }), dozen && _jsx(TableHead, { children: "Dozen" }), _jsx(TableHead, { children: "Belading" })] }) }), _jsx(TableBody, { children: regels.map((a) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "min-w-0", children: a.product }), _jsx(TableCell, { className: "tabular-nums", children: a.fusten ?? "—" }), dozen && _jsx(TableCell, { className: "tabular-nums", children: a.dozen ?? "—" }), _jsx(TableCell, { className: "text-xs text-muted-foreground", children: a.belading ?? "Belading onbekend" })] }, a.key))) })] }) })), onLagen && d.soort === "layered" && (_jsx(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => onLagen(d), children: "Lagen bekijken" }))] }));
150
+ const rood = markeringTekst(d);
151
+ return (_jsxs("div", { className: `min-w-0 space-y-2 rounded-xl border bg-card p-3 shadow-sm ${rood ? "border-destructive" : "border-border"}`, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-medium text-foreground", children: dragerTitel(d) }), rood && _jsxs(Badge, { variant: "destructive", className: "rounded-full", children: [_jsx(AlertTriangle, { className: "mr-1 h-3 w-3", "aria-hidden": true }), rood] }), status && _jsx(Badge, { variant: "outline", className: "rounded-full", children: status }), floriday && d.floriday_gelijk === true && _jsx(Badge, { variant: "secondary", className: "rounded-full", children: "Floriday gelijk" }), gedeeld && _jsx(Badge, { variant: "outline", className: "rounded-full", children: gedeeld })] }), (d.nummer != null || d.letters.length > 0) && (_jsx("div", { className: "text-xs tabular-nums text-muted-foreground", children: karKop({ nummer: d.nummer, vulgraad_pct: d.vulgraad_pct, letters: d.letters, naam: d.naam }) })), _jsx(KarSlotMelding, { slot: d, orderId: orderId, compact: true }), pct != null && (_jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [_jsx("div", { className: "h-2 flex-1 overflow-hidden rounded-full bg-muted", role: "progressbar", "aria-valuenow": pct, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": "Vulgraad", children: _jsx("div", { className: "h-full rounded-full bg-primary", style: { width: `${pct}%` } }) }), _jsxs("span", { className: "tabular-nums", children: [pct, "%"] })] })), lagen && _jsx("div", { className: "text-xs tabular-nums text-muted-foreground", children: lagen }), d.waarschuwingen.length > 0 && (_jsx("ul", { className: "space-y-0.5 text-xs text-foreground", children: d.waarschuwingen.map((w, i) => (_jsxs("li", { className: "flex items-start gap-1", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-3 w-3 shrink-0 text-warning" }), w] }, i))) })), d.svg && (_jsx("button", { type: "button", onClick: onGroot, className: "block w-full rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", "aria-label": `Grote tekening van ${dragerTitel(d)}`, children: _jsx(SafeSvg, { svg: d.svg, className: "max-h-64 overflow-hidden [&>svg]:mx-auto [&>svg]:h-auto [&>svg]:max-h-64 [&>svg]:w-full", label: dragerTitel(d) }) })), regels.length > 0 && (_jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Artikel" }), _jsx(TableHead, { children: "Fusten" }), dozen && _jsx(TableHead, { children: "Dozen" }), _jsx(TableHead, { children: "Belading" })] }) }), _jsx(TableBody, { children: regels.map((a) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "min-w-0", children: a.product }), _jsx(TableCell, { className: "tabular-nums", children: a.fusten ?? "—" }), dozen && _jsx(TableCell, { className: "tabular-nums", children: a.dozen ?? "—" }), _jsx(TableCell, { className: "text-xs text-muted-foreground", children: regelBeladingTekst(a, d) })] }, a.key))) })] }) })), onLagen && d.soort === "layered" && (_jsx(Button, { variant: "outline", size: "sm", className: "h-8", onClick: () => onLagen(d), children: "Lagen bekijken" }))] }));
128
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OrderKarindelingCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderKarindelingCard.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAgB/D,eAAO,MAAM,WAAW,iDAA4C,CAAC;AAiBrE,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,YAAY,GACb,EAAE;IACD,KAAK,EAAE,aAAa,CAAC;IACrB,2EAA2E;IAC3E,YAAY,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAClH,+BAwWA;AAGD,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAaxD"}
1
+ {"version":3,"file":"OrderKarindelingCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderKarindelingCard.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAgB/D,eAAO,MAAM,WAAW,iDAA4C,CAAC;AAiBrE,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,YAAY,GACb,EAAE;IACD,KAAK,EAAE,aAAa,CAAC;IACrB,2EAA2E;IAC3E,YAAY,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAClH,+BAsXA;AAGD,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAaxD"}
@@ -21,8 +21,8 @@ import { CartLayersDialog } from "./CartLayersDialog.js";
21
21
  import { PlanCoverageBadge } from "./PlanCoverageBadge.js";
22
22
  import { isProefindeling } from "../../lib/floriday-actual-carriers.js";
23
23
  import { KarindelingSkeleton, useKarTekening } from "./KarTekeningSection.js";
24
- import { karRegelsPerDrager, pickTekst, toonDozen } from "../../lib/kar-tekening.js";
25
- import { listOrderItemPacking } from "../../lib/order-item-packing.functions.js";
24
+ import { karRegelsPerDrager, pickTekst, regelsZonderBelading, toonDozen } from "../../lib/kar-tekening.js";
25
+ import { listOrderItemBelading, listOrderItemPacking } from "../../lib/order-item-packing.functions.js";
26
26
  export const PROEF_TITEL = "Proefindeling – afgehandeld in Floriday";
27
27
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
28
28
  const PICK_LABEL = {
@@ -128,7 +128,22 @@ export function OrderKarindelingCard({ order, pickProgress, }) {
128
128
  });
129
129
  if (packingQ.isError)
130
130
  console.error("[karindeling] belading orderregels:", packingQ.error);
131
- const regelsPerDrager = karRegelsPerDrager(carts, packingQ.data?.items ?? [], resolveProductName);
131
+ // Regels op de kar die niet (volledig) uit de eigen orderregels komen (gedeelde kar,
132
+ // onvolledige snapshot): belading uit de orderregel zelf of de Engine-uitleg.
133
+ const packingKlaar = packingQ.isSuccess || packingQ.isError;
134
+ const zonderBelading = packingKlaar ? regelsZonderBelading(carts, packingQ.data?.items ?? []) : [];
135
+ const fetchBelading = useServerFn(listOrderItemBelading);
136
+ const extraQ = useQuery({
137
+ queryKey: ["kar-regel-belading", zonderBelading.join(",")],
138
+ enabled: !proef && zonderBelading.length > 0,
139
+ staleTime: 60000,
140
+ queryFn: () => fetchBelading({ data: { orderItemIds: zonderBelading.slice(0, 100) } }),
141
+ });
142
+ if (extraQ.isError)
143
+ console.error("[karindeling] belading aanvullen:", extraQ.error);
144
+ const extraBelading = new Map(Object.entries(extraQ.data?.items ?? {}));
145
+ const beladingLaden = !proef && (packingQ.isPending || (zonderBelading.length > 0 && extraQ.isPending));
146
+ const regelsPerDrager = karRegelsPerDrager(carts, packingQ.data?.items ?? [], resolveProductName, extraBelading, beladingLaden);
132
147
  const kt = useKarTekening(proef ? null : orderId, {
133
148
  floriday: isFloriday,
134
149
  onLagen: (d) => setLayersFor({ id: d.id, number: d.nummer ?? 0 }),
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAsIA,wBAAgB,oBAAoB,gCAsWnC"}
1
+ {"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAuIA,wBAAgB,oBAAoB,gCAwWnC"}
@@ -37,6 +37,7 @@ import { PickupDeliveryLine, useOrderTransport } from "./OrderTransportCard.js";
37
37
  import { groepZonderGeannuleerd, kanLidAnnuleren } from "../../lib/order-cancel-view.js";
38
38
  import { geannuleerdMelding } from "../../lib/order-terugdraaien.js";
39
39
  import { cancelLocalOrder } from "../../lib/create-order.functions.js";
40
+ import { useOrderDetailPrefetch } from "../../lib/useOrderDetailPrefetch.js";
40
41
  import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, toast } from "@flowselections/core";
41
42
  import { Loader2 } from "lucide-react";
42
43
  const eur = new Intl.NumberFormat("nl-NL", { style: "currency", currency: "EUR", minimumFractionDigits: 2, maximumFractionDigits: 2 });
@@ -103,6 +104,8 @@ export function SalesOrderDetailPage() {
103
104
  const isLocal = salesOrderId.startsWith("local:");
104
105
  const isMailboxProposal = salesOrderId.startsWith("mailbox-proposal:");
105
106
  const isFloriday = !isLocal && !isMailboxProposal;
107
+ // Kaartgegevens tegelijk met de order ophalen (geen tweede wachtronde).
108
+ useOrderDetailPrefetch(salesOrderId, { reservation: cached.row?.isReservation ?? null });
106
109
  // Floriday-orders: gerichte, snelle per-order fetch.
107
110
  const detailQuery = useSalesOrderDetailQuery(isFloriday ? salesOrderId : null);
108
111
  // Lokale orders: eveneens gericht ophalen, onafhankelijk van paginering en
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAOA,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
+ {"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAmC,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGvH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAkKnE,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"}
@@ -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"}