@flowselections/floriday-verkoop-module 1.0.141 → 1.0.143
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.
- package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/CreateOrderPage.js +274 -203
- package/dist-lib/components/verkoop/EngineBufferCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/EngineBufferCard.js +2 -4
- package/dist-lib/components/verkoop/FloridaySyncSettings.d.ts.map +1 -1
- package/dist-lib/components/verkoop/FloridaySyncSettings.js +2 -1
- package/dist-lib/components/verkoop/OrderCarrierPicker.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderCarrierPicker.js +5 -1
- package/dist-lib/components/verkoop/OrderControlStatusCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderControlStatusCard.js +2 -10
- package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts +7 -1
- package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderKarindelingCard.js +4 -3
- package/dist-lib/components/verkoop/OrderLinePackingCard.js +2 -2
- package/dist-lib/components/verkoop/OrderPickupMomentPicker.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderPickupMomentPicker.js +4 -8
- package/dist-lib/components/verkoop/OrderShipmentsCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderShipmentsCard.js +2 -4
- package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.js +34 -9
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +37 -11
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -14
- package/dist-lib/components/verkoop/SearchableSelect.d.ts +10 -1
- package/dist-lib/components/verkoop/SearchableSelect.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SearchableSelect.js +13 -4
- package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/VerkoopOrdersPage.js +3 -2
- package/dist-lib/components/verkoop/v3/InfoCard.js +1 -1
- package/dist-lib/components/verkoop/v3/OrderProgress.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/OrderProgress.js +3 -8
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts +2 -1
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/OrderStepper.js +7 -8
- package/dist-lib/integrations/supabase/types.d.ts +16 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/buffer-carts.d.ts +15 -0
- package/dist-lib/lib/buffer-carts.d.ts.map +1 -1
- package/dist-lib/lib/buffer-carts.js +21 -0
- package/dist-lib/lib/buffer-pick-progress.check.d.ts +2 -0
- package/dist-lib/lib/buffer-pick-progress.check.d.ts.map +1 -0
- package/dist-lib/lib/buffer-pick-progress.check.js +11 -0
- package/dist-lib/lib/create-order-customers.d.ts +8 -0
- package/dist-lib/lib/create-order-customers.d.ts.map +1 -0
- package/dist-lib/lib/create-order-customers.js +18 -0
- package/dist-lib/lib/create-order-form.check.d.ts +2 -0
- package/dist-lib/lib/create-order-form.check.d.ts.map +1 -0
- package/dist-lib/lib/create-order-form.check.js +27 -0
- package/dist-lib/lib/create-order-form.d.ts +22 -0
- package/dist-lib/lib/create-order-form.d.ts.map +1 -0
- package/dist-lib/lib/create-order-form.js +52 -0
- package/dist-lib/lib/create-order.functions.d.ts +21 -1
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.js +66 -19
- package/dist-lib/lib/delivery-format.check.d.ts +2 -0
- package/dist-lib/lib/delivery-format.check.d.ts.map +1 -0
- package/dist-lib/lib/delivery-format.check.js +32 -0
- package/dist-lib/lib/delivery-format.d.ts +31 -0
- package/dist-lib/lib/delivery-format.d.ts.map +1 -0
- package/dist-lib/lib/delivery-format.js +70 -0
- package/dist-lib/lib/floriday-invoice-line.check.d.ts +2 -0
- package/dist-lib/lib/floriday-invoice-line.check.d.ts.map +1 -0
- package/dist-lib/lib/floriday-invoice-line.check.js +18 -0
- package/dist-lib/lib/floriday-status.d.ts +6 -0
- package/dist-lib/lib/floriday-status.d.ts.map +1 -1
- package/dist-lib/lib/floriday-status.js +26 -0
- package/dist-lib/lib/nl-datetime.check.d.ts +2 -0
- package/dist-lib/lib/nl-datetime.check.d.ts.map +1 -0
- package/dist-lib/lib/nl-datetime.check.js +14 -0
- package/dist-lib/lib/nl-datetime.d.ts +6 -0
- package/dist-lib/lib/nl-datetime.d.ts.map +1 -0
- package/dist-lib/lib/nl-datetime.js +39 -0
- package/dist-lib/lib/order-pickup.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-pickup.functions.js +4 -57
- package/dist-lib/lib/order-pickup.server.d.ts +38 -0
- package/dist-lib/lib/order-pickup.server.d.ts.map +1 -0
- package/dist-lib/lib/order-pickup.server.js +76 -0
- package/dist-lib/lib/order-progress.server.d.ts +23 -0
- package/dist-lib/lib/order-progress.server.d.ts.map +1 -1
- package/dist-lib/lib/order-progress.server.js +25 -0
- package/dist-lib/lib/pickup-seed.check.d.ts +2 -0
- package/dist-lib/lib/pickup-seed.check.d.ts.map +1 -0
- package/dist-lib/lib/pickup-seed.check.js +18 -0
- package/dist-lib/lib/salesorders-list.functions.d.ts +43 -0
- package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.functions.js +29 -0
- package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +4 -3
- package/dist-lib/lib/salesorders-mapping.d.ts +6 -0
- package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-mapping.js +1 -0
- package/dist-lib/lib/salesorders.functions.d.ts +15 -0
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.js +35 -3
- package/dist-lib/lib/useDetailProgressFallback.d.ts +17 -0
- package/dist-lib/lib/useDetailProgressFallback.d.ts.map +1 -0
- package/dist-lib/lib/useDetailProgressFallback.js +28 -0
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts +24 -0
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts.map +1 -1
- package/dist-lib/lib/usePickupMoment.d.ts +44 -0
- package/dist-lib/lib/usePickupMoment.d.ts.map +1 -0
- package/dist-lib/lib/usePickupMoment.js +46 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineBufferCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/EngineBufferCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EngineBufferCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/EngineBufferCard.tsx"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAkJvE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNL } from "../../lib/nl-datetime.js";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
5
|
import { useServerFn } from "@tanstack/react-start";
|
|
@@ -8,10 +9,7 @@ import { getEngineBufferForOrder, releaseEngineBuffer, } from "../../lib/logisti
|
|
|
8
9
|
function fmt(value) {
|
|
9
10
|
if (!value)
|
|
10
11
|
return "—";
|
|
11
|
-
|
|
12
|
-
if (Number.isNaN(d.getTime()))
|
|
13
|
-
return String(value);
|
|
14
|
-
return d.toLocaleString("nl-NL", { dateStyle: "short", timeStyle: "short" });
|
|
12
|
+
return fmtNL(value, { dateStyle: "short", timeStyle: "short" }) ?? String(value);
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* Toont de bufferbeslissing van de Logistics Engine. In schaduwmodus staat
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloridaySyncSettings.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/FloridaySyncSettings.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FloridaySyncSettings.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/FloridaySyncSettings.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,wBAAwB,uCAuDvC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNLDefault } from "../../lib/nl-datetime.js";
|
|
2
3
|
// Instellingenkaart "Floriday": handmatig de al binnengekomen Floriday-orders
|
|
3
4
|
// doorzetten naar de orderlijst. Alleen zichtbaar bij een actieve koppeling.
|
|
4
5
|
// De automatische ophaalronde en de realtime-verversing blijven gewoon lopen.
|
|
@@ -43,6 +44,6 @@ export function FloridaySyncSettingsCard() {
|
|
|
43
44
|
setSyncing(false);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
const last = health.lastSuccessAt ?
|
|
47
|
+
const last = health.lastSuccessAt ? (fmtNLDefault(health.lastSuccessAt) ?? "nog nooit") : "nog nooit";
|
|
47
48
|
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Floriday" }), _jsx(CardDescription, { children: "Floriday-orders komen automatisch binnen. Hier kun je ze ook handmatig direct ophalen." })] }), _jsx(CardContent, { children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [_jsxs("p", { className: "text-sm text-muted-foreground", children: ["Laatst met succes opgehaald: ", last] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: handleSync, disabled: syncing, children: [_jsx(RefreshCw, { className: "mr-2 h-4 w-4 motion-reduce:animate-none " + (syncing ? "animate-spin" : "") }), "Floriday-orders nu ophalen"] })] }) })] }));
|
|
48
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderCarrierPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderCarrierPicker.tsx"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,aAAqB,EACrB,OAAe,EACf,MAAc,EACd,SAAS,GACV,EAAE;IACD,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,+
|
|
1
|
+
{"version":3,"file":"OrderCarrierPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderCarrierPicker.tsx"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,aAAqB,EACrB,OAAe,EACf,MAAc,EACd,SAAS,GACV,EAAE;IACD,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,+BA2GA"}
|
|
@@ -55,5 +55,9 @@ export function OrderCarrierPicker({ orderId, applyToBuffer = false, compact = f
|
|
|
55
55
|
setSaving(false);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
return (_jsxs("div", { className: compact ? "space-y-1" : "
|
|
58
|
+
return (_jsxs("div", { className: compact ? "min-w-0 space-y-1" : "flex min-w-0 max-w-full flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [!compact && _jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }), _jsxs("select", { className: "h-9 w-full min-w-0 max-w-full rounded-md border border-border bg-background px-2 text-sm text-foreground disabled:opacity-60", value: value, disabled: saving || q.isLoading || q.isError, onChange: (e) => onChange(e.target.value), children: [_jsx("option", { value: AUTO, children: "Automatisch" }), options.map((o) => (_jsx("option", { value: o.id, children: o.name }, o.id)))] }), saving && _jsx("span", { className: "text-xs text-muted-foreground", children: "Opslaan\u2026" })] }), q.isError && (_jsx("span", { className: "text-xs text-destructive", children: q.error?.message ?? "Vervoerder kon niet worden geladen" })), resolved && (_jsx("span", { className: `text-xs ${resolved.state === "ok" ? "text-muted-foreground" : "text-destructive"}`, children: resolved.state === "ok"
|
|
59
|
+
? isManual
|
|
60
|
+
? `Handmatig gekozen: ${resolved.carrierName ?? "onbekend"}`
|
|
61
|
+
: `Automatisch gekozen: ${resolved.carrierName ?? "onbekend"}`
|
|
62
|
+
: carrierLine(resolved) })), resolved?.state === "geen" && (_jsx("a", { href: "/afhandeling/vervoerders", className: "text-xs text-primary underline", children: "Stel een vervoerder in bij Afhandeling \u2192 Vervoerders" })), resolved?.warning && _jsx("span", { className: "text-xs text-muted-foreground", children: resolved.warning }), (resolved?.adminNotice || notice) && (_jsxs("span", { className: "text-xs text-muted-foreground", children: ["Voor beheer: ", notice ?? resolved?.adminNotice] })), (applyToBuffer || (groupSize ?? 0) > 1) && (_jsx("span", { className: "text-xs font-medium text-warning-soft-foreground", children: groupSize && groupSize > 1 ? `Geldt voor alle ${groupSize} orders in deze groep` : "Geldt voor alle orders in deze groep" })), results && (_jsx("ul", { className: "text-xs", children: results.map((r) => (_jsxs("li", { className: r.ok ? "text-muted-foreground" : "text-destructive", children: [r.orderNumber ?? r.orderId, ": ", r.ok ? "gelukt" : `niet gelukt – ${r.error}`] }, r.orderId))) })), error && _jsx("span", { className: "text-xs text-destructive", children: error })] }));
|
|
59
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderControlStatusCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderControlStatusCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrderControlStatusCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderControlStatusCard.tsx"],"names":[],"mappings":"AAeA,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,YAAY,EACZ,YAAY,GACb,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,+BA+DA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNL } from "../../lib/nl-datetime.js";
|
|
2
3
|
// Handmatige controle-markering na orderpicking. Dit is een overschrijving
|
|
3
4
|
// door de gebruiker; het controleert niet of alle karren daadwerkelijk gescand zijn.
|
|
4
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
@@ -10,16 +11,7 @@ import { setSalesOrderControlled } from "../../lib/salesorders.functions.js";
|
|
|
10
11
|
function fmt(iso) {
|
|
11
12
|
if (!iso)
|
|
12
13
|
return "";
|
|
13
|
-
|
|
14
|
-
if (Number.isNaN(d.getTime()))
|
|
15
|
-
return iso;
|
|
16
|
-
return d.toLocaleString("nl-NL", {
|
|
17
|
-
day: "numeric",
|
|
18
|
-
month: "short",
|
|
19
|
-
year: "numeric",
|
|
20
|
-
hour: "2-digit",
|
|
21
|
-
minute: "2-digit",
|
|
22
|
-
});
|
|
14
|
+
return fmtNL(iso, { day: "numeric", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" }) ?? iso;
|
|
23
15
|
}
|
|
24
16
|
export function OrderControlStatusCard({ floridayId, isControlled, controlledAt, }) {
|
|
25
17
|
const queryClient = useQueryClient();
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { SalesOrderDTO } from "../../lib/salesorders-mapping.js";
|
|
2
|
-
export declare function OrderKarindelingCard({ order }: {
|
|
2
|
+
export declare function OrderKarindelingCard({ order, pickProgress, }: {
|
|
3
3
|
order: SalesOrderDTO;
|
|
4
|
+
/** Geprint/gepickt per kar, zelfde bron als de lijst (alleen weergave). */
|
|
5
|
+
pickProgress?: {
|
|
6
|
+
cartsTotal?: number | null;
|
|
7
|
+
cartsPrinted?: number | null;
|
|
8
|
+
cartsScanned?: number | null;
|
|
9
|
+
} | null;
|
|
4
10
|
}): import("react").JSX.Element;
|
|
5
11
|
/** Lange Engine-tekst volledig tonen; boven ±160 tekens inklapbaar. */
|
|
6
12
|
export declare function ExpandableText({ text }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderKarindelingCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderKarindelingCard.tsx"],"names":[],"mappings":"
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNLDefault } from "../../lib/nl-datetime.js";
|
|
2
3
|
// Toont de karindeling van deze order zoals de Logistiek Engine die levert
|
|
3
4
|
// (logistics_order_plan_coverage). Deze kaart leest order_carts/
|
|
4
5
|
// order_cart_items niet zelf en berekent niets: alleen de regels van DEZE
|
|
@@ -28,8 +29,8 @@ const PICK_LABEL = {
|
|
|
28
29
|
const JUST_CREATED_MS = 120000;
|
|
29
30
|
// "Karindeling wordt gemaakt…" alleen de eerste korte wachttijd, nooit als eindstand.
|
|
30
31
|
const CREATING_LABEL_MS = 20000;
|
|
31
|
-
const fmt = (v) => (v ?
|
|
32
|
-
export function OrderKarindelingCard({ order }) {
|
|
32
|
+
const fmt = (v) => (v ? fmtNLDefault(v) : null);
|
|
33
|
+
export function OrderKarindelingCard({ order, pickProgress, }) {
|
|
33
34
|
// Lokale orders hebben een prefix in hun DTO-id; Floriday-orders hun
|
|
34
35
|
// salesOrderId. De server zoekt de juiste order op.
|
|
35
36
|
const rawId = order?.id ?? null;
|
|
@@ -106,7 +107,7 @@ export function OrderKarindelingCard({ order }) {
|
|
|
106
107
|
? 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 }))
|
|
107
108
|
: Array.isArray(cov?.pickRows) ? cov.pickRows : [];
|
|
108
109
|
const [layersFor, setLayersFor] = useState(null);
|
|
109
|
-
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)}` : ""] })] }), 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: [
|
|
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: [
|
|
110
111
|
p.printedAt ? `Geprint ${fmt(p.printedAt)}` : "Nog niet geprint",
|
|
111
112
|
p.completedAt ? `Afgerond ${fmt(p.completedAt)}` : null,
|
|
112
113
|
]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNLDefault } from "../../lib/nl-datetime.js";
|
|
2
3
|
// Belading per bestelregel: zichtbaar maken en handmatig vastzetten/losmaken.
|
|
3
4
|
//
|
|
4
5
|
// Vastzetten beschermt de regel tegen overschrijven door de volgende
|
|
@@ -15,8 +16,7 @@ import { listOrderItemPacking, setOrderItemPacking, previewOrderItemPacking, cle
|
|
|
15
16
|
function fmtWhen(iso) {
|
|
16
17
|
if (!iso)
|
|
17
18
|
return "";
|
|
18
|
-
|
|
19
|
-
return Number.isNaN(d.getTime()) ? "" : d.toLocaleString("nl-NL");
|
|
19
|
+
return fmtNLDefault(iso) ?? "";
|
|
20
20
|
}
|
|
21
21
|
function LineRow({ item, onChanged, orderId, }) {
|
|
22
22
|
const setEngineMelding = useSetEngineMelding(orderId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderPickupMomentPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderPickupMomentPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrderPickupMomentPicker.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderPickupMomentPicker.tsx"],"names":[],"mappings":"AAQA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,QAAgB,EAChB,OAAe,GAChB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,+BAwEA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { usePickupMoment } from "../../lib/usePickupMoment.js";
|
|
4
5
|
import { useServerFn } from "@tanstack/react-start";
|
|
5
6
|
import { Clock } from "lucide-react";
|
|
6
|
-
import {
|
|
7
|
+
import { setOrderPickupMoment } from "../../lib/order-pickup.functions.js";
|
|
7
8
|
import { formatMoment } from "../../lib/order-departure.js";
|
|
8
9
|
/**
|
|
9
10
|
* Toont het ophaal- en aanmeldmoment zoals de planning het heeft berekend.
|
|
@@ -11,15 +12,10 @@ import { formatMoment } from "../../lib/order-departure.js";
|
|
|
11
12
|
*/
|
|
12
13
|
export function OrderPickupMomentPicker({ orderId, readOnly = false, compact = false, }) {
|
|
13
14
|
const qc = useQueryClient();
|
|
14
|
-
const fetchMoment = useServerFn(getOrderPickupMoment);
|
|
15
15
|
const saveMoment = useServerFn(setOrderPickupMoment);
|
|
16
16
|
const [saving, setSaving] = useState(false);
|
|
17
17
|
const [error, setError] = useState(null);
|
|
18
|
-
const { data, isLoading } =
|
|
19
|
-
queryKey: ["order-pickup-moment", orderId],
|
|
20
|
-
queryFn: () => fetchMoment({ data: { orderId } }),
|
|
21
|
-
staleTime: 30000,
|
|
22
|
-
});
|
|
18
|
+
const { data, isLoading } = usePickupMoment(orderId);
|
|
23
19
|
async function onChange(next) {
|
|
24
20
|
if (!next)
|
|
25
21
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderShipmentsCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderShipmentsCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrderShipmentsCard.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/OrderShipmentsCard.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA6C/D,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,sCAQrE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNL } from "../../lib/nl-datetime.js";
|
|
2
3
|
// Bezorgmomenten (deelleveringen) voor een bestelling.
|
|
3
4
|
// Toont totalen (besteld / gepland / geleverd / openstaand), lijst met shipments
|
|
4
5
|
// en knoppen om nieuwe bezorgmomenten aan te maken en te markeren als geleverd.
|
|
@@ -14,10 +15,7 @@ import { cancelShipment, createShipment, listOrderShipments, markShipmentShipped
|
|
|
14
15
|
function formatDate(iso) {
|
|
15
16
|
if (!iso)
|
|
16
17
|
return "—";
|
|
17
|
-
|
|
18
|
-
if (Number.isNaN(d.getTime()))
|
|
19
|
-
return iso;
|
|
20
|
-
return d.toLocaleDateString("nl-NL", { day: "numeric", month: "short", year: "numeric" });
|
|
18
|
+
return fmtNL(iso, { day: "numeric", month: "short", year: "numeric" }) ?? iso;
|
|
21
19
|
}
|
|
22
20
|
export function OrderShipmentsCard({ order }) {
|
|
23
21
|
// Alleen lokale (en dus reserveer-bare) orders ondersteunen deelleveringen.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAuHA,wBAAgB,oBAAoB,gCAyUnC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { fmtNL } from "../../lib/nl-datetime.js";
|
|
3
|
+
import { seedPickupMoment } from "../../lib/usePickupMoment.js";
|
|
4
|
+
import { bufferPickProgress } from "../../lib/buffer-carts.js";
|
|
5
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
6
|
import { Link, useParams, useSearch } from "@tanstack/react-router";
|
|
4
7
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
8
|
import { useServerFn } from "@tanstack/react-start";
|
|
@@ -22,6 +25,7 @@ import { useSalesOrderDetailQuery } from "../../lib/useSalesOrderDetailQuery.js"
|
|
|
22
25
|
import { useLocalSalesOrderDetailQuery } from "../../lib/useLocalSalesOrderDetailQuery.js";
|
|
23
26
|
import { getOrderAddresses } from "../../lib/order-addresses.functions.js";
|
|
24
27
|
import { orderStageLabel, orderStageBadgeClass } from "../../lib/order-status.js";
|
|
28
|
+
import { useDetailProgressFallback } from "../../lib/useDetailProgressFallback.js";
|
|
25
29
|
import { toProgressMember } from "../../lib/order-progress.js";
|
|
26
30
|
import { listHref, markRestore, neighbours } from "../../lib/order-nav.js";
|
|
27
31
|
import { SourceIcon, sourceLabel } from "./v3/SourceIcon.js";
|
|
@@ -31,10 +35,7 @@ const eur = new Intl.NumberFormat("nl-NL", { style: "currency", currency: "EUR",
|
|
|
31
35
|
function fmtDT(iso) {
|
|
32
36
|
if (!iso)
|
|
33
37
|
return null;
|
|
34
|
-
|
|
35
|
-
if (Number.isNaN(d.getTime()))
|
|
36
|
-
return null;
|
|
37
|
-
return d.toLocaleString("nl-NL", { day: "numeric", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
38
|
+
return fmtNL(iso, { day: "numeric", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" });
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Rij uit de al geladen orderlijst (alleen voorlopige kop en voortgang; het
|
|
@@ -180,11 +181,35 @@ export function SalesOrderDetailPage() {
|
|
|
180
181
|
const rawLocalId = isLocal && salesOrderId.startsWith("local:")
|
|
181
182
|
? salesOrderId.slice("local:".length)
|
|
182
183
|
: null;
|
|
184
|
+
// Factuurstand + pickvoortgang komen mee in het detailverzoek (geen tweede ronde).
|
|
185
|
+
const qcSeed = useQueryClient();
|
|
186
|
+
const seedSrc = (isFloriday ? detailQuery : isLocal ? localDetailQuery : null);
|
|
187
|
+
const seedData = seedSrc?.data?.pickupMoment ?? null;
|
|
188
|
+
const seedArrived = seedSrc?.dataUpdatedAt ?? 0;
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (seedData)
|
|
191
|
+
seedPickupMoment(qcSeed, seedData, seedArrived);
|
|
192
|
+
}, [qcSeed, seedData, seedArrived]);
|
|
193
|
+
const detailProgress = (isFloriday ? detailQuery.data?.progress : isLocal ? localDetailQuery.data?.progress : undefined) ?? null;
|
|
194
|
+
const fallback = useDetailProgressFallback(detailProgress?.invoice === "pending" ? bufferOrders : null);
|
|
183
195
|
const membersFor = (orders) => {
|
|
184
196
|
const fromList = cached.row?.progressMembers ?? [];
|
|
185
|
-
return orders.map((o) =>
|
|
197
|
+
return orders.map((o) => {
|
|
198
|
+
if (detailProgress) {
|
|
199
|
+
const extra = o.orderRowId ? fallback.byId?.[o.orderRowId] : undefined;
|
|
200
|
+
return toProgressMember({ ...o, ...(extra ? { erpInvoice: extra.erpInvoice ?? o.erpInvoice, pickProgress: extra.pickProgress ?? o.pickProgress } : {}) });
|
|
201
|
+
}
|
|
202
|
+
return fromList.find((m) => m.orderNumber === o.orderNumber) ?? toProgressMember(o);
|
|
203
|
+
});
|
|
186
204
|
};
|
|
187
|
-
const features = cached.features ?? { erpInvoices: false, pickProgress: false };
|
|
205
|
+
const features = fallback.features ?? detailProgress?.features ?? cached.features ?? { erpInvoices: false, pickProgress: false };
|
|
206
|
+
const invoiceLoad = !detailProgress
|
|
207
|
+
? (cached.features ? "ok" : "loading")
|
|
208
|
+
: detailProgress.invoice === "ok"
|
|
209
|
+
? "ok"
|
|
210
|
+
: detailProgress.invoice === "failed"
|
|
211
|
+
? "unknown"
|
|
212
|
+
: fallback.state;
|
|
188
213
|
const nav = neighbours(salesOrderId);
|
|
189
214
|
const backHref = listHref();
|
|
190
215
|
const head = primary ?? (cached.row && !(cached.row.bufferSize && cached.row.bufferSize > 1) ? cached.row : null);
|
|
@@ -194,10 +219,10 @@ export function SalesOrderDetailPage() {
|
|
|
194
219
|
const fTotal = floridayMembers.reduce((s, m) => s + m.floridayTotal, 0);
|
|
195
220
|
return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { href: backHref, onClick: () => markRestore(), children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { to: "/floriday-verkoop/verkooporders", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) })) : null, nav.next ? (_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming")}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming")) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
|
|
196
221
|
? head.customer.name
|
|
197
|
-
: `${sourceLabel(sources[0])}-order` }), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
|
|
222
|
+
: `${sourceLabel(sources[0])}-order` }), isBuffer && fTotal > 0 && (_jsxs("p", { className: "text-xs font-medium tabular-nums text-foreground", children: ["Afgemeld: ", fDone, " van ", fTotal] })), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features, invoiceLoad: invoiceLoad }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
|
|
198
223
|
const f = friendlyLoadError(error);
|
|
199
224
|
return (_jsxs("div", { role: "alert", className: "flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive-soft p-4 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium text-foreground", children: f.text }), _jsxs("details", { className: "mt-1 text-xs text-muted-foreground", children: [_jsx("summary", { className: "cursor-pointer", children: "Technische details" }), f.tech] })] }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => activeQuery.refetch(), children: "Opnieuw" })] }));
|
|
200
|
-
})(), !isLoading && !error && !primary && (_jsx("div", { className: "rounded-xl border border-border bg-card p-8 text-center text-sm text-muted-foreground shadow-sm", children: "Order niet gevonden." })), primary && isBuffer && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(Euro, {}), label: "Totale omzet", value: eur.format(totals.revenue), sub: `${bufferOrders.length} orders` }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren", value: engineBuffer ? engineBuffer.karren : totals.karren == null ? "Nog niet bekend" : formatLoadUnits(totals.karren, totals.cartType), sub: engineBuffer && engineBuffer.ladingdragers.length > 0 ? ladingdragerSummary(engineBuffer) : undefined }), _jsx(FactTile, { icon: _jsx(Layers, {}), label: "Fust", value: formatLoadUnits(totals.fusten, totals.crateType) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: primary.customer.name, sub: primary.customer.legalName ?? undefined })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsx(InfoCard, { icon: _jsx(Layers, {}), title: `Orders in deze groep (${bufferOrders.length})`, children: _jsx("div", { className: "space-y-3", children: bufferOrders.map((o) => (_jsx(BufferOrderRow, { order: o, member: membersFor([o])[0], sellerFallback: sellerFallback }, o.id))) }) }), _jsxs("div", { children: [_jsx("div", { className: "mb-2 text-sm font-semibold text-foreground", children: "Gecombineerde karindeling" }), _jsx(OrderKarindelingCard, { order: primary })] })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer en ophalen", children: [_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: primary.id, applyToBuffer: true, compact: true, groupSize: bufferOrders.length, locked: bufferOrders.every((o) => !!o.isReservation) }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: primary.id, readOnly: true, compact: true }), _jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", bufferOrders.length, " orders in deze groep"] })] }), _jsx(BufferAddresses, { orderId: primary.id })] }), fTotal > 0 && (_jsxs(InfoCard, { icon: _jsx(ReceiptText, {}), title: "Floriday", children: [_jsx(InfoRow, { label: "Floriday-orders", children: _jsx("span", { className: "flex flex-wrap gap-1.5", children: bufferOrders.filter((o) => !o.isLocal && o.orderNumber).map((o) => (_jsx(Badge, { variant: "outline", className: "text-xs", children: o.orderNumber }, o.id))) }) }), _jsxs(InfoRow, { label: "Afgemeld", children: [fDone, " van ", fTotal] })] }))] })] })] })), inGroup && !singleInGroup && rawLocalId && _jsx(EngineBufferCard, { orderId: rawLocalId }), primary && !isBuffer && (_jsx(SalesOrderDetailView, { order: primary, sellerFallback: sellerFallback, members: membersFor([primary]), features: features, groupSize: inGroup ? bufferOrders.length : undefined })), rawLocalId && _jsx(EditLocalOrderDialog, { orderId: rawLocalId, open: editOpen, onOpenChange: setEditOpen })] }));
|
|
225
|
+
})(), !isLoading && !error && !primary && (_jsx("div", { className: "rounded-xl border border-border bg-card p-8 text-center text-sm text-muted-foreground shadow-sm", children: "Order niet gevonden." })), primary && isBuffer && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(Euro, {}), label: "Totale omzet", value: eur.format(totals.revenue), sub: `${bufferOrders.length} orders` }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren", value: engineBuffer ? engineBuffer.karren : totals.karren == null ? "Nog niet bekend" : formatLoadUnits(totals.karren, totals.cartType), sub: engineBuffer && engineBuffer.ladingdragers.length > 0 ? ladingdragerSummary(engineBuffer) : undefined }), _jsx(FactTile, { icon: _jsx(Layers, {}), label: "Fust", value: formatLoadUnits(totals.fusten, totals.crateType) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: primary.customer.name, sub: primary.customer.legalName ?? undefined })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsx(InfoCard, { icon: _jsx(Layers, {}), title: `Orders in deze groep (${bufferOrders.length})`, children: _jsx("div", { className: "space-y-3", children: bufferOrders.map((o) => (_jsx(BufferOrderRow, { order: o, member: membersFor([o])[0], sellerFallback: sellerFallback }, o.id))) }) }), _jsxs("div", { children: [_jsx("div", { className: "mb-2 text-sm font-semibold text-foreground", children: "Gecombineerde karindeling" }), _jsx(OrderKarindelingCard, { order: primary, pickProgress: bufferPickProgress(engineBuffer, membersFor(bufferOrders).map((m) => m.pickProgress ?? null)) })] })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer en ophalen", children: [_jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: primary.id, applyToBuffer: true, compact: true, groupSize: bufferOrders.length, locked: bufferOrders.every((o) => !!o.isReservation) }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: primary.id, readOnly: true, compact: true }), _jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", bufferOrders.length, " orders in deze groep"] })] }), _jsx(BufferAddresses, { orderId: primary.id })] }), fTotal > 0 && (_jsxs(InfoCard, { icon: _jsx(ReceiptText, {}), title: "Floriday", children: [_jsx(InfoRow, { label: "Floriday-orders", children: _jsx("span", { className: "flex flex-wrap gap-1.5", children: bufferOrders.filter((o) => !o.isLocal && o.orderNumber).map((o) => (_jsx(Badge, { variant: "outline", className: "text-xs", children: o.orderNumber }, o.id))) }) }), _jsxs(InfoRow, { label: "Afgemeld", children: [fDone, " van ", fTotal] })] }))] })] })] })), inGroup && !singleInGroup && rawLocalId && _jsx(EngineBufferCard, { orderId: rawLocalId }), primary && !isBuffer && (_jsx(SalesOrderDetailView, { order: primary, sellerFallback: sellerFallback, members: membersFor([primary]), features: features, groupSize: inGroup ? bufferOrders.length : undefined })), rawLocalId && _jsx(EditLocalOrderDialog, { orderId: rawLocalId, open: editOpen, onOpenChange: setEditOpen })] }));
|
|
201
226
|
}
|
|
202
227
|
function BufferOrderRow({ order, member, sellerFallback }) {
|
|
203
228
|
const [open, setOpen] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAmC,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGvH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA2JnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAkBA"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { fmtNL, fmtNLDefault } from "../../lib/nl-datetime.js";
|
|
3
|
+
import { floridayInvoiceLine } from "../../lib/floriday-status.js";
|
|
4
|
+
import { usePickupMoment } from "../../lib/usePickupMoment.js";
|
|
5
|
+
import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
|
|
2
6
|
import { formatMoment } from "../../lib/order-departure.js";
|
|
3
7
|
import { AlertTriangle, Boxes, CalendarDays, CheckCircle2, Clock, ClipboardList, ExternalLink, Flower2, ImageIcon, MapPin, ReceiptText, Truck, User } from "lucide-react";
|
|
4
8
|
import { InfoCard, InfoRow, FactTile } from "./v3/InfoCard.js";
|
|
5
|
-
import { toProgressMember } from "../../lib/order-progress.js";
|
|
9
|
+
import { memberInvoice, toProgressMember } from "../../lib/order-progress.js";
|
|
6
10
|
import { useQuery } from "@tanstack/react-query";
|
|
7
11
|
import { useServerFn } from "@tanstack/react-start";
|
|
8
12
|
import { formatBeladingNotation, formatLoadUnits } from "../../lib/load-carrier-labels.js";
|
|
@@ -17,7 +21,6 @@ import { orderUuid } from "../../lib/order-price-lock.js";
|
|
|
17
21
|
import { OrderControlStatusCard } from "./OrderControlStatusCard.js";
|
|
18
22
|
import { OrderCarrierPicker } from "./OrderCarrierPicker.js";
|
|
19
23
|
import { OrderPickupMomentPicker } from "./OrderPickupMomentPicker.js";
|
|
20
|
-
import { FloridayStageLine } from "./FloridayStageLine.js";
|
|
21
24
|
import { getFloridayStatusesForRows } from "../../lib/salesorders-list.functions.js";
|
|
22
25
|
function AddressCard({ icon, lines, extra, }) {
|
|
23
26
|
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 })] })] }));
|
|
@@ -33,15 +36,12 @@ function fmtDateTime(iso) {
|
|
|
33
36
|
return "—";
|
|
34
37
|
// Kale datum: geen verzonnen tijdstip (anders 02:00 door UTC-middernacht).
|
|
35
38
|
const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(String(iso).trim());
|
|
36
|
-
|
|
37
|
-
if (Number.isNaN(d.getTime()))
|
|
38
|
-
return iso;
|
|
39
|
-
return d.toLocaleString("nl-NL", {
|
|
39
|
+
return fmtNL(String(iso).trim(), {
|
|
40
40
|
day: "numeric",
|
|
41
41
|
month: "long",
|
|
42
42
|
year: "numeric",
|
|
43
43
|
...(dateOnly ? {} : { hour: "2-digit", minute: "2-digit" }),
|
|
44
|
-
});
|
|
44
|
+
}) ?? iso;
|
|
45
45
|
}
|
|
46
46
|
function pickStr(v) {
|
|
47
47
|
if (v == null)
|
|
@@ -138,7 +138,7 @@ export function SalesOrderDetailView(props) {
|
|
|
138
138
|
: props.order;
|
|
139
139
|
return _jsx(SalesOrderDetailViewInner, { ...props, order: order, floridayLoading: ids.length > 0 && statusQ.isPending });
|
|
140
140
|
}
|
|
141
|
-
function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hideKarindeling = false, members, groupSize, }) {
|
|
141
|
+
function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hideKarindeling = false, members, features, groupSize, }) {
|
|
142
142
|
const o = order.raw.order ?? {};
|
|
143
143
|
const c = order.raw.customer ?? {};
|
|
144
144
|
const cRaw = c?.raw ?? {};
|
|
@@ -305,11 +305,25 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
305
305
|
const verkoopwijze = [tradingType !== "—" ? tradingType : null, financial !== "—" ? financial : null].filter(Boolean).join(" · ") || "—";
|
|
306
306
|
const showIncoterm = !!fe && incoterm !== "niet opgegeven" && incoterm !== "—";
|
|
307
307
|
const hasExternal = !!order.floridayExternalFulfilledAt || (order.floridayExternalFulfilledIds?.length ?? 0) > 0;
|
|
308
|
-
return (_jsxs("div", { className: "space-y-4", children: [order.needsManualReview ? (_jsxs(Notice, { tone: "destructive", title: "Handmatige controle nodig", children: [order.needsManualReview.reason, order.needsManualReview.at ? ` (gezien op ${
|
|
308
|
+
return (_jsxs("div", { className: "space-y-4", children: [order.needsManualReview ? (_jsxs(Notice, { tone: "destructive", title: "Handmatige controle nodig", children: [order.needsManualReview.reason, order.needsManualReview.at ? ` (gezien op ${fmtNLDefault(order.needsManualReview.at)})` : ""] })) : null, isFlorinOrder && order.mixedDeliveryDates ? (_jsx(Notice, { tone: "muted", title: "Bestellingen met verschillende leverdatums", children: "Deze order bestaat uit Floriday-bestellingen met verschillende leverdatums. De vroegste leverdatum is aangehouden." })) : null, isFlorinOrder && (order.unlinkedProducts?.length ?? 0) > 0 ? (_jsxs(Notice, { tone: "destructive", title: "Artikel uit Floriday nog niet gekoppeld aan een eigen product", children: [_jsx("ul", { className: "mt-1 space-y-0.5", children: order.unlinkedProducts.map((u, i) => (_jsx("li", { children: u.name }, i))) }), _jsx("div", { className: "mt-1 text-xs", children: "Koppel het artikel aan een eigen product; bij de volgende update wordt het overgenomen." })] })) : null, order.floridayMissingLineKeyNotice && (_jsx(Notice, { tone: "destructive", title: "Let op", children: order.floridayMissingLineKeyNotice })), _jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(CalendarDays, {}), label: "Leverdatum", value: order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { year: true, wallClock: deliveryIsWallClockFor(order) }).date : "—", sub: _jsx(DeliveryTileSub, { order: order }) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined }), (() => {
|
|
309
|
+
const noCarrier = !order.cartTypeName || /geen ladingdrager/i.test(order.cartTypeName);
|
|
310
|
+
const fust = order.fustCount > 0 ? `${formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName)} fust` : "";
|
|
311
|
+
return (_jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren / fusten", value: noCarrier ? (fust || "Geen ladingdrager") : formatLoadUnits(order.karCount, order.cartTypeName), sub: [noCarrier ? (fust ? "Geen ladingdrager" : "") : fust, order.karShared ? "kar gedeeld met andere orders" : ""].filter(Boolean).join(" · ") || undefined }));
|
|
312
|
+
})()] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Flower2, {}), title: "Artikelen", attention: priceProblem, children: [_jsx("div", { className: "-mx-4 overflow-x-auto sm:-mx-5", children: _jsxs("table", { className: "w-full min-w-[520px] text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Artikel" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Aantal" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Fust" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Prijs" }), _jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Totaal" })] }) }), _jsx("tbody", { children: _jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: order.productName }), _jsx("div", { className: "text-xs text-muted-foreground", children: order.mixedPacking
|
|
309
313
|
? (order.articleCount ?? 0) > 1 ? `Gemengd (${order.articleCount} artikelen)` : "Gemengd"
|
|
310
|
-
: `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] }) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines }), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(ClipboardList, {}), title: "Orderinformatie", children: [_jsx(InfoRow, { label: "Ordernummer", children: order.orderNumber || "—" }), _jsx(InfoRow, { label: "Status", children: _jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(order.stage ?? "incoming")}`, children: bestellingLabel }) }), _jsx(InfoRow, { label: "Besteld op", children: fmtDateTime(order.orderedAt) }), _jsx(InfoRow, { label: "Klantreferentie", children: klantReferentie }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopkanaal", children: verkoopkanaal }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopwijze", children: verkoopwijze }), isFlorinOrder && _jsx(InfoRow, { label: "Floriday-referentie", children: floridayRef }), _jsx(InfoRow, { label: "Verkoper", children: sellerName ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground", children: initials(sellerName) }), sellerName] })) : "—" }), hasExternal && (_jsx(InfoRow, { label: "Afhandeling", children: order.floridayExternalFulfilledAt
|
|
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
|
|
311
315
|
? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
|
|
312
|
-
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), _jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: String(order.id), locked: !!order.isReservation, compact: true, groupSize: groupSize }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: String(order.id) }), (groupSize ?? 0) > 1 && (_jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", groupSize, " orders in deze groep"] }))] }), showIncoterm && _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm })] }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })),
|
|
316
|
+
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), _jsx(InfoRow, { label: "Vervoerder", children: _jsx(OrderCarrierPicker, { orderId: String(order.id), locked: !!order.isReservation, compact: true, groupSize: groupSize }) }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: String(order.id) }), (groupSize ?? 0) > 1 && (_jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", groupSize, " orders in deze groep"] }))] }), showIncoterm && _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm })] }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: invoiceStandText(member, features) }), _jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), (() => {
|
|
317
|
+
const line = floridayInvoiceLine(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0);
|
|
318
|
+
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 })] })] })] })] })] }));
|
|
320
|
+
}
|
|
321
|
+
/** Zelfde stand als het factuuricoon in de lijst (memberInvoice). */
|
|
322
|
+
function invoiceStandText(member, features) {
|
|
323
|
+
if (!member)
|
|
324
|
+
return "Onbekend";
|
|
325
|
+
const st = memberInvoice(member, features ?? { erpInvoices: false, pickProgress: false });
|
|
326
|
+
return st === "done" ? "Gefactureerd" : st === "attention" ? "Aandacht nodig" : st === "hidden" ? "Onbekend" : st === "error" ? "Fout" : "Nog niet";
|
|
313
327
|
}
|
|
314
328
|
function props_member(order, members) {
|
|
315
329
|
const own = members?.find((m) => m.orderNumber === order.orderNumber) ?? null;
|
|
@@ -328,3 +342,15 @@ function Notice({ tone, title, children }) {
|
|
|
328
342
|
return (_jsxs("div", { role: tone === "destructive" ? "alert" : undefined, className: "flex items-start gap-3 rounded-xl border px-4 py-3 text-sm " +
|
|
329
343
|
(tone === "destructive" ? "border-destructive/40 bg-destructive-soft" : "border-border bg-muted/40"), children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 " + (tone === "destructive" ? "text-destructive" : "text-muted-foreground") }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "font-semibold text-foreground", children: title }), _jsx("div", { className: "text-muted-foreground", children: children })] })] }));
|
|
330
344
|
}
|
|
345
|
+
/** Tweede regel(s) van de tegel Leverdatum: levertijd en ophaalmoment.
|
|
346
|
+
* Het ophaalmoment komt uit dezelfde query als de kaart Vervoer. */
|
|
347
|
+
function DeliveryTileSub({ order }) {
|
|
348
|
+
const pm = usePickupMoment(String(order.id));
|
|
349
|
+
const t = order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { wallClock: deliveryIsWallClockFor(order) }).time : "";
|
|
350
|
+
const short = pm.data ? (pm.data.view?.short ?? null) : null;
|
|
351
|
+
const pickup = pm.data ? short : (order.pickupLabel && order.pickupLabel !== "onbekend" ? order.pickupLabel : null);
|
|
352
|
+
const showSlot = pm.isPending && !pickup;
|
|
353
|
+
if (!t && !pickup && !showSlot)
|
|
354
|
+
return null;
|
|
355
|
+
return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [t && _jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Clock, { className: "h-3.5 w-3.5" }), t] }), pickup ? (_jsxs("span", { className: "block", children: ["Ophalen: ", pickup] })) : showSlot ? (_jsx("span", { className: "block h-4 w-28 animate-pulse rounded bg-muted", "aria-hidden": true })) : null] }));
|
|
356
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAuBlC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAG1D;AAuXD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,QAA2B,EAC3B,SAAmC,EACnC,cAAc,EACd,YAAgB,EAChB,OAAO,EACP,KAAa,EACb,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAc,GACf,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAmJA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
|
|
2
3
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
3
4
|
import { Checkbox, Skeleton, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@flowselections/core";
|
|
4
5
|
import { AlertCircle, ArrowDown, Clock, Eye, SearchX } from "lucide-react";
|
|
@@ -22,18 +23,6 @@ function fmtOrdered(iso) {
|
|
|
22
23
|
time: d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
function fmtDelivery(iso) {
|
|
26
|
-
if (!iso)
|
|
27
|
-
return { date: "—", time: "" };
|
|
28
|
-
const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(iso.trim());
|
|
29
|
-
const d = new Date(dateOnly ? `${iso.trim()}T00:00:00` : iso);
|
|
30
|
-
if (Number.isNaN(d.getTime()))
|
|
31
|
-
return { date: iso, time: "" };
|
|
32
|
-
return {
|
|
33
|
-
date: d.toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short" }),
|
|
34
|
-
time: dateOnly ? "" : d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
26
|
/** Stabiele rij-id: buffers zijn serverside al samengevouwen tot één rij. */
|
|
38
27
|
export function salesOrderRowId(row) {
|
|
39
28
|
const bufferSize = row.bufferSize ?? 1;
|
|
@@ -98,7 +87,7 @@ const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, hig
|
|
|
98
87
|
const isBuffer = !!row.bufferId && size > 1;
|
|
99
88
|
const members = membersOf(row);
|
|
100
89
|
const ordered = fmtOrdered(row.orderedAt);
|
|
101
|
-
const delivery =
|
|
90
|
+
const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row), { wallClock: deliveryIsWallClockFor(row) });
|
|
102
91
|
const d2 = deliveryLine2(row, delivery.time);
|
|
103
92
|
const cancelled = row.stage === "cancelled";
|
|
104
93
|
const place = row.customer.city || row.deliveryLocationLabel || "—";
|
|
@@ -123,7 +112,7 @@ const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, hig
|
|
|
123
112
|
const size = row.bufferSize ?? 1;
|
|
124
113
|
const isBuffer = !!row.bufferId && size > 1;
|
|
125
114
|
const members = membersOf(row);
|
|
126
|
-
const delivery =
|
|
115
|
+
const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row), { wallClock: deliveryIsWallClockFor(row) });
|
|
127
116
|
const d2 = deliveryLine2(row, delivery.time);
|
|
128
117
|
const cancelled = row.stage === "cancelled";
|
|
129
118
|
const h = handlers.current;
|