@flowselections/floriday-verkoop-module 1.0.155 → 1.0.157

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 (46) hide show
  1. package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
  2. package/dist-lib/components/verkoop/CreateOrderPage.js +8 -6
  3. package/dist-lib/components/verkoop/OrderTransportCard.d.ts +3 -1
  4. package/dist-lib/components/verkoop/OrderTransportCard.d.ts.map +1 -1
  5. package/dist-lib/components/verkoop/OrderTransportCard.js +8 -6
  6. package/dist-lib/components/verkoop/SalesOrderDetailView.js +5 -2
  7. package/dist-lib/components/verkoop/SalesOrdersFilters.d.ts +6 -1
  8. package/dist-lib/components/verkoop/SalesOrdersFilters.d.ts.map +1 -1
  9. package/dist-lib/components/verkoop/SalesOrdersFilters.js +10 -4
  10. package/dist-lib/components/verkoop/SearchableSelect.js +1 -1
  11. package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
  12. package/dist-lib/components/verkoop/VerkoopOrdersPage.js +30 -18
  13. package/dist-lib/components/verkoop/klok/KlokOrderPage.d.ts.map +1 -1
  14. package/dist-lib/components/verkoop/klok/KlokOrderPage.js +38 -17
  15. package/dist-lib/components/verkoop/klok/KlokOrdersList.d.ts +1 -1
  16. package/dist-lib/components/verkoop/klok/KlokOrdersList.d.ts.map +1 -1
  17. package/dist-lib/components/verkoop/klok/KlokOrdersList.js +2 -1
  18. package/dist-lib/components/verkoop/klok/KlokPage.d.ts.map +1 -1
  19. package/dist-lib/components/verkoop/klok/KlokPage.js +26 -5
  20. package/dist-lib/lib/create-order-form.d.ts +23 -0
  21. package/dist-lib/lib/create-order-form.d.ts.map +1 -1
  22. package/dist-lib/lib/create-order-form.js +35 -0
  23. package/dist-lib/lib/create-order.functions.d.ts +1 -0
  24. package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
  25. package/dist-lib/lib/create-order.functions.js +12 -3
  26. package/dist-lib/lib/klok-form.d.ts +12 -0
  27. package/dist-lib/lib/klok-form.d.ts.map +1 -1
  28. package/dist-lib/lib/klok-form.js +76 -0
  29. package/dist-lib/lib/klok-labels.d.ts +13 -0
  30. package/dist-lib/lib/klok-labels.d.ts.map +1 -1
  31. package/dist-lib/lib/klok-labels.js +22 -0
  32. package/dist-lib/lib/klok-payload.d.ts +34 -0
  33. package/dist-lib/lib/klok-payload.d.ts.map +1 -0
  34. package/dist-lib/lib/klok-payload.js +38 -0
  35. package/dist-lib/lib/klok.server.d.ts +4 -33
  36. package/dist-lib/lib/klok.server.d.ts.map +1 -1
  37. package/dist-lib/lib/klok.server.js +6 -38
  38. package/dist-lib/lib/order-transport.functions.d.ts +1 -0
  39. package/dist-lib/lib/order-transport.functions.d.ts.map +1 -1
  40. package/dist-lib/lib/order-transport.server.d.ts +1 -0
  41. package/dist-lib/lib/order-transport.server.d.ts.map +1 -1
  42. package/dist-lib/lib/order-transport.server.js +5 -3
  43. package/dist-lib/lib/own-transport.d.ts +29 -0
  44. package/dist-lib/lib/own-transport.d.ts.map +1 -1
  45. package/dist-lib/lib/own-transport.js +33 -0
  46. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AAoGA,wBAAgB,eAAe,gCAqwC9B"}
1
+ {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AAsGA,wBAAgB,eAAe,gCAkxC9B"}
@@ -11,7 +11,7 @@ import { Link, useBlocker, useNavigate } from "@tanstack/react-router";
11
11
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
12
12
  import { AlertTriangle, ArrowLeft, CheckCircle2, ChevronUp, Loader2, Plus, Trash2 } from "lucide-react";
13
13
  import { isOwnTransportKind, ownPickupLabel, OWN_PICKUP_MISSING_TEXT } from "../../lib/own-transport.js";
14
- import { missingItems, lineTotal, dateWithWeekday, eur, attentionItems, selectionKey, resetOnSelectionChange, applyFirstFeasible, prijsBronLabel, prijsSleutel, PRIJS_FOUT_TEXT } from "../../lib/create-order-form.js";
14
+ import { missingItems, lineTotal, dateWithWeekday, eur, attentionItems, selectionKey, resetOnSelectionChange, applyFirstFeasible, prijsSleutel, PRIJS_FOUT_TEXT, PRIJS_ONBEKEND_TEXT, bekendePrijs, regelMistPrijs } from "../../lib/create-order-form.js";
15
15
  import { useServerFn } from "@tanstack/react-start";
16
16
  import { SearchableSelect } from "./SearchableSelect.js";
17
17
  import { toISODate } from "../../lib/carrier-availability.js";
@@ -149,7 +149,7 @@ export function CreateOrderPage() {
149
149
  if (!r || !r.ok)
150
150
  copy[x.i] = { ...ln, price_error: true, price_key: x.key, price_source: null, unit_price: null };
151
151
  else
152
- copy[x.i] = { ...ln, price_error: false, price_key: x.key, price_mode: "auto", unit_price: r.prijs ? r.prijs.net_price : null, price_source: prijsBronLabel(r.prijs) };
152
+ copy[x.i] = { ...ln, price_error: false, price_key: x.key, price_mode: "auto", price_zero_ok: false, ...bekendePrijs(r.prijs) };
153
153
  });
154
154
  return copy;
155
155
  });
@@ -533,6 +533,7 @@ export function CreateOrderPage() {
533
533
  quantity: l.quantity,
534
534
  unit: l.unit ?? p?.unit ?? "stuks",
535
535
  unit_price: l.unit_price ?? undefined,
536
+ price_zero_ok: l.price_zero_ok === true && Number(l.unit_price) === 0,
536
537
  // Gekozen belading heeft voorrang op de productstandaard.
537
538
  plants_per_crate: l.belading?.plants_per_crate ?? p?.plants_per_crate ?? undefined,
538
539
  crates_per_layer: l.belading?.crates_per_layer ?? p?.crates_per_layer ?? undefined,
@@ -667,11 +668,12 @@ export function CreateOrderPage() {
667
668
  validLineCount: validLines.length,
668
669
  linesWithoutBelading: lines.filter((l, i) => l.product_id && !lineInfo[i].eff).length,
669
670
  stockBlocked,
671
+ linesWithoutPrice: lines.filter((l) => regelMistPrijs(l)).length,
670
672
  previewPending: canPickDate && !isReservation && !decision,
671
673
  previewBlockedReason: decision && (decision.kind === "blocked" || decision.kind === "departed") ? decision.reason : null,
672
674
  });
673
675
  const attention0 = attentionItems({
674
- linesWithoutPrice: lines.filter((l) => l.product_id && !l.price_error && !(Number(l.unit_price) > 0)).length,
676
+ linesWithoutPrice: 0, // blokkeert nu aanmaken (zie missingItems)
675
677
  linesPriceError: lines.filter((l) => l.product_id && l.price_error).length,
676
678
  linesOverStock: lines.filter((l) => l.product_id && shortageByProduct.has(l.product_id)).length,
677
679
  });
