@flowselections/floriday-verkoop-module 1.0.174 → 1.0.176
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/KlokAanvoerRow.d.ts +11 -0
- package/dist-lib/components/verkoop/KlokAanvoerRow.d.ts.map +1 -0
- package/dist-lib/components/verkoop/KlokAanvoerRow.js +31 -0
- package/dist-lib/components/verkoop/OrderTransportCard.d.ts +1 -0
- package/dist-lib/components/verkoop/OrderTransportCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderTransportCard.js +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.js +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +29 -11
- package/dist-lib/components/verkoop/klok/KlokOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/klok/KlokOrderPage.js +51 -11
- package/dist-lib/components/verkoop/klok/KlokOrdersList.d.ts.map +1 -1
- package/dist-lib/components/verkoop/klok/KlokOrdersList.js +1 -1
- package/dist-lib/components/verkoop/klok/KlokPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/klok/KlokPage.js +10 -1
- package/dist-lib/components/verkoop/v3/OrderProgress.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/OrderProgress.js +6 -0
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/OrderStepper.js +7 -3
- package/dist-lib/integrations/supabase/types.d.ts +1683 -3
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/floriday-mirror.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-mirror.server.js +31 -0
- package/dist-lib/lib/klok-aanvoer.server.d.ts +18 -0
- package/dist-lib/lib/klok-aanvoer.server.d.ts.map +1 -0
- package/dist-lib/lib/klok-aanvoer.server.js +42 -0
- package/dist-lib/lib/klok-floriday.d.ts +100 -0
- package/dist-lib/lib/klok-floriday.d.ts.map +1 -0
- package/dist-lib/lib/klok-floriday.js +221 -0
- package/dist-lib/lib/klok-floriday.server.d.ts +17 -0
- package/dist-lib/lib/klok-floriday.server.d.ts.map +1 -0
- package/dist-lib/lib/klok-floriday.server.js +355 -0
- package/dist-lib/lib/klok-form.d.ts +6 -0
- package/dist-lib/lib/klok-form.d.ts.map +1 -1
- package/dist-lib/lib/klok-form.js +10 -0
- package/dist-lib/lib/klok-payload.d.ts +0 -1
- package/dist-lib/lib/klok-payload.d.ts.map +1 -1
- package/dist-lib/lib/klok-payload.js +2 -2
- package/dist-lib/lib/klok-sales.server.d.ts.map +1 -1
- package/dist-lib/lib/klok-sales.server.js +11 -17
- package/dist-lib/lib/klok.functions.d.ts +40 -1
- package/dist-lib/lib/klok.functions.d.ts.map +1 -1
- package/dist-lib/lib/klok.functions.js +111 -10
- package/dist-lib/lib/klok.server.d.ts +44 -0
- package/dist-lib/lib/klok.server.d.ts.map +1 -1
- package/dist-lib/lib/klok.server.js +81 -68
- package/dist-lib/lib/klokverkoop.d.ts +32 -0
- package/dist-lib/lib/klokverkoop.d.ts.map +1 -0
- package/dist-lib/lib/klokverkoop.js +86 -0
- package/dist-lib/lib/order-carrier.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-carrier.functions.js +9 -0
- package/dist-lib/lib/order-progress.d.ts +9 -0
- package/dist-lib/lib/order-progress.d.ts.map +1 -1
- package/dist-lib/lib/order-progress.js +27 -4
- package/dist-lib/lib/order-status.d.ts +7 -2
- package/dist-lib/lib/order-status.d.ts.map +1 -1
- package/dist-lib/lib/order-status.js +8 -2
- package/dist-lib/lib/order-transport.functions.d.ts +1 -0
- package/dist-lib/lib/order-transport.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-transport.server.d.ts +1 -0
- package/dist-lib/lib/order-transport.server.d.ts.map +1 -1
- package/dist-lib/lib/order-transport.server.js +13 -0
- package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +34 -9
- 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 -1
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.js +14 -3
- package/package.json +1 -1
- package/schema/verkoop.sql +833 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rij "Klokaanvoer" bij een klokverkoop: partijnummer (batchReference), en
|
|
3
|
+
* veildatum en veillocatie als de aanvoerregel bekend is. Een link naar het
|
|
4
|
+
* Klok-scherm alleen als er een eigen veilbrief bij hoort (bestaande koppeling).
|
|
5
|
+
*/
|
|
6
|
+
export declare function KlokAanvoerRow({ batchReference, supplyLineId, salesOrderIds, }: {
|
|
7
|
+
batchReference: string | null;
|
|
8
|
+
supplyLineId: string | null;
|
|
9
|
+
salesOrderIds: string[];
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=KlokAanvoerRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KlokAanvoerRow.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/KlokAanvoerRow.tsx"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,cAAc,EACd,YAAY,EACZ,aAAa,GACd,EAAE;IACD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,kDA8BA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from "@tanstack/react-router";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
5
|
+
import { fmtNL } from "../../lib/nl-datetime.js";
|
|
6
|
+
import { getKlokAanvoer } from "../../lib/klok.functions.js";
|
|
7
|
+
import { InfoRow } from "./v3/InfoCard.js";
|
|
8
|
+
/**
|
|
9
|
+
* Rij "Klokaanvoer" bij een klokverkoop: partijnummer (batchReference), en
|
|
10
|
+
* veildatum en veillocatie als de aanvoerregel bekend is. Een link naar het
|
|
11
|
+
* Klok-scherm alleen als er een eigen veilbrief bij hoort (bestaande koppeling).
|
|
12
|
+
*/
|
|
13
|
+
export function KlokAanvoerRow({ batchReference, supplyLineId, salesOrderIds, }) {
|
|
14
|
+
const fetchAanvoer = useServerFn(getKlokAanvoer);
|
|
15
|
+
const q = useQuery({
|
|
16
|
+
queryKey: ["klok-aanvoer", supplyLineId ?? "", salesOrderIds.join(",")],
|
|
17
|
+
queryFn: () => fetchAanvoer({ data: { salesOrderIds, supplyLineIds: supplyLineId ? [supplyLineId] : [] } }),
|
|
18
|
+
enabled: salesOrderIds.length > 0 || !!supplyLineId,
|
|
19
|
+
staleTime: 5 * 60000,
|
|
20
|
+
retry: 1,
|
|
21
|
+
});
|
|
22
|
+
if (q.isError)
|
|
23
|
+
console.error("[orderpagina] klokaanvoer laden:", q.error);
|
|
24
|
+
const a = q.data?.aanvoer ?? null;
|
|
25
|
+
const vb = q.data?.veilbrief ?? null;
|
|
26
|
+
const veildatum = a?.veildatum ? fmtNL(a.veildatum, { weekday: "short", day: "numeric", month: "short", year: "numeric" }) : null;
|
|
27
|
+
const sub = [veildatum, a?.veillocatie].filter(Boolean).join(" · ");
|
|
28
|
+
if (!batchReference && !sub && !vb)
|
|
29
|
+
return null;
|
|
30
|
+
return (_jsxs(InfoRow, { label: "Klokaanvoer", children: [_jsx("span", { className: "block", children: batchReference ?? "—" }), sub && _jsx("span", { className: "block text-xs text-muted-foreground", children: sub }), vb && (_jsxs(Link, { to: "/floriday-verkoop/klok/$klokId", params: { klokId: vb.id }, className: "mt-0.5 inline-block text-xs font-medium text-primary underline-offset-2 hover:underline", children: ["Veilbrief ", vb.nummer ?? "", " openen"] }))] }));
|
|
31
|
+
}
|
|
@@ -7,6 +7,7 @@ export declare function useOrderTransport(orderId: string | null | undefined, en
|
|
|
7
7
|
carrier: import("../../lib/carrier-resolve.js").ResolvedCarrier;
|
|
8
8
|
carrierGln: string | null;
|
|
9
9
|
floridayCarrierNotice: string | null;
|
|
10
|
+
klokVervoerOnzeker: string | null;
|
|
10
11
|
own: boolean;
|
|
11
12
|
ownKind: string | null;
|
|
12
13
|
ownPickup: {
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;WAQnF;AAED,0GAA0G;AAC1G,wBAAgB,yBAAyB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAMnE;AAED,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,kDAkB1E;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,2CA6CA;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,2CA4F9H;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,kDAWrE"}
|
|
@@ -105,7 +105,7 @@ export function OrderTransportCard({ order, groupSize, extra }) {
|
|
|
105
105
|
const missingOwnTime = view.melding === "invullen";
|
|
106
106
|
const signup = !t?.own && !afgehandeld ? formatMoment(pm.data?.departure?.signupDeadline ?? null) : null;
|
|
107
107
|
const karren = Number(order.karCount ?? 0);
|
|
108
|
-
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 ? (_jsxs(InfoRow, { label: "Vervoerder", children: [_jsx(OrderCarrierPicker, { orderId: orderId, locked: true, compact: true }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : changing ? (_jsxs(InfoRow, { label: "Vervoerder", children: [_jsx(OrderCarrierPicker, { orderId: orderId, compact: true, groupSize: groupSize }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : q.isLoading ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) })) : q.isError ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-destructive", children: "Het vervoer kon nu niet worden gelezen. Lukt het later nog niet, neem dan contact op met de beheerder." }) })) : hasCarrier ? (_jsxs(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" })] }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : (_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] }));
|
|
108
|
+
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] })), t?.klokVervoerOnzeker && (_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: t.klokVervoerOnzeker })), 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 ? (_jsxs(InfoRow, { label: "Vervoerder", children: [_jsx(OrderCarrierPicker, { orderId: orderId, locked: true, compact: true }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : changing ? (_jsxs(InfoRow, { label: "Vervoerder", children: [_jsx(OrderCarrierPicker, { orderId: orderId, compact: true, groupSize: groupSize }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : q.isLoading ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) })) : q.isError ? (_jsx(InfoRow, { label: "Vervoerder", children: _jsx("span", { className: "text-sm text-destructive", children: "Het vervoer kon nu niet worden gelezen. Lukt het later nog niet, neem dan contact op met de beheerder." }) })) : hasCarrier ? (_jsxs(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" })] }), t?.floridayCarrierNotice && _jsx(FloridayCarrierNoticeText, { text: t.floridayCarrierNotice })] })) : (_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] }));
|
|
109
109
|
}
|
|
110
110
|
/** Kopregel van een handmatige order: "Ophalen do 29 okt 15:00 · Levering vr 30 okt 08:00". */
|
|
111
111
|
export function PickupDeliveryLine({ order }) {
|
|
@@ -262,7 +262,7 @@ export function SalesOrderDetailPage() {
|
|
|
262
262
|
const floridayMembers = membersFor(bufferOrders).filter((m) => m.invoiceRoute === "floriday" && !m.cancelled);
|
|
263
263
|
const fDone = floridayMembers.reduce((s, m) => s + m.floridayDone, 0);
|
|
264
264
|
const fTotal = floridayMembers.reduce((s, m) => s + m.floridayTotal, 0);
|
|
265
|
-
return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(NavigationTooltip, { label: "Terug naar verkooporders", shortcut: "Esc", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { ref: backLink, href: backHref, onClick: () => markRestore(), "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { ref: backLink, to: "/floriday-verkoop/verkooporders", "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(NavigationTooltip, { label: "Vorige order", shortcut: "\u2190", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: previousLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, "aria-keyshortcuts": "ArrowLeft", children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) }) })) : null, nav.next ? (_jsx(NavigationTooltip, { label: "Volgende order", shortcut: "\u2192", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: nextLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, "aria-keyshortcuts": "ArrowRight", children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming")}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming"), head.stageNote ?? null) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
|
|
265
|
+
return (_jsxs("main", { className: "mx-auto w-full max-w-[1200px] space-y-4 p-4 pb-24 sm:p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx(NavigationTooltip, { label: "Terug naar verkooporders", shortcut: "Esc", children: _jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "-ml-2", children: backHref ? (_jsxs("a", { ref: backLink, href: backHref, onClick: () => markRestore(), "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) : (_jsxs(Link, { ref: backLink, to: "/floriday-verkoop/verkooporders", "aria-keyshortcuts": "Escape", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Terug naar verkooporders"] })) }) }), nav && (nav.prev || nav.next) && (_jsxs("div", { className: "flex items-center gap-2", children: [nav.prev ? (_jsx(NavigationTooltip, { label: "Vorige order", shortcut: "\u2190", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: previousLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.prev }, "aria-keyshortcuts": "ArrowLeft", children: [_jsx(ChevronLeft, { className: "mr-1 h-4 w-4" }), " Vorige"] }) }) })) : null, nav.next ? (_jsx(NavigationTooltip, { label: "Volgende order", shortcut: "\u2192", children: _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsxs(Link, { ref: nextLink, to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: nav.next }, "aria-keyshortcuts": "ArrowRight", children: ["Volgende ", _jsx(ChevronRight, { className: "ml-1 h-4 w-4" })] }) }) })) : null] }))] }), head && (_jsxs("header", { className: "flex flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-sm sm:flex-row sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "inline-flex h-14 w-14 shrink-0 items-center justify-center rounded-xl bg-primary/10", children: _jsx(SourceIcon, { sources: sources }) }), _jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: isBuffer ? `Samengevoegde order · ${bufferOrders.length} orders` : head.orderNumber || "Order" }), !isBuffer && (_jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(head.stage ?? "incoming", { klokverkoop: head.klokverkoop === true })}`, children: orderStageLabel(head.stage ?? (head.status?.isCancelled ? "cancelled" : "incoming"), head.stageNote ?? null, { klokverkoop: head.klokverkoop === true, klokverkoopSoort: head.klokverkoopSoort ?? null }) }))] }), _jsx("p", { className: "text-sm text-muted-foreground", children: isBuffer
|
|
266
266
|
? head.customer.name
|
|
267
267
|
: `${sourceLabel(sources[0])}-order` }), isBuffer && fTotal > 0 && (_jsxs("p", { className: "text-xs font-medium tabular-nums text-foreground", children: ["Afgemeld: ", fDone, " van ", fTotal] })), !isBuffer && isLocal && _jsx(PickupDeliveryLine, { order: head }), !isBuffer && fmtDT(head.orderedAt) && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Ontvangen op ", fmtDT(head.orderedAt)] }))] })] }), rawLocalId && !isBuffer && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), disabled: !primary, className: "w-full sm:w-auto", children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bestelling bewerken"] }))] })), singleInGroup && inGroup && primary && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-xl border border-primary/30 bg-primary/5 px-4 py-3 text-sm", children: [_jsxs("span", { className: "inline-flex items-center gap-2 text-foreground", children: [_jsx(Layers, { className: "h-4 w-4 text-primary" }), " Onderdeel van een samengevoegde order met ", bufferOrders.length, " orders"] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId }, children: "Naar samengevoegde weergave" }) })] })), primary && _jsx(OrderStepper, { members: membersFor(isBuffer ? bufferOrders : [primary]), features: features, invoiceLoad: invoiceLoad }), isLoading && !primary && _jsx(DetailSkeleton, {}), error && !primary && (() => {
|
|
268
268
|
const f = friendlyLoadError(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrderDetailView.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailView.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAmC,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGvH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
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;AAuKnE,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,2CAkBA"}
|
|
@@ -28,6 +28,8 @@ import { OrderTijdlijnCard } from "./tijdlijn/OrderTijdlijnCard.js";
|
|
|
28
28
|
import { OrderLineExtrasCard } from "./regel/OrderLineExtrasCard.js";
|
|
29
29
|
import { listOrderItemPacking } from "../../lib/order-item-packing.functions.js";
|
|
30
30
|
import { formatBelading } from "../../lib/belading-format.js";
|
|
31
|
+
import { klokverkoopAfgerekend, klokverkoopKop, klokverkoopSoort, veilingTekst } from "../../lib/klokverkoop.js";
|
|
32
|
+
import { KlokAanvoerRow } from "./KlokAanvoerRow.js";
|
|
31
33
|
function AddressCard({ icon, lines, extra, }) {
|
|
32
34
|
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
35
|
}
|
|
@@ -105,6 +107,7 @@ const SALES_INTERFACE_LABELS = {
|
|
|
105
107
|
const PAYMENT_PROVIDER_LABELS = {
|
|
106
108
|
RFH: "Royal FloraHolland",
|
|
107
109
|
RFH_E_WALLET: "Royal FloraHolland (E-wallet)",
|
|
110
|
+
VRM: "Veiling Rhein-Maas",
|
|
108
111
|
PLANTION: "Plantion",
|
|
109
112
|
DIRECT: "Direct",
|
|
110
113
|
};
|
|
@@ -151,6 +154,8 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
151
154
|
const cRaw = c?.raw ?? {};
|
|
152
155
|
// Floriday-order die nog niet als eigen order bestaat: niets opvragen dat een eigen order nodig heeft.
|
|
153
156
|
const wordtVerwerkt = order.stageNote === "processing";
|
|
157
|
+
// Klokverkoop (orders.klokverkoop): geen indeling, picken, vervoer of afmelden — die blokken vervallen.
|
|
158
|
+
const klok = order.klokverkoop === true;
|
|
154
159
|
const fetchAddresses = useServerFn(getOrderAddresses);
|
|
155
160
|
const { data: resolvedAddresses } = useQuery({
|
|
156
161
|
queryKey: ["order-addresses", order.id],
|
|
@@ -170,7 +175,7 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
170
175
|
console.error("[orderpagina] regels laden:", packingQ.error);
|
|
171
176
|
const regelItems = packingQ.data?.items ?? [];
|
|
172
177
|
// Zelf ophalen (carrier_kind klant_haalt_op, via de Engine): geen afleveradres maar "Klant haalt zelf op".
|
|
173
|
-
const transportQ = useOrderTransport(String(order.id), !order.isReservation && !wordtVerwerkt);
|
|
178
|
+
const transportQ = useOrderTransport(String(order.id), !order.isReservation && !wordtVerwerkt && !klok);
|
|
174
179
|
const klantHaaltOp = transportQ.data?.ownKind === "klant_haalt_op";
|
|
175
180
|
const instr = String(o.tradeInstrument ?? o.tradingType ?? o.tradeType ?? "").toUpperCase();
|
|
176
181
|
const tradingType = TRADE_INSTRUMENT_LABELS[instr] ?? (instr ? instr.replace(/_/g, " ").toLowerCase() : "—");
|
|
@@ -302,9 +307,10 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
302
307
|
pickStr(cRaw.rfhRelationId) ??
|
|
303
308
|
pickStr(cRaw.rfhCompanyAccountId) ??
|
|
304
309
|
"—";
|
|
305
|
-
const customerPhone = pickStr(c.phone) ?? pickStr(c.
|
|
310
|
+
const customerPhone = pickStr(c.phone) ?? pickStr(c.contact_person?.phone) ?? "—";
|
|
306
311
|
// Centrale weergavestatus (orders.status is leidend, zie order-status.ts).
|
|
307
|
-
const
|
|
312
|
+
const klokSoort = klok ? (order.klokverkoopSoort ?? klokverkoopSoort(o) ?? "klok") : null;
|
|
313
|
+
const bestellingLabel = orderStageLabel(order.stage ?? (order.status.isCancelled ? "cancelled" : "incoming"), order.stageNote ?? null, { klokverkoop: klok, klokverkoopSoort: klokSoort });
|
|
308
314
|
const isFlorinOrder = !order.isLocal && ((order.floridayIds?.length ?? 0) > 0 || !!o.salesOrderId || !!fs);
|
|
309
315
|
const member = props_member(order, members);
|
|
310
316
|
const route = member?.invoiceRoute ?? order.invoiceRoute ?? (isFlorinOrder ? "floriday" : "erp");
|
|
@@ -329,9 +335,14 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
329
335
|
const verkoopwijze = [tradingType !== "—" ? tradingType : null, financial !== "—" ? financial : null].filter(Boolean).join(" · ") || "—";
|
|
330
336
|
const showIncoterm = !!fe && incoterm !== "niet opgegeven" && incoterm !== "—";
|
|
331
337
|
const hasExternal = !!order.floridayExternalFulfilledAt || (order.floridayExternalFulfilledIds?.length ?? 0) > 0;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
338
|
+
const klokProvider = order.paymentProvider ?? (payKey || null);
|
|
339
|
+
const klokAfgerekend = klok && klokverkoopAfgerekend(order.floridayRawStatus ?? (typeof o.status === "string" ? o.status : null));
|
|
340
|
+
const klokSalesIds = Array.from(new Set([...(order.floridayIds ?? []), ...(o?.salesOrderId ? [String(o.salesOrderId)] : [])]));
|
|
341
|
+
return (_jsxs("div", { className: "space-y-4", children: [wordtVerwerkt ? (_jsx(Notice, { tone: "muted", title: "Wordt verwerkt", children: "Deze Floriday-order staat nog niet in het ERP. Hij wordt binnen een paar minuten overgenomen; daarna verschijnen karindeling en afhandeling hier vanzelf." })) : null, 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: klok ? _jsx(KlokTileSub, { order: order }) : _jsx(DeliveryTileSub, { order: order }) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), klok
|
|
342
|
+
? _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Veillocatie", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined })
|
|
343
|
+
: klantHaaltOp
|
|
344
|
+
? _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: KLANT_HAALT_ZELF_OP })
|
|
345
|
+
: _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined }), klok ? (_jsx(FactTile, { icon: _jsx(ReceiptText, {}), label: "Afrekening", value: klokverkoopKop(klokSoort), sub: veilingTekst(klokProvider) })) : (() => {
|
|
335
346
|
const noCarrier = !order.cartTypeName || /geen ladingdrager/i.test(order.cartTypeName);
|
|
336
347
|
const fust = order.fustCount > 0 ? `${formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName)} fust` : "";
|
|
337
348
|
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 }));
|
|
@@ -339,18 +350,18 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
339
350
|
const bel = formatBelading({ perFust: it.plantsPerCrate, fustenPerLaag: it.cratesPerLayer, lagenPerKar: it.layersPerCart });
|
|
340
351
|
const fusten = it.plantsPerCrate && it.plantsPerCrate > 0 ? Math.ceil(it.quantity / it.plantsPerCrate) : null;
|
|
341
352
|
const prijs = it.unitPrice != null && it.unitPrice > 0 ? it.unitPrice : null;
|
|
342
|
-
return (_jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: it.productName }), _jsx("div", { className: "text-xs text-muted-foreground", children: bel ? `Belading ${bel}` : "Belading onbekend" })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: it.quantity > 0 ? it.quantity.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: fusten != null ? fusten.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: prijs != null ? eurFlex.format(prijs) : "—" }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: prijs != null ? eurFlex.format(prijs * it.quantity) : "—" })] }, it.id));
|
|
343
|
-
}) : (_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
|
|
353
|
+
return (_jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: it.productName }), !klok && _jsx("div", { className: "text-xs text-muted-foreground", children: bel ? `Belading ${bel}` : "Belading onbekend" })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: it.quantity > 0 ? it.quantity.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: fusten != null ? fusten.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: prijs != null ? eurFlex.format(prijs) : "—" }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: prijs != null ? eurFlex.format(prijs * it.quantity) : "—" })] }, it.id));
|
|
354
|
+
}) : (_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" + (klok ? " hidden" : ""), children: order.mixedPacking
|
|
344
355
|
? (order.articleCount ?? 0) > 1 ? `Gemengd (${order.articleCount} artikelen)` : "Gemengd"
|
|
345
|
-
: `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] })) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [klantHaaltOp ? (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border p-4", children: [_jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:h-5 [&_svg]:w-5", "aria-hidden": true, children: _jsx(MapPin, {}) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "mb-1 text-sm font-semibold text-foreground", children: "Afleveradres" }), _jsx("span", { className: "text-foreground", children: KLANT_HAALT_ZELF_OP })] })] })) : (_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines })), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), !wordtVerwerkt && _jsx(GewijzigdNaPrintCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderCorrectiesCard, { salesOrderIds: Array.from(new Set([...(order.floridayIds ?? []), ...(o?.salesOrderId ? [String(o.salesOrderId)] : [])])), floridayOrder: o, orderRowId: invoiceOrderId }), _jsx(OudeOrderCard, { orderRowId: invoiceOrderId }), _jsx(OrderShipmentsCard, { order: order }), !wordtVerwerkt && _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !wordtVerwerkt && (_jsx(OrderLineExtrasCard, { orderId: String(order.id), pickProgress: member?.pickProgress ?? null, pickKnown: features?.pickProgress === true })), !hideKarindeling && !wordtVerwerkt && _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
|
|
356
|
+
: `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."] }))] })] }), klok ? (_jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Veillocatie", children: _jsx("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: _jsx(AddressBox, { title: "Veillocatie", icon: _jsx(MapPin, {}), lines: deliveryLines }) }) })) : (_jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [klantHaaltOp ? (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border p-4", children: [_jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:h-5 [&_svg]:w-5", "aria-hidden": true, children: _jsx(MapPin, {}) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "mb-1 text-sm font-semibold text-foreground", children: "Afleveradres" }), _jsx("span", { className: "text-foreground", children: KLANT_HAALT_ZELF_OP })] })] })) : (_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines })), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) })), !wordtVerwerkt && !klok && _jsx(GewijzigdNaPrintCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderCorrectiesCard, { salesOrderIds: Array.from(new Set([...(order.floridayIds ?? []), ...(o?.salesOrderId ? [String(o.salesOrderId)] : [])])), floridayOrder: o, orderRowId: invoiceOrderId }), _jsx(OudeOrderCard, { orderRowId: invoiceOrderId }), !klok && _jsx(OrderShipmentsCard, { order: order }), !wordtVerwerkt && !klok && _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !wordtVerwerkt && !klok && (_jsx(OrderLineExtrasCard, { orderId: String(order.id), pickProgress: member?.pickProgress ?? null, pickKnown: features?.pickProgress === true })), !hideKarindeling && !wordtVerwerkt && !klok && _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", { klokverkoop: klok })}`, 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 }), klok && (_jsx(KlokAanvoerRow, { batchReference: pickStr(o.batchReference), supplyLineId: pickStr(o.supplyLineId), salesOrderIds: klokSalesIds })), _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
|
|
346
357
|
? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
|
|
347
|
-
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsx(OrderTijdlijnCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: invoiceStandText(member, features) }), _jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), (() => {
|
|
358
|
+
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), !klok && _jsx(OrderTijdlijnCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), !klok && (_jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined })), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: klok ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: klokAfgerekend ? "Afgerekend" : "Nog niet afgerekend" }), _jsxs(InfoRow, { label: "Afgerekend door", children: [(PAYMENT_PROVIDER_LABELS[String(klokProvider ?? "").toUpperCase()] ?? (klokProvider || "De veiling")), ", ", veilingTekst(klokProvider)] }), _jsx("div", { className: "mt-2 text-xs text-muted-foreground", children: "De veiling rekent een klokverkoop zelf af bij de koop." })] })) : 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." })), (() => {
|
|
348
359
|
const line = floridayInvoiceState(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0, {
|
|
349
360
|
full: !!order.floridayExternalFulfilledAt,
|
|
350
361
|
count: order.floridayExternalFulfilledIds?.length ?? 0,
|
|
351
362
|
});
|
|
352
363
|
return line ? _jsx(InfoRow, { label: "Floriday", children: line }) : null;
|
|
353
|
-
})()] })) : (_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 ? (_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 })] })] })] })] })] }));
|
|
364
|
+
})()] })) : (_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 && !klok ? (_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 })] })] })] })] })] }));
|
|
354
365
|
}
|
|
355
366
|
/** Zelfde stand als het factuuricoon in de lijst (memberInvoice). */
|
|
356
367
|
function invoiceStandText(member, features) {
|
|
@@ -376,6 +387,13 @@ function Notice({ tone, title, children }) {
|
|
|
376
387
|
return (_jsxs("div", { role: tone === "destructive" ? "alert" : undefined, className: "flex items-start gap-3 rounded-xl border px-4 py-3 text-sm " +
|
|
377
388
|
(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 })] })] }));
|
|
378
389
|
}
|
|
390
|
+
/** Tegel Leverdatum bij een klokverkoop: alleen de levertijd, geen ophaalmoment. */
|
|
391
|
+
function KlokTileSub({ order }) {
|
|
392
|
+
const t = order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { wallClock: deliveryIsWallClockFor(order) }).time : "";
|
|
393
|
+
if (!t)
|
|
394
|
+
return null;
|
|
395
|
+
return _jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Clock, { className: "h-3.5 w-3.5" }), t] });
|
|
396
|
+
}
|
|
379
397
|
/** Tweede regel(s) van de tegel Leverdatum: levertijd en ophaalmoment.
|
|
380
398
|
* Het ophaalmoment komt uit dezelfde query als de kaart Vervoer. */
|
|
381
399
|
function DeliveryTileSub({ order }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AA8EA,wBAAgB,aAAa,4CAmzB5B"}
|
|
@@ -5,10 +5,11 @@ import { useServerFn } from "@tanstack/react-start";
|
|
|
5
5
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Skeleton, toast, } from "@flowselections/core";
|
|
7
7
|
import { ArrowLeft, ChevronDown, Eye, Loader2, Package, Plus, Repeat, RotateCcw, Save, Send, Trash2, X } from "lucide-react";
|
|
8
|
-
import { listProductsForCreateOrder } from "../../../lib/create-order.functions.js";
|
|
9
|
-
import { deleteKlokOrder, getKlokArtikelen, getKlokLijsten, getKlokOrder, listKlokSjablonen, repeatKlokOrder, resendKlokOrder, saveKlokConcept, saveKlokSjabloon, sendKlokOrder, refreshKlokStatus, retryKlokAnnuleren, } from "../../../lib/klok.functions.js";
|
|
8
|
+
import { listCarriersForCreateOrder, listProductsForCreateOrder } from "../../../lib/create-order.functions.js";
|
|
9
|
+
import { deleteKlokOrder, getKlokArtikelen, getKlokLijsten, getKlokOrder, listKlokSjablonen, repeatKlokOrder, resendKlokOrder, saveKlokConcept, saveKlokSjabloon, sendKlokOrder, refreshKlokStatus, retryKlokAnnuleren, setKlokVervoerder, } from "../../../lib/klok.functions.js";
|
|
10
|
+
import { KLOK_FLORIDAY_ALLEEN_LEZEN_TEXT, KLOK_VERVOER_ONZEKER_TEXT } from "../../../lib/klok-floriday.js";
|
|
10
11
|
import { klokFoutLijst, klokOntbreekt, klokOntbreektVelden, LEGE_KOP, neemPrijsOver, regelMetArtikel, regelNaArtikelwissel } from "../../../lib/klok-form.js";
|
|
11
|
-
import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, klokRegelKwaliteitFout, klokLijstenMislukt, KLOK_LIJST_FOUT_TEXT, } from "../../../lib/klok-labels.js";
|
|
12
|
+
import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, klokRegelKwaliteitFout, klokLijstenMislukt, KLOK_LIJST_FOUT_TEXT, TRADE_INSTRUMENT_LABEL, } from "../../../lib/klok-labels.js";
|
|
12
13
|
import { fmtNL } from "../../../lib/nl-datetime.js";
|
|
13
14
|
import { amsterdamYmd, ymdString } from "../../../lib/period-range.js";
|
|
14
15
|
import { SearchableSelect } from "../SearchableSelect.js";
|
|
@@ -33,11 +34,6 @@ function legeRegel() {
|
|
|
33
34
|
prijs_bevestigd: true, kwaliteit: null, keurcodes: [], veil_opmerking: null, aflever_opmerking: null,
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
const VERVOER = [
|
|
37
|
-
{ id: "geen", label: "Geen" },
|
|
38
|
-
{ id: "eigen", label: "Eigen" },
|
|
39
|
-
{ id: "transporteur", label: "Transporteur" },
|
|
40
|
-
];
|
|
41
37
|
export function KlokOrderPage() {
|
|
42
38
|
const params = useParams({ strict: false });
|
|
43
39
|
const klokId = params.klokId && params.klokId !== "nieuw" ? params.klokId : null;
|
|
@@ -58,6 +54,12 @@ export function KlokOrderPage() {
|
|
|
58
54
|
const doRepeat = useServerFn(repeatKlokOrder);
|
|
59
55
|
const doSjabloon = useServerFn(saveKlokSjabloon);
|
|
60
56
|
const doRefresh = useServerFn(refreshKlokStatus);
|
|
57
|
+
const fetchCarriers = useServerFn(listCarriersForCreateOrder);
|
|
58
|
+
const doVervoerder = useServerFn(setKlokVervoerder);
|
|
59
|
+
const carriersQ = useQuery({ queryKey: ["co-carriers"], queryFn: () => fetchCarriers(), staleTime: 5 * 60000 });
|
|
60
|
+
if (carriersQ.isError)
|
|
61
|
+
console.error("[klok] vervoerders laden mislukt:", carriersQ.error);
|
|
62
|
+
const [vervoerBezig, setVervoerBezig] = useState(false);
|
|
61
63
|
const lijstenQ = useQuery({
|
|
62
64
|
queryKey: ["klok-lijsten"],
|
|
63
65
|
queryFn: async () => {
|
|
@@ -105,8 +107,15 @@ export function KlokOrderPage() {
|
|
|
105
107
|
const row = orderQ.data?.order ?? null;
|
|
106
108
|
const resultaten = orderQ.data?.resultaten ?? [];
|
|
107
109
|
const status = row?.status ?? "concept";
|
|
110
|
+
// Veilbrief uit Floriday: alleen lezen (wijzigen/verwijderen in Floriday), behalve de vervoerder.
|
|
111
|
+
const uitFloriday = row?.herkomst === "floriday";
|
|
108
112
|
// Verstuurd/bij de veiling of verwijderd: alles alleen-lezen (ook kwaliteit en keurcodes).
|
|
109
|
-
const alleenLezen = !!row && klokAlleenLezen(status, bewerken);
|
|
113
|
+
const alleenLezen = !!row && (uitFloriday || klokAlleenLezen(status, bewerken));
|
|
114
|
+
// Vervoerder apart wijzigen: bij een alleen-lezen veilbrief die nog niet verwijderd is.
|
|
115
|
+
const vervoerApart = !!row && alleenLezen && status !== "verwijderd";
|
|
116
|
+
const carrierOpties = (carriersQ.data?.items ?? [])
|
|
117
|
+
.filter((c) => !c.archived_at && c.carrier_kind !== "klant_haalt_op")
|
|
118
|
+
.map((c) => ({ value: String(c.id), label: String(c.name ?? ""), badge: c.carrier_kind === "eigen_vervoer" ? "Eigen vervoer" : null }));
|
|
110
119
|
const annulerenOpen = klokAnnulerenOpenstaand(row);
|
|
111
120
|
// Bestaande veilbrief laden.
|
|
112
121
|
useEffect(() => {
|
|
@@ -118,6 +127,7 @@ export function KlokOrderPage() {
|
|
|
118
127
|
veillocatie_org_id: row.veillocatie_org_id, veildatum: row.veildatum, veilgroep: row.veilgroep,
|
|
119
128
|
verzendlocatie_id: row.verzendlocatie_id, verzendlocatie_naam: row.verzendlocatie_naam,
|
|
120
129
|
vervoer: row.vervoer ?? "geen", carrier_org_id: row.carrier_org_id,
|
|
130
|
+
carrier_id: row.carrier_id ?? null, carrier_naam: row.carrier_naam ?? null,
|
|
121
131
|
});
|
|
122
132
|
const rs = (row.regels ?? []);
|
|
123
133
|
setRegels(rs.length ? rs : [legeRegel()]);
|
|
@@ -362,6 +372,29 @@ export function KlokOrderPage() {
|
|
|
362
372
|
setBezig(null);
|
|
363
373
|
}
|
|
364
374
|
}
|
|
375
|
+
async function onVervoerderWijzigen(carrierId) {
|
|
376
|
+
if (!klokId || !carrierId || vervoerBezig)
|
|
377
|
+
return;
|
|
378
|
+
setVervoerBezig(true);
|
|
379
|
+
try {
|
|
380
|
+
const res = await doVervoerder({ data: { id: klokId, carrierId } });
|
|
381
|
+
if (res?.ok) {
|
|
382
|
+
toast.success("Vervoerder opgeslagen.");
|
|
383
|
+
await qc.invalidateQueries({ queryKey: ["klok-order", klokId] });
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
setFout(res?.reden ?? "De vervoerder is niet opgeslagen.");
|
|
387
|
+
console.error("[klok] vervoerder:", res?.detail);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
catch (e) {
|
|
391
|
+
console.error(e);
|
|
392
|
+
setFout(e?.message ?? "De vervoerder is niet opgeslagen. Probeer het opnieuw of neem contact op met de beheerder.");
|
|
393
|
+
}
|
|
394
|
+
finally {
|
|
395
|
+
setVervoerBezig(false);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
365
398
|
async function onHerhalen() {
|
|
366
399
|
if (!klokId)
|
|
367
400
|
return;
|
|
@@ -411,12 +444,19 @@ export function KlokOrderPage() {
|
|
|
411
444
|
const verkochtStuks = resultaten.filter((r) => !r.doorgedraaid).reduce((s, r) => s + Number(r.stuks || 0), 0);
|
|
412
445
|
const verkochtBedrag = resultaten.filter((r) => !r.doorgedraaid).reduce((s, r) => s + Number(r.bedrag || 0), 0);
|
|
413
446
|
const doorStuks = resultaten.filter((r) => r.doorgedraaid).reduce((s, r) => s + Number(r.stuks || 0), 0);
|
|
414
|
-
return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-40 sm:p-6 sm:pb-32", children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 p-0", "aria-label": "Terug", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight sm:text-2xl", children: row ? `Veilbrief ${row.klok_nummer}` : "Klokorder (veilbrief)" }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground", children: [_jsx(KlokStatusBadge, { status: status, detail: row.status_detail }), row.status_detail && _jsx("span", { children: row.status_detail }), orderQ.data?.orderNumber && _jsxs("span", { children: ["Order ", orderQ.data.orderNumber] })] }))] })] }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onHerhalen, children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), klokKanVerwijderen(status) && !bewerken && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setBevestigVerwijder(true), disabled: !!bezig || !!blokkade, title: blokkade ?? undefined, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] })), annulerenOpen && (_jsxs(Button, { size: "sm", variant: "outline", onClick: onOpnieuwAnnuleren, disabled: !!bezig, "aria-busy": bezig === "retry" || undefined, children: [bezig === "retry" ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }) : _jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(status) && !bewerken && (_jsx(Button, { size: "sm", onClick: () => setBewerken(true), disabled: !!blokkade, title: blokkade ?? undefined, children: "Wijzigen en opnieuw versturen" }))] }))] }), _jsx(KlokNotice, {}), fout && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-sm text-destructive-soft-foreground", children: [fouten.length > 1 || (fouten.length === 1 && fouten[0].tekst !== fout) ? (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium", children: fouten.length === 1 ? "Er is 1 punt om op te lossen:" : `Er zijn ${fouten.length} punten om op te lossen:` }), _jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5", children: fouten.map((f, i) => _jsx("li", { children: f.tekst }, i)) })] })) : (_jsx("span", { className: "min-w-0 flex-1", children: fout })), _jsx("button", { type: "button", "aria-label": "Sluiten", onClick: () => setFout(null), children: _jsx(X, { className: "h-4 w-4" }) })] })), row?.laatste_fout && !fout && (_jsx("div", { className: "rounded-lg border border-border bg-warning-soft px-3 py-2 text-sm text-warning-soft-foreground", children: row.laatste_fout })), lijstStand === "fout" && (_jsx("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 px-4 py-3 text-sm text-destructive", children: KLOK_LIJST_FOUT_TEXT })), _jsx("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: _jsxs("div", { className: "grid gap-4 [@container(min-width:48rem)]:grid-cols-2 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2 rounded-lg" + (foutVelden.has("veillocatie") ? " p-1 ring-1 ring-destructive" : ""), children: [_jsxs("div", { className: "mb-1.5 text-sm font-medium", children: ["Veillocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" })] })) : locaties.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst ?? lijsten?.locaties?.message ?? lijsten?.locaties?.error ?? (kop.veillocatie_naam || "Geen veillocaties gevonden.") })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [toonKnoppen.map((l) => (_jsx(Button, { type: "button", variant: kop.veillocatie_id === l.id ? "default" : "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: alleenLezen, onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: k.veillocatie_id === l.id ? k.veilgroep : null })), children: l.displayName ?? l.name }, l.id))), toonMeer.length > 0 && !alleenLezen && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: ["Meer ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: toonMeer.map((l) => (_jsx(DropdownMenuItem, { onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: null })), children: l.displayName ?? l.name }, l.id))) })] }))] }))] }), _jsxs("label", { className: "block", children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veildatum ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { type: "date", value: kop.veildatum ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veildatum"), onChange: (e) => setKop((k) => ({ ...k, veildatum: e.target.value || null })) }), kop.veildatum && _jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: fmtNL(kop.veildatum, { weekday: "long", day: "numeric", month: "long" }) })] }), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veilgroep ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsx(Skeleton, { className: "h-9 w-full" })) : eigenGroep || groepOpties.length === 0 ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { inputMode: "numeric", placeholder: groepOpties.length === 0 && leegTekst ? leegTekst : "Veilgroep (cijfers)", value: kop.veilgroep ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veilgroep"), onChange: (e) => setKop((k) => ({ ...k, veilgroep: e.target.value.replace(/\D/g, "") || null })) }), groepOpties.length > 0 && !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(false), children: "Kies uit lijst" })] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsx(SearchableSelect, { value: kop.veilgroep, options: groepOpties, placeholder: "Zoek veilgroep", allowClear: true, clearLabel: "\u2014 Geen \u2014", disabled: alleenLezen, className: "min-h-9 flex-1 [@media(pointer:coarse)]:min-h-11" + rood("veilgroep"), onChange: (v) => setKop((k) => ({ ...k, veilgroep: v })) }), !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(true), children: "Zelf invullen" })] }))] }), laden && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Skeleton, { className: "h-9 w-full" })] })), !laden && verzend.length > 1 && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: kop.verzendlocatie_id, disabled: alleenLezen, allowClear: false, options: verzend.map((v) => ({ value: v.id, label: v.name, badge: v.isDefault ? "Standaard" : v.isExternal ? "Extern" : null })), className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("verzendlocatie"), onChange: (v) => setKop((k) => ({ ...k, verzendlocatie_id: v, verzendlocatie_naam: verzend.find((x) => x.id === v)?.name ?? null })) })] })), !laden && verzend.length === 0 && !kop.verzendlocatie_id && leegTekst && (_jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Verzendlocatie" }), _jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst })] })), _jsxs("div", { children: [
|
|
447
|
+
return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-40 sm:p-6 sm:pb-32", children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 p-0", "aria-label": "Terug", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight sm:text-2xl", children: row ? `Veilbrief ${row.klok_nummer}` : "Klokorder (veilbrief)" }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground", children: [_jsx(KlokStatusBadge, { status: status, detail: row.status_detail }), row.status_detail && _jsx("span", { children: row.status_detail }), orderQ.data?.orderNumber && _jsxs("span", { children: ["Order ", orderQ.data.orderNumber] }), uitFloriday && _jsxs("span", { children: ["Uit Floriday", row.floriday_delivery_note_code ? ` · aanvoerbrief ${row.floriday_delivery_note_code}` : ""] })] }))] })] }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onHerhalen, children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), !uitFloriday && klokKanVerwijderen(status) && !bewerken && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setBevestigVerwijder(true), disabled: !!bezig || !!blokkade, title: blokkade ?? undefined, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] })), annulerenOpen && (_jsxs(Button, { size: "sm", variant: "outline", onClick: onOpnieuwAnnuleren, disabled: !!bezig, "aria-busy": bezig === "retry" || undefined, children: [bezig === "retry" ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }) : _jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), !uitFloriday && klokKanVerwijderen(status) && !bewerken && (_jsx(Button, { size: "sm", onClick: () => setBewerken(true), disabled: !!blokkade, title: blokkade ?? undefined, children: "Wijzigen en opnieuw versturen" }))] }))] }), _jsx(KlokNotice, {}), uitFloriday && (_jsx("div", { role: "status", className: "rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground", children: KLOK_FLORIDAY_ALLEEN_LEZEN_TEXT })), fout && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-sm text-destructive-soft-foreground", children: [fouten.length > 1 || (fouten.length === 1 && fouten[0].tekst !== fout) ? (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium", children: fouten.length === 1 ? "Er is 1 punt om op te lossen:" : `Er zijn ${fouten.length} punten om op te lossen:` }), _jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5", children: fouten.map((f, i) => _jsx("li", { children: f.tekst }, i)) })] })) : (_jsx("span", { className: "min-w-0 flex-1", children: fout })), _jsx("button", { type: "button", "aria-label": "Sluiten", onClick: () => setFout(null), children: _jsx(X, { className: "h-4 w-4" }) })] })), row?.laatste_fout && !fout && (_jsx("div", { className: "rounded-lg border border-border bg-warning-soft px-3 py-2 text-sm text-warning-soft-foreground", children: row.laatste_fout })), lijstStand === "fout" && (_jsx("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 px-4 py-3 text-sm text-destructive", children: KLOK_LIJST_FOUT_TEXT })), _jsx("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: _jsxs("div", { className: "grid gap-4 [@container(min-width:48rem)]:grid-cols-2 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2 rounded-lg" + (foutVelden.has("veillocatie") ? " p-1 ring-1 ring-destructive" : ""), children: [_jsxs("div", { className: "mb-1.5 text-sm font-medium", children: ["Veillocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" })] })) : locaties.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst ?? lijsten?.locaties?.message ?? lijsten?.locaties?.error ?? (kop.veillocatie_naam || "Geen veillocaties gevonden.") })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [toonKnoppen.map((l) => (_jsx(Button, { type: "button", variant: kop.veillocatie_id === l.id ? "default" : "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: alleenLezen, onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: k.veillocatie_id === l.id ? k.veilgroep : null })), children: l.displayName ?? l.name }, l.id))), toonMeer.length > 0 && !alleenLezen && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: ["Meer ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: toonMeer.map((l) => (_jsx(DropdownMenuItem, { onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: null })), children: l.displayName ?? l.name }, l.id))) })] }))] }))] }), _jsxs("label", { className: "block", children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veildatum ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { type: "date", value: kop.veildatum ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veildatum"), onChange: (e) => setKop((k) => ({ ...k, veildatum: e.target.value || null })) }), kop.veildatum && _jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: fmtNL(kop.veildatum, { weekday: "long", day: "numeric", month: "long" }) })] }), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veilgroep ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsx(Skeleton, { className: "h-9 w-full" })) : eigenGroep || groepOpties.length === 0 ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { inputMode: "numeric", placeholder: groepOpties.length === 0 && leegTekst ? leegTekst : "Veilgroep (cijfers)", value: kop.veilgroep ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veilgroep"), onChange: (e) => setKop((k) => ({ ...k, veilgroep: e.target.value.replace(/\D/g, "") || null })) }), groepOpties.length > 0 && !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(false), children: "Kies uit lijst" })] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsx(SearchableSelect, { value: kop.veilgroep, options: groepOpties, placeholder: "Zoek veilgroep", allowClear: true, clearLabel: "\u2014 Geen \u2014", disabled: alleenLezen, className: "min-h-9 flex-1 [@media(pointer:coarse)]:min-h-11" + rood("veilgroep"), onChange: (v) => setKop((k) => ({ ...k, veilgroep: v })) }), !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(true), children: "Zelf invullen" })] }))] }), laden && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Skeleton, { className: "h-9 w-full" })] })), !laden && verzend.length > 1 && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: kop.verzendlocatie_id, disabled: alleenLezen, allowClear: false, options: verzend.map((v) => ({ value: v.id, label: v.name, badge: v.isDefault ? "Standaard" : v.isExternal ? "Extern" : null })), className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("verzendlocatie"), onChange: (v) => setKop((k) => ({ ...k, verzendlocatie_id: v, verzendlocatie_naam: verzend.find((x) => x.id === v)?.name ?? null })) })] })), !laden && verzend.length === 0 && !kop.verzendlocatie_id && leegTekst && (_jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Verzendlocatie" }), _jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst })] })), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Vervoerder ", _jsx("span", { className: "text-destructive", children: "*" })] }), carriersQ.isLoading ? (_jsx(Skeleton, { className: "h-9 w-full" })) : (_jsx(SearchableSelect, { value: kop.carrier_id ?? null, options: carrierOpties.length || !kop.carrier_id ? carrierOpties : [{ value: kop.carrier_id, label: kop.carrier_naam ?? "Vervoerder" }], placeholder: "Kies vervoerder", allowClear: false, disabled: (alleenLezen && !vervoerApart) || vervoerBezig, className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("vervoerder"), onChange: (v) => {
|
|
448
|
+
const c = carrierOpties.find((o) => o.value === v);
|
|
449
|
+
if (vervoerApart) {
|
|
450
|
+
void onVervoerderWijzigen(v);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
setKop((k) => ({ ...k, carrier_id: v, carrier_naam: c ? String(c.label) : null, vervoer: c?.badge ? "eigen" : "transporteur" }));
|
|
454
|
+
} })), uitFloriday && row?.vervoer_bron !== "handmatig" && status !== "verwijderd" && (_jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: KLOK_VERVOER_ONZEKER_TEXT })), carriersQ.isError && _jsx("span", { className: "mt-1 block text-xs text-destructive", children: "De vervoerders konden niet worden geladen. Probeer het later opnieuw." })] })] }) }), _jsxs("section", { className: "rounded-xl border border-border bg-card shadow-sm", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3 sm:px-5", children: [_jsx("h2", { className: "text-sm font-semibold", children: "Regels" }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [sjablonen.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: ["Kies sjabloon ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: sjablonen.map((s) => _jsx(DropdownMenuItem, { onClick: () => kiesSjabloon(s), children: s.naam }, s.id)) })] })), _jsx(Button, { variant: "outline", size: "sm", disabled: !kop.veillocatie_id, onClick: () => setSjabloonNaam(""), children: "Opslaan als sjabloon" })] }))] }), _jsx("ul", { className: "divide-y divide-border", children: regels.map((r, i) => {
|
|
415
455
|
const km = kenmerken[r.key];
|
|
416
456
|
const kwFout = alleenLezen ? null : klokRegelKwaliteitFout(r, km);
|
|
417
457
|
const kwRood = regelRood(r.key, "kwaliteit") || !!kwFout;
|
|
418
458
|
return (_jsxs("li", { className: "space-y-3 px-4 py-4 sm:px-5", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 w-6 shrink-0 text-xs text-muted-foreground tabular-nums", children: i + 1 }), _jsx("div", { className: "min-w-0 flex-1", children: alleenLezen ? (_jsx("div", { className: "py-1.5 text-sm font-medium", children: r.product_name || "Onbekend artikel" })) : (_jsx(SearchableSelect, { value: r.product_id, options: productOpties(false), showImages: true, placeholder: "Kies artikel", allowClear: false, className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + (regelRood(r.key, "artikel") || regelRood(r.key, "fust") ? " border-destructive ring-1 ring-destructive" : ""), onChange: (v) => kiesProduct(r.key, v) })) }), !alleenLezen && (_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 shrink-0 p-0 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", "aria-label": "Regel verwijderen", onClick: () => setRegels((rs) => (rs.length > 1 ? rs.filter((x) => x.key !== r.key) : [legeRegel()])), children: _jsx(Trash2, { className: "h-4 w-4" }) }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-3 pl-8 sm:grid-cols-3 lg:grid-cols-6", children: [_jsx(NumField, { label: "Fusten", req: true, fout: regelRood(r.key, "fusten"), value: r.fusten, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fusten: v }) }), _jsx(NumField, { label: "Stuks/fust", req: true, fout: regelRood(r.key, "stuks"), value: r.stuks_per_fust, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { stuks_per_fust: v }) }), _jsx(NumField, { label: "Fust/laag", value: r.fust_per_laag, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fust_per_laag: v }) }), _jsx(NumField, { label: "Lagen/kar", value: r.lagen_per_kar, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { lagen_per_kar: v }) }), _jsxs("div", { children: [_jsx(NumField, { label: "Minimumprijs", req: true, fout: regelRood(r.key, "prijs"), value: r.min_prijs, disabled: alleenLezen, inputMode: "decimal", muted: !r.prijs_bevestigd, onChange: (v) => setRegel(r.key, { min_prijs: v, prijs_bevestigd: true, prijs_at: null }) }), !r.prijs_bevestigd && r.min_prijs != null && !alleenLezen && (_jsx("button", { type: "button", className: "mt-1 text-xs font-medium text-primary hover:underline", onClick: () => setRegel(r.key, { prijs_bevestigd: true }), children: "Voorstel bevestigen" }))] }), _jsx(NumField, { label: "Klokvoorverkoop", value: r.voorverkoop_prijs, disabled: alleenLezen, inputMode: "decimal", onChange: (v) => setRegel(r.key, { voorverkoop_prijs: v }) })] }), _jsxs("div", { className: "pl-8", children: [_jsxs("button", { type: "button", className: "text-xs font-medium text-muted-foreground hover:text-foreground", onClick: () => setMeerOpen((m) => ({ ...m, [r.key]: !m[r.key] })), children: [meerOpen[r.key] ? "Minder" : "Meer", ": opmerking, kwaliteit en keurcodes"] }), (meerOpen[r.key] || kwRood) && (_jsxs("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [_jsxs("label", { className: "block sm:col-span-2", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Opmerking voor de veiling" }), _jsx(Input, { value: r.veil_opmerking ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { veil_opmerking: e.target.value || null }) })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Kwaliteit (S98)" }), _jsxs("select", { className: "h-9 w-full rounded-lg border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-70 [@media(pointer:coarse)]:h-11" + (kwRood ? " border-destructive ring-1 ring-destructive" : ""), "aria-invalid": kwRood || undefined, value: r.kwaliteit ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { kwaliteit: e.target.value || null }), children: [_jsx("option", { value: "", children: km?.kwaliteit ? `Artikel: ${km.kwaliteit}` : kwaliteitCodes.length ? "Kenmerk van het artikel" : (leegTekst ?? "Kenmerk van het artikel") }), kwaliteitCodes.filter((c) => c?.vbnCode === "S98").map((c) => (_jsxs("option", { value: c.vbnValueCode, children: [c.vbnValueCode, c.description ? ` · ${c.description}` : ""] }, c.vbnValueCode)))] })] }), _jsxs("div", { children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Keurcodes (K01/K02, P01/P02)" }), _jsx(KeurcodeVeld, { codes: kwaliteitCodes.filter((c) => /^(K01|K02|P01|P02)$/.test(String(c?.vbnCode))), waarde: r.keurcodes, voorinvulling: km?.keurcodes ?? [], leegTekst: leegTekst, disabled: alleenLezen, fout: kwRood, onChange: (v) => setRegel(r.key, { keurcodes: v }) })] })] })), kwFout && _jsx("p", { role: "alert", className: "mt-2 text-xs text-destructive", children: kwFout })] })] }, r.key));
|
|
419
|
-
}) }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2 border-t border-border px-4 py-3 sm:px-5", children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setRegels((rs) => [...rs, legeRegel()]), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Artikel toevoegen"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: [_jsx(Package, { className: "mr-2 h-4 w-4" }), " Uit voorraad"] }) }), _jsxs(DropdownMenuContent, { className: "max-h-80 overflow-y-auto", children: [productOpties(true).length === 0 && _jsx(DropdownMenuItem, { disabled: true, children: "Geen artikelen op voorraad" }), productOpties(true).slice(0, 100).map((o) => (_jsxs(DropdownMenuItem, { onClick: () => { const n = legeRegel(); setRegels((rs) => [...rs.filter((x) => x.product_id || x.product_name), n]); void kiesProduct(n.key, o.value); }, children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: o.label }), _jsx("span", { className: "ml-3 text-xs text-muted-foreground", children: o.hint })] }, o.value)))] })] })] }))] }), resultaten.length > 0 && (_jsxs("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: [_jsx("h2", { className: "mb-3 text-sm font-semibold", children: "Verkocht" }), _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "py-1", children: "Koper" }), _jsx("th", { className: "py-1", children: "Stuks" }), _jsx("th", { className: "py-1", children: "Prijs" }), _jsx("th", { className: "py-1", children: "Bedrag" })] }) }), _jsx("tbody", { className: "divide-y divide-border", children: resultaten.filter((x) => !x.doorgedraaid).map((x) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2", children: x.koper_naam }), _jsx("td", { className: "py-2 tabular-nums", children: Number(x.stuks || 0).toLocaleString("nl-NL") }), _jsx("td", { className: "py-2 tabular-nums", children: x.prijs != null ? eur(Number(x.prijs)) : "—" }), _jsx("td", { className: "py-2 tabular-nums", children: x.bedrag != null ? eur(Number(x.bedrag)) : "—" })] }, x.id))) })] }), _jsxs("div", { className: "mt-3 flex flex-wrap gap-x-6 gap-y-1 border-t border-border pt-3 text-sm", children: [_jsxs("span", { children: ["Totaal: ", _jsxs("strong", { className: "tabular-nums", children: [verkochtStuks.toLocaleString("nl-NL"), " stuks \u00B7 ", eur(verkochtBedrag)] })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Doorgedraaid: ", _jsxs("span", { className: "tabular-nums", children: [doorStuks.toLocaleString("nl-NL"), " stuks"] })] })] })] })), !alleenLezen && (_jsx("div", { className: "sticky bottom-0 z-20 -mx-4 border-t border-border bg-background/95 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "text-sm tabular-nums", children: [_jsx("span", { className: "font-medium", children: tellersTekst(tellers) }), totaal > 0 && _jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u00B7 min. ", eur(totaal)] }), ontbreekt.length > 0 && _jsxs("span", { className: "ml-2 text-xs text-muted-foreground", title: ontbreekt.join(", "), children: ["\u00B7 ", ontbreekt.length, " ontbreekt nog"] })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setVoorbeeld(true), children: [_jsx(Eye, { className: "mr-2 h-4 w-4" }), " Voorbeeld"] }), bewerken ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => { setBewerken(false); geladen.current = null; qc.invalidateQueries({ queryKey: ["klok-order", klokId] }); }, children: "Annuleren" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => setBevestigWijzig(true), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " Opnieuw versturen"] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig, onClick: onOpslaan, children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan als concept"] }), _jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(true), children: "Versturen en nieuwe" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(false), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " ", bezig === "send" ? "Bezig…" : "Versturen naar veiling"] })] }))] })] }) })), voorbeeld && (_jsxs(Dialoog, { titel: "Voorbeeld veilbrief", onClose: () => setVoorbeeld(false), children: [_jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: "Veillocatie" }), _jsx("dd", { children: kop.veillocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veildatum" }), _jsx("dd", { children: kop.veildatum ? fmtNL(kop.veildatum, { weekday: "short", day: "numeric", month: "short" }) : "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veilgroep" }), _jsx("dd", { children: kop.veilgroep ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Verzendlocatie" }), _jsx("dd", { children: kop.verzendlocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "
|
|
459
|
+
}) }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2 border-t border-border px-4 py-3 sm:px-5", children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setRegels((rs) => [...rs, legeRegel()]), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Artikel toevoegen"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: [_jsx(Package, { className: "mr-2 h-4 w-4" }), " Uit voorraad"] }) }), _jsxs(DropdownMenuContent, { className: "max-h-80 overflow-y-auto", children: [productOpties(true).length === 0 && _jsx(DropdownMenuItem, { disabled: true, children: "Geen artikelen op voorraad" }), productOpties(true).slice(0, 100).map((o) => (_jsxs(DropdownMenuItem, { onClick: () => { const n = legeRegel(); setRegels((rs) => [...rs.filter((x) => x.product_id || x.product_name), n]); void kiesProduct(n.key, o.value); }, children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: o.label }), _jsx("span", { className: "ml-3 text-xs text-muted-foreground", children: o.hint })] }, o.value)))] })] })] }))] }), resultaten.length > 0 && (_jsxs("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: [_jsx("h2", { className: "mb-3 text-sm font-semibold", children: "Verkocht" }), _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "py-1", children: "Koper" }), _jsx("th", { className: "py-1", children: "Soort" }), _jsx("th", { className: "py-1", children: "Stuks" }), _jsx("th", { className: "py-1", children: "Prijs" }), _jsx("th", { className: "py-1", children: "Bedrag" })] }) }), _jsx("tbody", { className: "divide-y divide-border", children: resultaten.filter((x) => !x.doorgedraaid).map((x) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2", children: x.koper_naam }), _jsx("td", { className: "py-2 text-muted-foreground", children: TRADE_INSTRUMENT_LABEL[String(x.trade_instrument ?? "").toUpperCase()] ?? "—" }), _jsx("td", { className: "py-2 tabular-nums", children: Number(x.stuks || 0).toLocaleString("nl-NL") }), _jsx("td", { className: "py-2 tabular-nums", children: x.prijs != null ? eur(Number(x.prijs)) : "—" }), _jsx("td", { className: "py-2 tabular-nums", children: x.bedrag != null ? eur(Number(x.bedrag)) : "—" })] }, x.id))) })] }), _jsxs("div", { className: "mt-3 flex flex-wrap gap-x-6 gap-y-1 border-t border-border pt-3 text-sm", children: [_jsxs("span", { children: ["Totaal: ", _jsxs("strong", { className: "tabular-nums", children: [verkochtStuks.toLocaleString("nl-NL"), " stuks \u00B7 ", eur(verkochtBedrag)] })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Doorgedraaid: ", _jsxs("span", { className: "tabular-nums", children: [doorStuks.toLocaleString("nl-NL"), " stuks"] })] })] })] })), !alleenLezen && (_jsx("div", { className: "sticky bottom-0 z-20 -mx-4 border-t border-border bg-background/95 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "text-sm tabular-nums", children: [_jsx("span", { className: "font-medium", children: tellersTekst(tellers) }), totaal > 0 && _jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u00B7 min. ", eur(totaal)] }), ontbreekt.length > 0 && _jsxs("span", { className: "ml-2 text-xs text-muted-foreground", title: ontbreekt.join(", "), children: ["\u00B7 ", ontbreekt.length, " ontbreekt nog"] })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setVoorbeeld(true), children: [_jsx(Eye, { className: "mr-2 h-4 w-4" }), " Voorbeeld"] }), bewerken ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => { setBewerken(false); geladen.current = null; qc.invalidateQueries({ queryKey: ["klok-order", klokId] }); }, children: "Annuleren" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => setBevestigWijzig(true), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " Opnieuw versturen"] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig, onClick: onOpslaan, children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan als concept"] }), _jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(true), children: "Versturen en nieuwe" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(false), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " ", bezig === "send" ? "Bezig…" : "Versturen naar veiling"] })] }))] })] }) })), voorbeeld && (_jsxs(Dialoog, { titel: "Voorbeeld veilbrief", onClose: () => setVoorbeeld(false), children: [_jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: "Veillocatie" }), _jsx("dd", { children: kop.veillocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veildatum" }), _jsx("dd", { children: kop.veildatum ? fmtNL(kop.veildatum, { weekday: "short", day: "numeric", month: "short" }) : "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veilgroep" }), _jsx("dd", { children: kop.veilgroep ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Verzendlocatie" }), _jsx("dd", { children: kop.verzendlocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Vervoerder" }), _jsx("dd", { children: kop.carrier_naam ?? "—" })] }), _jsx("ul", { className: "mt-3 divide-y divide-border text-sm", children: regels.filter((r) => r.product_name).map((r) => (_jsxs("li", { className: "flex justify-between gap-3 py-1.5", children: [_jsx("span", { className: "min-w-0 truncate", children: r.product_name }), _jsxs("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: [r.fusten ?? 0, " \u00D7 ", r.stuks_per_fust ?? 0, " \u00B7 min. ", r.min_prijs != null ? eur(r.min_prijs) : "—"] })] }, r.key))) }), _jsx("p", { className: "mt-3 text-sm font-medium tabular-nums", children: tellersTekst(tellers) }), ontbreekt.length > 0 && _jsxs("p", { className: "mt-2 text-sm text-muted-foreground", children: ["Ontbreekt nog: ", ontbreekt.join(", ")] })] })), bevestigWijzig && (_jsxs(Dialoog, { titel: "Wijzigen en opnieuw versturen?", onClose: () => setBevestigWijzig(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "De huidige veilbrief wordt bij de veiling verwijderd en opnieuw verstuurd. Doorgaan?" }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigWijzig(false), children: "Annuleren" }), _jsx(Button, { onClick: onWijzigEnVerstuur, disabled: !!bezig, children: "Doorgaan" })] })] })), bevestigVerwijder && (_jsxs(Dialoog, { titel: `Veilbrief ${row?.klok_nummer ?? ""} verwijderen?`, onClose: () => !bezig && setBevestigVerwijder(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigVerwijder(false), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: onVerwijderen, disabled: !!bezig, "aria-busy": bezig === "delete" || undefined, children: bezig === "delete" ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] })), sjabloonNaam != null && (_jsxs(Dialoog, { titel: "Opslaan als sjabloon", onClose: () => setSjabloonNaam(null), children: [_jsxs("label", { className: "block text-sm", children: [_jsxs("span", { className: "mb-1 block", children: ["Naam ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { autoFocus: true, value: sjabloonNaam, maxLength: 80, onChange: (e) => setSjabloonNaam(e.target.value) })] }), _jsxs("p", { className: "mt-2 text-xs text-muted-foreground", children: ["Voor ", kop.veillocatie_naam, ". Prijzen ouder dan 14 dagen worden later als voorstel getoond."] }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setSjabloonNaam(null), children: "Annuleren" }), _jsx(Button, { onClick: bewaarSjabloon, disabled: !sjabloonNaam.trim(), children: "Opslaan" })] })] }))] }));
|
|
420
460
|
}
|
|
421
461
|
function NumField({ label, value, onChange, disabled, req, inputMode, muted, fout }) {
|
|
422
462
|
// Bedragen altijd met twee decimalen ("0,50"); hele getallen zonder.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,UAAO;;;;;;;WASpE;AAED,eAAO,MAAM,uBAAuB,sFAAsF,CAAC;AAK3H,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GACpC,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,
|
|
1
|
+
{"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,UAAO;;;;;;;WASpE;AAED,eAAO,MAAM,uBAAuB,sFAAsF,CAAC;AAK3H,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GACpC,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,2CA8NA"}
|
|
@@ -140,7 +140,7 @@ export function KlokOrdersList({ from, to, params, focusedId, onPage, }) {
|
|
|
140
140
|
const regels = (o.regels ?? []);
|
|
141
141
|
const t = klokTellers(regels);
|
|
142
142
|
const prijzen = regels.map((r) => Number(r.min_prijs)).filter((n) => n > 0);
|
|
143
|
-
return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [
|
|
143
|
+
return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [_jsxs("td", { className: "px-4 font-medium tabular-nums", children: [o.klok_nummer, o.herkomst === "floriday" && _jsxs("span", { className: "block text-xs font-normal text-muted-foreground", children: ["Uit Floriday", o.floriday_delivery_note_code ? ` · ${o.floriday_delivery_note_code}` : ""] })] }), _jsx("td", { className: "px-3", children: o.veillocatie_naam ?? "—" }), _jsx("td", { className: "px-3 tabular-nums", children: o.veilgroep ?? "—" }), _jsxs("td", { className: "px-3 tabular-nums", children: [t.fusten, " \u00B7 ", t.stuks] }), _jsx("td", { className: "px-3 tabular-nums", children: prijzen.length ? `€ ${Math.min(...prijzen).toFixed(2).replace(".", ",")}${prijzen.length > 1 && Math.max(...prijzen) !== Math.min(...prijzen) ? ` – ${Math.max(...prijzen).toFixed(2).replace(".", ",")}` : ""}` : "—" }), _jsx("td", { className: "px-3", children: _jsx(KlokStatusBadge, { status: o.status, detail: o.status_detail ?? o.laatste_fout }) }), _jsx("td", { className: "px-3", onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Acties", disabled: bezig === o.id, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => herhaal(o), children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), (o.afleverbrieven ?? []).length ? (_jsxs(DropdownMenuItem, { onClick: () => afleverbrief(o), children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] })) : (_jsx("div", { title: KLOK_AFLEVERBRIEF_UIT_TEXT, "aria-label": `Afleverbrief: ${KLOK_AFLEVERBRIEF_UIT_TEXT}`, children: _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] }) })), klokAnnulerenOpenstaand(o) && (_jsxs(DropdownMenuItem, { onClick: () => opnieuwAnnuleren(o), children: [_jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), o.herkomst !== "floriday" && klokKanVerwijderen(o.status) && (_jsxs(DropdownMenuItem, { className: "text-destructive", onClick: () => setTeVerwijderen(o), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] }) })] }, o.id));
|
|
144
144
|
}) }, dag || "geen"))) })] }), params && pages > 1 && (_jsxs("div", { className: "flex items-center justify-between gap-2 border-t border-border px-4 py-3 text-sm", children: [_jsxs("span", { className: "text-muted-foreground tabular-nums", children: [(page - 1) * KLOK_PAGE_SIZE + 1, "\u2013", Math.min(total, page * KLOK_PAGE_SIZE), " van ", total] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: page <= 1, onClick: () => onPage?.(page - 1), children: "Vorige" }), _jsx(Button, { variant: "outline", size: "sm", disabled: page >= pages, onClick: () => onPage?.(page + 1), children: "Volgende" })] })] })), teVerwijderen && (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 p-4", onClick: () => !bezig && setTeVerwijderen(null), children: _jsxs("div", { className: "w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg", onClick: (e) => e.stopPropagation(), children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Veilbrief ", teVerwijderen.klok_nummer, " verwijderen?"] }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setTeVerwijderen(null), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: () => verwijder(teVerwijderen), disabled: !!bezig, "aria-busy": !!bezig || undefined, children: bezig ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] }) }))] }));
|
|
145
145
|
}
|
|
146
146
|
function FragmentGroep({ label, count, children }) {
|