@flowselections/floriday-verkoop-module 1.0.160 → 1.0.161

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 (70) hide show
  1. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts +1 -0
  2. package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -1
  3. package/dist-lib/components/verkoop/OrderKarindelingCard.js +7 -2
  4. package/dist-lib/components/verkoop/OrderTransportCard.d.ts.map +1 -1
  5. package/dist-lib/components/verkoop/OrderTransportCard.js +6 -4
  6. package/dist-lib/components/verkoop/SalesOrderDetailPage.js +1 -1
  7. package/dist-lib/components/verkoop/SalesOrderDetailView.js +7 -4
  8. package/dist-lib/components/verkoop/klok/KlokOrderPage.d.ts.map +1 -1
  9. package/dist-lib/components/verkoop/klok/KlokOrderPage.js +21 -6
  10. package/dist-lib/components/verkoop/klok/KlokOrdersList.d.ts.map +1 -1
  11. package/dist-lib/components/verkoop/klok/KlokOrdersList.js +3 -3
  12. package/dist-lib/integrations/supabase/types.d.ts +531 -0
  13. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  14. package/dist-lib/lib/cart-replan.functions.d.ts +6 -0
  15. package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
  16. package/dist-lib/lib/cart-replan.functions.js +18 -8
  17. package/dist-lib/lib/cron/sync-salesorders-now.d.ts +1 -0
  18. package/dist-lib/lib/cron/sync-salesorders-now.d.ts.map +1 -1
  19. package/dist-lib/lib/cron/sync-salesorders-now.js +26 -2
  20. package/dist-lib/lib/engine-block-alerts.server.d.ts.map +1 -1
  21. package/dist-lib/lib/engine-block-alerts.server.js +3 -1
  22. package/dist-lib/lib/floriday-actual-carriers.d.ts +18 -0
  23. package/dist-lib/lib/floriday-actual-carriers.d.ts.map +1 -0
  24. package/dist-lib/lib/floriday-actual-carriers.js +26 -0
  25. package/dist-lib/lib/floriday-actual-carriers.server.d.ts +6 -0
  26. package/dist-lib/lib/floriday-actual-carriers.server.d.ts.map +1 -0
  27. package/dist-lib/lib/floriday-actual-carriers.server.js +31 -0
  28. package/dist-lib/lib/floriday-backfill.d.ts +26 -0
  29. package/dist-lib/lib/floriday-backfill.d.ts.map +1 -0
  30. package/dist-lib/lib/floriday-backfill.js +43 -0
  31. package/dist-lib/lib/floriday-backfill.server.d.ts +2 -0
  32. package/dist-lib/lib/floriday-backfill.server.d.ts.map +1 -0
  33. package/dist-lib/lib/floriday-backfill.server.js +32 -0
  34. package/dist-lib/lib/floriday-mirror.server.d.ts +2 -1
  35. package/dist-lib/lib/floriday-mirror.server.d.ts.map +1 -1
  36. package/dist-lib/lib/floriday-mirror.server.js +30 -49
  37. package/dist-lib/lib/floriday-status.d.ts +9 -0
  38. package/dist-lib/lib/floriday-status.d.ts.map +1 -1
  39. package/dist-lib/lib/floriday-status.js +12 -0
  40. package/dist-lib/lib/invoice-timing.d.ts +9 -0
  41. package/dist-lib/lib/invoice-timing.d.ts.map +1 -1
  42. package/dist-lib/lib/invoice-timing.js +15 -0
  43. package/dist-lib/lib/invoice-timing.server.d.ts.map +1 -1
  44. package/dist-lib/lib/invoice-timing.server.js +8 -3
  45. package/dist-lib/lib/klok-labels.d.ts +4 -1
  46. package/dist-lib/lib/klok-labels.d.ts.map +1 -1
  47. package/dist-lib/lib/klok-labels.js +10 -1
  48. package/dist-lib/lib/list-own-rows.d.ts +9 -0
  49. package/dist-lib/lib/list-own-rows.d.ts.map +1 -0
  50. package/dist-lib/lib/list-own-rows.js +20 -0
  51. package/dist-lib/lib/order-departure.d.ts +1 -1
  52. package/dist-lib/lib/order-departure.d.ts.map +1 -1
  53. package/dist-lib/lib/order-departure.js +1 -1
  54. package/dist-lib/lib/order-status.d.ts +15 -1
  55. package/dist-lib/lib/order-status.d.ts.map +1 -1
  56. package/dist-lib/lib/order-status.js +17 -1
  57. package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
  58. package/dist-lib/lib/salesorders-list.server.js +70 -4
  59. package/dist-lib/lib/salesorders-mapping.d.ts +2 -0
  60. package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
  61. package/dist-lib/lib/salesorders-mapping.js +1 -1
  62. package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
  63. package/dist-lib/lib/salesorders.functions.js +12 -3
  64. package/dist-lib/lib/sync-melding.d.ts +3 -0
  65. package/dist-lib/lib/sync-melding.d.ts.map +1 -1
  66. package/dist-lib/lib/sync-melding.functions.d.ts.map +1 -1
  67. package/dist-lib/lib/sync-melding.functions.js +1 -0
  68. package/dist-lib/lib/sync-melding.js +5 -2
  69. package/package.json +1 -1
  70. package/schema/verkoop.sql +408 -8
@@ -1,4 +1,5 @@
1
1
  import type { SalesOrderDTO } from "../../lib/salesorders-mapping.js";
2
+ export declare const PROEF_TITEL = "Proefindeling \u2013 afgehandeld in Floriday";
2
3
  export declare function OrderKarindelingCard({ order, pickProgress, }: {
3
4
  order: SalesOrderDTO;
4
5
  /** Geprint/gepickt per kar, zelfde bron als de lijst (alleen weergave). */
@@ -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;AA2B/D,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,+BAyRA;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;AAa/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,+BAoTA;AAGD,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAaxD"}
@@ -19,6 +19,8 @@ import { loadCarrierName } from "../../lib/load-carrier-labels.js";
19
19
  import { resolveProductName } from "../../lib/product-name.js";
20
20
  import { CartLayersDialog } from "./CartLayersDialog.js";
21
21
  import { PlanCoverageBadge } from "./PlanCoverageBadge.js";
22
+ import { isProefindeling } from "../../lib/floriday-actual-carriers.js";
23
+ export const PROEF_TITEL = "Proefindeling – afgehandeld in Floriday";
22
24
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
23
25
  const PICK_LABEL = {
24
26
  geen_pickrij: "Geen pickrij",
@@ -107,12 +109,15 @@ export function OrderKarindelingCard({ order, pickProgress, }) {
107
109
  ? engineBuffer.carts.filter((b) => b.pickDocument).map((b) => ({ queueItemId: b.pickDocument.id, documentNumber: b.pickDocument.documentNumber, cartId: b.cartId, printedAt: b.pickDocument.printedAt, completedAt: null }))
108
110
  : Array.isArray(cov?.pickRows) ? cov.pickRows : [];
109
111
  const [layersFor, setLayersFor] = useState(null);
110
- return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 sm:flex sm:flex-row sm:justify-between", children: [_jsx(CardTitle, { className: "truncate text-base", children: "Karindeling" }), _jsxs("div", { className: "flex items-center gap-2", children: [cov && cov.state !== "onbekend" && (_jsxs(Badge, { variant: "secondary", children: [engineBuffer ? engineBuffer.karren : carts.length, " kar(ren)"] })), _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Vernieuwen", title: "Vernieuwen", onClick: () => void queryClient.invalidateQueries({ queryKey }), children: _jsx(RefreshCw, { className: "h-4 w-4 " + (isFetching ? "animate-spin" : "") }) })] })] }), _jsx(CardContent, { className: "space-y-4", children: isLoading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Karindeling laden\u2026" })) : error ? (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: "Indeling onbekend" }), _jsx("p", { className: "text-sm text-muted-foreground", children: error.message })] })) : cov ? (_jsxs(_Fragment, { children: [cov.externalFulfilled && !cov.externalFulfilled.full && (_jsxs("p", { className: "text-sm text-muted-foreground", children: [cov.externalFulfilled.salesOrderIds.length, " bestelling(en) afgehandeld in Floriday; de voortgang telt alleen de rest."] })), data?.externalEvent?.sendError ? (_jsxs("p", { className: "text-sm text-destructive", children: ["Het afronden in de planning lukte niet: de melding kon niet worden verstuurd (", data.externalEvent.sendError, ")."] })) : data?.externalEvent?.status === "failed" ? (_jsxs("p", { className: "text-sm text-destructive", children: ["Het afronden in de planning lukte niet: ", data.externalEvent.error ?? "geen reden opgegeven"] })) : data?.externalEvent && data.externalEvent.status && !["done", "processed", "completed", "applied", "skipped"].includes(data.externalEvent.status) ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "De planning verwerkt \"Afgehandeld in Floriday\" nog." })) : null, _jsxs("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2 text-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Indeling" }), creating ? (_jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Karindeling wordt gemaakt\u2026" })) : (_jsx(PlanCoverageBadge, { coverage: summarize(cov) }))] }), _jsxs("div", { children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Pickstatus" }), _jsxs("div", { className: "mt-1", children: [cov.pickStatus ? PICK_LABEL[cov.pickStatus] : "—", cov.pickStatus === "gepickt" && cov.pickedAt ? ` · ${fmt(cov.pickedAt)}` : ""] }), pickProgress && (pickProgress.cartsTotal ?? 0) > 0 && (_jsxs("div", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: [pickProgress.cartsPrinted ?? 0, " van ", pickProgress.cartsTotal, " geprint", pickProgress.cartsScanned != null ? ` · ${pickProgress.cartsScanned} van ${pickProgress.cartsTotal} gepickt` : ""] }))] }), pickRows.length > 0 && (_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Pickdocumenten" }), _jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: pickRows.map((p, i) => (_jsxs(Badge, { variant: "outline", className: "text-[10px]", title: [
112
+ // In Floriday afgehandeld: indeling van de Engine als proefindeling, geen pick-/aanmeldacties.
113
+ const proef = isProefindeling({ coverageFull: cov?.externalFulfilled?.full ?? null, externalFulfilledAt: data?.externalFulfilledAt ?? order?.floridayExternalFulfilledAt ?? null });
114
+ const floridayCarriers = data?.floriday;
115
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 sm:flex sm:flex-row sm:justify-between", children: [_jsx(CardTitle, { className: "truncate text-base", children: proef ? PROEF_TITEL : "Karindeling" }), _jsxs("div", { className: "flex items-center gap-2", children: [cov && cov.state !== "onbekend" && (_jsxs(Badge, { variant: "secondary", children: [engineBuffer ? engineBuffer.karren : carts.length, " kar(ren)"] })), _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Vernieuwen", title: "Vernieuwen", onClick: () => void queryClient.invalidateQueries({ queryKey }), children: _jsx(RefreshCw, { className: "h-4 w-4 " + (isFetching ? "animate-spin" : "") }) })] })] }), _jsx(CardContent, { className: "space-y-4", children: isLoading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Karindeling laden\u2026" })) : error ? (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: "Indeling onbekend" }), _jsx("p", { className: "text-sm text-muted-foreground", children: error.message })] })) : cov ? (_jsxs(_Fragment, { children: [cov.externalFulfilled && !cov.externalFulfilled.full && (_jsxs("p", { className: "text-sm text-muted-foreground", children: [cov.externalFulfilled.salesOrderIds.length, " bestelling(en) afgehandeld in Floriday; de voortgang telt alleen de rest."] })), data?.externalEvent?.sendError ? (_jsxs("p", { className: "text-sm text-destructive", children: ["Het afronden in de planning lukte niet: de melding kon niet worden verstuurd (", data.externalEvent.sendError, ")."] })) : data?.externalEvent?.status === "failed" ? (_jsxs("p", { className: "text-sm text-destructive", children: ["Het afronden in de planning lukte niet: ", data.externalEvent.error ?? "geen reden opgegeven"] })) : data?.externalEvent && data.externalEvent.status && !["done", "processed", "completed", "applied", "skipped"].includes(data.externalEvent.status) ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "De planning verwerkt \"Afgehandeld in Floriday\" nog." })) : null, _jsxs("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2 text-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Indeling" }), creating ? (_jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Karindeling wordt gemaakt\u2026" })) : (_jsx(PlanCoverageBadge, { coverage: summarize(cov) }))] }), !proef && (_jsxs("div", { children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Pickstatus" }), _jsxs("div", { className: "mt-1", children: [cov.pickStatus ? PICK_LABEL[cov.pickStatus] : "—", cov.pickStatus === "gepickt" && cov.pickedAt ? ` · ${fmt(cov.pickedAt)}` : ""] }), pickProgress && (pickProgress.cartsTotal ?? 0) > 0 && (_jsxs("div", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: [pickProgress.cartsPrinted ?? 0, " van ", pickProgress.cartsTotal, " geprint", pickProgress.cartsScanned != null ? ` · ${pickProgress.cartsScanned} van ${pickProgress.cartsTotal} gepickt` : ""] }))] })), !proef && pickRows.length > 0 && (_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Pickdocumenten" }), _jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: pickRows.map((p, i) => (_jsxs(Badge, { variant: "outline", className: "text-[10px]", title: [
111
116
  p.printedAt ? `Geprint ${fmt(p.printedAt)}` : "Nog niet geprint",
112
117
  p.completedAt ? `Afgerond ${fmt(p.completedAt)}` : null,
113
118
  ]