@@ -705,7 +707,7 @@ export function CreateOrderPage() {
705
707
  const fieldLabel = "text-[13px] font-medium text-foreground";
706
708
  const summaryRows = (_jsxs("dl", { className: "space-y-3 text-sm", children: [_jsxs("div", { children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: "Klant" }), _jsx("dd", { className: "font-medium text-foreground", children: selectedCustomer ? customerLabel(selectedCustomer) : "—" }), selectedCustomer && customerSub(selectedCustomer) && _jsx("dd", { className: "text-xs text-muted-foreground", children: customerSub(selectedCustomer) })] }), _jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] gap-2", children: [_jsx("dt", { className: "text-muted-foreground", children: "Leverdatum" }), _jsx("dd", { className: "text-right tabular-nums text-foreground", children: isReservation ? "Reservering" : dateWithWeekday(deliveryDate) ?? "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("dt", { className: "text-muted-foreground", children: "Ophaalmoment" }), !isReservation && !ownTransport && preview && preview.moments.length > 1 && decision && (decision.kind === "ok" || decision.kind === "late") ? (_jsx("select", { className: "h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground", value: momentKey ?? decision.momentKey ?? "", onChange: (e) => setMomentKey(e.target.value || null), "aria-label": "Ophaalmoment kiezen", children: preview.moments.map((m) => (_jsxs("option", { value: m.momentKey, disabled: !m.feasible, children: [momentLabel(m), m.feasible ? "" : " (niet haalbaar)"] }, m.momentKey))) })) : (_jsx("dd", { className: "text-foreground", children: momentText ?? (canPickDate && !isReservation && !decision
707
709
  ? _jsx("span", { className: "inline-block h-4 w-40 animate-pulse rounded bg-muted align-middle", "aria-label": "Ophaalmoment laden" })
708
- : "—") }))] }), _jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] gap-2", children: [_jsx("dt", { className: "text-muted-foreground", children: "Vervoerder" }), _jsx("dd", { className: "truncate text-right text-foreground", children: carrierText })] }), _jsxs("div", { className: "border-t border-border pt-3 grid grid-cols-[minmax(0,1fr)_auto] gap-y-1.5 gap-x-2 tabular-nums", children: [_jsx("dt", { className: "text-muted-foreground", children: "Regels" }), _jsx("dd", { className: "text-right", children: validLines.length }), _jsx("dt", { className: "text-muted-foreground", children: "Fusten" }), _jsx("dd", { className: "text-right", children: totals.crates }), _jsx("dt", { className: "text-muted-foreground", children: "Stuks" }), _jsx("dd", { className: "text-right", children: totals.stuks.toLocaleString("nl-NL") })] }), _jsxs("div", { className: "border-t border-border pt-3 grid grid-cols-[minmax(0,1fr)_auto] gap-2", children: [_jsx("dt", { className: "font-semibold text-foreground", children: "Totaal" }), _jsx("dd", { className: "text-right text-lg font-semibold tabular-nums text-foreground", children: eur(totals.amount) })] })] }));
710
+ : "—") }))] }), _jsxs("div", { className: "grid min-w-0 gap-0.5", children: [_jsx("dt", { className: "text-muted-foreground", children: "Vervoerder" }), _jsx("dd", { className: "min-w-0 truncate text-foreground", title: carrierText, children: carrierText })] }), _jsxs("div", { className: "border-t border-border pt-3 grid grid-cols-[minmax(0,1fr)_auto] gap-y-1.5 gap-x-2 tabular-nums", children: [_jsx("dt", { className: "text-muted-foreground", children: "Regels" }), _jsx("dd", { className: "text-right", children: validLines.length }), _jsx("dt", { className: "text-muted-foreground", children: "Fusten" }), _jsx("dd", { className: "text-right", children: totals.crates }), _jsx("dt", { className: "text-muted-foreground", children: "Stuks" }), _jsx("dd", { className: "text-right", children: totals.stuks.toLocaleString("nl-NL") })] }), _jsxs("div", { className: "border-t border-border pt-3 grid grid-cols-[minmax(0,1fr)_auto] gap-2", children: [_jsx("dt", { className: "font-semibold text-foreground", children: "Totaal" }), _jsx("dd", { className: "text-right text-lg font-semibold tabular-nums text-foreground", children: eur(totals.amount) })] })] }));
709
711
  const missingBlock = missing.length > 0 ? (_jsxs("div", { className: "rounded-lg border border-border bg-muted/40 p-3 text-sm", children: [_jsx("div", { className: "mb-1 font-medium text-foreground", children: "Ontbreekt nog" }), _jsx("ul", { className: "space-y-1 text-muted-foreground", children: missing.map((m) => (_jsxs("li", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 h-1 w-1 shrink-0 rounded-full bg-muted-foreground" }), m] }, m))) })] })) : attention.length > 0 ? null : (_jsxs("div", { className: "flex items-center gap-2 rounded-lg bg-primary/10 p-3 text-sm font-medium text-primary", children: [_jsx(CheckCircle2, { className: "h-4 w-4 shrink-0" }), " Alles is compleet"] }));
710
712
  const attentionBlock = attention.length > 0 ? (_jsxs("div", { className: "rounded-lg border border-warning/40 bg-warning-soft p-3 text-sm", children: [_jsxs("div", { className: "mb-1 flex items-center gap-2 font-medium text-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0 text-warning-soft-foreground" }), "Aandachtspunten"] }), _jsx("ul", { className: "space-y-1 text-muted-foreground", children: attention.map((m) => (_jsxs("li", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 h-1 w-1 shrink-0 rounded-full bg-muted-foreground" }), m] }, m))) })] })) : null;
711
713
  const createButton = (cls = "") => (_jsx(Button, { className: `h-10 w-full [@media(pointer:coarse)]:h-11 ${cls}`, onClick: submit, disabled: !canCreate, title: stockBlocked ? "Onvoldoende voorraad; pas de aantallen aan." : undefined, children: createMut.isPending ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Bezig\u2026"] })
@@ -767,7 +769,7 @@ export function CreateOrderPage() {
767
769
  const available = product ? Number(product.available_stock ?? 0) : null;
768
770
  const unit = product?.unit || "stuks";
769
771
  const overStock = !!product && (plants ?? 0) > 0 && (shortage || (available != null && (plants ?? 0) > available));
770
- const noPrice = !!line.product_id && !(Number(line.unit_price) > 0);
772
+ const noPrice = regelMistPrijs(line);
771
773
  const pricePending = !!line.product_id && line.price_mode !== "manual" && !line.price_error && line.price_key !== prijsSleutel(customerId, line.product_id, deliveryDate, line.quantity);
772
774
  const impossible = line.product_id ? impossibleByLine[String(idx)] : undefined;
773
775
  const missingLine = line.product_id && !impossible ? (missingByLine[String(idx)] ?? missingByProduct[line.product_id]) : undefined;
@@ -833,6 +835,6 @@ export function CreateOrderPage() {
833
835
  const cr = raw ? Math.max(1, Math.floor(Number(raw))) : null;
834
836
  next[idx] = { ...next[idx], quantity: cr === null ? null : cr * ppc };
835
837
  setLines(next);
836
- }, placeholder: ppc === null ? "—" : "Fusten", title: ppc === null ? "Kies eerst een belading" : `${ppc} planten per fust` })] }), _jsxs("div", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Stuks" }), _jsx("div", { className: "flex h-9 items-center text-sm tabular-nums text-foreground @[60rem]:justify-end", children: line.product_id && plants ? plants.toLocaleString("nl-NL") : "—" })] }), _jsxs("div", { className: "min-w-0 grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Beschikbaar" }), product ? (_jsxs("div", { className: `flex min-h-9 items-center gap-1 text-sm tabular-nums ${overStock ? (stockBlocked ? "text-destructive" : "text-warning-soft-foreground") : "text-foreground"}`, children: [overStock && _jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [(available ?? 0).toLocaleString("nl-NL"), " ", unit] })] })) : _jsx("div", { className: "flex h-9 items-center text-sm text-muted-foreground", children: "\u2014" }), overStock && (_jsx("div", { className: `text-xs ${stockBlocked ? "text-destructive" : "text-warning-soft-foreground"}`, children: shortage ? `Tekort ${shortage.missing.toLocaleString("nl-NL")}` : "Meer dan beschikbaar" }))] }), _jsxs("label", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Prijs per stuk" }), _jsx(Input, { type: "number", min: 0, step: "0.01", inputMode: "decimal", className: "h-9 tabular-nums [@media(pointer:coarse)]:h-11", value: line.unit_price ?? "", onChange: (e) => { const next = [...lines]; next[idx] = { ...next[idx], unit_price: e.target.value === "" ? null : Number(e.target.value), price_mode: "manual", price_source: "Handmatig", price_error: false }; setLines(next); }, placeholder: "\u20AC", "aria-invalid": noPrice || line.price_error }), line.price_error ? (_jsx("span", { className: "mt-1 block text-xs text-destructive", children: PRIJS_FOUT_TEXT })) : noPrice && !pricePending ? (_jsx("span", { className: "mt-1 block text-xs text-destructive", children: "Geen prijs gevonden" })) : line.price_source ? (_jsx("span", { className: "mt-1 block truncate text-xs text-muted-foreground", title: line.price_source, children: line.price_source })) : null, line.product_id && (line.price_mode === "manual" || line.price_error) && (_jsx("button", { type: "button", className: "mt-0.5 block text-xs font-medium text-primary hover:underline [@media(pointer:coarse)]:min-h-11", onClick: (e) => { e.preventDefault(); const next = [...lines]; next[idx] = { ...next[idx], price_mode: "auto", price_key: null, price_error: false }; setLines(next); }, children: "Prijs opnieuw ophalen" }))] }), _jsxs("div", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Totaal" }), _jsx("div", { className: "flex h-9 items-center text-sm font-medium tabular-nums text-foreground @[60rem]:justify-end", children: line.product_id ? eur(lineInfo[idx].total) : "—" })] }), _jsx("div", { className: "order-2 flex shrink-0 justify-end @[60rem]:order-none", children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-9 w-9 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", onClick: () => setLines(lines.filter((_, i) => i !== idx)), "aria-label": "Regel verwijderen", children: _jsx(Trash2, { className: "h-4 w-4" }) }) })] }, idx));
838
+ }, placeholder: ppc === null ? "—" : "Fusten", title: ppc === null ? "Kies eerst een belading" : `${ppc} planten per fust` })] }), _jsxs("div", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Stuks" }), _jsx("div", { className: "flex h-9 items-center text-sm tabular-nums text-foreground @[60rem]:justify-end", children: line.product_id && plants ? plants.toLocaleString("nl-NL") : "—" })] }), _jsxs("div", { className: "min-w-0 grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Beschikbaar" }), product ? (_jsxs("div", { className: `flex min-h-9 items-center gap-1 text-sm tabular-nums ${overStock ? (stockBlocked ? "text-destructive" : "text-warning-soft-foreground") : "text-foreground"}`, children: [overStock && _jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [(available ?? 0).toLocaleString("nl-NL"), " ", unit] })] })) : _jsx("div", { className: "flex h-9 items-center text-sm text-muted-foreground", children: "\u2014" }), overStock && (_jsx("div", { className: `text-xs ${stockBlocked ? "text-destructive" : "text-warning-soft-foreground"}`, children: shortage ? `Tekort ${shortage.missing.toLocaleString("nl-NL")}` : "Meer dan beschikbaar" }))] }), _jsxs("label", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Prijs per stuk" }), _jsx(Input, { type: "number", min: 0, step: "0.01", inputMode: "decimal", className: "h-9 tabular-nums [@media(pointer:coarse)]:h-11", value: line.unit_price ?? "", onChange: (e) => { const next = [...lines]; next[idx] = { ...next[idx], unit_price: e.target.value === "" ? null : Number(e.target.value), price_mode: "manual", price_source: "Handmatig", price_error: false, price_zero_ok: false }; setLines(next); }, placeholder: "\u20AC", "aria-invalid": noPrice || line.price_error }), line.price_error ? (_jsx("span", { className: "mt-1 block text-xs text-destructive", children: PRIJS_FOUT_TEXT })) : noPrice && !pricePending ? (_jsxs("span", { className: "mt-1 block text-xs text-destructive", children: [PRIJS_ONBEKEND_TEXT, line.unit_price != null && Number(line.unit_price) === 0 && (_jsxs("span", { className: "mt-1 flex items-center gap-1.5 text-foreground [@media(pointer:coarse)]:min-h-11", children: [_jsx("input", { type: "checkbox", className: "h-4 w-4", checked: !!line.price_zero_ok, onChange: (e) => { const next = [...lines]; next[idx] = { ...next[idx], price_zero_ok: e.target.checked }; setLines(next); } }), "Prijs 0 is juist"] }))] })) : line.price_zero_ok && Number(line.unit_price) === 0 ? (_jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: "Prijs 0 bevestigd" })) : line.price_source ? (_jsx("span", { className: "mt-1 block truncate text-xs text-muted-foreground", title: line.price_source, children: line.price_source })) : null, line.product_id && (line.price_mode === "manual" || line.price_error) && (_jsx("button", { type: "button", className: "mt-0.5 block text-xs font-medium text-primary hover:underline [@media(pointer:coarse)]:min-h-11", onClick: (e) => { e.preventDefault(); const next = [...lines]; next[idx] = { ...next[idx], price_mode: "auto", price_key: null, price_error: false }; setLines(next); }, children: "Prijs opnieuw ophalen" }))] }), _jsxs("div", { className: "grow basis-[7.5rem] @[60rem]:basis-auto order-3 @[60rem]:order-none", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground @[60rem]:sr-only", children: "Totaal" }), _jsx("div", { className: "flex h-9 items-center text-sm font-medium tabular-nums text-foreground @[60rem]:justify-end", children: line.product_id ? eur(lineInfo[idx].total) : "—" })] }), _jsx("div", { className: "order-2 flex shrink-0 justify-end @[60rem]:order-none", children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-9 w-9 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", onClick: () => setLines(lines.filter((_, i) => i !== idx)), "aria-label": "Regel verwijderen", children: _jsx(Trash2, { className: "h-4 w-4" }) }) })] }, idx));
837
839
  }) }), _jsxs("div", { className: "mt-3 flex flex-col gap-3 border-t border-border pt-3 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs(Button, { variant: "outline", className: "h-9 w-full sm:w-auto [@media(pointer:coarse)]:h-11", onClick: addLine, children: [_jsx(Plus, { className: "mr-1 h-4 w-4" }), " Regel toevoegen"] }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-5 gap-y-1 text-sm tabular-nums", children: [_jsxs("span", { className: "text-muted-foreground", children: ["Fusten ", _jsx("span", { className: "font-medium text-foreground", children: totals.crates })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Stuks ", _jsx("span", { className: "font-medium text-foreground", children: totals.stuks.toLocaleString("nl-NL") })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Totaal ", _jsx("span", { className: "font-semibold text-foreground", children: eur(totals.amount) })] })] })] }), stockCheck && stockCheck.shortages.length > 0 && !stockBlocked && (_jsx("div", { className: "mt-3 rounded-lg bg-warning-soft p-2.5 text-xs text-warning-soft-foreground", children: "Uitleveren zonder voorraad staat aan: de bestelling kan met tekort worden aangemaakt." }))] }), _jsxs("section", { className: cardCls, children: [_jsx("h2", { className: h2, children: "Aanvullend" }), _jsxs("div", { className: "mt-4 grid gap-4", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: fieldLabel, children: "Referentie klant" }), _jsx(Input, { value: customerReference, maxLength: 100, className: "h-9 [@media(pointer:coarse)]:h-11", onChange: (e) => setCustomerReference(e.target.value), placeholder: "Optioneel, bijvoorbeeld het bestelnummer van je klant" })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { className: fieldLabel, children: "Opmerkingen" }), _jsx(Textarea, { value: notes, onChange: (e) => setNotes(e.target.value), placeholder: "Optionele notities bij deze bestelling", rows: 3 })] })] })] })] }), _jsx("aside", { className: "min-w-0", children: _jsxs("div", { className: `${cardCls} space-y-4 xl:sticky xl:top-4`, children: [_jsx("h2", { className: h2, children: "Samenvatting" }), summaryRows, missingBlock, attentionBlock, createButton(), _jsx(Button, { variant: "ghost", className: "h-9 w-full [@media(pointer:coarse)]:h-11", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders" }), disabled: createMut.isPending, children: "Annuleren" })] }) })] }), _jsxs("div", { className: "sticky bottom-0 z-30 -mx-4 border-t border-border bg-background/95 px-4 pt-3 backdrop-blur sm:-mx-6 sm:px-6 xl:hidden", style: { paddingBottom: "max(12px, env(safe-area-inset-bottom))" }, children: [mobileSummaryOpen && (_jsxs("div", { className: "mb-3 max-h-[50vh] space-y-3 overflow-y-auto", children: [summaryRows, missingBlock, attentionBlock] })), _jsxs("button", { type: "button", className: "mb-2 flex w-full items-center justify-between gap-3 text-left [@media(pointer:coarse)]:min-h-11", onClick: () => setMobileSummaryOpen((o) => !o), "aria-expanded": mobileSummaryOpen, children: [_jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate text-xs text-muted-foreground", children: momentText ? `Ophalen: ${momentText.replace(/^ophalen /, "")}` : missing.length > 0 ? `${missing.length} ontbreekt nog` : attention.length > 0 ? `${attention.length} aandachtspunt${attention.length === 1 ? "" : "en"}` : "Alles is compleet" }), _jsx("span", { className: "block text-base font-semibold tabular-nums text-foreground", children: eur(totals.amount) })] }), _jsx(ChevronUp, { className: `h-5 w-5 shrink-0 text-muted-foreground transition-transform ${mobileSummaryOpen ? "" : "rotate-180"}` })] }), createButton("h-12")] }), _jsx(ConfirmDialog, { open: zeroConfirmOpen, onOpenChange: setZeroConfirmOpen, title: "Prijs \u20AC 0 bevestigen?", description: `${zeroPriceCount} regel(s) hebben prijs € 0. Deze regels worden zo gefactureerd. Weet je zeker dat dat klopt?`, confirmLabel: "Ja, prijs \u20AC 0 klopt", onConfirm: () => { zeroPriceOkRef.current = true; createMut.mutate(undefined); } }), _jsx(ConfirmDialog, { open: lateConfirmOpen, onOpenChange: setLateConfirmOpen, title: "Toch aanmaken na de aanmeldtijd?", description: LATE_CONFIRM, confirmLabel: "Toch aanmaken", onConfirm: () => createMut.mutate({ lateConfirmed: true }) })] }));
