@flowselections/floriday-verkoop-module 1.0.165 → 1.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/CreateOrderPage.js +163 -70
- package/dist-lib/components/verkoop/EditLocalOrderDialog.d.ts.map +1 -1
- package/dist-lib/components/verkoop/EditLocalOrderDialog.js +3 -1
- package/dist-lib/components/verkoop/KarTekeningSection.d.ts.map +1 -1
- package/dist-lib/components/verkoop/KarTekeningSection.js +31 -7
- package/dist-lib/components/verkoop/OrderCarrierPicker.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderCarrierPicker.js +1 -0
- package/dist-lib/components/verkoop/OrderKarindelingCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderKarindelingCard.js +18 -3
- package/dist-lib/components/verkoop/OrderTransportCard.d.ts +9 -0
- package/dist-lib/components/verkoop/OrderTransportCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderTransportCard.js +21 -2
- package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.js +16 -8
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +31 -5
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.js +3 -2
- package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/VerkoopOrdersPage.js +2 -1
- package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts +10 -0
- package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/CorrectieBesluitKnoppen.js +47 -0
- package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts +10 -0
- package/dist-lib/components/verkoop/correcties/CorrectieChip.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/CorrectieChip.js +11 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts +3 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesBalk.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesBalk.js +16 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts +3 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesPage.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/CorrectiesPage.js +31 -0
- package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts +7 -0
- package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/OrderCorrectiesCard.js +17 -0
- package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts +5 -0
- package/dist-lib/components/verkoop/correcties/OudeOrderCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/correcties/OudeOrderCard.js +48 -0
- package/dist-lib/components/verkoop/regel/OrderLineExtrasCard.d.ts +8 -0
- package/dist-lib/components/verkoop/regel/OrderLineExtrasCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/regel/OrderLineExtrasCard.js +107 -0
- package/dist-lib/components/verkoop/regel/RegelGegevensVelden.d.ts +19 -0
- package/dist-lib/components/verkoop/regel/RegelGegevensVelden.d.ts.map +1 -0
- package/dist-lib/components/verkoop/regel/RegelGegevensVelden.js +26 -0
- package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts +5 -0
- package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/tijdlijn/GewijzigdNaPrintCard.js +53 -0
- package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts +5 -0
- package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/tijdlijn/OrderTijdlijnCard.js +31 -0
- package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts +11 -0
- package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.d.ts.map +1 -0
- package/dist-lib/components/verkoop/tijdlijn/useOrderTijdlijn.js +17 -0
- package/dist-lib/index.d.ts +1 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +1 -0
- package/dist-lib/integrations/supabase/types.d.ts +2530 -2
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +1 -0
- package/dist-lib/lib/belading-format.d.ts +3 -2
- package/dist-lib/lib/belading-format.d.ts.map +1 -1
- package/dist-lib/lib/belading-format.js +5 -3
- package/dist-lib/lib/beslis-rollen.server.d.ts +10 -0
- package/dist-lib/lib/beslis-rollen.server.d.ts.map +1 -0
- package/dist-lib/lib/beslis-rollen.server.js +10 -0
- package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
- package/dist-lib/lib/cart-replan.functions.js +8 -4
- package/dist-lib/lib/create-order-customers.d.ts +13 -0
- package/dist-lib/lib/create-order-customers.d.ts.map +1 -1
- package/dist-lib/lib/create-order-customers.js +41 -0
- package/dist-lib/lib/create-order-form.d.ts +7 -1
- package/dist-lib/lib/create-order-form.d.ts.map +1 -1
- package/dist-lib/lib/create-order-form.js +17 -1
- package/dist-lib/lib/create-order.functions.d.ts +10 -7
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.js +163 -56
- package/dist-lib/lib/departure-preview.functions.d.ts.map +1 -1
- package/dist-lib/lib/departure-preview.functions.js +3 -1
- package/dist-lib/lib/engine-tijdlijn.d.ts +69 -0
- package/dist-lib/lib/engine-tijdlijn.d.ts.map +1 -0
- package/dist-lib/lib/engine-tijdlijn.functions.d.ts +30 -0
- package/dist-lib/lib/engine-tijdlijn.functions.d.ts.map +1 -0
- package/dist-lib/lib/engine-tijdlijn.functions.js +47 -0
- package/dist-lib/lib/engine-tijdlijn.js +101 -0
- package/dist-lib/lib/engine-tijdlijn.server.d.ts +30 -0
- package/dist-lib/lib/engine-tijdlijn.server.d.ts.map +1 -0
- package/dist-lib/lib/engine-tijdlijn.server.js +41 -0
- package/dist-lib/lib/floriday-carrier-notice.d.ts +28 -0
- package/dist-lib/lib/floriday-carrier-notice.d.ts.map +1 -0
- package/dist-lib/lib/floriday-carrier-notice.js +44 -0
- package/dist-lib/lib/floriday-carrier-notice.server.d.ts +8 -0
- package/dist-lib/lib/floriday-carrier-notice.server.d.ts.map +1 -0
- package/dist-lib/lib/floriday-carrier-notice.server.js +57 -0
- package/dist-lib/lib/floriday-external-fulfillment.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-external-fulfillment.server.js +15 -11
- package/dist-lib/lib/floriday-mirror.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-mirror.server.js +58 -42
- package/dist-lib/lib/kar-handmatig.d.ts +7 -1
- package/dist-lib/lib/kar-handmatig.d.ts.map +1 -1
- package/dist-lib/lib/kar-handmatig.js +24 -2
- package/dist-lib/lib/kar-tekening.d.ts +54 -4
- package/dist-lib/lib/kar-tekening.d.ts.map +1 -1
- package/dist-lib/lib/kar-tekening.js +92 -8
- package/dist-lib/lib/kar-tekening.server.d.ts +5 -0
- package/dist-lib/lib/kar-tekening.server.d.ts.map +1 -1
- package/dist-lib/lib/kar-tekening.server.js +18 -0
- package/dist-lib/lib/logistics-engine.server.d.ts.map +1 -1
- package/dist-lib/lib/logistics-engine.server.js +13 -9
- package/dist-lib/lib/order-bijwerken.server.d.ts +20 -0
- package/dist-lib/lib/order-bijwerken.server.d.ts.map +1 -0
- package/dist-lib/lib/order-bijwerken.server.js +31 -0
- package/dist-lib/lib/order-cancel.server.d.ts.map +1 -1
- package/dist-lib/lib/order-cancel.server.js +33 -23
- package/dist-lib/lib/order-carrier.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-carrier.functions.js +4 -13
- package/dist-lib/lib/order-cf-merge.d.ts +17 -0
- package/dist-lib/lib/order-cf-merge.d.ts.map +1 -0
- package/dist-lib/lib/order-cf-merge.js +51 -0
- package/dist-lib/lib/order-item-packing.functions.d.ts +40 -0
- package/dist-lib/lib/order-item-packing.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-item-packing.functions.js +95 -9
- package/dist-lib/lib/order-line-extras.d.ts +94 -0
- package/dist-lib/lib/order-line-extras.d.ts.map +1 -0
- package/dist-lib/lib/order-line-extras.functions.d.ts +55 -0
- package/dist-lib/lib/order-line-extras.functions.d.ts.map +1 -0
- package/dist-lib/lib/order-line-extras.functions.js +117 -0
- package/dist-lib/lib/order-line-extras.js +171 -0
- package/dist-lib/lib/order-nav.d.ts +8 -0
- package/dist-lib/lib/order-nav.d.ts.map +1 -1
- package/dist-lib/lib/order-nav.js +13 -0
- package/dist-lib/lib/order-pickup.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-pickup.functions.js +5 -9
- package/dist-lib/lib/order-row.server.d.ts.map +1 -1
- package/dist-lib/lib/order-row.server.js +9 -6
- package/dist-lib/lib/order-status.d.ts +9 -1
- package/dist-lib/lib/order-status.d.ts.map +1 -1
- package/dist-lib/lib/order-status.js +8 -0
- package/dist-lib/lib/order-transport.functions.d.ts +9 -0
- package/dist-lib/lib/order-transport.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-transport.functions.js +21 -3
- 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 +15 -1
- package/dist-lib/lib/own-transport.d.ts +6 -0
- package/dist-lib/lib/own-transport.d.ts.map +1 -1
- package/dist-lib/lib/own-transport.js +12 -0
- package/dist-lib/lib/plan-coverage.server.d.ts.map +1 -1
- package/dist-lib/lib/plan-coverage.server.js +4 -2
- package/dist-lib/lib/sales-corrections.d.ts +44 -0
- package/dist-lib/lib/sales-corrections.d.ts.map +1 -0
- package/dist-lib/lib/sales-corrections.functions.d.ts +92 -0
- package/dist-lib/lib/sales-corrections.functions.d.ts.map +1 -0
- package/dist-lib/lib/sales-corrections.functions.js +132 -0
- package/dist-lib/lib/sales-corrections.js +129 -0
- package/dist-lib/lib/sales-corrections.server.d.ts +27 -0
- package/dist-lib/lib/sales-corrections.server.d.ts.map +1 -0
- package/dist-lib/lib/sales-corrections.server.js +68 -0
- package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.functions.js +17 -11
- package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +4 -2
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.js +7 -2
- package/dist-lib/lib/step-timer.server.d.ts +13 -0
- package/dist-lib/lib/step-timer.server.d.ts.map +1 -0
- package/dist-lib/lib/step-timer.server.js +33 -0
- package/dist-lib/lib/stock-product-link.server.d.ts.map +1 -1
- package/dist-lib/lib/stock-product-link.server.js +12 -8
- package/dist-lib/lib/useBufferEvents.d.ts.map +1 -1
- package/dist-lib/lib/useBufferEvents.js +2 -1
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts.map +1 -1
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.js +7 -1
- package/dist-lib/lib/useOpenCorrections.d.ts +17 -0
- package/dist-lib/lib/useOpenCorrections.d.ts.map +1 -0
- package/dist-lib/lib/useOpenCorrections.js +34 -0
- package/dist-lib/lib/useOrderDetailPrefetch.d.ts +9 -0
- package/dist-lib/lib/useOrderDetailPrefetch.d.ts.map +1 -0
- package/dist-lib/lib/useOrderDetailPrefetch.js +45 -0
- package/dist-lib/lib/useSalesOrderDetailQuery.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrderDetailQuery.js +5 -0
- package/dist-lib/lib/voorraad-vrij.d.ts +19 -0
- package/dist-lib/lib/voorraad-vrij.d.ts.map +1 -0
- package/dist-lib/lib/voorraad-vrij.js +34 -0
- package/package.json +9 -4
- package/schema/verkoop.sql +560 -0
|
@@ -6,6 +6,7 @@ export declare function useOrderTransport(orderId: string | null | undefined, en
|
|
|
6
6
|
deliveryDate: string | null;
|
|
7
7
|
carrier: import("../../lib/carrier-resolve.js").ResolvedCarrier;
|
|
8
8
|
carrierGln: string | null;
|
|
9
|
+
floridayCarrierNotice: string | null;
|
|
9
10
|
own: boolean;
|
|
10
11
|
ownKind: string | null;
|
|
11
12
|
ownPickup: {
|
|
@@ -16,6 +17,14 @@ export declare function useOrderTransport(orderId: string | null | undefined, en
|
|
|
16
17
|
lockReason: import("../../lib/own-transport.js").PickupLockReason;
|
|
17
18
|
lockKnown: boolean;
|
|
18
19
|
}, Error>;
|
|
20
|
+
/** Melding bij Vervoer: transporteur in Floriday wijkt af van de gekozen vervoerder (alleen weergave). */
|
|
21
|
+
export declare function FloridayCarrierNoticeText({ text }: {
|
|
22
|
+
text: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** Zelfde melding voor meerdere orders (groep); per order met ordernummer als er meer zijn. */
|
|
25
|
+
export declare function FloridayCarrierNotices({ orderIds }: {
|
|
26
|
+
orderIds: string[];
|
|
27
|
+
}): import("react").JSX.Element | null;
|
|
19
28
|
/** "do 29 okt 15:00" uit { date, time }. */
|
|
20
29
|
export declare function ownPickupText(p: {
|
|
21
30
|
date: string;
|
|
@@ -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;;;;;;;;;;;;;;;UAQnF;AAED,0GAA0G;AAC1G,wBAAgB,yBAAyB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAMnE;AAED,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,sCAkB1E;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIjG;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAmC,EAAE,EAAE;IACpH,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,+BAuCA;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,+BAyF9H;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,sCAWrE"}
|
|
@@ -10,7 +10,7 @@ import { OrderPickupMomentPicker } from "./OrderPickupMomentPicker.js";
|
|
|
10
10
|
import { usePickupMoment } from "../../lib/usePickupMoment.js";
|
|
11
11
|
import { formatMoment } from "../../lib/order-departure.js";
|
|
12
12
|
import { dateWithWeekday } from "../../lib/create-order-form.js";
|
|
13
|
-
import { getOrderTransport, setOrderOwnPickupTime } from "../../lib/order-transport.functions.js";
|
|
13
|
+
import { getFloridayCarrierNotices, getOrderTransport, setOrderOwnPickupTime } from "../../lib/order-transport.functions.js";
|
|
14
14
|
import { OWN_PICKUP_LOCKED_TEXT, OWN_PICKUP_MISSING_TEXT, OWN_PICKUP_UNKNOWN_TEXT, ownPickupLabel, ownPickupPlannedText, ownPickupView } from "../../lib/own-transport.js";
|
|
15
15
|
import { formatLoadUnits } from "../../lib/load-carrier-labels.js";
|
|
16
16
|
import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
|
|
@@ -24,6 +24,25 @@ export function useOrderTransport(orderId, enabled = true) {
|
|
|
24
24
|
staleTime: 30000,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
+
/** Melding bij Vervoer: transporteur in Floriday wijkt af van de gekozen vervoerder (alleen weergave). */
|
|
28
|
+
export function FloridayCarrierNoticeText({ text }) {
|
|
29
|
+
return (_jsxs("div", { role: "status", className: "mt-1 flex items-start gap-1.5 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 }), " ", _jsx("span", { children: text })] }));
|
|
30
|
+
}
|
|
31
|
+
/** Zelfde melding voor meerdere orders (groep); per order met ordernummer als er meer zijn. */
|
|
32
|
+
export function FloridayCarrierNotices({ orderIds }) {
|
|
33
|
+
const fetchN = useServerFn(getFloridayCarrierNotices);
|
|
34
|
+
const ids = orderIds.filter(Boolean);
|
|
35
|
+
const q = useQuery({
|
|
36
|
+
queryKey: ["order-transport", "floriday-carrier", ...ids],
|
|
37
|
+
queryFn: () => fetchN({ data: { orderIds: ids } }),
|
|
38
|
+
enabled: ids.length > 0,
|
|
39
|
+
staleTime: 30000,
|
|
40
|
+
});
|
|
41
|
+
const rows = q.data ?? [];
|
|
42
|
+
if (!rows.length)
|
|
43
|
+
return null;
|
|
44
|
+
return (_jsx("div", { className: "space-y-0.5", children: rows.map((r) => (_jsx(FloridayCarrierNoticeText, { text: ids.length > 1 && r.orderNumber ? `${r.orderNumber}: ${r.melding}` : r.melding }, r.orderId))) }));
|
|
45
|
+
}
|
|
27
46
|
/** "do 29 okt 15:00" uit { date, time }. */
|
|
28
47
|
export function ownPickupText(p) {
|
|
29
48
|
if (!p)
|
|
@@ -82,7 +101,7 @@ export function OrderTransportCard({ order, groupSize, extra }) {
|
|
|
82
101
|
const missingOwnTime = view.melding === "invullen";
|
|
83
102
|
const signup = !t?.own && !afgehandeld ? formatMoment(pm.data?.departure?.signupDeadline ?? null) : null;
|
|
84
103
|
const karren = Number(order.karCount ?? 0);
|
|
85
|
-
return (_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer", attention: missingOwnTime, action: !locked ? (_jsx(Button, { size: "sm", variant: "ghost", className: "[@media(pointer:coarse)]:h-11", onClick: () => setChanging((v) => !v), "aria-expanded": changing, children: changing ? "Klaar" : "Vervoerder wijzigen" })) : undefined, children: [(groupSize ?? 0) > 1 && (_jsxs("div", { className: "mb-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: ["Vervoerder en ophaalmoment gelden voor alle ", groupSize, " orders in deze groep."] })), missingOwnTime && (_jsxs("div", { role: "status", className: "mb-2 flex items-start gap-2 rounded-lg border border-warning/40 bg-warning-soft px-3 py-2 text-xs font-medium text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": true }), " ", OWN_PICKUP_MISSING_TEXT] })), view.melding === "onbekend" && !t?.ownPickup && (_jsx("div", { role: "status", className: "mb-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground", children: OWN_PICKUP_UNKNOWN_TEXT })), locked ? (
|
|
104
|
+
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] }));
|
|
86
105
|
}
|
|
87
106
|
/** Kopregel van een handmatige order: "Ophalen do 29 okt 15:00 · Levering vr 30 okt 08:00". */
|
|
88
107
|
export function PickupDeliveryLine({ order }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AAwIA,wBAAgB,oBAAoB,gCA6WnC"}
|
|
@@ -23,6 +23,7 @@ import { useSalesOrdersQuery } from "../../lib/useSalesOrdersQuery.js";
|
|
|
23
23
|
import { useBufferEvents } from "../../lib/useBufferEvents.js";
|
|
24
24
|
import { useSalesOrderDetailQuery } from "../../lib/useSalesOrderDetailQuery.js";
|
|
25
25
|
import { useLocalSalesOrderDetailQuery } from "../../lib/useLocalSalesOrderDetailQuery.js";
|
|
26
|
+
import { localIdFallback } from "../../lib/order-nav.js";
|
|
26
27
|
import { getOrderAddresses } from "../../lib/order-addresses.functions.js";
|
|
27
28
|
import { orderStageLabel, orderStageBadgeClass } from "../../lib/order-status.js";
|
|
28
29
|
import { useDetailProgressFallback } from "../../lib/useDetailProgressFallback.js";
|
|
@@ -33,10 +34,11 @@ import { OrderStepper } from "./v3/OrderStepper.js";
|
|
|
33
34
|
import { NavigationTooltip } from "./v3/NavigationTooltip.js";
|
|
34
35
|
import { FactTile, InfoCard, InfoRow } from "./v3/InfoCard.js";
|
|
35
36
|
import { KLANT_HAALT_ZELF_OP } from "../../lib/own-transport.js";
|
|
36
|
-
import { PickupDeliveryLine, useOrderTransport } from "./OrderTransportCard.js";
|
|
37
|
+
import { FloridayCarrierNotices, PickupDeliveryLine, useOrderTransport } from "./OrderTransportCard.js";
|
|
37
38
|
import { groepZonderGeannuleerd, kanLidAnnuleren } from "../../lib/order-cancel-view.js";
|
|
38
39
|
import { geannuleerdMelding } from "../../lib/order-terugdraaien.js";
|
|
39
40
|
import { cancelLocalOrder } from "../../lib/create-order.functions.js";
|
|
41
|
+
import { useOrderDetailPrefetch } from "../../lib/useOrderDetailPrefetch.js";
|
|
40
42
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, toast } from "@flowselections/core";
|
|
41
43
|
import { Loader2 } from "lucide-react";
|
|
42
44
|
const eur = new Intl.NumberFormat("nl-NL", { style: "currency", currency: "EUR", minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
@@ -100,14 +102,20 @@ export function SalesOrderDetailPage() {
|
|
|
100
102
|
const { weergave } = useSearch({ from: "/_authenticated/floriday-verkoop/verkooporders/$salesOrderId" });
|
|
101
103
|
const singleInGroup = weergave === "order";
|
|
102
104
|
const cached = useListRow(salesOrderId);
|
|
103
|
-
const
|
|
105
|
+
const isLocalPrefix = salesOrderId.startsWith("local:");
|
|
104
106
|
const isMailboxProposal = salesOrderId.startsWith("mailbox-proposal:");
|
|
105
|
-
|
|
107
|
+
// Kaartgegevens tegelijk met de order ophalen (geen tweede wachtronde).
|
|
108
|
+
useOrderDetailPrefetch(salesOrderId, { reservation: cached.row?.isReservation ?? null });
|
|
106
109
|
// Floriday-orders: gerichte, snelle per-order fetch.
|
|
107
|
-
const detailQuery = useSalesOrderDetailQuery(
|
|
110
|
+
const detailQuery = useSalesOrderDetailQuery(!isLocalPrefix && !isMailboxProposal ? salesOrderId : null);
|
|
111
|
+
// De route accepteert ook het kale orders.id: geen Floriday-order met dit id → eigen order.
|
|
112
|
+
const kaalId = localIdFallback(salesOrderId, detailQuery.data ? { order: detailQuery.data.order ?? null } : null);
|
|
113
|
+
const isLocal = isLocalPrefix || !!kaalId;
|
|
114
|
+
const isFloriday = !isLocal && !isMailboxProposal;
|
|
115
|
+
const localDetailId = isLocalPrefix ? salesOrderId : kaalId;
|
|
108
116
|
// Lokale orders: eveneens gericht ophalen, onafhankelijk van paginering en
|
|
109
117
|
// filters in de algemene verkooplijst.
|
|
110
|
-
const localDetailQuery = useLocalSalesOrderDetailQuery(
|
|
118
|
+
const localDetailQuery = useLocalSalesOrderDetailQuery(localDetailId);
|
|
111
119
|
// Alleen mailbox-orders hebben de algemene lijst nog nodig. Lokale en
|
|
112
120
|
// Floriday-details hebben een eigen gerichte bron; een tweede beschermde
|
|
113
121
|
// aanvraag kan hun detailweergave dus niet meer verstoren.
|
|
@@ -191,8 +199,8 @@ export function SalesOrderDetailPage() {
|
|
|
191
199
|
const bufferCartsQ = useBufferCarts(isBuffer ? bufferId : null);
|
|
192
200
|
const engineBuffer = bufferCartsQ.data?.carts ?? null;
|
|
193
201
|
const [editOpen, setEditOpen] = useState(false);
|
|
194
|
-
const rawLocalId = isLocal &&
|
|
195
|
-
?
|
|
202
|
+
const rawLocalId = isLocal && localDetailId?.startsWith("local:")
|
|
203
|
+
? localDetailId.slice("local:".length)
|
|
196
204
|
: null;
|
|
197
205
|
// Factuurstand + pickvoortgang komen mee in het detailverzoek (geen tweede ronde).
|
|
198
206
|
const qcSeed = useQueryClient();
|
|
@@ -259,7 +267,7 @@ export function SalesOrderDetailPage() {
|
|
|
259
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 && (() => {
|
|
260
268
|
const f = friendlyLoadError(error);
|
|
261
269
|
return (_jsxs("div", { role: "alert", className: "flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive-soft p-4 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-medium text-foreground", children: f.text }), _jsxs("details", { className: "mt-1 text-xs text-muted-foreground", children: [_jsx("summary", { className: "cursor-pointer", children: "Technische details" }), f.tech] })] }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => activeQuery.refetch(), children: "Opnieuw" })] }));
|
|
262
|
-
})(), !isLoading && !error && !primary && (_jsx("div", { className: "rounded-xl border border-border bg-card p-8 text-center text-sm text-muted-foreground shadow-sm", children: "Order niet gevonden." })), primary && isBuffer && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(Euro, {}), label: "Totale omzet", value: eur.format(totals.revenue), sub: `${bufferOrders.length} orders` }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren", value: engineBuffer ? engineBuffer.karren : totals.karren == null ? "Nog niet bekend" : formatLoadUnits(totals.karren, totals.cartType), sub: engineBuffer && engineBuffer.ladingdragers.length > 0 ? ladingdragerSummary(engineBuffer) : undefined }), _jsx(FactTile, { icon: _jsx(Layers, {}), label: "Fust", value: formatLoadUnits(totals.fusten, totals.crateType) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: primary.customer.name, sub: primary.customer.legalName ?? undefined })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsx(InfoCard, { icon: _jsx(Layers, {}), title: `Orders in deze groep (${bufferOrders.length})`, children: _jsx("div", { className: "space-y-3", children: bufferOrders.map((o) => (_jsx(BufferOrderRow, { order: o, member: membersFor([o])[0], sellerFallback: sellerFallback }, o.id))) }) }), _jsxs("div", { children: [_jsx("div", { className: "mb-2 text-sm font-semibold text-foreground", children: "Gecombineerde karindeling" }), _jsx(OrderKarindelingCard, { order: primary, pickProgress: bufferPickProgress(engineBuffer, membersFor(bufferOrders).map((m) => m.pickProgress ?? null)) })] })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer en ophalen", children: [
|
|
270
|
+
})(), !isLoading && !error && !primary && (_jsx("div", { className: "rounded-xl border border-border bg-card p-8 text-center text-sm text-muted-foreground shadow-sm", children: "Order niet gevonden." })), primary && isBuffer && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(Euro, {}), label: "Totale omzet", value: eur.format(totals.revenue), sub: `${bufferOrders.length} orders` }), _jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren", value: engineBuffer ? engineBuffer.karren : totals.karren == null ? "Nog niet bekend" : formatLoadUnits(totals.karren, totals.cartType), sub: engineBuffer && engineBuffer.ladingdragers.length > 0 ? ladingdragerSummary(engineBuffer) : undefined }), _jsx(FactTile, { icon: _jsx(Layers, {}), label: "Fust", value: formatLoadUnits(totals.fusten, totals.crateType) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: primary.customer.name, sub: primary.customer.legalName ?? undefined })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsx(InfoCard, { icon: _jsx(Layers, {}), title: `Orders in deze groep (${bufferOrders.length})`, children: _jsx("div", { className: "space-y-3", children: bufferOrders.map((o) => (_jsx(BufferOrderRow, { order: o, member: membersFor([o])[0], sellerFallback: sellerFallback }, o.id))) }) }), _jsxs("div", { children: [_jsx("div", { className: "mb-2 text-sm font-semibold text-foreground", children: "Gecombineerde karindeling" }), _jsx(OrderKarindelingCard, { order: primary, pickProgress: bufferPickProgress(engineBuffer, membersFor(bufferOrders).map((m) => m.pickProgress ?? null)) })] })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Truck, {}), title: "Vervoer en ophalen", children: [_jsxs(InfoRow, { label: "Vervoerder", children: [_jsx(OrderCarrierPicker, { orderId: primary.id, applyToBuffer: true, compact: true, groupSize: bufferOrders.length, locked: bufferOrders.every((o) => !!o.isReservation) }), _jsx(FloridayCarrierNotices, { orderIds: bufferOrders.map((o) => String(o.id)) })] }), _jsxs(InfoRow, { label: "Ophaalmoment", children: [_jsx(OrderPickupMomentPicker, { orderId: primary.id, readOnly: true, compact: true }), _jsxs("div", { className: "mt-1 text-xs font-medium text-warning-soft-foreground", children: ["Geldt voor alle ", bufferOrders.length, " orders in deze groep"] })] }), _jsx(BufferAddresses, { orderId: primary.id })] }), fTotal > 0 && (_jsxs(InfoCard, { icon: _jsx(ReceiptText, {}), title: "Floriday", children: [_jsx(InfoRow, { label: "Floriday-orders", children: _jsx("span", { className: "flex flex-wrap gap-1.5", children: bufferOrders.filter((o) => !o.isLocal && o.orderNumber).map((o) => (_jsx(Badge, { variant: "outline", className: "text-xs", children: o.orderNumber }, o.id))) }) }), _jsxs(InfoRow, { label: "Afgemeld", children: [fDone, " van ", fTotal] })] }))] })] })] })), inGroup && !singleInGroup && rawLocalId && _jsx(EngineBufferCard, { orderId: rawLocalId }), primary && !isBuffer && (_jsx(SalesOrderDetailView, { order: primary, sellerFallback: sellerFallback, members: membersFor([primary]), features: features, groupSize: inGroup ? bufferOrders.length : undefined })), rawLocalId && _jsx(EditLocalOrderDialog, { orderId: rawLocalId, open: editOpen, onOpenChange: setEditOpen })] }));
|
|
263
271
|
}
|
|
264
272
|
function BufferOrderRow({ order, member, sellerFallback }) {
|
|
265
273
|
const [open, setOpen] = useState(false);
|
|
@@ -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;AAqKnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAkBA"}
|
|
@@ -22,6 +22,13 @@ import { OrderControlStatusCard } from "./OrderControlStatusCard.js";
|
|
|
22
22
|
import { OrderTransportCard, ownPickupText, useOrderTransport } from "./OrderTransportCard.js";
|
|
23
23
|
import { KLANT_HAALT_ZELF_OP } from "../../lib/own-transport.js";
|
|
24
24
|
import { getFloridayStatusesForRows } from "../../lib/salesorders-list.functions.js";
|
|
25
|
+
import { OrderCorrectiesCard } from "./correcties/OrderCorrectiesCard.js";
|
|
26
|
+
import { OudeOrderCard } from "./correcties/OudeOrderCard.js";
|
|
27
|
+
import { GewijzigdNaPrintCard } from "./tijdlijn/GewijzigdNaPrintCard.js";
|
|
28
|
+
import { OrderTijdlijnCard } from "./tijdlijn/OrderTijdlijnCard.js";
|
|
29
|
+
import { OrderLineExtrasCard } from "./regel/OrderLineExtrasCard.js";
|
|
30
|
+
import { listOrderItemPacking } from "../../lib/order-item-packing.functions.js";
|
|
31
|
+
import { formatBelading } from "../../lib/belading-format.js";
|
|
25
32
|
function AddressCard({ icon, lines, extra, }) {
|
|
26
33
|
return (_jsxs("div", { className: "inline-flex max-w-xs items-start gap-3 rounded-md border border-border bg-card p-3", children: [_jsx("div", { className: "flex h-9 w-9 items-center justify-center rounded-md bg-primary/10 text-primary", children: icon }), _jsxs("div", { className: "text-sm", children: [lines.length > 0 ? lines.map((l, i) => _jsx("div", { children: l }, i)) : _jsx("div", { children: "\u2014" }), extra && _jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: extra })] })] }));
|
|
27
34
|
}
|
|
@@ -143,14 +150,28 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
143
150
|
const o = order.raw.order ?? {};
|
|
144
151
|
const c = order.raw.customer ?? {};
|
|
145
152
|
const cRaw = c?.raw ?? {};
|
|
153
|
+
// Floriday-order die nog niet als eigen order bestaat: niets opvragen dat een eigen order nodig heeft.
|
|
154
|
+
const wordtVerwerkt = order.stageNote === "processing";
|
|
146
155
|
const fetchAddresses = useServerFn(getOrderAddresses);
|
|
147
156
|
const { data: resolvedAddresses } = useQuery({
|
|
148
157
|
queryKey: ["order-addresses", order.id],
|
|
149
158
|
queryFn: () => fetchAddresses({ data: { orderId: String(order.id) } }),
|
|
150
159
|
staleTime: 60000,
|
|
160
|
+
enabled: !wordtVerwerkt,
|
|
151
161
|
});
|
|
162
|
+
// Regels met belading en prijs: één aanvraag, gedeeld met de beladingkaart en de karindeling.
|
|
163
|
+
const fetchPacking = useServerFn(listOrderItemPacking);
|
|
164
|
+
const packingQ = useQuery({
|
|
165
|
+
queryKey: ["order-item-packing", String(order.id)],
|
|
166
|
+
queryFn: () => fetchPacking({ data: { orderId: String(order.id) } }),
|
|
167
|
+
staleTime: 15000,
|
|
168
|
+
enabled: !wordtVerwerkt,
|
|
169
|
+
});
|
|
170
|
+
if (packingQ.isError)
|
|
171
|
+
console.error("[orderpagina] regels laden:", packingQ.error);
|
|
172
|
+
const regelItems = packingQ.data?.items ?? [];
|
|
152
173
|
// Zelf ophalen (carrier_kind klant_haalt_op, via de Engine): geen afleveradres maar "Klant haalt zelf op".
|
|
153
|
-
const transportQ = useOrderTransport(String(order.id), !order.isReservation);
|
|
174
|
+
const transportQ = useOrderTransport(String(order.id), !order.isReservation && !wordtVerwerkt);
|
|
154
175
|
const klantHaaltOp = transportQ.data?.ownKind === "klant_haalt_op";
|
|
155
176
|
const instr = String(o.tradeInstrument ?? o.tradingType ?? o.tradeType ?? "").toUpperCase();
|
|
156
177
|
const tradingType = TRADE_INSTRUMENT_LABELS[instr] ?? (instr ? instr.replace(/_/g, " ").toLowerCase() : "—");
|
|
@@ -309,17 +330,22 @@ function SalesOrderDetailViewInner({ floridayLoading, order, sellerFallback, hid
|
|
|
309
330
|
const verkoopwijze = [tradingType !== "—" ? tradingType : null, financial !== "—" ? financial : null].filter(Boolean).join(" · ") || "—";
|
|
310
331
|
const showIncoterm = !!fe && incoterm !== "niet opgegeven" && incoterm !== "—";
|
|
311
332
|
const hasExternal = !!order.floridayExternalFulfilledAt || (order.floridayExternalFulfilledIds?.length ?? 0) > 0;
|
|
312
|
-
return (_jsxs("div", { className: "space-y-4", children: [order.needsManualReview ? (_jsxs(Notice, { tone: "destructive", title: "Handmatige controle nodig", children: [order.needsManualReview.reason, order.needsManualReview.at ? ` (gezien op ${fmtNLDefault(order.needsManualReview.at)})` : ""] })) : null, isFlorinOrder && order.mixedDeliveryDates ? (_jsx(Notice, { tone: "muted", title: "Bestellingen met verschillende leverdatums", children: "Deze order bestaat uit Floriday-bestellingen met verschillende leverdatums. De vroegste leverdatum is aangehouden." })) : null, isFlorinOrder && (order.unlinkedProducts?.length ?? 0) > 0 ? (_jsxs(Notice, { tone: "destructive", title: "Artikel uit Floriday nog niet gekoppeld aan een eigen product", children: [_jsx("ul", { className: "mt-1 space-y-0.5", children: order.unlinkedProducts.map((u, i) => (_jsx("li", { children: u.name }, i))) }), _jsx("div", { className: "mt-1 text-xs", children: "Koppel het artikel aan een eigen product; bij de volgende update wordt het overgenomen." })] })) : null, order.floridayMissingLineKeyNotice && (_jsx(Notice, { tone: "destructive", title: "Let op", children: order.floridayMissingLineKeyNotice })), _jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-4", children: [_jsx(FactTile, { icon: _jsx(CalendarDays, {}), label: "Leverdatum", value: order.deliveryAt ? formatDelivery(order.deliveryAt, deliveryHasTimeFor(order), { year: true, wallClock: deliveryIsWallClockFor(order) }).date : "—", sub: _jsx(DeliveryTileSub, { order: order }) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), klantHaaltOp
|
|
333
|
+
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: _jsx(DeliveryTileSub, { order: order }) }), _jsx(FactTile, { icon: _jsx(User, {}), label: "Klant", value: customerName || "—", sub: [customerLegalName, order.customer.city].filter(Boolean).join(" · ") || undefined }), klantHaaltOp
|
|
313
334
|
? _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: KLANT_HAALT_ZELF_OP })
|
|
314
335
|
: _jsx(FactTile, { icon: _jsx(MapPin, {}), label: "Leveradres", value: deliveryLines[0] ?? "—", sub: deliveryLines.slice(1).join(", ") || undefined }), (() => {
|
|
315
336
|
const noCarrier = !order.cartTypeName || /geen ladingdrager/i.test(order.cartTypeName);
|
|
316
337
|
const fust = order.fustCount > 0 ? `${formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName)} fust` : "";
|
|
317
338
|
return (_jsx(FactTile, { icon: _jsx(Boxes, {}), label: "Karren / fusten", value: noCarrier ? (fust || "Geen ladingdrager") : formatLoadUnits(order.karCount, order.cartTypeName), sub: [noCarrier ? (fust ? "Geen ladingdrager" : "") : fust, order.karShared ? "kar gedeeld met andere orders" : ""].filter(Boolean).join(" · ") || undefined }));
|
|
318
|
-
})()] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Flower2, {}), title: "Artikelen", attention: priceProblem, children: [_jsx("div", { className: "-mx-4 overflow-x-auto sm:-mx-5", children: _jsxs("table", { className: "w-full min-w-[520px] text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Artikel" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Aantal" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Fust" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Prijs" }), _jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Totaal" })] }) }), _jsx("tbody", { children:
|
|
339
|
+
})()] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]", children: [_jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(Flower2, {}), title: "Artikelen", attention: priceProblem, children: [_jsx("div", { className: "-mx-4 overflow-x-auto sm:-mx-5", children: _jsxs("table", { className: "w-full min-w-[520px] text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-border text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Artikel" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Aantal" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Fust" }), _jsx("th", { className: "px-2 py-2 font-semibold", children: "Prijs" }), _jsx("th", { className: "px-4 py-2 font-semibold sm:px-5", children: "Totaal" })] }) }), _jsx("tbody", { children: regelItems.length > 1 ? regelItems.map((it) => {
|
|
340
|
+
const bel = formatBelading({ perFust: it.plantsPerCrate, fustenPerLaag: it.cratesPerLayer, lagenPerKar: it.layersPerCart });
|
|
341
|
+
const fusten = it.plantsPerCrate && it.plantsPerCrate > 0 ? Math.ceil(it.quantity / it.plantsPerCrate) : null;
|
|
342
|
+
const prijs = it.unitPrice != null && it.unitPrice > 0 ? it.unitPrice : null;
|
|
343
|
+
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));
|
|
344
|
+
}) : (_jsxs("tr", { className: "border-b border-border", children: [_jsx("td", { className: "px-4 py-3 sm:px-5", children: _jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("div", { className: "flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium text-foreground", children: order.productName }), _jsx("div", { className: "text-xs text-muted-foreground", children: order.mixedPacking
|
|
319
345
|
? (order.articleCount ?? 0) > 1 ? `Gemengd (${order.articleCount} artikelen)` : "Gemengd"
|
|
320
|
-
: `Belading ${belading}` })] })] }) }), _jsx("td", { className: "px-2 py-3 font-semibold tabular-nums", children: numberOfPieces > 0 ? numberOfPieces.toLocaleString("nl-NL") : "—" }), _jsx("td", { className: "px-2 py-3 tabular-nums", children: formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName) }), _jsxs("td", { className: "px-2 py-3 tabular-nums", children: [oldProductPrice !== null && _jsx("span", { className: "mr-1 text-destructive line-through", children: eurFlex.format(oldProductPrice) }), eurFlex.format(productUnit)] }), _jsx("td", { className: "px-4 py-3 font-semibold tabular-nums sm:px-5", children: eurFlex.format(totalAmount) })] }) })] }) }), _jsxs("div", { className: "mt-3 space-y-1.5 text-sm", children: [_jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Transportkosten per stuk" }), _jsx("span", { className: "tabular-nums", children: eurFlex.format(transportPerPiece) })] }), _jsxs("div", { className: "flex justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Inkoopprijs per stuk" }), _jsx("span", { className: "tabular-nums", children: hasPurchase ? eurFlex.format(purchaseUnit) : "—" })] }), hasCorrection && (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijscorrectie" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary" }), " Verwerkt"] })] })), _jsxs("div", { className: "flex items-baseline justify-between gap-3 border-t border-border pt-2 text-base font-semibold", children: [_jsx("span", { children: "Totaal" }), _jsxs("span", { className: "text-right tabular-nums", children: [totalBreakdown && _jsxs("span", { className: "mr-2 block text-xs font-normal text-muted-foreground sm:inline", children: ["(", totalBreakdown, ")"] }), eurFlex.format(totalAmount)] })] }), priceProblem && (_jsxs("div", { className: "rounded-lg border border-destructive/40 bg-destructive-soft px-3 py-2 text-xs text-destructive", children: ["Prijs ontbreekt: ", linesWithoutPrice || "een of meer", " regel(s) zonder prijs. Vul de prijs in voordat de order wordt bevestigd."] }))] })] }), _jsx(InfoCard, { icon: _jsx(MapPin, {}), title: "Aflever- en ophaalgegevens", children: _jsxs("div", { className: "grid grid-cols-1 gap-3 py-1 sm:grid-cols-2", children: [klantHaaltOp ? (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border p-4", children: [_jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:h-5 [&_svg]:w-5", "aria-hidden": true, children: _jsx(MapPin, {}) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "mb-1 text-sm font-semibold text-foreground", children: "Afleveradres" }), _jsx("span", { className: "text-foreground", children: KLANT_HAALT_ZELF_OP })] })] })) : (_jsx(AddressBox, { title: "Afleveradres", icon: _jsx(MapPin, {}), lines: deliveryLines })), _jsx(AddressBox, { title: "Ophaaladres", icon: _jsx(Truck, {}), lines: pickupLines })] }) }), _jsx(OrderShipmentsCard, { order: order }), _jsx(OrderLinePackingCard, { orderId: String(order.id) }), !hideKarindeling && _jsx(OrderKarindelingCard, { order: order, pickProgress: member?.pickProgress ?? null })] }), _jsxs("div", { className: "min-w-0 space-y-4", children: [_jsxs(InfoCard, { icon: _jsx(ClipboardList, {}), title: "Orderinformatie", children: [_jsx(InfoRow, { label: "Ordernummer", children: order.orderNumber || "—" }), _jsx(InfoRow, { label: "Status", children: _jsx("span", { className: `rounded-full px-2 py-0.5 text-xs font-medium ${orderStageBadgeClass(order.stage ?? "incoming")}`, children: bestellingLabel }) }), _jsx(InfoRow, { label: "Besteld op", children: fmtDateTime(order.orderedAt) }), _jsx(InfoRow, { label: "Klantreferentie", children: klantReferentie }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopkanaal", children: verkoopkanaal }), isFlorinOrder && _jsx(InfoRow, { label: "Verkoopwijze", children: verkoopwijze }), isFlorinOrder && _jsx(InfoRow, { label: "Floriday-referentie", children: floridayRef }), _jsx(InfoRow, { label: "Verkoper", children: sellerName ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx("span", { className: "inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-semibold text-muted-foreground", children: initials(sellerName) }), sellerName] })) : "—" }), hasExternal && (_jsx(InfoRow, { label: "Afhandeling", children: order.floridayExternalFulfilledAt
|
|
346
|
+
: `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 && order.isLocal && (_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
|
|
321
347
|
? `Afgehandeld in Floriday · ${formatMoment(order.floridayExternalFulfilledAt)}`
|
|
322
|
-
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: invoiceStandText(member, features) }), _jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), (() => {
|
|
348
|
+
: `${order.floridayExternalFulfilledIds.length} bestelling(en) afgehandeld in Floriday; de rest loopt door` }))] }), _jsx(OrderTijdlijnCard, { orderRowId: invoiceOrderId, floriday: !order.isLocal }), _jsx(OrderTransportCard, { order: order, groupSize: groupSize, extra: showIncoterm ? _jsx(InfoRow, { label: "Leveringsvoorwaarde", children: incoterm }) : undefined }), _jsx(InfoCard, { icon: _jsx(ReceiptText, {}), title: route === "floriday" ? "Factuur via Floriday" : "Factuur", attention: route === "erp" && priceProblem, children: route === "floriday" ? (_jsxs(_Fragment, { children: [_jsx(InfoRow, { label: "Stand", children: invoiceStandText(member, features) }), _jsx(InfoRow, { label: "Gefactureerd door", children: "Royal FloraHolland, via Floriday" }), member && (_jsxs(InfoRow, { label: "Afgemeld", children: [member.floridayDone, " van ", member.floridayTotal] })), member && member.stage === "shipped" && member.floridayDone < member.floridayTotal && (_jsx("div", { className: "mt-2 text-xs text-warning-soft-foreground", children: "De factuur volgt pas na afmelden bij Floriday." })), (() => {
|
|
323
349
|
const line = floridayInvoiceState(order.floridayRawStatus, member?.floridayDone ?? 0, member?.floridayTotal ?? 0, {
|
|
324
350
|
full: !!order.floridayExternalFulfilledAt,
|
|
325
351
|
count: order.floridayExternalFulfilledIds?.length ?? 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAwBlC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAG1D;AAuZD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,QAA2B,EAC3B,SAAmC,EACnC,cAAc,EACd,YAAgB,EAChB,OAAO,EACP,KAAa,EACb,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAc,GACf,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAmJA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CorrectieChip } from "./correcties/CorrectieChip.js";
|
|
2
3
|
import { formatDelivery, deliveryHasTimeFor, deliveryIsWallClockFor } from "../../lib/delivery-format.js";
|
|
3
4
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
4
5
|
import { Checkbox, Skeleton, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@flowselections/core";
|
|
@@ -105,7 +106,7 @@ const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, hig
|
|
|
105
106
|
e.stopPropagation();
|
|
106
107
|
handlers.current.onSelectOrder?.(row);
|
|
107
108
|
}, className: "min-w-0 truncate rounded-sm font-medium tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
|
|
108
|
-
(cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }), _jsx(TableCell, { className: "min-w-0 py-0", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { "aria-hidden": true, className: "hidden h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary lg:inline-flex", children: initials(row.customer.name) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", title: row.customer.name || undefined, children: _jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }) }), _jsx(Line, { text: place, className: "text-xs text-muted-foreground" })] })] }) }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: ordered.date, className: "text-sm text-foreground" }), _jsx(Line, { text: ordered.time, className: "text-xs text-muted-foreground tabular-nums" })] }), _jsxs(TableCell, { className: "py-0 text-left", children: [row.articleLines?.length ? (_jsx(ArticleNames, { row: row })) : (_jsx(ArticlesHover, { ids: row.bufferOrderIds?.length ? row.bufferOrderIds : [row.id], count: row.articleCount ?? 1, children: _jsx("span", { className: "text-sm text-foreground", children: `${articlesLabel(row.articleCount ?? 1)} · ${row.fustCount} fust` }) })), _jsx("div", { className: "text-xs text-muted-foreground", children: _jsx(Money, { value: row.revenue ?? 0 }) })] }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: delivery.date, className: "text-sm text-foreground" }), d2.text ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1 text-xs tabular-nums " + (d2.late ? "font-medium text-destructive" : "text-muted-foreground"), children: [d2.late ? _jsx(AlertCircle, { className: "h-3 w-3 shrink-0", "aria-hidden": true }) : _jsx(Clock, { className: "h-3 w-3 shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: d2.text })] })) : (_jsx("div", { children: "\u00a0" }))] }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [_jsx("button", { type: "button", "aria-label": `Open ${row.orderNumber || "order"}`, title: "Openen", onClick: () => handlers.current.onSelectOrder?.(row), className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 " +
|
|
109
|
+
(cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) }), _jsx(CorrectieChip, { row: row })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }), _jsx(TableCell, { className: "min-w-0 py-0", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { "aria-hidden": true, className: "hidden h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary lg:inline-flex", children: initials(row.customer.name) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", title: row.customer.name || undefined, children: _jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }) }), _jsx(Line, { text: place, className: "text-xs text-muted-foreground" })] })] }) }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: ordered.date, className: "text-sm text-foreground" }), _jsx(Line, { text: ordered.time, className: "text-xs text-muted-foreground tabular-nums" })] }), _jsxs(TableCell, { className: "py-0 text-left", children: [row.articleLines?.length ? (_jsx(ArticleNames, { row: row })) : (_jsx(ArticlesHover, { ids: row.bufferOrderIds?.length ? row.bufferOrderIds : [row.id], count: row.articleCount ?? 1, children: _jsx("span", { className: "text-sm text-foreground", children: `${articlesLabel(row.articleCount ?? 1)} · ${row.fustCount} fust` }) })), _jsx("div", { className: "text-xs text-muted-foreground", children: _jsx(Money, { value: row.revenue ?? 0 }) })] }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: delivery.date, className: "text-sm text-foreground" }), d2.text ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1 text-xs tabular-nums " + (d2.late ? "font-medium text-destructive" : "text-muted-foreground"), children: [d2.late ? _jsx(AlertCircle, { className: "h-3 w-3 shrink-0", "aria-hidden": true }) : _jsx(Clock, { className: "h-3 w-3 shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: d2.text })] })) : (_jsx("div", { children: "\u00a0" }))] }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [_jsx("button", { type: "button", "aria-label": `Open ${row.orderNumber || "order"}`, title: "Openen", onClick: () => handlers.current.onSelectOrder?.(row), className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 " +
|
|
109
110
|
(focused ? "opacity-100" : "opacity-0"), children: _jsx(Eye, { className: "h-4 w-4", "aria-hidden": true }) }), _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined })] }) })] }));
|
|
110
111
|
});
|
|
111
112
|
const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, highlight, features, linkable, fulfillingId, handlers, }) {
|
|
@@ -123,7 +124,7 @@ const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, hig
|
|
|
123
124
|
const d2 = deliveryLine2(row, delivery.time);
|
|
124
125
|
const cancelled = row.stage === "cancelled";
|
|
125
126
|
const h = handlers.current;
|
|
126
|
-
return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 cursor-pointer gap-3 px-3 py-3.5 transition-colors active:bg-muted/70 " + (selected ? "bg-muted/50" : ""), style: { ...transitionStyle("opacity", 150), opacity: leaving ? 0 : 1 }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs("div", { className: "flex shrink-0 flex-col items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) }), _jsx(SourceIcon, { sources: members.map((m) => m.source) })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium tabular-nums " + (cancelled ? "line-through text-muted-foreground" : "text-foreground"), title: row.orderNumber || undefined, children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), _jsxs("div", { className: "truncate text-sm", title: row.customer.name || undefined, children: [_jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }), row.customer.city && _jsxs("span", { className: "text-muted-foreground", children: [" \u00B7 ", row.customer.city] })] })] }), _jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined }) })] }), _jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsxs("span", { className: "truncate", children: [articlesLabel(row.articleCount ?? 1), " \u00B7 ", row.fustCount, " fust"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "shrink-0 font-medium tabular-nums text-foreground", children: ["\u20AC ", amount(row.revenue ?? 0)] })] }), _jsxs("div", { className: "mt-2.5 flex min-w-0 flex-nowrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 truncate text-xs text-foreground", children: [delivery.date, d2.text ? (_jsxs("span", { className: d2.late ? "font-medium text-destructive" : "text-muted-foreground", children: [" ", d2.text] })) : null] }), _jsx("div", { className: "shrink-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) })] })] })] }));
|
|
127
|
+
return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 cursor-pointer gap-3 px-3 py-3.5 transition-colors active:bg-muted/70 " + (selected ? "bg-muted/50" : ""), style: { ...transitionStyle("opacity", 150), opacity: leaving ? 0 : 1 }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs("div", { className: "flex shrink-0 flex-col items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) }), _jsx(SourceIcon, { sources: members.map((m) => m.source) })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium tabular-nums " + (cancelled ? "line-through text-muted-foreground" : "text-foreground"), title: row.orderNumber || undefined, children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) }), _jsx(CorrectieChip, { row: row })] }), _jsxs("div", { className: "truncate text-sm", title: row.customer.name || undefined, children: [_jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }), row.customer.city && _jsxs("span", { className: "text-muted-foreground", children: [" \u00B7 ", row.customer.city] })] })] }), _jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined }) })] }), _jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsxs("span", { className: "truncate", children: [articlesLabel(row.articleCount ?? 1), " \u00B7 ", row.fustCount, " fust"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "shrink-0 font-medium tabular-nums text-foreground", children: ["\u20AC ", amount(row.revenue ?? 0)] })] }), _jsxs("div", { className: "mt-2.5 flex min-w-0 flex-nowrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 truncate text-xs text-foreground", children: [delivery.date, d2.text ? (_jsxs("span", { className: d2.late ? "font-medium text-destructive" : "text-muted-foreground", children: [" ", d2.text] })) : null] }), _jsx("div", { className: "shrink-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) })] })] })] }));
|
|
127
128
|
});
|
|
128
129
|
/**
|
|
129
130
|
* Houdt bij een achtergrondverversing verdwenen rijen 150 ms zichtbaar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAsRA,wBAAgB,iBAAiB,gCA4jChC"}
|
|
@@ -29,6 +29,7 @@ import { SalesOrdersFilterPanel, countActiveFilters, } from "./SalesOrdersFilter
|
|
|
29
29
|
import { SalesOrdersTable, salesOrderRowId } from "./SalesOrdersTable.js";
|
|
30
30
|
import { EditLocalOrderDialog } from "./EditLocalOrderDialog.js";
|
|
31
31
|
import { StockConsumptionAlertsBanner } from "./StockConsumptionAlertsBanner.js";
|
|
32
|
+
import { CorrectiesBalk } from "./correcties/CorrectiesBalk.js";
|
|
32
33
|
import { KPI_GRID_CLASS, KpiTile } from "./v3/KpiTile.js";
|
|
33
34
|
import { FilterChip } from "./v3/FilterChip.js";
|
|
34
35
|
import { markeerGeannuleerd } from "../../lib/order-cancel-view.js";
|
|
@@ -657,7 +658,7 @@ export function VerkoopOrdersPage() {
|
|
|
657
658
|
const t = amsterdamYmd();
|
|
658
659
|
const from = ymdString({ ...t, y: t.y - 1, d: t.m === 2 && t.d === 29 ? 28 : t.d });
|
|
659
660
|
setFilters({ ...filters, period: "custom", customFrom: from, customTo: ymdString(t) });
|
|
660
|
-
}, children: "Zoek in het laatste jaar" })), (filters.search || activeFilterCount > 0) && (_jsx(Button, { variant: "ghost", size: "sm", onClick: clearAll, children: "Alles wissen" }))] }), _jsx("div", { className: "shrink-0", children: _jsx(StockConsumptionAlertsBanner, {}) }), error && !data && (_jsxs("div", { role: "alert", className: "shrink-0 flex items-start gap-3 rounded-lg border border-destructive/30 bg-destructive-soft p-4 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "font-medium text-destructive-soft-foreground", children: isSessionError(error) ? "Je inlogsessie is verlopen" : "Orders konden niet geladen worden" }), _jsx("div", { className: "mt-1 text-muted-foreground", children: isSessionError(error) ? "Log opnieuw in om de orders te zien." : error.message })] }), isSessionError(error) ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => navigate({ to: "/login" }), children: "Opnieuw inloggen" })) : (_jsx(Button, { size: "sm", variant: "outline", onClick: () => refetch(), disabled: isFetching, children: "Opnieuw proberen" }))] })), _jsx(NoticeBar, { items: notices }), selectedRows.length === 0 && (_jsx("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/90 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:hidden", children: _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { className: "h-12 flex-1 text-base", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders/nieuw" }), children: [_jsx(Plus, { className: "mr-2 h-5 w-5" }), " Nieuwe order"] }), klokZichtbaar && (_jsx(Button, { variant: "outline", className: "h-12 px-4", "aria-label": "Klokorder (veilbrief)", onClick: () => navigate({ to: "/floriday-verkoop/klok/nieuw" }), children: _jsx(Gavel, { className: "h-5 w-5" }) }))] }) })), selectedRows.length > 0 && (_jsxs("div", { ref: (el) => {
|
|
661
|
+
}, children: "Zoek in het laatste jaar" })), (filters.search || activeFilterCount > 0) && (_jsx(Button, { variant: "ghost", size: "sm", onClick: clearAll, children: "Alles wissen" }))] }), _jsx("div", { className: "shrink-0", children: _jsx(StockConsumptionAlertsBanner, {}) }), _jsx("div", { className: "shrink-0", children: _jsx(CorrectiesBalk, {}) }), error && !data && (_jsxs("div", { role: "alert", className: "shrink-0 flex items-start gap-3 rounded-lg border border-destructive/30 bg-destructive-soft p-4 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "font-medium text-destructive-soft-foreground", children: isSessionError(error) ? "Je inlogsessie is verlopen" : "Orders konden niet geladen worden" }), _jsx("div", { className: "mt-1 text-muted-foreground", children: isSessionError(error) ? "Log opnieuw in om de orders te zien." : error.message })] }), isSessionError(error) ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => navigate({ to: "/login" }), children: "Opnieuw inloggen" })) : (_jsx(Button, { size: "sm", variant: "outline", onClick: () => refetch(), disabled: isFetching, children: "Opnieuw proberen" }))] })), _jsx(NoticeBar, { items: notices }), selectedRows.length === 0 && (_jsx("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/90 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:hidden", children: _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { className: "h-12 flex-1 text-base", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders/nieuw" }), children: [_jsx(Plus, { className: "mr-2 h-5 w-5" }), " Nieuwe order"] }), klokZichtbaar && (_jsx(Button, { variant: "outline", className: "h-12 px-4", "aria-label": "Klokorder (veilbrief)", onClick: () => navigate({ to: "/floriday-verkoop/klok/nieuw" }), children: _jsx(Gavel, { className: "h-5 w-5" }) }))] }) })), selectedRows.length > 0 && (_jsxs("div", { ref: (el) => {
|
|
661
662
|
if (el && !el.dataset.shown) {
|
|
662
663
|
el.dataset.shown = "1";
|
|
663
664
|
animateIn(el, { duration: 180, y: 8 });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accepteren / Afwijzen. Is er al geprint (of onbekend), dan eerst de keuze
|
|
3
|
+
* "Kar aanpassen" (nieuwe pakbon) of "Laten zo" — nooit een stille wijziging.
|
|
4
|
+
*/
|
|
5
|
+
export declare function CorrectieBesluitKnoppen({ id, orderRowId, onDone }: {
|
|
6
|
+
id: string;
|
|
7
|
+
orderRowId?: string | null;
|
|
8
|
+
onDone?: () => void;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=CorrectieBesluitKnoppen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrectieBesluitKnoppen.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectieBesluitKnoppen.tsx"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,+BA+ClI"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
5
|
+
import { Button } from "@flowselections/core";
|
|
6
|
+
import { decideSalesCorrection } from "../../../lib/sales-corrections.functions.js";
|
|
7
|
+
import { OPEN_CORRECTIONS_KEY } from "../../../lib/useOpenCorrections.js";
|
|
8
|
+
/**
|
|
9
|
+
* Accepteren / Afwijzen. Is er al geprint (of onbekend), dan eerst de keuze
|
|
10
|
+
* "Kar aanpassen" (nieuwe pakbon) of "Laten zo" — nooit een stille wijziging.
|
|
11
|
+
*/
|
|
12
|
+
export function CorrectieBesluitKnoppen({ id, orderRowId, onDone }) {
|
|
13
|
+
const decide = useServerFn(decideSalesCorrection);
|
|
14
|
+
const qc = useQueryClient();
|
|
15
|
+
const [bezig, setBezig] = useState(null);
|
|
16
|
+
const [vraag, setVraag] = useState(null);
|
|
17
|
+
const [fout, setFout] = useState(null);
|
|
18
|
+
const [klaar, setKlaar] = useState(null);
|
|
19
|
+
async function run(besluit, keuzeNaPrint) {
|
|
20
|
+
setBezig(besluit);
|
|
21
|
+
setFout(null);
|
|
22
|
+
try {
|
|
23
|
+
const r = await decide({ data: { id, besluit, orderRowId: orderRowId ?? null, keuzeNaPrint: keuzeNaPrint ?? null } });
|
|
24
|
+
if (r.code === "confirm_print") {
|
|
25
|
+
setVraag(r.vraag);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!r.ok) {
|
|
29
|
+
setFout(r.melding);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setVraag(null);
|
|
33
|
+
setKlaar(r.melding);
|
|
34
|
+
await qc.invalidateQueries({ queryKey: OPEN_CORRECTIONS_KEY });
|
|
35
|
+
await qc.invalidateQueries({ queryKey: ["sales-corrections"] });
|
|
36
|
+
onDone?.();
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error("[correcties] besluit", e);
|
|
40
|
+
setFout("Het besluit kon niet worden verstuurd. Probeer het opnieuw of neem contact op met de beheerder.");
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
setBezig(null);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs("div", { className: "space-y-2", children: [vraag ? (_jsxs("div", { role: "alert", className: "space-y-2 rounded-md border border-border bg-warning-soft p-3 text-sm text-warning-soft-foreground", children: [_jsx("div", { className: "font-medium", children: vraag }), _jsx("div", { children: "Wil je de kar aanpassen (met een nieuwe pakbon) of de geprinte kar laten zoals hij is?" }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { size: "sm", disabled: !!bezig, onClick: () => run("accept", "kar_aanpassen"), children: "Kar aanpassen" }), _jsx(Button, { size: "sm", variant: "outline", disabled: !!bezig, onClick: () => run("accept", "laten_zo"), children: "Laten zo" }), _jsx(Button, { size: "sm", variant: "ghost", disabled: !!bezig, onClick: () => setVraag(null), children: "Annuleren" })] })] })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { size: "sm", disabled: !!bezig, onClick: () => run("accept"), children: bezig === "accept" ? "Bezig…" : "Accepteren" }), _jsx(Button, { size: "sm", variant: "outline", disabled: !!bezig, onClick: () => run("decline"), children: bezig === "decline" ? "Bezig…" : "Afwijzen" })] })), fout && _jsx("div", { role: "alert", className: "text-sm text-destructive", children: fout }), klaar && _jsx("div", { role: "status", className: "text-sm text-muted-foreground", children: klaar })] }));
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Label "Correctie gevraagd" bij een order met een open correctieverzoek. */
|
|
2
|
+
export declare function CorrectieChip({ row }: {
|
|
3
|
+
row: {
|
|
4
|
+
floridayIds?: string[];
|
|
5
|
+
raw?: {
|
|
6
|
+
order?: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=CorrectieChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrectieChip.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectieChip.tsx"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,GAAG,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,sCAUhG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MessageSquareWarning } from "lucide-react";
|
|
3
|
+
import { floridayIdsOf, useOpenCorrections } from "../../../lib/useOpenCorrections.js";
|
|
4
|
+
/** Label "Correctie gevraagd" bij een order met een open correctieverzoek. */
|
|
5
|
+
export function CorrectieChip({ row }) {
|
|
6
|
+
const { bySalesOrder } = useOpenCorrections();
|
|
7
|
+
const has = floridayIdsOf(row).some((id) => bySalesOrder.has(id));
|
|
8
|
+
if (!has)
|
|
9
|
+
return null;
|
|
10
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning-soft-foreground", children: [_jsx(MessageSquareWarning, { className: "h-3 w-3", "aria-hidden": true }), "Correctie gevraagd"] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrectiesBalk.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectiesBalk.tsx"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,wBAAgB,cAAc,uCAmB7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from "@tanstack/react-router";
|
|
3
|
+
import { AlertTriangle } from "lucide-react";
|
|
4
|
+
import { balkTekst } from "../../../lib/sales-corrections.js";
|
|
5
|
+
import { useOpenCorrections } from "../../../lib/useOpenCorrections.js";
|
|
6
|
+
/** Balk bovenaan Verkoop: open correctieverzoeken met de eerste deadline. */
|
|
7
|
+
export function CorrectiesBalk() {
|
|
8
|
+
const { items, failed, error } = useOpenCorrections();
|
|
9
|
+
const tekst = balkTekst(items);
|
|
10
|
+
if (failed) {
|
|
11
|
+
return (_jsxs("div", { role: "status", className: "flex items-center gap-2 rounded-lg border border-border bg-muted p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), error || "Correctieverzoeken konden niet worden gecontroleerd."] }));
|
|
12
|
+
}
|
|
13
|
+
if (!tekst)
|
|
14
|
+
return null;
|
|
15
|
+
return (_jsxs("div", { role: "alert", className: "flex flex-wrap items-center gap-2 rounded-lg border border-border bg-warning-soft p-3 text-sm text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), _jsx("span", { className: "font-medium", children: tekst }), _jsx(Link, { to: "/floriday-verkoop/correcties", className: "ml-auto font-medium underline underline-offset-2", children: "Bekijk correctieverzoeken" })] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrectiesPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/correcties/CorrectiesPage.tsx"],"names":[],"mappings":"AAiBA,qFAAqF;AACrF,wBAAgB,cAAc,gCAsD7B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Link } from "@tanstack/react-router";
|
|
4
|
+
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
6
|
+
import { Button, Input } from "@flowselections/core";
|
|
7
|
+
import { MessageSquareWarning } from "lucide-react";
|
|
8
|
+
import { listSalesCorrections } from "../../../lib/sales-corrections.functions.js";
|
|
9
|
+
import { bijnaVerlopen, deadlineTekst, isOpen, parseCorrection } from "../../../lib/sales-corrections.js";
|
|
10
|
+
const STATUSSEN = [
|
|
11
|
+
{ id: "PENDING", label: "Wacht op reactie" },
|
|
12
|
+
{ id: "ACCEPTED", label: "Geaccepteerd" },
|
|
13
|
+
{ id: "DECLINED", label: "Afgewezen" },
|
|
14
|
+
{ id: "EXPIRED", label: "Verlopen" },
|
|
15
|
+
{ id: null, label: "Alles" },
|
|
16
|
+
];
|
|
17
|
+
/** Lijst "Correctieverzoeken" van kopers (per 25, zoeken en status op de server). */
|
|
18
|
+
export function CorrectiesPage() {
|
|
19
|
+
const fetchList = useServerFn(listSalesCorrections);
|
|
20
|
+
const [status, setStatus] = useState("PENDING");
|
|
21
|
+
const [zoek, setZoek] = useState("");
|
|
22
|
+
const [offset, setOffset] = useState(0);
|
|
23
|
+
const q = useQuery({
|
|
24
|
+
queryKey: ["sales-corrections", status, zoek, offset],
|
|
25
|
+
placeholderData: keepPreviousData,
|
|
26
|
+
queryFn: () => fetchList({ data: { status, zoek: zoek || undefined, offset } }),
|
|
27
|
+
});
|
|
28
|
+
const items = (q.data?.items ?? []).map(parseCorrection).filter((c) => !!c);
|
|
29
|
+
const totaal = q.data?.totaal ?? 0;
|
|
30
|
+
return (_jsxs("div", { className: "space-y-4 p-4 sm:p-6", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MessageSquareWarning, { className: "h-5 w-5 text-primary", "aria-hidden": true }), _jsx("h1", { className: "text-xl font-bold tracking-tight text-foreground sm:text-2xl", children: "Correctieverzoeken" })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [STATUSSEN.map((s) => (_jsx(Button, { size: "sm", variant: status === s.id ? "default" : "outline", onClick: () => { setStatus(s.id); setOffset(0); }, children: s.label }, String(s.id)))), _jsx(Input, { className: "ml-auto w-full sm:w-64", placeholder: "Zoek op ordernummer of reden", value: zoek, onChange: (e) => { setZoek(e.target.value); setOffset(0); } })] }), q.data && !q.data.ok && _jsx("div", { role: "alert", className: "text-sm text-destructive", children: q.data.error }), q.isLoading ? _jsx("div", { className: "text-sm text-muted-foreground", children: "Laden\u2026" }) : items.length === 0 ? (_jsx("div", { className: "text-sm text-muted-foreground", children: "Geen correctieverzoeken gevonden." })) : (_jsx("ul", { className: "divide-y divide-border rounded-lg border border-border bg-card", children: items.map((c) => (_jsxs("li", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 p-3 text-sm", children: [_jsx("span", { className: "font-medium " + (bijnaVerlopen(c) ? "text-destructive" : "text-foreground"), children: deadlineTekst(c) }), _jsx("span", { className: "text-muted-foreground", children: c.isCancelRequest ? "Annuleren gevraagd" : "Wijziging gevraagd" }), c.reason && _jsx("span", { className: "min-w-0 truncate text-muted-foreground", children: c.reason }), c.besluitDoor && !isOpen(c) && _jsxs("span", { className: "text-muted-foreground", children: ["door ", c.besluitDoor] }), c.salesOrderId && (_jsx(Link, { className: "ml-auto font-medium text-primary underline underline-offset-2", to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: c.salesOrderId }, children: "Order openen" }))] }, c.id))) })), totaal > 25 && (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: offset === 0, onClick: () => setOffset(Math.max(0, offset - 25)), children: "Vorige" }), _jsxs("span", { className: "text-muted-foreground", children: [offset + 1, "\u2013", Math.min(offset + 25, totaal), " van ", totaal] }), _jsx(Button, { size: "sm", variant: "outline", disabled: offset + 25 >= totaal, onClick: () => setOffset(offset + 25), children: "Volgende" })] }))] }));
|
|
31
|
+
}
|