114
119
  .filter(Boolean)
115
- .join(" · "), children: [p.documentNumber ?? "pickrij", p.completedAt ? " ✓" : ""] }, p.queueItemId ?? i))) })] }))] }), engineBuffer && engineBuffer.dubbeleDocumenten.length > 0 && (_jsx("div", { className: "rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive", children: engineBuffer.dubbeleDocumenten.map((d) => (_jsxs("div", { children: ["Pickdocument ", d.documentNumber, " bestaat twee keer"] }, d.documentNumber))) })), (cov.indelingVerouderd || engineMelding) && (_jsx(IndelingVerouderdBlock, { orderId: orderId, verouderd: cov.indelingVerouderd ?? null, melding: engineMelding, onDone: () => { clearMelding(null); queryClient.invalidateQueries({ queryKey }); } })), cov.state === "geen_indeling" && !creating && (cov.geenIndeling ? (_jsxs("div", { className: "rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm", children: [_jsxs("div", { className: "font-medium text-destructive", children: ["Geen indeling", cov.geenIndeling.code ? ` (${cov.geenIndeling.code})` : ""] }), cov.geenIndeling.regels.length > 0 ? (_jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5 text-foreground", children: cov.geenIndeling.regels.map((r, i) => _jsx("li", { className: "break-words", children: r }, i)) })) : cov.geenIndeling.tekst ? (_jsx(ExpandableText, { text: cov.geenIndeling.tekst })) : null, cov.geenIndeling.actieUrl && (cov.geenIndeling.actieLabel || cov.geenIndeling.actie) && (_jsx(Button, { asChild: true, size: "sm", variant: "outline", className: "mt-2", children: _jsx("a", { href: cov.geenIndeling.actieUrl, children: cov.geenIndeling.actieLabel ?? cov.geenIndeling.actie }) }))] })) : (_jsxs("p", { className: "text-sm text-muted-foreground", children: ["Geen indeling: bekijk de reden in Engine beheer.", cov.reason && _jsx(ExpandableText, { text: cov.reason })] }))), cov.state === "onbekend" && cov.error && (_jsx("p", { className: "text-sm text-muted-foreground", children: cov.error })), carts.map((c) => (_jsxs("div", { className: "rounded-md border border-border", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b border-border bg-muted/30 px-3 py-2 text-sm", children: [_jsxs("button", { type: "button", className: "flex items-center gap-2 rounded-sm text-left hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", onClick: () => setLayersFor({ id: c.cartId, number: c.cartNumber ?? 0 }), title: "Bekijk de lagen van deze kar", children: [_jsx(LayoutGrid, { className: "h-4 w-4 text-muted-foreground" }), _jsxs("span", { className: "font-mono font-medium", children: ["Kar ", c.cartNumber ?? "—"] })] }), c.shared && _jsx(Badge, { variant: "outline", children: "Gedeeld met gecombineerde order" }), cartSummary(c) ? (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: cartSummary(c) })) : c.carrierType ? (_jsxs(Badge, { variant: "outline", className: "text-[10px]", children: [loadCarrierName(c.carrierType) ?? c.carrierType, c.additionalLayers != null ? ` · ${c.additionalLayers} ${c.additionalLayers === 1 ? "plaat" : "platen"}` : ""] })) : null, c.teHoog === true && _jsx(Badge, { variant: "destructive", className: "text-[10px]", children: "Te hoog" })] }), _jsx(VerouderdRedenen, { regels: verouderdRegels(c) }), c.blokkade && (_jsxs("div", { className: "border-b border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: ["Blokkade", c.blokkade.code ? ` (${c.blokkade.code})` : "", ": ", c.blokkade.tekst ?? "zie Engine beheer"] })), _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Artikel (deze order)" }), _jsx(TableHead, { className: "text-right", children: "Fusten" }), _jsx(TableHead, { className: "text-right", children: "Dozen" })] }) }), _jsx(TableBody, { children: (Array.isArray(c.lines) ? c.lines : []).map((l, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: resolveProductName(l.productName) ?? "—" }), _jsx(TableCell, { className: "text-right", children: l.crates }), _jsx(TableCell, { className: "text-right", children: l.boxes })] }, `${l.orderItemId ?? "x"}-${i}`))) })] })] }, c.cartId)))] })) : null }), _jsx(CartLayersDialog, { cartId: layersFor?.id ?? null, cartNumber: layersFor?.number ?? null, open: !!layersFor, onOpenChange: (v) => {
120
+ .join(" · "), children: [p.documentNumber ?? "pickrij", p.completedAt ? " ✓" : ""] }, p.queueItemId ?? i))) })] }))] }), engineBuffer && engineBuffer.dubbeleDocumenten.length > 0 && (_jsx("div", { className: "rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive", children: engineBuffer.dubbeleDocumenten.map((d) => (_jsxs("div", { children: ["Pickdocument ", d.documentNumber, " bestaat twee keer"] }, d.documentNumber))) })), !proef && (cov.indelingVerouderd || engineMelding) && (_jsx(IndelingVerouderdBlock, { orderId: orderId, verouderd: cov.indelingVerouderd ?? null, melding: engineMelding, onDone: () => { clearMelding(null); queryClient.invalidateQueries({ queryKey }); } })), proef && carts.length === 0 && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen proefindeling beschikbaar." })), !proef && cov.state === "geen_indeling" && !creating && (cov.geenIndeling ? (_jsxs("div", { className: "rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm", children: [_jsxs("div", { className: "font-medium text-destructive", children: ["Geen indeling", cov.geenIndeling.code ? ` (${cov.geenIndeling.code})` : ""] }), cov.geenIndeling.regels.length > 0 ? (_jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5 text-foreground", children: cov.geenIndeling.regels.map((r, i) => _jsx("li", { className: "break-words", children: r }, i)) })) : cov.geenIndeling.tekst ? (_jsx(ExpandableText, { text: cov.geenIndeling.tekst })) : null, cov.geenIndeling.actieUrl && (cov.geenIndeling.actieLabel || cov.geenIndeling.actie) && (_jsx(Button, { asChild: true, size: "sm", variant: "outline", className: "mt-2", children: _jsx("a", { href: cov.geenIndeling.actieUrl, children: cov.geenIndeling.actieLabel ?? cov.geenIndeling.actie }) }))] })) : (_jsxs("p", { className: "text-sm text-muted-foreground", children: ["Geen indeling: bekijk de reden in Engine beheer.", cov.reason && _jsx(ExpandableText, { text: cov.reason })] }))), cov.state === "onbekend" && cov.error && (_jsx("p", { className: "text-sm text-muted-foreground", children: cov.error })), carts.map((c) => (_jsxs("div", { className: "rounded-md border border-border", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b border-border bg-muted/30 px-3 py-2 text-sm", children: [_jsxs("button", { type: "button", className: "flex items-center gap-2 rounded-sm text-left hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", onClick: () => setLayersFor({ id: c.cartId, number: c.cartNumber ?? 0 }), title: "Bekijk de lagen van deze kar", children: [_jsx(LayoutGrid, { className: "h-4 w-4 text-muted-foreground" }), _jsxs("span", { className: "font-mono font-medium", children: ["Kar ", c.cartNumber ?? "—"] })] }), c.shared && _jsx(Badge, { variant: "outline", children: "Gedeeld met gecombineerde order" }), cartSummary(c) ? (_jsx(Badge, { variant: "outline", className: "text-[10px]", children: cartSummary(c) })) : c.carrierType ? (_jsxs(Badge, { variant: "outline", className: "text-[10px]", children: [loadCarrierName(c.carrierType) ?? c.carrierType, c.additionalLayers != null ? ` · ${c.additionalLayers} ${c.additionalLayers === 1 ? "plaat" : "platen"}` : ""] })) : null, c.teHoog === true && _jsx(Badge, { variant: "destructive", className: "text-[10px]", children: "Te hoog" })] }), _jsx(VerouderdRedenen, { regels: verouderdRegels(c) }), c.blokkade && (_jsxs("div", { className: "border-b border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: ["Blokkade", c.blokkade.code ? ` (${c.blokkade.code})` : "", ": ", c.blokkade.tekst ?? "zie Engine beheer"] })), _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Artikel (deze order)" }), _jsx(TableHead, { className: "text-right", children: "Fusten" }), _jsx(TableHead, { className: "text-right", children: "Dozen" })] }) }), _jsx(TableBody, { children: (Array.isArray(c.lines) ? c.lines : []).map((l, i) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: resolveProductName(l.productName) ?? "—" }), _jsx(TableCell, { className: "text-right", children: l.crates }), _jsx(TableCell, { className: "text-right", children: l.boxes })] }, `${l.orderItemId ?? "x"}-${i}`))) })] })] }, c.cartId))), proef && (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: "Werkelijke ladingdragers uit Floriday" }), floridayCarriers?.error ? (_jsx("p", { className: "text-sm text-muted-foreground", children: floridayCarriers.error })) : !floridayCarriers || floridayCarriers.carriers.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Floriday heeft (nog) geen ladingdragers voor deze order." })) : (_jsx("ul", { className: "divide-y divide-border rounded-md border border-border text-sm", children: floridayCarriers.carriers.map((c, i) => (_jsxs("li", { className: "flex flex-wrap items-center gap-2 px-3 py-2", children: [_jsx("span", { className: "font-medium", children: loadCarrierName(c.type ?? "") ?? c.type ?? "Ladingdrager" }), _jsxs("span", { className: "tabular-nums text-muted-foreground", children: [c.packages, " fust"] }), c.code && _jsx("span", { className: "font-mono text-xs text-muted-foreground", children: c.code })] }, `${c.fulfillmentId}-${c.index}-${i}`))) }))] }))] })) : null }), _jsx(CartLayersDialog, { cartId: layersFor?.id ?? null, cartNumber: layersFor?.number ?? null, open: !!layersFor, onOpenChange: (v) => {
116
121
  if (!v)
117
122
  setLayersFor(null);
118
123
  } })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"OrderTransportCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderTransportCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAcjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,yCAA0C,CAAC;AAE5F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,UAAO;;;;;;;;;;;;;;UAQnF;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIjG;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAmC,EAAE,EAAE;IACpH,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,+BAuCA;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,+BAsF9H;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,sCAWrE"}