838
840
  }
@@ -13,6 +13,7 @@ export declare function useOrderTransport(orderId: string | null | undefined, en
13
13
  time: string;
14
14
  } | null;
15
15
  locked: boolean;
16
+ lockReason: import("../../lib/own-transport.js").PickupLockReason;
16
17
  lockKnown: boolean;
17
18
  }, Error>;
18
19
  /** "do 29 okt 15:00" uit { date, time }. */
@@ -21,7 +22,7 @@ export declare function ownPickupText(p: {
21
22
  time: string;
22
23
  } | null | undefined): string | null;
23
24
  /** Ophaaltijd invullen/wijzigen bij eigen vervoer of klant haalt op. */
24
- export declare function OwnPickupEditor({ orderId, kind, current, defaultDate, locked }: {
25
+ export declare function OwnPickupEditor({ orderId, kind, current, defaultDate, locked, lockedText }: {
25
26
  orderId: string;
26
27
  kind: string | null;
27
28
  current: {
@@ -30,6 +31,7 @@ export declare function OwnPickupEditor({ orderId, kind, current, defaultDate, l
30
31
  } | null;
31
32
  defaultDate: string | null;
32
33
  locked: boolean;
34
+ lockedText?: string;
33
35
  }): import("react").JSX.Element;
34
36
  /** Blok "Vervoer" op de orderpagina; ontbrekende velden worden weggelaten. */
35
37
  export declare function OrderTransportCard({ order, groupSize, extra }: {
@@ -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,EAAE;IAC/E,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;CACjB,+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,+BA0E9H;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,sCAUrE"}
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"}
@@ -11,7 +11,7 @@ import { usePickupMoment } from "../../lib/usePickupMoment.js";
11
11
  import { formatMoment } from "../../lib/order-departure.js";
12
12
  import { dateWithWeekday } from "../../lib/create-order-form.js";
13
13
  import { getOrderTransport, setOrderOwnPickupTime } from "../../lib/order-transport.functions.js";
14
- import { OWN_PICKUP_LOCKED_TEXT, OWN_PICKUP_MISSING_TEXT, ownPickupLabel } from "../../lib/own-transport.js";
14
+ import { OWN_PICKUP_LOCKED_TEXT, OWN_PICKUP_MISSING_TEXT, OWN_PICKUP_UNKNOWN_TEXT, ownPickupLabel, ownPickupPlannedText, ownPickupView } from "../../lib/own-transport.js";
15
15
  import { formatLoadUnits } from "../../lib/load-carrier-labels.js";
16
16
  import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
17
17
  export const orderTransportKey = (orderId) => ["order-transport", orderId];
@@ -32,7 +32,7 @@ export function ownPickupText(p) {
32
32
  return d ? `${d.replace(/ \d{4}$/, "")} ${p.time}` : null;
33
33
  }
34
34
  /** Ophaaltijd invullen/wijzigen bij eigen vervoer of klant haalt op. */
35
- export function OwnPickupEditor({ orderId, kind, current, defaultDate, locked }) {
35
+ export function OwnPickupEditor({ orderId, kind, current, defaultDate, locked, lockedText = OWN_PICKUP_LOCKED_TEXT }) {
36
36
  const qc = useQueryClient();
37
37
  const save = useServerFn(setOrderOwnPickupTime);
38
38
  const [date, setDate] = useState(current?.date ?? defaultDate ?? "");
@@ -63,7 +63,7 @@ export function OwnPickupEditor({ orderId, kind, current, defaultDate, locked })
63
63
  setBusy(false);
64
64
  }
65
65
  };
66
- return (_jsxs("div", { className: "space-y-1", title: locked ? OWN_PICKUP_LOCKED_TEXT : undefined, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Input, { type: "date", "aria-label": `${label}: datum`, className: "h-9 w-40 [@media(pointer:coarse)]:h-11", value: date, disabled: locked || busy, onChange: (e) => setDate(e.target.value) }), _jsx(Input, { type: "time", "aria-label": label, className: "h-9 w-28 [@media(pointer:coarse)]:h-11", value: time, disabled: locked || busy, onChange: (e) => setTime(e.target.value) }), _jsx(Button, { size: "sm", variant: "outline", className: "[@media(pointer:coarse)]:h-11", disabled: locked || busy || !date || !time || (current?.date === date && current?.time === time), onClick: onSave, children: busy ? "Opslaan…" : "Opslaan" })] }), locked && _jsx("div", { className: "text-xs text-muted-foreground", children: OWN_PICKUP_LOCKED_TEXT }), error && _jsx("div", { className: "text-xs text-destructive", children: error })] }));
66
+ return (_jsxs("div", { className: "space-y-1", title: locked ? lockedText : undefined, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Input, { type: "date", "aria-label": `${label}: datum`, className: "h-9 w-40 [@media(pointer:coarse)]:h-11", value: date, disabled: locked || busy, onChange: (e) => setDate(e.target.value) }), _jsx(Input, { type: "time", "aria-label": label, className: "h-9 w-28 [@media(pointer:coarse)]:h-11", value: time, disabled: locked || busy, onChange: (e) => setTime(e.target.value) }), _jsx(Button, { size: "sm", variant: "outline", className: "[@media(pointer:coarse)]:h-11", disabled: locked || busy || !date || !time || (current?.date === date && current?.time === time), onClick: onSave, children: busy ? "Opslaan…" : "Opslaan" })] }), locked && _jsx("div", { className: "text-xs text-muted-foreground", children: lockedText }), error && _jsx("div", { className: "text-xs text-destructive", children: error })] }));
67
67
  }