1
+ {"version":3,"file":"OrderTransportCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderTransportCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAcjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,yCAA0C,CAAC;AAE5F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,UAAO;;;;;;;;;;;;;;UAQnF;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIjG;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAmC,EAAE,EAAE;IACpH,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,+BAuCA;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,+BAwF9H;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,sCAWrE"}
@@ -68,8 +68,10 @@ export function OwnPickupEditor({ orderId, kind, current, defaultDate, locked, l
68
68
  /** Blok "Vervoer" op de orderpagina; ontbrekende velden worden weggelaten. */
69
69
  export function OrderTransportCard({ order, groupSize, extra }) {
70
70
  const orderId = String(order.id);
71
- const locked = !!order.isReservation;
72
- const q = useOrderTransport(orderId, !locked);
71
+ // In Floriday afgehandeld: geen aanmeld- of wijzigacties meer (alleen tonen).
72
+ const afgehandeld = !!order.floridayExternalFulfilledAt;
73
+ const locked = !!order.isReservation || afgehandeld;
74
+ const q = useOrderTransport(orderId, !order.isReservation);
73
75
  const pm = usePickupMoment(orderId);
74
76
  const [changing, setChanging] = useState(false);
75
77
  const t = q.data;
@@ -78,9 +80,9 @@ export function OrderTransportCard({ order, groupSize, extra }) {
78
80
  const manual = carrier?.source === "handmatig";
79
81
  const view = ownPickupView({ own: !!t?.own, ownPickup: t?.ownPickup ?? null, lockReason: t?.lockReason ?? (t?.locked ? "onbekend" : null), plannedShort: pm.data?.view?.short ?? null });
80
82
  const missingOwnTime = view.melding === "invullen";
81
- const signup = !t?.own ? formatMoment(pm.data?.departure?.signupDeadline ?? null) : null;
83
+ const signup = !t?.own && !afgehandeld ? formatMoment(pm.data?.departure?.signupDeadline ?? null) : null;
82
84
  const karren = Number(order.karCount ?? 0);
83
- return (_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", attention: missingOwnTime, action: !locked ? (_jsx(Button, { size: "sm", variant: "ghost", className: "[@media(pointer:coarse)]:h-11", onClick: () => setChanging((v) => !v), "aria-expanded": changing, children: changing ? "Klaar" : "Vervoerder wijzigen" })) : undefined, children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), missingOwnTime && (_jsxs("div", { role: "status", className: "mb-2 flex items-start gap-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": true }), " ", OWN_PICKUP_MISSING_TEXT] })), view.melding === "onbekend" && !t?.ownPickup && (_jsx("div", { role: "status", className: "mb-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: OWN_PICKUP_UNKNOWN_TEXT })), locked ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: orderId, locked: true, compact: true }) })) : changing ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: orderId, compact: true, groupSize: groupSize }) })) : q.isLoading ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) })) : q.isError ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-destructive", children: "Vervoer kon niet worden geladen. Ververs de pagina." }) })) : hasCarrier ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsxs("span", { className: "inline-flex flex-wrap items-center gap-2", children: [_jsx("span", { children: carrier.carrierName }), _jsx(Badge, { variant: "outline", className: "text-xs", children: manual ? "Handmatig" : "Automatisch" })] }) })) : (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Nog geen vervoerder" }) })), !locked && t?.own && !view.editable && !t.ownPickup ? (_jsx(InfoRow, { label: ownPickupLabel(t.ownKind), children: _jsxs("div", { className: "space-y-0.5", children: [view.kopTijd && _jsx("div", { className: "tabular-nums", children: view.kopTijd }), view.melding === "planning" && _jsx("div", { className: "text-xs text-muted-foreground", children: ownPickupPlannedText(view.plannedTime) })] }) })) : !locked && t?.own ? (_jsx(InfoRow, { label: ownPickupLabel(t.ownKind), children: _jsx(OwnPickupEditor, { orderId: orderId, kind: t.ownKind, current: t.ownPickup, defaultDate: t.deliveryDate, locked: t.locked, lockedText: t.lockReason === "onbekend" ? OWN_PICKUP_UNKNOWN_TEXT : OWN_PICKUP_LOCKED_TEXT }, `${t.ownPickup?.date ?? ""}|${t.ownPickup?.time ?? ""}`) })) : !locked && t && !t.own ? (_jsx(InfoRow, { label: "Ophaalmoment", children: _jsx(OrderPickupMomentPicker, { orderId: orderId, pickupOnly: true, compact: true }) })) : null, signup && _jsx(InfoRow, { label: "Aanmelden v\u00F3\u00F3r", children: signup }), t?.carrierGln && _jsx(InfoRow, { label: "GLN vervoerder", children: t.carrierGln }), order.cartTypeName && _jsx(InfoRow, { label: "Ladingdrager", children: order.cartTypeName }), karren > 0 && _jsx(InfoRow, { label: "Karren", children: formatLoadUnits(karren, order.cartTypeName ?? null) }), extra] }));
85
+ return (_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", attention: missingOwnTime, action: !locked ? (_jsx(Button, { size: "sm", variant: "ghost", className: "[@media(pointer:coarse)]:h-11", onClick: () => setChanging((v) => !v), "aria-expanded": changing, children: changing ? "Klaar" : "Vervoerder wijzigen" })) : undefined, children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), missingOwnTime && (_jsxs("div", { role: "status", className: "mb-2 flex items-start gap-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": true }), " ", OWN_PICKUP_MISSING_TEXT] })), view.melding === "onbekend" && !t?.ownPickup && (_jsx("div", { role: "status", className: "mb-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: OWN_PICKUP_UNKNOWN_TEXT })), locked ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: orderId, locked: true, compact: true }) })) : changing ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: orderId, compact: true, groupSize: groupSize }) })) : q.isLoading ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) })) : q.isError ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-destructive", children: "Het vervoer kon nu niet worden gelezen. Lukt het later nog niet, neem dan contact op met de beheerder." }) })) : hasCarrier ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsxs("span", { className: "inline-flex flex-wrap items-center gap-2", children: [_jsx("span", { children: carrier.carrierName }), _jsx(Badge, { variant: "outline", className: "text-xs", children: manual ? "Handmatig" : "Automatisch" })] }) })) : (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Nog geen vervoerder" }) })), !locked && t?.own && !view.editable && !t.ownPickup ? (_jsx(InfoRow, { label: ownPickupLabel(t.ownKind), children: _jsxs("div", { className: "space-y-0.5", children: [view.kopTijd && _jsx("div", { className: "tabular-nums", children: view.kopTijd }), view.melding === "planning" && _jsx("div", { className: "text-xs text-muted-foreground", children: ownPickupPlannedText(view.plannedTime) })] }) })) : !locked && t?.own ? (_jsx(InfoRow, { label: ownPickupLabel(t.ownKind), children: _jsx(OwnPickupEditor, { orderId: orderId, kind: t.ownKind, current: t.ownPickup, defaultDate: t.deliveryDate, locked: t.locked, lockedText: t.lockReason === "onbekend" ? OWN_PICKUP_UNKNOWN_TEXT : OWN_PICKUP_LOCKED_TEXT }, `${t.ownPickup?.date ?? ""}|${t.ownPickup?.time ?? ""}`) })) : !locked && t && !t.own ? (_jsx(InfoRow, { label: "Ophaalmoment", children: _jsx(OrderPickupMomentPicker, { orderId: orderId, pickupOnly: true, compact: true }) })) : null, signup && _jsx(InfoRow, { label: "Aanmelden v\u00F3\u00F3r", children: signup }), t?.carrierGln && _jsx(InfoRow, { label: "GLN vervoerder", children: t.carrierGln }), order.cartTypeName && _jsx(InfoRow, { label: "Ladingdrager", children: order.cartTypeName }), karren > 0 && _jsx(InfoRow, { label: "Karren", children: formatLoadUnits(karren, order.cartTypeName ?? null) }), extra] }));
84
86
  }
85
87
  /** Kopregel van een handmatige order: "Ophalen do 29 okt 15:00 · Levering vr 30 okt 08:00". */
86
88
  export function PickupDeliveryLine({ order }) {
@@ -250,7 +250,7 @@ export function SalesOrderDetailPage() {
250
250
  const floridayMembers = membersFor(bufferOrders).filter((m) => m.invoiceRoute === "floriday" && !m.cancelled);
251
251
  const fDone = floridayMembers.reduce((s, m) => s + m.floridayDone, 0);
252
252
  const fTotal = floridayMembers.reduce((s, m) => s + m.floridayTotal, 0);
253
- return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(NavigationTooltip, { label: "Terug naar verkooporders", shortcut: "Esc", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { ref: backLink, href: backHref, onClick: () => markRestore(), "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { ref: backLink, to: "/floriday-verkoop/verkooporders", "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(NavigationTooltip, { label: "Vorige order", shortcut: "\u2190", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: previousLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, "aria-keyshortcuts": "ArrowLeft", children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) }) })) : null, nav.next ? (_jsx(NavigationTooltip, { label: "Volgende order", shortcut: "\u2192", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: nextLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, "aria-keyshortcuts": "ArrowRight", children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming")}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming")) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
253
+ return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(NavigationTooltip, { label: "Terug naar verkooporders", shortcut: "Esc", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { ref: backLink, href: backHref, onClick: () => markRestore(), "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { ref: backLink, to: "/floriday-verkoop/verkooporders", "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(NavigationTooltip, { label: "Vorige order", shortcut: "\u2190", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: previousLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, "aria-keyshortcuts": "ArrowLeft", children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) }) })) : null, nav.next ? (_jsx(NavigationTooltip, { label: "Volgende order", shortcut: "\u2192", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: nextLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, "aria-keyshortcuts": "ArrowRight", children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming")}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming"), head.stageNote ?? null) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
254
254
  ? head.customer.name
255
255
  : `${sourceLabel(sources[0])}-order` }), isBuffer && fTotal > 0 && (_jsxs("p", { className: "text-xs font-medium tabular-nums text-foreground", children: ["Afgemeld: ", fDone, " van ", fTotal] })), !isBuffer && isLocal && _jsx(PickupDeliveryLine, { order: head }), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features, invoiceLoad: invoiceLoad }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
256
256
  const f = friendlyLoadError(error);
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { fmtNL, fmtNLDefault } from "../../lib/nl-datetime.js";
3
- import { floridayInvoiceLine } from "../../lib/floriday-status.js";
3
+ import { floridayInvoiceState } from "../../lib/floriday-status.js";
4
4
  import { usePickupMoment } from "../../lib/usePickupMoment.js";
5
5
  import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
6
6
  import { formatMoment } from "../../lib/order-departure.js";
@@ -280,7 +280,7 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
280
280
  "—";
281
281
  const customerPhone = pickStr(c.phone) ?? pickStr(c.phone_number) ?? pickStr(c.contact_person?.phone) ?? "—";
282
282
  // Centrale weergavestatus (orders.status is leidend, zie order-status.ts).
283
- const bestellingLabel = orderStageLabel(order.stage ?? (order.status.isCancelled ? "cancelled" : "incoming"));
283
+ const bestellingLabel = orderStageLabel(order.stage ?? (order.status.isCancelled ? "cancelled" : "incoming"), order.stageNote ?? null);
284
284
  const isFlorinOrder = !order.isLocal && ((order.floridayIds?.length ?? 0) > 0 || !!o.salesOrderId || !!fs);
285
285
  const member = props_member(order, members);
286
286
  const route = member?.invoiceRoute ?? order.invoiceRoute ?? (isFlorinOrder ? "floriday" : "erp");