68
68
  /** Blok "Vervoer" op de orderpagina; ontbrekende velden worden weggelaten. */
69
69
  export function OrderTransportCard({ order, groupSize, extra }) {
@@ -76,17 +76,19 @@ export function OrderTransportCard({ order, groupSize, extra }) {
76
76
  const carrier = t?.carrier ?? null;
77
77
  const hasCarrier = carrier?.state === "ok" && !!carrier.carrierName;
78
78
  const manual = carrier?.source === "handmatig";
79
- const missingOwnTime = !!t?.own && !t.ownPickup;
79
+ const view = ownPickupView({ own: !!t?.own, ownPickup: t?.ownPickup ?? null, lockReason: t?.lockReason ?? (t?.locked ? "onbekend" : null), plannedShort: pm.data?.view?.short ?? null });
80
+ const missingOwnTime = view.melding === "invullen";
80
81
  const signup = !t?.own ? formatMoment(pm.data?.departure?.signupDeadline ?? null) : null;
81
82
  const karren = Number(order.karCount ?? 0);
82
- 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] })), 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 ? (_jsx(InfoRow, { label: ownPickupLabel(t.ownKind), children: _jsx(OwnPickupEditor, { orderId: orderId, kind: t.ownKind, current: t.ownPickup, defaultDate: t.deliveryDate, locked: t.locked }, `${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] }));
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] }));
83
84
  }
84
85
  /** Kopregel van een handmatige order: "Ophalen do 29 okt 15:00 · Levering vr 30 okt 08:00". */
85
86
  export function PickupDeliveryLine({ order }) {
86
87
  const orderId = String(order.id);
87
88
  const t = useOrderTransport(orderId, !order.isReservation);
88
89
  const pm = usePickupMoment(orderId);
89
- const pickup = t.data?.own ? ownPickupText(t.data.ownPickup) : pm.data?.view?.short ?? null;
90
+ // Zelfde bron als het blok Vervoer: eigen tijd, anders het moment uit de planning.
91
+ const pickup = (t.data?.own ? ownPickupText(t.data.ownPickup) : null) ?? pm.data?.view?.short ?? null;
90
92
  const d = order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { wallClock: deliveryIsWallClockFor(order) }) : null;
91
93
  const levering = d ? [d.date, d.time].filter(Boolean).join(" ") : null;
92
94
  const parts = [pickup ? `Ophalen ${pickup}` : null, levering ? `Levering ${levering}` : null].filter(Boolean);
@@ -19,7 +19,7 @@ import { OrderShipmentsCard } from "./OrderShipmentsCard.js";
19
19
  import { OrderInvoiceCard } from "./OrderInvoiceCard.js";
20
20
  import { orderUuid } from "../../lib/order-price-lock.js";
21
21
  import { OrderControlStatusCard } from "./OrderControlStatusCard.js";
22
- import { OrderTransportCard } from "./OrderTransportCard.js";
22
+ import { OrderTransportCard, ownPickupText, useOrderTransport } from "./OrderTransportCard.js";
23
23
  import { getFloridayStatusesForRows } from "../../lib/salesorders-list.functions.js";
24
24
  function AddressCard({ icon, lines, extra, }) {
25
25
  return (_jsxs("div", { className: "inline-flex max-w-xs items-start gap-3 rounded-md border border-border bg-card p-3", children: [_jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-md bg-primary/10 text-primary", children: icon }), _jsxs("div", { className: "text-sm", children: [lines.length > 0 ? lines.map((l, i) => _jsx("div", { children: l }, i)) : _jsx("div", { children: "\u2014" }), extra && _jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: extra })] })] }));
@@ -347,8 +347,11 @@ function Notice({ tone, title, children }) {
347
347
  function DeliveryTileSub({ order }) {
348
348
  const pm = usePickupMoment(String(order.id));
349
349
  const t = order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { wallClock: deliveryIsWallClockFor(order) }).time : "";
350
+ // Zelfde tijd als het blok Vervoer: eigen ophaaltijd (eigen vervoer/klant haalt op), anders de planning.
351
+ const tr = useOrderTransport(String(order.id), !order.isReservation);
352
+ const own = tr.data?.own ? ownPickupText(tr.data.ownPickup) : null;
350
353
  const short = pm.data ? (pm.data.view?.short ?? null) : null;
351
- const pickup = pm.data ? short : (order.pickupLabel && order.pickupLabel !== "onbekend" ? order.pickupLabel : null);
354
+ const pickup = own ?? (pm.data ? short : (order.pickupLabel && order.pickupLabel !== "onbekend" ? order.pickupLabel : null));
352
355
  const showSlot = pm.isPending && !pickup;
353
356
  if (!t && !pickup && !showSlot)
354
357
  return null;
@@ -22,12 +22,17 @@ export interface Filters {
22
22
  dateField?: "ordered" | "delivery";
23
23
  period?: "week" | "month" | "day" | "last7" | "last30" | "custom";
24
24
  }
25
- export declare function SalesOrdersFilters({ value, onChange, part, busy, }: {
25
+ export declare function SalesOrdersFilters({ value, onChange, part, busy, alle, }: {
26
26
  value: Filters;
27
27
  onChange: (next: Filters) => void;
28
28
  /** Alleen de periodekeuze, alleen het zoekveld, of beide (standaard). */
29
29
  part?: "both" | "period" | "search";
30
30
  /** Server bevestigt de zoekterm nog (klein laadstreepje). */
31
31
  busy?: boolean;
32
+ /** Optioneel "Alle" in het periodemenu (zonder datumgrens), bv. op de pagina Klok. */
33
+ alle?: {
34
+ active: boolean;
35
+ onChange: (active: boolean) => void;
36
+ };
32
37
  }): import("react").JSX.Element;
33
38
  //# sourceMappingURL=SalesOrdersFilters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnE;AA6BD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,IAAa,EACb,IAAY,GACb,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,+BA6TA"}
1
+ {"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnE;AA6BD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,IAAa,EACb,IAAY,EACZ,IAAI,GACL,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sFAAsF;IACtF,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,CAAC;CACjE,+BAwUA"}
@@ -27,7 +27,7 @@ function generateMonthOptions() {
27
27
  }
28
28
  return options;
29
29
  }
30
- export function SalesOrdersFilters({ value, onChange, part = "both", busy = false, }) {
30
+ export function SalesOrdersFilters({ value, onChange, part = "both", busy = false, alle, }) {
31
31
  const currentWeek = getCurrentWeek();
32
32
  const week = value.week ?? currentWeek.week;
33
33
  const year = value.year ?? currentWeek.year;
@@ -144,11 +144,17 @@ export function SalesOrdersFilters({ value, onChange, part = "both", busy = fals
144
144
  return "Aangepast tijdsbestek";
145
145
  return `Week ${week}, ${year}`;
146
146
  };
147
- const showArrows = period === "week" || period === "month" || period === "day";
148
- return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [part !== "search" && (_jsxs("div", { className: "flex h-10 w-full items-center justify-between gap-1 rounded-md border border-border bg-card px-1 sm:h-9 sm:w-auto sm:justify-start", children: [showArrows && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => shiftPeriod(-1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Vorige", children: _jsx(ChevronLeft, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => shiftPeriod(1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Volgende", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] })), period === "month" ? (_jsxs(Select, { value: `${monthYear}-${month}`, onValueChange: (v) => {
147
+ const alleActief = !!alle?.active;
148
+ const showArrows = !alleActief && (period === "week" || period === "month" || period === "day");
149
+ return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [part !== "search" && (_jsxs("div", { className: "flex h-10 w-full items-center justify-between gap-1 rounded-md border border-border bg-card px-1 sm:h-9 sm:w-auto sm:justify-start", children: [showArrows && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => shiftPeriod(-1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Vorige", children: _jsx(ChevronLeft, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => shiftPeriod(1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Volgende", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] })), alleActief ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: "Alle" })) : period === "month" ? (_jsxs(Select, { value: `${monthYear}-${month}`, onValueChange: (v) => {
149
150
  const [y, m] = v.split("-").map(Number);
150
151
  onChange({ ...value, month: m, monthYear: y });
151
- }, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), (value.dateField ?? "delivery") === "ordered" && (_jsx("span", { className: "pr-1 text-sm text-muted-foreground whitespace-nowrap", "aria-label": "Periode op besteldatum", children: "\u00B7 besteldatum" })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: period, onValueChange: (v) => handlePeriodChange(v), children: [_jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuRadioGroup, { value: value.dateField ?? "delivery", onValueChange: (v) => onChange({ ...value, dateField: v === "ordered" ? "ordered" : "delivery" }), children: [_jsx(DropdownMenuRadioItem, { value: "delivery", children: "Op leverdatum" }), _jsx(DropdownMenuRadioItem, { value: "ordered", children: "Op besteldatum" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [periodLabel(), (value.dateField ?? "delivery") === "ordered" ? " · besteldatum" : "", _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] })), part !== "period" && (_jsxs("div", { className: "group relative flex h-10 sm:h-9 w-full items-center overflow-hidden rounded-md border border-border bg-card " +
152
+ }, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), (value.dateField ?? "delivery") === "ordered" && (_jsx("span", { className: "pr-1 text-sm text-muted-foreground whitespace-nowrap", "aria-label": "Periode op besteldatum", children: "\u00B7 besteldatum" })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: alleActief ? "__alle" : period, onValueChange: (v) => {
153
+ if (v === "__alle")
154
+ return alle?.onChange(true);
155
+ alle?.onChange(false);
156
+ handlePeriodChange(v);
157
+ }, children: [alle && _jsx(DropdownMenuRadioItem, { value: "__alle", children: "Alle" }), _jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuRadioGroup, { value: value.dateField ?? "delivery", onValueChange: (v) => onChange({ ...value, dateField: v === "ordered" ? "ordered" : "delivery" }), children: [_jsx(DropdownMenuRadioItem, { value: "delivery", children: "Op leverdatum" }), _jsx(DropdownMenuRadioItem, { value: "ordered", children: "Op besteldatum" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [alleActief ? "Alle" : periodLabel(), (value.dateField ?? "delivery") === "ordered" ? " · besteldatum" : "", _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] })), part !== "period" && (_jsxs("div", { className: "group relative flex h-10 sm:h-9 w-full items-center overflow-hidden rounded-md border border-border bg-card " +
152
158
  "transition-[box-shadow,border-color,width] duration-[180ms] ease-out motion-reduce:transition-none " +
153
159
  "focus-within:border-primary focus-within:ring-[3px] focus-within:ring-ring/20 " +
154
160
  (part === "search" ? "sm:w-80 sm:focus-within:w-[400px]" : ""), children: [_jsx(Search, { className: "ml-3 h-4 w-4 shrink-0 text-muted-foreground transition-colors duration-[120ms] group-focus-within:text-primary", "aria-hidden": true }), _jsx("input", { ref: inputRef, type: "search", placeholder: part === "search" ? "Zoek op ordernummer, klant, artikel of referentie" : "Op briefnummer zoeken", "aria-label": "Zoeken", value: search, maxLength: 100, autoComplete: "off", spellCheck: false, onChange: (e) => setSearch(e.target.value), onKeyDown: (e) => {
@@ -26,5 +26,5 @@ export const SearchableSelect = forwardRef(function SearchableSelect({ value, op
26
26
  onChange(filtered[0].value);
27
27
  setOpen(false);
28
28
  }
29
- }, placeholder: `Zoek in ${options.length} ${options.length === 1 ? "item" : "items"}…`, className: "pl-8 h-9" })] }) }), _jsxs("div", { className: "max-h-64 overflow-y-auto py-1", children: [allowClear && (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-center gap-2", onClick: () => { onChange(null); setOpen(false); }, children: [value === null && _jsx(Check, { className: "h-3 w-3" }), _jsx("span", { className: "text-muted-foreground italic", children: clearLabel })] })), filtered.length === 0 ? (_jsx("div", { className: "px-3 py-6 text-sm text-muted-foreground text-center", children: emptyLabel })) : (filtered.map((o) => (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-start gap-2", onClick: () => { onChange(o.value); setOpen(false); }, children: [_jsx(Check, { className: `h-3 w-3 mt-1 shrink-0 ${value === o.value ? "" : "invisible"}` }), showImages && _jsx(Thumb, { src: o.image }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: `truncate ${o.muted ? "text-muted-foreground" : ""}`, children: o.label }), o.badge && _jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: o.badge })] }), o.hint && _jsx("div", { className: `text-xs truncate ${o.muted ? "text-muted-foreground/70" : "text-muted-foreground"}`, children: o.hint })] })] }, o.value)))), filtered.length === 200 && (_jsx("div", { className: "px-3 py-2 text-xs text-muted-foreground text-center border-t", children: "Toon eerste 200 resultaten \u2014 verfijn je zoekopdracht" }))] })] })] }));
29
+ }, placeholder: "Zoeken\u2026", className: "pl-8 h-9" })] }) }), _jsxs("div", { className: "max-h-64 overflow-y-auto py-1", children: [allowClear && (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-center gap-2", onClick: () => { onChange(null); setOpen(false); }, children: [value === null && _jsx(Check, { className: "h-3 w-3" }), _jsx("span", { className: "text-muted-foreground italic", children: clearLabel })] })), filtered.length === 0 ? (_jsx("div", { className: "px-3 py-6 text-sm text-muted-foreground text-center", children: emptyLabel })) : (filtered.map((o) => (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-start gap-2", onClick: () => { onChange(o.value); setOpen(false); }, children: [_jsx(Check, { className: `h-3 w-3 mt-1 shrink-0 ${value === o.value ? "" : "invisible"}` }), showImages && _jsx(Thumb, { src: o.image }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: `truncate ${o.muted ? "text-muted-foreground" : ""}`, children: o.label }), o.badge && _jsx("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: o.badge })] }), o.hint && _jsx("div", { className: `text-xs truncate ${o.muted ? "text-muted-foreground/70" : "text-muted-foreground"}`, children: o.hint })] })] }, o.value)))), filtered.length === 200 && (_jsx("div", { className: "px-3 py-2 text-xs text-muted-foreground text-center border-t", children: "Toon eerste 200 resultaten \u2014 verfijn je zoekopdracht" }))] })] })] }));
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AA6PA,wBAAgB,iBAAiB,gCAmiChC"}
1
+ {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AA8RA,wBAAgB,iBAAiB,gCAwhChC"}
@@ -6,7 +6,7 @@ import { Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
6
6
  import { Download, Plus, AlertTriangle, ChevronLeft, ChevronRight, Euro, Layers, ShoppingCart, X, Inbox, PackageOpen, PackageCheck, Truck, ReceiptText, Ban, List, SlidersHorizontal, ChevronDown, SearchX, Clock, Gavel, } from "lucide-react";
7
7
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@flowselections/core";
8
8
  import { useKlokZichtbaar } from "./klok/useKlok.js";
9
- import { KlokOrdersList } from "./klok/KlokOrdersList.js";
9
+ import { KlokOrdersList, useKlokOrders } from "./klok/KlokOrdersList.js";
10
10
  import { useServerFn } from "@tanstack/react-start";
11
11
  import { useNavigate, useSearch } from "@tanstack/react-router";
12
12
  import { saveListNav, saveListScroll, takeRestoreScroll } from "../../lib/order-nav.js";
@@ -119,7 +119,7 @@ function Crossfade({ value }) {
119
119
  function FilterChip({ label, onClear, icon }) {
120
120
  return (_jsxs("button", { type: "button", onClick: onClear, "aria-label": `Filter ${label} wissen`, className: "inline-flex h-8 items-center gap-1.5 rounded-full border border-border bg-muted px-3 text-xs font-medium text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [icon, label, _jsx(X, { className: "h-3.5 w-3.5", "aria-hidden": true })] }));
121
121
  }
122
- function StatusTabs({ tab, counts, onChange, }) {
122
+ function StatusTabs({ tab, counts, onChange, extra, }) {
123
123
  const listRef = useRef(null);
124
124
  const activeId = tab === "backlog" ? "topick" : tab === "problem" ? "all" : tab;
125
125
  useLayoutEffect(() => {
@@ -134,19 +134,25 @@ function StatusTabs({ tab, counts, onChange, }) {
134
134
  window.addEventListener("resize", measure);
135
135
  return () => window.removeEventListener("resize", measure);
136
136
  }, [activeId, counts]);
137
- return (_jsx("div", { className: "shrink-0", children: _jsx("div", { ref: listRef, role: "tablist", "aria-label": "Orderstatus", className: "relative -mx-4 flex items-center gap-2 overflow-x-auto px-4 pb-1 [scrollbar-width:none] [mask-image:linear-gradient(to_right,black_85%,transparent)] [&::-webkit-scrollbar]:hidden sm:mx-0 sm:px-0 sm:[mask-image:none]", children: STATUS_TABS.map((t) => {
138
- const active = activeId === t.id;
139
- return (_jsxs("button", { "data-tab": t.id, type: "button", role: "tab", "aria-selected": active, onClick: () => onChange(t.id), title: t.hint, style: transitionStyle("color, background-color, border-color", 150), className: "relative flex h-9 items-center gap-2 whitespace-nowrap rounded-lg border px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
140
- (active
137
+ return (_jsx("div", { className: "shrink-0", children: _jsxs("div", { ref: listRef, role: "tablist", "aria-label": "Orderstatus", className: "relative -mx-4 flex items-center gap-2 overflow-x-auto px-4 pb-1 [scrollbar-width:none] [mask-image:linear-gradient(to_right,black_85%,transparent)] [&::-webkit-scrollbar]:hidden sm:mx-0 sm:px-0 sm:[mask-image:none]", children: [STATUS_TABS.map((t) => {
138
+ const active = activeId === t.id;
139
+ return (_jsxs("button", { "data-tab": t.id, type: "button", role: "tab", "aria-selected": active, onClick: () => onChange(t.id), title: t.hint, style: transitionStyle("color, background-color, border-color", 150), className: "relative flex h-9 items-center gap-2 whitespace-nowrap rounded-lg border px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
140
+ (active
141
+ ? "border-primary/30 bg-primary/10 font-semibold text-foreground"
142
+ : counts[t.id] === 0
143
+ ? "border-border bg-card text-muted-foreground/70 hover:text-foreground"
144
+ : "border-border bg-card text-foreground/80 hover:bg-muted hover:text-foreground"), children: [(() => {
145
+ const Icon = TAB_ICONS[t.id];
146
+ return Icon ? _jsx(Icon, { className: "h-4 w-4 shrink-0", "aria-hidden": true }) : null;
147
+ })(), _jsx("span", { children: t.label }), _jsx("span", { className: "inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold tabular-nums " +
148
+ (active ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"), children: _jsx(Crossfade, { value: counts[t.id] }) })] }, t.id));
149
+ }), extra && (_jsxs("button", { "data-tab": extra.id, type: "button", role: "tab", "aria-selected": extra.active, onClick: extra.onClick, style: transitionStyle("color, background-color, border-color", 150), className: "relative flex h-9 items-center gap-2 whitespace-nowrap rounded-lg border px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
150
+ (extra.active
141
151
  ? "border-primary/30 bg-primary/10 font-semibold text-foreground"
142
- : counts[t.id] === 0
152
+ : extra.count === 0
143
153
  ? "border-border bg-card text-muted-foreground/70 hover:text-foreground"
144
- : "border-border bg-card text-foreground/80 hover:bg-muted hover:text-foreground"), children: [(() => {
145
- const Icon = TAB_ICONS[t.id];
146
- return Icon ? _jsx(Icon, { className: "h-4 w-4 shrink-0", "aria-hidden": true }) : null;
147
- })(), _jsx("span", { children: t.label }), _jsx("span", { className: "inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold tabular-nums " +
148
- (active ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"), children: _jsx(Crossfade, { value: counts[t.id] }) })] }, t.id));
149
- }) }) }));
154
+ : "border-border bg-card text-foreground/80 hover:bg-muted hover:text-foreground"), children: [_jsx(extra.icon, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), _jsx("span", { children: extra.label }), _jsx("span", { className: "inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold tabular-nums " +
155
+ (extra.active ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"), children: extra.count == null ? "–" : _jsx(Crossfade, { value: extra.count }) })] }, extra.id))] }) }));
150
156
  }
151
157
  const eur0 = (n) => `€ ${Math.round(n).toLocaleString("nl-NL")}`;
152
158
  // Statusfiltering, buffer-groepering en totalen gebeuren serverside
@@ -170,6 +176,9 @@ export function VerkoopOrdersPage() {
170
176
  ...periodFromSearch(urlSearch),
171
177
  search: typeof urlSearch.q === "string" ? urlSearch.q.slice(0, 100) : undefined,
172
178
  }));
179
+ const klokRange = periodRange(filters);
180
+ // Teller op de Klok-tab: zelfde lijst (en cache) als het Klok-tabblad zelf.
181
+ const klokQ = useKlokOrders(klokRange?.startDate ?? null, klokRange?.endDate ?? null, klokZichtbaar);
173
182
  const periodKey = JSON.stringify(periodToSearch(periodFromSearch(urlSearch)));
174
183
  useEffect(() => {
175
184
  // URL gewijzigd van buitenaf (terug/vooruit): periode overnemen.
@@ -612,11 +621,14 @@ export function VerkoopOrdersPage() {
612
621
  }, className: "rounded-sm font-medium text-destructive underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [kpiCounts.backlog, " te laat"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("button", { type: "button", "aria-pressed": tab === "problem", onClick: (e) => {
613
622
  e.stopPropagation();
614
623
  toggleTab("problem");
615
- }, className: "rounded-sm font-medium text-destructive underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: features.pickProgress ? `${kpiCounts.problem} probleem` : "probleem onbekend" })] }) })] }), _jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(StatusTabs, { tab: showKlok && klokZichtbaar ? "__klok" : tab, counts: statusCounts, onChange: (t) => {
616
- setShowKlok(false);
617
- setTab(t);
618
- } }) }), klokZichtbaar && (_jsxs("button", { type: "button", role: "tab", "aria-selected": showKlok, onClick: () => setShowKlok((v) => !v), className: "mb-1 flex h-9 shrink-0 items-center gap-2 whitespace-nowrap rounded-lg border px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
619
- (showKlok ? "border-primary/30 bg-primary/10 font-semibold text-foreground" : "border-border bg-card text-foreground/80 hover:bg-muted hover:text-foreground"), children: [_jsx(Gavel, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), _jsx("span", { children: "Klok" })] }))] }), _jsxs("div", { className: "shrink-0 flex flex-wrap items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SalesOrdersFilters, { value: filters, onChange: setFilters, part: "search", busy: searchPending }) }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setFilterPanelOpen(true), "aria-label": "Filters", className: "relative h-10 px-3 sm:h-9", children: [_jsx(SlidersHorizontal, { className: "h-4 w-4 sm:mr-2" }), _jsx("span", { className: "hidden sm:inline", children: "Filters" }), activeFilterCount > 0 && (_jsx("span", { className: "ml-2 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground", children: activeFilterCount }))] }), tab === "backlog" && (_jsx(FilterChip, { label: "Te laat", icon: _jsx(Clock, { className: "h-3.5 w-3.5 text-destructive", "aria-hidden": true }), onClear: () => setTab("topick") })), tab === "problem" && (_jsx(FilterChip, { label: "Probleem", icon: _jsx(AlertTriangle, { className: "h-3.5 w-3.5 text-warning", "aria-hidden": true }), onClear: () => setTab("all") })), filters.search && !userLoading && !searchPending && totalCount === 0 && filters.period !== "custom" && (_jsx(Button, { variant: "outline", size: "sm", onClick: () => {
624
+ }, className: "rounded-sm font-medium text-destructive underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: features.pickProgress ? `${kpiCounts.problem} probleem` : "probleem onbekend" })] }) })] }), _jsx(StatusTabs, { tab: showKlok && klokZichtbaar ? "__klok" : tab, counts: statusCounts, onChange: (t) => {
625
+ setShowKlok(false);
626
+ setTab(t);
627
+ }, extra: klokZichtbaar ? {
628
+ id: "__klok", label: "Klok", icon: Gavel, active: showKlok,
629
+ count: klokQ.data ? (klokQ.data.orders ?? []).filter((o) => o.status !== "verwijderd").length : null,
630
+ onClick: () => setShowKlok((v) => !v),
631
+ } : undefined }), _jsxs("div", { className: "shrink-0 flex flex-wrap items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SalesOrdersFilters, { value: filters, onChange: setFilters, part: "search", busy: searchPending }) }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setFilterPanelOpen(true), "aria-label": "Filters", className: "relative h-10 px-3 sm:h-9", children: [_jsx(SlidersHorizontal, { className: "h-4 w-4 sm:mr-2" }), _jsx("span", { className: "hidden sm:inline", children: "Filters" }), activeFilterCount > 0 && (_jsx("span", { className: "ml-2 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground", children: activeFilterCount }))] }), tab === "backlog" && (_jsx(FilterChip, { label: "Te laat", icon: _jsx(Clock, { className: "h-3.5 w-3.5 text-destructive", "aria-hidden": true }), onClear: () => setTab("topick") })), tab === "problem" && (_jsx(FilterChip, { label: "Probleem", icon: _jsx(AlertTriangle, { className: "h-3.5 w-3.5 text-warning", "aria-hidden": true }), onClear: () => setTab("all") })), filters.search && !userLoading && !searchPending && totalCount === 0 && filters.period !== "custom" && (_jsx(Button, { variant: "outline", size: "sm", onClick: () => {
620
632
  const t = amsterdamYmd();
621
633
  const from = ymdString({ ...t, y: t.y - 1, d: t.m === 2 && t.d === 29 ? 28 : t.d });
622
634
  setFilters({ ...filters, period: "custom", customFrom: from, customTo: ymdString(t) });
@@ -1 +1 @@
1
- {"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AAqEA,wBAAgB,aAAa,gCAkqB5B"}
1
+ {"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,aAAa,gCAgsB5B"}