@@ -314,9 +314,12 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
314
314
  : `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] }) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines }), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order, 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
315
315
  ? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
316
316
  : `${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." })), (() => {
317
- const line = floridayInvoiceLine(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0);
317
+ const line = floridayInvoiceState(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0, {
318
+ full: !!order.floridayExternalFulfilledAt,
319
+ count: order.floridayExternalFulfilledIds?.length ?? 0,
320
+ });
318
321
  return line ? _jsx(InfoRow, { label: "Floriday", children: line }) : null;
319
- })(), (order.floridayExternalFulfilledIds?.length ?? 0) > 0 && (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: "Al afgehandeld in Floriday" }))] })) : (_jsxs(_Fragment, { children: [_jsxs(InfoRow, { label: "Stand", children: [invoiceStandText(member, features), !member?.erpInvoice && order.invoiceState ? (_jsxs("span", { className: "block text-xs text-muted-foreground", children: [order.invoiceState, order.invoiceNote ? ` · ${order.invoiceNote}` : ""] })) : null] }), order.missingPrice && order.stage !== "cancelled" && !member?.erpInvoice && (_jsx("div", { className: "mt-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-soft-foreground", children: "Prijs ontbreekt: vul de prijs in voordat er gefactureerd kan worden." })), member?.erpInvoice && (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Factuurnummer", children: member.erpInvoice.number ?? "—" }), _jsx(InfoRow, { label: "Status", children: member.erpInvoice.status ?? "—" }), _jsx(InfoRow, { label: "Verstuurd", children: member.erpInvoice.sentAt ? fmtDateTime(member.erpInvoice.sentAt) : "—" })] })), invoiceOrderId && _jsx(OrderInvoiceCard, { orderId: invoiceOrderId })] })) }), o?.salesOrderId ? (_jsxs(_Fragment, { children: [_jsx(OrderControlStatusCard, { floridayId: String(o.salesOrderId), isControlled: order.status.isControlled, controlledAt: order.status.controlledAt }), _jsx(OrderAfleverbrievenCard, { salesOrderId: String(o.salesOrderId), orderNumber: order.orderNumber ?? undefined })] })) : null, _jsxs(InfoCard, { icon: _jsx(User, {}), title: "Klant", children: [_jsxs(InfoRow, { label: "Naam", children: [_jsx("span", { className: "font-medium", children: customerName }), customerLegalName && _jsx("div", { className: "text-xs text-muted-foreground", children: customerLegalName })] }), _jsx(InfoRow, { label: "Telefoon", children: customerPhone }), _jsxs("details", { className: "group pt-2 text-sm", children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground", children: "Meer klantgegevens" }), _jsx(InfoRow, { label: "GLN", children: customerGln }), _jsx(InfoRow, { label: "Administratienummer", children: customerAdmin }), deliveryGln && _jsx(InfoRow, { label: "GLN afleveradres", children: deliveryGln })] })] })] })] })] }));
322
+ })()] })) : (_jsxs(_Fragment, { children: [_jsxs(InfoRow, { label: "Stand", children: [invoiceStandText(member, features), !member?.erpInvoice && order.invoiceState ? (_jsxs("span", { className: "block text-xs text-muted-foreground", children: [order.invoiceState, order.invoiceNote ? ` · ${order.invoiceNote}` : ""] })) : null] }), order.missingPrice && order.stage !== "cancelled" && !member?.erpInvoice && (_jsx("div", { className: "mt-2 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning-soft-foreground", children: "Prijs ontbreekt: vul de prijs in voordat er gefactureerd kan worden." })), member?.erpInvoice && (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Factuurnummer", children: member.erpInvoice.number ?? "—" }), _jsx(InfoRow, { label: "Status", children: member.erpInvoice.status ?? "—" }), _jsx(InfoRow, { label: "Verstuurd", children: member.erpInvoice.sentAt ? fmtDateTime(member.erpInvoice.sentAt) : "—" })] })), invoiceOrderId && _jsx(OrderInvoiceCard, { orderId: invoiceOrderId })] })) }), o?.salesOrderId ? (_jsxs(_Fragment, { children: [_jsx(OrderControlStatusCard, { floridayId: String(o.salesOrderId), isControlled: order.status.isControlled, controlledAt: order.status.controlledAt }), _jsx(OrderAfleverbrievenCard, { salesOrderId: String(o.salesOrderId), orderNumber: order.orderNumber ?? undefined })] })) : null, _jsxs(InfoCard, { icon: _jsx(User, {}), title: "Klant", children: [_jsxs(InfoRow, { label: "Naam", children: [_jsx("span", { className: "font-medium", children: customerName }), customerLegalName && _jsx("div", { className: "text-xs text-muted-foreground", children: customerLegalName })] }), _jsx(InfoRow, { label: "Telefoon", children: customerPhone }), _jsxs("details", { className: "group pt-2 text-sm", children: [_jsx("summary", { className: "cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground", children: "Meer klantgegevens" }), _jsx(InfoRow, { label: "GLN", children: customerGln }), _jsx(InfoRow, { label: "Administratienummer", children: customerAdmin }), deliveryGln && _jsx(InfoRow, { label: "GLN afleveradres", children: deliveryGln })] })] })] })] })] }));
320
323
  }
321
324
  /** Zelfde stand als het factuuricoon in de lijst (memberInvoice). */
322
325
  function invoiceStandText(member, features) {
@@ -1 +1 @@
1
- {"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AA8EA,wBAAgB,aAAa,gCA0uB5B"}
1
+ {"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AAgFA,wBAAgB,aAAa,gCA8vB5B"}
@@ -8,7 +8,7 @@ import { ArrowLeft, ChevronDown, Eye, Loader2, Package, Plus, Repeat, RotateCcw,
8
8
  import { listProductsForCreateOrder } from "../../../lib/create-order.functions.js";
9
9
  import { deleteKlokOrder, getKlokArtikelen, getKlokLijsten, getKlokOrder, listKlokSjablonen, repeatKlokOrder, resendKlokOrder, saveKlokConcept, saveKlokSjabloon, sendKlokOrder, refreshKlokStatus, retryKlokAnnuleren, } from "../../../lib/klok.functions.js";
10
10
  import { klokFoutLijst, klokOntbreekt, klokOntbreektVelden, LEGE_KOP, neemPrijsOver, regelMetArtikel, regelNaArtikelwissel } from "../../../lib/klok-form.js";
11
- import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, klokRegelKwaliteitFout, } from "../../../lib/klok-labels.js";
11
+ import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, klokRegelKwaliteitFout, klokLijstenMislukt, KLOK_LIJST_FOUT_TEXT, } from "../../../lib/klok-labels.js";
12
12
  import { fmtNL } from "../../../lib/nl-datetime.js";
13
13
  import { amsterdamYmd, ymdString } from "../../../lib/period-range.js";
14
14
  import { SearchableSelect } from "../SearchableSelect.js";
@@ -58,7 +58,21 @@ export function KlokOrderPage() {
58
58
  const doRepeat = useServerFn(repeatKlokOrder);
59
59
  const doSjabloon = useServerFn(saveKlokSjabloon);
60
60
  const doRefresh = useServerFn(refreshKlokStatus);
61
- const lijstenQ = useQuery({ queryKey: ["klok-lijsten"], queryFn: () => fetchLijsten(), staleTime: 5 * 60000 });
61
+ const lijstenQ = useQuery({
62
+ queryKey: ["klok-lijsten"],
63
+ queryFn: async () => {
64
+ const l = await fetchLijsten();
65
+ if (klokLijstenMislukt(l)) {
66
+ console.error("[klok] lijsten deels mislukt:", { locaties: l.locaties?.error, verzend: l.verzend?.error, groepen: l.groepen?.error, kwaliteit: l.kwaliteit?.error });
67
+ throw new Error("klok-lijsten");
68
+ }
69
+ return l;
70
+ },
71
+ staleTime: 5 * 60000,
72
+ retry: 2,
73
+ // Mislukt: automatisch opnieuw proberen; gelukt: melding verdwijnt vanzelf.
74
+ refetchInterval: (q) => (q.state.status === "error" ? 15000 : false),
75
+ });
62
76
  const productsQ = useQuery({ queryKey: ["co-products"], queryFn: () => fetchProducts(), staleTime: 5 * 60000, gcTime: 30 * 60000 });
63
77
  const orderQ = useQuery({ queryKey: ["klok-order", klokId], queryFn: () => fetchOrder({ data: { id: klokId } }), enabled: !!klokId });
64
78
  const [kop, setKop] = useState(LEGE_KOP);
@@ -390,17 +404,18 @@ export function KlokOrderPage() {
390
404
  if (klokId && !row) {
391
405
  return (_jsxs("main", { className: "flex w-full flex-col gap-4 p-4 sm:p-6", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "Deze veilbrief bestaat niet (meer)." }), _jsx(Button, { variant: "outline", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: "Terug naar Klok" })] }));
392
406
  }
393
- const lijstStand = klokLijstWeergave(lijstenQ.isLoading, lijsten?.gereed);
394
- const laden = lijstStand === "laden";
407
+ const lijstStand = klokLijstWeergave(lijstenQ.isLoading, lijsten?.gereed, lijstenQ.isError && !lijstenQ.data);
408
+ // Fout: skeletons blijven staan (geen stille terugval op kale invoer).
409
+ const laden = lijstStand === "laden" || lijstStand === "fout";
395
410
  const leegTekst = lijstStand === "geen_koppeling" ? KLOK_LIJST_LEEG_TEXT : null;
396
411
  const verkochtStuks = resultaten.filter((r) => !r.doorgedraaid).reduce((s, r) => s + Number(r.stuks || 0), 0);
397
412
  const verkochtBedrag = resultaten.filter((r) => !r.doorgedraaid).reduce((s, r) => s + Number(r.bedrag || 0), 0);
398
413
  const doorStuks = resultaten.filter((r) => r.doorgedraaid).reduce((s, r) => s + Number(r.stuks || 0), 0);
399
- return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-40 sm:p-6 sm:pb-32", children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 p-0", "aria-label": "Terug", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight sm:text-2xl", children: row ? `Veilbrief ${row.klok_nummer}` : "Klokorder (veilbrief)" }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground", children: [_jsx(KlokStatusBadge, { status: status, detail: row.status_detail }), row.status_detail && _jsx("span", { children: row.status_detail }), orderQ.data?.orderNumber && _jsxs("span", { children: ["Order ", orderQ.data.orderNumber] })] }))] })] }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onHerhalen, children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), klokKanVerwijderen(status) && !bewerken && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setBevestigVerwijder(true), disabled: !!bezig || !!blokkade, title: blokkade ?? undefined, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] })), annulerenOpen && (_jsxs(Button, { size: "sm", variant: "outline", onClick: onOpnieuwAnnuleren, disabled: !!bezig, "aria-busy": bezig === "retry" || undefined, children: [bezig === "retry" ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }) : _jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(status) && !bewerken && (_jsx(Button, { size: "sm", onClick: () => setBewerken(true), disabled: !!blokkade, title: blokkade ?? undefined, children: "Wijzigen en opnieuw versturen" }))] }))] }), _jsx(KlokNotice, {}), fout && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-sm text-destructive-soft-foreground", children: [fouten.length > 1 || (fouten.length === 1 && fouten[0].tekst !== fout) ? (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium", children: fouten.length === 1 ? "Er is 1 punt om op te lossen:" : `Er zijn ${fouten.length} punten om op te lossen:` }), _jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5", children: fouten.map((f, i) => _jsx("li", { children: f.tekst }, i)) })] })) : (_jsx("span", { className: "min-w-0 flex-1", children: fout })), _jsx("button", { type: "button", "aria-label": "Sluiten", onClick: () => setFout(null), children: _jsx(X, { className: "h-4 w-4" }) })] })), row?.laatste_fout && !fout && (_jsx("div", { className: "rounded-lg border border-border bg-warning-soft px-3 py-2 text-sm text-warning-soft-foreground", children: row.laatste_fout })), _jsx("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: _jsxs("div", { className: "grid gap-4 [@container(min-width:48rem)]:grid-cols-2 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2 rounded-lg" + (foutVelden.has("veillocatie") ? " p-1 ring-1 ring-destructive" : ""), children: [_jsxs("div", { className: "mb-1.5 text-sm font-medium", children: ["Veillocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" })] })) : locaties.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst ?? lijsten?.locaties?.message ?? lijsten?.locaties?.error ?? (kop.veillocatie_naam || "Geen veillocaties gevonden.") })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [toonKnoppen.map((l) => (_jsx(Button, { type: "button", variant: kop.veillocatie_id === l.id ? "default" : "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: alleenLezen, onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: k.veillocatie_id === l.id ? k.veilgroep : null })), children: l.displayName ?? l.name }, l.id))), toonMeer.length > 0 && !alleenLezen && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: ["Meer ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: toonMeer.map((l) => (_jsx(DropdownMenuItem, { onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: null })), children: l.displayName ?? l.name }, l.id))) })] }))] }))] }), _jsxs("label", { className: "block", children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veildatum ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { type: "date", value: kop.veildatum ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veildatum"), onChange: (e) => setKop((k) => ({ ...k, veildatum: e.target.value || null })) }), kop.veildatum && _jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: fmtNL(kop.veildatum, { weekday: "long", day: "numeric", month: "long" }) })] }), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veilgroep ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsx(Skeleton, { className: "h-9 w-full" })) : eigenGroep || groepOpties.length === 0 ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { inputMode: "numeric", placeholder: groepOpties.length === 0 && leegTekst ? leegTekst : "Veilgroep (cijfers)", value: kop.veilgroep ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veilgroep"), onChange: (e) => setKop((k) => ({ ...k, veilgroep: e.target.value.replace(/\D/g, "") || null })) }), groepOpties.length > 0 && !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(false), children: "Kies uit lijst" })] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsx(SearchableSelect, { value: kop.veilgroep, options: groepOpties, placeholder: "Zoek veilgroep", allowClear: true, clearLabel: "\u2014 Geen \u2014", disabled: alleenLezen, className: "min-h-9 flex-1 [@media(pointer:coarse)]:min-h-11" + rood("veilgroep"), onChange: (v) => setKop((k) => ({ ...k, veilgroep: v })) }), !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(true), children: "Zelf invullen" })] }))] }), laden && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Skeleton, { className: "h-9 w-full" })] })), !laden && verzend.length > 1 && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: kop.verzendlocatie_id, disabled: alleenLezen, allowClear: false, options: verzend.map((v) => ({ value: v.id, label: v.name, badge: v.isDefault ? "Standaard" : v.isExternal ? "Extern" : null })), className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("verzendlocatie"), onChange: (v) => setKop((k) => ({ ...k, verzendlocatie_id: v, verzendlocatie_naam: verzend.find((x) => x.id === v)?.name ?? null })) })] })), !laden && verzend.length === 0 && !kop.verzendlocatie_id && leegTekst && (_jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Verzendlocatie" }), _jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst })] })), _jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Vervoer" }), _jsx("div", { className: "flex gap-2", children: VERVOER.map((v) => (_jsx(Button, { type: "button", size: "sm", variant: kop.vervoer === v.id ? "default" : "outline", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setKop((k) => ({ ...k, vervoer: v.id })), children: v.label }, v.id))) })] })] }) }), _jsxs("section", { className: "rounded-xl border border-border bg-card shadow-sm", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3 sm:px-5", children: [_jsx("h2", { className: "text-sm font-semibold", children: "Regels" }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [sjablonen.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: ["Kies sjabloon ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: sjablonen.map((s) => _jsx(DropdownMenuItem, { onClick: () => kiesSjabloon(s), children: s.naam }, s.id)) })] })), _jsx(Button, { variant: "outline", size: "sm", disabled: !kop.veillocatie_id, onClick: () => setSjabloonNaam(""), children: "Opslaan als sjabloon" })] }))] }), _jsx("ul", { className: "divide-y divide-border", children: regels.map((r, i) => {
414
+ return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-40 sm:p-6 sm:pb-32", children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 p-0", "aria-label": "Terug", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight sm:text-2xl", children: row ? `Veilbrief ${row.klok_nummer}` : "Klokorder (veilbrief)" }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground", children: [_jsx(KlokStatusBadge, { status: status, detail: row.status_detail }), row.status_detail && _jsx("span", { children: row.status_detail }), orderQ.data?.orderNumber && _jsxs("span", { children: ["Order ", orderQ.data.orderNumber] })] }))] })] }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onHerhalen, children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), klokKanVerwijderen(status) && !bewerken && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setBevestigVerwijder(true), disabled: !!bezig || !!blokkade, title: blokkade ?? undefined, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] })), annulerenOpen && (_jsxs(Button, { size: "sm", variant: "outline", onClick: onOpnieuwAnnuleren, disabled: !!bezig, "aria-busy": bezig === "retry" || undefined, children: [bezig === "retry" ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }) : _jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(status) && !bewerken && (_jsx(Button, { size: "sm", onClick: () => setBewerken(true), disabled: !!blokkade, title: blokkade ?? undefined, children: "Wijzigen en opnieuw versturen" }))] }))] }), _jsx(KlokNotice, {}), fout && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-sm text-destructive-soft-foreground", children: [fouten.length > 1 || (fouten.length === 1 && fouten[0].tekst !== fout) ? (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium", children: fouten.length === 1 ? "Er is 1 punt om op te lossen:" : `Er zijn ${fouten.length} punten om op te lossen:` }), _jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5", children: fouten.map((f, i) => _jsx("li", { children: f.tekst }, i)) })] })) : (_jsx("span", { className: "min-w-0 flex-1", children: fout })), _jsx("button", { type: "button", "aria-label": "Sluiten", onClick: () => setFout(null), children: _jsx(X, { className: "h-4 w-4" }) })] })), row?.laatste_fout && !fout && (_jsx("div", { className: "rounded-lg border border-border bg-warning-soft px-3 py-2 text-sm text-warning-soft-foreground", children: row.laatste_fout })), lijstStand === "fout" && (_jsx("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 px-4 py-3 text-sm text-destructive", children: KLOK_LIJST_FOUT_TEXT })), _jsx("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: _jsxs("div", { className: "grid gap-4 [@container(min-width:48rem)]:grid-cols-2 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2 rounded-lg" + (foutVelden.has("veillocatie") ? " p-1 ring-1 ring-destructive" : ""), children: [_jsxs("div", { className: "mb-1.5 text-sm font-medium", children: ["Veillocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" })] })) : locaties.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst ?? lijsten?.locaties?.message ?? lijsten?.locaties?.error ?? (kop.veillocatie_naam || "Geen veillocaties gevonden.") })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [toonKnoppen.map((l) => (_jsx(Button, { type: "button", variant: kop.veillocatie_id === l.id ? "default" : "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: alleenLezen, onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: k.veillocatie_id === l.id ? k.veilgroep : null })), children: l.displayName ?? l.name }, l.id))), toonMeer.length > 0 && !alleenLezen && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: ["Meer ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: toonMeer.map((l) => (_jsx(DropdownMenuItem, { onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: null })), children: l.displayName ?? l.name }, l.id))) })] }))] }))] }), _jsxs("label", { className: "block", children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veildatum ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { type: "date", value: kop.veildatum ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veildatum"), onChange: (e) => setKop((k) => ({ ...k, veildatum: e.target.value || null })) }), kop.veildatum && _jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: fmtNL(kop.veildatum, { weekday: "long", day: "numeric", month: "long" }) })] }), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veilgroep ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsx(Skeleton, { className: "h-9 w-full" })) : eigenGroep || groepOpties.length === 0 ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { inputMode: "numeric", placeholder: groepOpties.length === 0 && leegTekst ? leegTekst : "Veilgroep (cijfers)", value: kop.veilgroep ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veilgroep"), onChange: (e) => setKop((k) => ({ ...k, veilgroep: e.target.value.replace(/\D/g, "") || null })) }), groepOpties.length > 0 && !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(false), children: "Kies uit lijst" })] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsx(SearchableSelect, { value: kop.veilgroep, options: groepOpties, placeholder: "Zoek veilgroep", allowClear: true, clearLabel: "\u2014 Geen \u2014", disabled: alleenLezen, className: "min-h-9 flex-1 [@media(pointer:coarse)]:min-h-11" + rood("veilgroep"), onChange: (v) => setKop((k) => ({ ...k, veilgroep: v })) }), !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(true), children: "Zelf invullen" })] }))] }), laden && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Skeleton, { className: "h-9 w-full" })] })), !laden && verzend.length > 1 && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: kop.verzendlocatie_id, disabled: alleenLezen, allowClear: false, options: verzend.map((v) => ({ value: v.id, label: v.name, badge: v.isDefault ? "Standaard" : v.isExternal ? "Extern" : null })), className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("verzendlocatie"), onChange: (v) => setKop((k) => ({ ...k, verzendlocatie_id: v, verzendlocatie_naam: verzend.find((x) => x.id === v)?.name ?? null })) })] })), !laden && verzend.length === 0 && !kop.verzendlocatie_id && leegTekst && (_jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Verzendlocatie" }), _jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst })] })), _jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Vervoer" }), _jsx("div", { className: "flex gap-2", children: VERVOER.map((v) => (_jsx(Button, { type: "button", size: "sm", variant: kop.vervoer === v.id ? "default" : "outline", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setKop((k) => ({ ...k, vervoer: v.id })), children: v.label }, v.id))) })] })] }) }), _jsxs("section", { className: "rounded-xl border border-border bg-card shadow-sm", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3 sm:px-5", children: [_jsx("h2", { className: "text-sm font-semibold", children: "Regels" }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [sjablonen.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: ["Kies sjabloon ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: sjablonen.map((s) => _jsx(DropdownMenuItem, { onClick: () => kiesSjabloon(s), children: s.naam }, s.id)) })] })), _jsx(Button, { variant: "outline", size: "sm", disabled: !kop.veillocatie_id, onClick: () => setSjabloonNaam(""), children: "Opslaan als sjabloon" })] }))] }), _jsx("ul", { className: "divide-y divide-border", children: regels.map((r, i) => {
400
415
  const km = kenmerken[r.key];
401
416
  const kwFout = alleenLezen ? null : klokRegelKwaliteitFout(r, km);
402
417
  const kwRood = regelRood(r.key, "kwaliteit") || !!kwFout;
403
- return (_jsxs("li", { className: "space-y-3 px-4 py-4 sm:px-5", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 w-6 shrink-0 text-xs text-muted-foreground tabular-nums", children: i + 1 }), _jsx("div", { className: "min-w-0 flex-1", children: alleenLezen ? (_jsx("div", { className: "py-1.5 text-sm font-medium", children: r.product_name || "Onbekend artikel" })) : (_jsx(SearchableSelect, { value: r.product_id, options: productOpties(false), showImages: true, placeholder: "Kies artikel", allowClear: false, className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + (regelRood(r.key, "artikel") || regelRood(r.key, "fust") ? " border-destructive ring-1 ring-destructive" : ""), onChange: (v) => kiesProduct(r.key, v) })) }), !alleenLezen && (_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 shrink-0 p-0 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", "aria-label": "Regel verwijderen", onClick: () => setRegels((rs) => (rs.length > 1 ? rs.filter((x) => x.key !== r.key) : [legeRegel()])), children: _jsx(Trash2, { className: "h-4 w-4" }) }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-3 pl-8 sm:grid-cols-3 lg:grid-cols-6", children: [_jsx(NumField, { label: "Fusten", req: true, fout: regelRood(r.key, "fusten"), value: r.fusten, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fusten: v }) }), _jsx(NumField, { label: "Stuks/fust", req: true, fout: regelRood(r.key, "stuks"), value: r.stuks_per_fust, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { stuks_per_fust: v }) }), _jsx(NumField, { label: "Fust/laag", value: r.fust_per_laag, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fust_per_laag: v }) }), _jsx(NumField, { label: "Lagen/kar", value: r.lagen_per_kar, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { lagen_per_kar: v }) }), _jsxs("div", { children: [_jsx(NumField, { label: "Minimumprijs", req: true, fout: regelRood(r.key, "prijs"), value: r.min_prijs, disabled: alleenLezen, inputMode: "decimal", muted: !r.prijs_bevestigd, onChange: (v) => setRegel(r.key, { min_prijs: v, prijs_bevestigd: true, prijs_at: null }) }), !r.prijs_bevestigd && r.min_prijs != null && !alleenLezen && (_jsx("button", { type: "button", className: "mt-1 text-xs font-medium text-primary hover:underline", onClick: () => setRegel(r.key, { prijs_bevestigd: true }), children: "Voorstel bevestigen" }))] }), _jsx(NumField, { label: "Klokvoorverkoop", value: r.voorverkoop_prijs, disabled: alleenLezen, inputMode: "decimal", onChange: (v) => setRegel(r.key, { voorverkoop_prijs: v }) })] }), _jsxs("div", { className: "pl-8", children: [_jsxs("button", { type: "button", className: "text-xs font-medium text-muted-foreground hover:text-foreground", onClick: () => setMeerOpen((m) => ({ ...m, [r.key]: !m[r.key] })), children: [meerOpen[r.key] ? "Minder" : "Meer", ": opmerking, kwaliteit en keurcodes"] }), (meerOpen[r.key] || regelRood(r.key, "kwaliteit")) && (_jsxs("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [_jsxs("label", { className: "block sm:col-span-2", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Opmerking voor de veiling" }), _jsx(Input, { value: r.veil_opmerking ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { veil_opmerking: e.target.value || null }) })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Kwaliteit (S98)" }), _jsxs("select", { className: "h-9 w-full rounded-lg border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-70 [@media(pointer:coarse)]:h-11" + (regelRood(r.key, "kwaliteit") ? " border-destructive ring-1 ring-destructive" : ""), "aria-invalid": regelRood(r.key, "kwaliteit") || undefined, value: r.kwaliteit ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { kwaliteit: e.target.value || null }), children: [_jsx("option", { value: "", children: km?.kwaliteit ? `Artikel: ${km.kwaliteit}` : kwaliteitCodes.length ? "Kenmerk van het artikel" : (leegTekst ?? "Kenmerk van het artikel") }), kwaliteitCodes.filter((c) => c?.vbnCode === "S98").map((c) => (_jsxs("option", { value: c.vbnValueCode, children: [c.vbnValueCode, c.description ? ` · ${c.description}` : ""] }, c.vbnValueCode)))] })] }), _jsxs("div", { children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Keurcodes (K01/K02, P01/P02)" }), _jsx(KeurcodeVeld, { codes: kwaliteitCodes.filter((c) => /^(K01|K02|P01|P02)$/.test(String(c?.vbnCode))), waarde: r.keurcodes, voorinvulling: km?.keurcodes ?? [], leegTekst: leegTekst, disabled: alleenLezen, fout: regelRood(r.key, "kwaliteit"), onChange: (v) => setRegel(r.key, { keurcodes: v }) })] })] }))] })] }, r.key));
418
+ return (_jsxs("li", { className: "space-y-3 px-4 py-4 sm:px-5", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 w-6 shrink-0 text-xs text-muted-foreground tabular-nums", children: i + 1 }), _jsx("div", { className: "min-w-0 flex-1", children: alleenLezen ? (_jsx("div", { className: "py-1.5 text-sm font-medium", children: r.product_name || "Onbekend artikel" })) : (_jsx(SearchableSelect, { value: r.product_id, options: productOpties(false), showImages: true, placeholder: "Kies artikel", allowClear: false, className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + (regelRood(r.key, "artikel") || regelRood(r.key, "fust") ? " border-destructive ring-1 ring-destructive" : ""), onChange: (v) => kiesProduct(r.key, v) })) }), !alleenLezen && (_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 shrink-0 p-0 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", "aria-label": "Regel verwijderen", onClick: () => setRegels((rs) => (rs.length > 1 ? rs.filter((x) => x.key !== r.key) : [legeRegel()])), children: _jsx(Trash2, { className: "h-4 w-4" }) }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-3 pl-8 sm:grid-cols-3 lg:grid-cols-6", children: [_jsx(NumField, { label: "Fusten", req: true, fout: regelRood(r.key, "fusten"), value: r.fusten, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fusten: v }) }), _jsx(NumField, { label: "Stuks/fust", req: true, fout: regelRood(r.key, "stuks"), value: r.stuks_per_fust, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { stuks_per_fust: v }) }), _jsx(NumField, { label: "Fust/laag", value: r.fust_per_laag, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fust_per_laag: v }) }), _jsx(NumField, { label: "Lagen/kar", value: r.lagen_per_kar, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { lagen_per_kar: v }) }), _jsxs("div", { children: [_jsx(NumField, { label: "Minimumprijs", req: true, fout: regelRood(r.key, "prijs"), value: r.min_prijs, disabled: alleenLezen, inputMode: "decimal", muted: !r.prijs_bevestigd, onChange: (v) => setRegel(r.key, { min_prijs: v, prijs_bevestigd: true, prijs_at: null }) }), !r.prijs_bevestigd && r.min_prijs != null && !alleenLezen && (_jsx("button", { type: "button", className: "mt-1 text-xs font-medium text-primary hover:underline", onClick: () => setRegel(r.key, { prijs_bevestigd: true }), children: "Voorstel bevestigen" }))] }), _jsx(NumField, { label: "Klokvoorverkoop", value: r.voorverkoop_prijs, disabled: alleenLezen, inputMode: "decimal", onChange: (v) => setRegel(r.key, { voorverkoop_prijs: v }) })] }), _jsxs("div", { className: "pl-8", children: [_jsxs("button", { type: "button", className: "text-xs font-medium text-muted-foreground hover:text-foreground", onClick: () => setMeerOpen((m) => ({ ...m, [r.key]: !m[r.key] })), children: [meerOpen[r.key] ? "Minder" : "Meer", ": opmerking, kwaliteit en keurcodes"] }), (meerOpen[r.key] || kwRood) && (_jsxs("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [_jsxs("label", { className: "block sm:col-span-2", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Opmerking voor de veiling" }), _jsx(Input, { value: r.veil_opmerking ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { veil_opmerking: e.target.value || null }) })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Kwaliteit (S98)" }), _jsxs("select", { className: "h-9 w-full rounded-lg border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-70 [@media(pointer:coarse)]:h-11" + (kwRood ? " border-destructive ring-1 ring-destructive" : ""), "aria-invalid": kwRood || undefined, value: r.kwaliteit ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { kwaliteit: e.target.value || null }), children: [_jsx("option", { value: "", children: km?.kwaliteit ? `Artikel: ${km.kwaliteit}` : kwaliteitCodes.length ? "Kenmerk van het artikel" : (leegTekst ?? "Kenmerk van het artikel") }), kwaliteitCodes.filter((c) => c?.vbnCode === "S98").map((c) => (_jsxs("option", { value: c.vbnValueCode, children: [c.vbnValueCode, c.description ? ` · ${c.description}` : ""] }, c.vbnValueCode)))] })] }), _jsxs("div", { children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Keurcodes (K01/K02, P01/P02)" }), _jsx(KeurcodeVeld, { codes: kwaliteitCodes.filter((c) => /^(K01|K02|P01|P02)$/.test(String(c?.vbnCode))), waarde: r.keurcodes, voorinvulling: km?.keurcodes ?? [], leegTekst: leegTekst, disabled: alleenLezen, fout: kwRood, onChange: (v) => setRegel(r.key, { keurcodes: v }) })] })] })), kwFout && _jsx("p", { role: "alert", className: "mt-2 text-xs text-destructive", children: kwFout })] })] }, r.key));
404
419
  }) }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2 border-t border-border px-4 py-3 sm:px-5", children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setRegels((rs) => [...rs, legeRegel()]), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Artikel toevoegen"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: [_jsx(Package, { className: "mr-2 h-4 w-4" }), " Uit voorraad"] }) }), _jsxs(DropdownMenuContent, { className: "max-h-80 overflow-y-auto", children: [productOpties(true).length === 0 && _jsx(DropdownMenuItem, { disabled: true, children: "Geen artikelen op voorraad" }), productOpties(true).slice(0, 100).map((o) => (_jsxs(DropdownMenuItem, { onClick: () => { const n = legeRegel(); setRegels((rs) => [...rs.filter((x) => x.product_id || x.product_name), n]); void kiesProduct(n.key, o.value); }, children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: o.label }), _jsx("span", { className: "ml-3 text-xs text-muted-foreground", children: o.hint })] }, o.value)))] })] })] }))] }), resultaten.length > 0 && (_jsxs("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: [_jsx("h2", { className: "mb-3 text-sm font-semibold", children: "Verkocht" }), _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "py-1", children: "Koper" }), _jsx("th", { className: "py-1", children: "Stuks" }), _jsx("th", { className: "py-1", children: "Prijs" }), _jsx("th", { className: "py-1", children: "Bedrag" })] }) }), _jsx("tbody", { className: "divide-y divide-border", children: resultaten.filter((x) => !x.doorgedraaid).map((x) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2", children: x.koper_naam }), _jsx("td", { className: "py-2 tabular-nums", children: Number(x.stuks || 0).toLocaleString("nl-NL") }), _jsx("td", { className: "py-2 tabular-nums", children: x.prijs != null ? eur(Number(x.prijs)) : "—" }), _jsx("td", { className: "py-2 tabular-nums", children: x.bedrag != null ? eur(Number(x.bedrag)) : "—" })] }, x.id))) })] }), _jsxs("div", { className: "mt-3 flex flex-wrap gap-x-6 gap-y-1 border-t border-border pt-3 text-sm", children: [_jsxs("span", { children: ["Totaal: ", _jsxs("strong", { className: "tabular-nums", children: [verkochtStuks.toLocaleString("nl-NL"), " stuks \u00B7 ", eur(verkochtBedrag)] })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Doorgedraaid: ", _jsxs("span", { className: "tabular-nums", children: [doorStuks.toLocaleString("nl-NL"), " stuks"] })] })] })] })), !alleenLezen && (_jsx("div", { className: "sticky bottom-0 z-20 -mx-4 border-t border-border bg-background/95 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "text-sm tabular-nums", children: [_jsx("span", { className: "font-medium", children: tellersTekst(tellers) }), totaal > 0 && _jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u00B7 min. ", eur(totaal)] }), ontbreekt.length > 0 && _jsxs("span", { className: "ml-2 text-xs text-muted-foreground", title: ontbreekt.join(", "), children: ["\u00B7 ", ontbreekt.length, " ontbreekt nog"] })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setVoorbeeld(true), children: [_jsx(Eye, { className: "mr-2 h-4 w-4" }), " Voorbeeld"] }), bewerken ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => { setBewerken(false); geladen.current = null; qc.invalidateQueries({ queryKey: ["klok-order", klokId] }); }, children: "Annuleren" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => setBevestigWijzig(true), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " Opnieuw versturen"] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig, onClick: onOpslaan, children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan als concept"] }), _jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(true), children: "Versturen en nieuwe" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(false), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " ", bezig === "send" ? "Bezig…" : "Versturen naar veiling"] })] }))] })] }) })), voorbeeld && (_jsxs(Dialoog, { titel: "Voorbeeld veilbrief", onClose: () => setVoorbeeld(false), children: [_jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: "Veillocatie" }), _jsx("dd", { children: kop.veillocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veildatum" }), _jsx("dd", { children: kop.veildatum ? fmtNL(kop.veildatum, { weekday: "short", day: "numeric", month: "short" }) : "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veilgroep" }), _jsx("dd", { children: kop.veilgroep ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Verzendlocatie" }), _jsx("dd", { children: kop.verzendlocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Vervoer" }), _jsx("dd", { children: VERVOER.find((v) => v.id === kop.vervoer)?.label })] }), _jsx("ul", { className: "mt-3 divide-y divide-border text-sm", children: regels.filter((r) => r.product_name).map((r) => (_jsxs("li", { className: "flex justify-between gap-3 py-1.5", children: [_jsx("span", { className: "min-w-0 truncate", children: r.product_name }), _jsxs("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: [r.fusten ?? 0, " \u00D7 ", r.stuks_per_fust ?? 0, " \u00B7 min. ", r.min_prijs != null ? eur(r.min_prijs) : "—"] })] }, r.key))) }), _jsx("p", { className: "mt-3 text-sm font-medium tabular-nums", children: tellersTekst(tellers) }), ontbreekt.length > 0 && _jsxs("p", { className: "mt-2 text-sm text-muted-foreground", children: ["Ontbreekt nog: ", ontbreekt.join(", ")] })] })), bevestigWijzig && (_jsxs(Dialoog, { titel: "Wijzigen en opnieuw versturen?", onClose: () => setBevestigWijzig(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "De huidige veilbrief wordt bij de veiling verwijderd en opnieuw verstuurd. Doorgaan?" }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigWijzig(false), children: "Annuleren" }), _jsx(Button, { onClick: onWijzigEnVerstuur, disabled: !!bezig, children: "Doorgaan" })] })] })), bevestigVerwijder && (_jsxs(Dialoog, { titel: `Veilbrief ${row?.klok_nummer ?? ""} verwijderen?`, onClose: () => !bezig && setBevestigVerwijder(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigVerwijder(false), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: onVerwijderen, disabled: !!bezig, "aria-busy": bezig === "delete" || undefined, children: bezig === "delete" ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] })), sjabloonNaam != null && (_jsxs(Dialoog, { titel: "Opslaan als sjabloon", onClose: () => setSjabloonNaam(null), children: [_jsxs("label", { className: "block text-sm", children: [_jsxs("span", { className: "mb-1 block", children: ["Naam ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { autoFocus: true, value: sjabloonNaam, maxLength: 80, onChange: (e) => setSjabloonNaam(e.target.value) })] }), _jsxs("p", { className: "mt-2 text-xs text-muted-foreground", children: ["Voor ", kop.veillocatie_naam, ". Prijzen ouder dan 14 dagen worden later als voorstel getoond."] }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setSjabloonNaam(null), children: "Annuleren" }), _jsx(Button, { onClick: bewaarSjabloon, disabled: !sjabloonNaam.trim(), children: "Opslaan" })] })] }))] }));
405
420
  }
406
421
  function NumField({ label, value, onChange, disabled, req, inputMode, muted, fout }) {
@@ -1 +1 @@
1
- {"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAqC,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAMlG,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,UAAO;;;;;;;UASpE;AAED,eAAO,MAAM,uBAAuB,sFAAsF,CAAC;AAK3H,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GACpC,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,+BAiOA"}
1
+ {"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,UAAO;;;;;;;UASpE;AAED,eAAO,MAAM,uBAAuB,sFAAsF,CAAC;AAK3H,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GACpC,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,+BA2NA"}
@@ -4,10 +4,10 @@ import { useNavigate } from "@tanstack/react-router";
4
4
  import { useServerFn } from "@tanstack/react-start";
5
5
  import { useQuery, useQueryClient } from "@tanstack/react-query";
6
6
  import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Skeleton, toast, } from "@flowselections/core";
7
- import { FileText, Gavel, Loader2, MoreHorizontal, Printer, Repeat, RotateCcw, Trash2 } from "lucide-react";
7
+ import { FileText, Gavel, Loader2, MoreHorizontal, Repeat, RotateCcw, Trash2 } from "lucide-react";
8
8
  import { deleteKlokOrder, getKlokAfleverbrief, listKlokOrders, repeatKlokOrder, retryKlokAnnuleren } from "../../../lib/klok.functions.js";
9
9
  import { KLOK_AFLEVERBRIEF_UIT_TEXT, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, volgendeVeildag } from "../../../lib/klok-labels.js";
10
- import { KLOK_PAGE_SIZE, klokOrderDetailId } from "../../../lib/klok-list.js";
10
+ import { KLOK_PAGE_SIZE } from "../../../lib/klok-list.js";
11
11
  import { fmtNL } from "../../../lib/nl-datetime.js";
12
12
  import { amsterdamYmd, ymdString } from "../../../lib/period-range.js";
13
13
  import { EmptyState } from "../v3/EmptyState.js";
@@ -140,7 +140,7 @@ export function KlokOrdersList({ from, to, params, focusedId, onPage, }) {
140
140
  const regels = (o.regels ?? []);
141
141
  const t = klokTellers(regels);
142
142
  const prijzen = regels.map((r) => Number(r.min_prijs)).filter((n) => n > 0);
143
- return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [_jsx("td", { className: "px-4 font-medium tabular-nums", children: o.klok_nummer }), _jsx("td", { className: "px-3", children: o.veillocatie_naam ?? "—" }), _jsx("td", { className: "px-3 tabular-nums", children: o.veilgroep ?? "—" }), _jsxs("td", { className: "px-3 tabular-nums", children: [t.fusten, " \u00B7 ", t.stuks] }), _jsx("td", { className: "px-3 tabular-nums", children: prijzen.length ? `€ ${Math.min(...prijzen).toFixed(2).replace(".", ",")}${prijzen.length > 1 && Math.max(...prijzen) !== Math.min(...prijzen) ? ` – ${Math.max(...prijzen).toFixed(2).replace(".", ",")}` : ""}` : "—" }), _jsx("td", { className: "px-3", children: _jsx(KlokStatusBadge, { status: o.status, detail: o.status_detail ?? o.laatste_fout }) }), _jsx("td", { className: "px-3", onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Acties", disabled: bezig === o.id, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => herhaal(o), children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), (o.afleverbrieven ?? []).length ? (_jsxs(DropdownMenuItem, { onClick: () => afleverbrief(o), children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] })) : (_jsx("div", { title: KLOK_AFLEVERBRIEF_UIT_TEXT, "aria-label": `Afleverbrief: ${KLOK_AFLEVERBRIEF_UIT_TEXT}`, children: _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] }) })), _jsxs(DropdownMenuItem, { disabled: !o.order_id, onClick: () => o.order_id && navigate({ to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: klokOrderDetailId(o.order_id) } }), children: [_jsx(Printer, { className: "mr-2 h-4 w-4" }), " Stickers printen"] }), klokAnnulerenOpenstaand(o) && (_jsxs(DropdownMenuItem, { onClick: () => opnieuwAnnuleren(o), children: [_jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(o.status) && (_jsxs(DropdownMenuItem, { className: "text-destructive", onClick: () => setTeVerwijderen(o), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] }) })] }, o.id));
143
+ return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [_jsx("td", { className: "px-4 font-medium tabular-nums", children: o.klok_nummer }), _jsx("td", { className: "px-3", children: o.veillocatie_naam ?? "—" }), _jsx("td", { className: "px-3 tabular-nums", children: o.veilgroep ?? "—" }), _jsxs("td", { className: "px-3 tabular-nums", children: [t.fusten, " \u00B7 ", t.stuks] }), _jsx("td", { className: "px-3 tabular-nums", children: prijzen.length ? `€ ${Math.min(...prijzen).toFixed(2).replace(".", ",")}${prijzen.length > 1 && Math.max(...prijzen) !== Math.min(...prijzen) ? ` – ${Math.max(...prijzen).toFixed(2).replace(".", ",")}` : ""}` : "—" }), _jsx("td", { className: "px-3", children: _jsx(KlokStatusBadge, { status: o.status, detail: o.status_detail ?? o.laatste_fout }) }), _jsx("td", { className: "px-3", onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Acties", disabled: bezig === o.id, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => herhaal(o), children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), (o.afleverbrieven ?? []).length ? (_jsxs(DropdownMenuItem, { onClick: () => afleverbrief(o), children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] })) : (_jsx("div", { title: KLOK_AFLEVERBRIEF_UIT_TEXT, "aria-label": `Afleverbrief: ${KLOK_AFLEVERBRIEF_UIT_TEXT}`, children: _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] }) })), klokAnnulerenOpenstaand(o) && (_jsxs(DropdownMenuItem, { onClick: () => opnieuwAnnuleren(o), children: [_jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(o.status) && (_jsxs(DropdownMenuItem, { className: "text-destructive", onClick: () => setTeVerwijderen(o), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] }) })] }, o.id));
144
144
  }) }, dag || "geen"))) })] }), params && pages > 1 && (_jsxs("div", { className: "flex items-center justify-between gap-2 border-t border-border px-4 py-3 text-sm", children: [_jsxs("span", { className: "text-muted-foreground tabular-nums", children: [(page - 1) * KLOK_PAGE_SIZE + 1, "\u2013", Math.min(total, page * KLOK_PAGE_SIZE), " van ", total] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: page <= 1, onClick: () => onPage?.(page - 1), children: "Vorige" }), _jsx(Button, { variant: "outline", size: "sm", disabled: page >= pages, onClick: () => onPage?.(page + 1), children: "Volgende" })] })] })), teVerwijderen && (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 p-4", onClick: () => !bezig && setTeVerwijderen(null), children: _jsxs("div", { className: "w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg", onClick: (e) => e.stopPropagation(), children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Veilbrief ", teVerwijderen.klok_nummer, " verwijderen?"] }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setTeVerwijderen(null), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: () => verwijder(teVerwijderen), disabled: !!bezig, "aria-busy": !!bezig || undefined, children: bezig ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] }) }))] }));
145
145
  }
146
146
  function FragmentGroep({ label, count, children }) {