@flowselections/pick-schermen-kwekers 1.0.60 → 1.0.62
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/pick/PickScherm.d.ts.map +1 -1
- package/dist-lib/components/pick/PickScherm.js +11 -4
- package/dist-lib/components/pick/ShippingNoteScan.d.ts.map +1 -1
- package/dist-lib/components/pick/ShippingNoteScan.js +52 -13
- package/dist-lib/components/pick/StickerState.d.ts +4 -0
- package/dist-lib/components/pick/StickerState.d.ts.map +1 -1
- package/dist-lib/components/pick/StickerState.js +30 -4
- package/dist-lib/integrations/supabase/types.d.ts +428 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/__tests__/pick161.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/pick161.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/pick161.test.js +29 -0
- package/dist-lib/lib/__tests__/pickUitwijk.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/pickUitwijk.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/pickUitwijk.test.js +36 -0
- package/dist-lib/lib/pick159.js +1 -1
- package/dist-lib/lib/pick161.d.ts +27 -0
- package/dist-lib/lib/pick161.d.ts.map +1 -0
- package/dist-lib/lib/pick161.js +86 -0
- package/dist-lib/lib/pickPreview.d.ts.map +1 -1
- package/dist-lib/lib/pickPreview.js +2 -1
- package/dist-lib/lib/pickStickers.d.ts +5 -0
- package/dist-lib/lib/pickStickers.d.ts.map +1 -1
- package/dist-lib/lib/pickStickers.js +3 -0
- package/dist-lib/lib/pickUitwijk.d.ts +25 -0
- package/dist-lib/lib/pickUitwijk.d.ts.map +1 -0
- package/dist-lib/lib/pickUitwijk.js +93 -0
- package/dist-lib/lib/shippingNote.d.ts +2 -0
- package/dist-lib/lib/shippingNote.d.ts.map +1 -1
- package/dist-lib/lib/shippingNote.js +2 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA0DA,OAAO,EAaL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AA2D7B,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,+
|
|
1
|
+
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA0DA,OAAO,EAaL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AA2D7B,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,+BAyqEpD"}
|
|
@@ -26,7 +26,7 @@ import { usePrintBatch, usePrintJob } from "../../hooks/usePrintJob.js";
|
|
|
26
26
|
import { useShippingNoteStatus } from "../../hooks/useShippingNoteStatus.js";
|
|
27
27
|
import { firstVisibleTarget, isJobFinished, isRowGoneError, NO_ROW_IN_FILTER_MESSAGE, RELEASE_PENDING_MESSAGE, ROW_GONE_MESSAGE, stuckMessage, stuckMinutesOf, } from "../../lib/pickRowState.js";
|
|
28
28
|
import { CartItemRows, PlanWarnings } from "./CartItemRows.js";
|
|
29
|
-
import { CartStickerState, OrderStickerMeldingen, StickerFitMeldingen } from "./StickerState.js";
|
|
29
|
+
import { CartStickerState, OrderStickerMeldingen, StickerFitMeldingen, VroegeStickerWaarschuwing } from "./StickerState.js";
|
|
30
30
|
import { StickerReprintButton } from "./StickerReprintButton.js";
|
|
31
31
|
import { isJobFailed } from "../../lib/pick142.js";
|
|
32
32
|
import { isPrintBlocked } from "../../lib/pick156.js";
|
|
@@ -144,15 +144,22 @@ export function PickScherm({ station, onBack }) {
|
|
|
144
144
|
if (fetchingNotes)
|
|
145
145
|
return;
|
|
146
146
|
setFetchingNotes(true);
|
|
147
|
+
const id = toast.loading("Verzendbrieven ophalen…");
|
|
147
148
|
try {
|
|
148
149
|
const result = await refreshShippingNotesNow();
|
|
149
150
|
if (result.ok) {
|
|
150
|
-
toast.success(result.message ?? "Verzendbrieven worden opgehaald.");
|
|
151
|
+
toast.success(result.message ?? "Verzendbrieven worden opgehaald.", { id });
|
|
151
152
|
}
|
|
152
153
|
else {
|
|
153
|
-
toast.info("De verzendbrieven worden zo vanzelf opgehaald. Je hoeft niets te doen.");
|
|
154
|
+
toast.info("De verzendbrieven worden zo vanzelf opgehaald. Je hoeft niets te doen.", { id });
|
|
154
155
|
}
|
|
155
156
|
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
toast.error("Verzendbrieven ophalen lukte niet. Probeer het over een minuut opnieuw.", {
|
|
159
|
+
id,
|
|
160
|
+
description: e instanceof Error ? `Details voor beheer: ${e.message}` : undefined,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
156
163
|
finally {
|
|
157
164
|
setFetchingNotes(false);
|
|
158
165
|
}
|
|
@@ -1371,7 +1378,7 @@ export function PickScherm({ station, onBack }) {
|
|
|
1371
1378
|
const cart = plannedCart ?? { cartId: r.cartId, cartLabel: r.cartLabel ?? r.cartId };
|
|
1372
1379
|
setLastCartResults((prev) => prev.filter((x) => x.cartId !== r.cartId));
|
|
1373
1380
|
void reprintCart(lastPrinted, cart);
|
|
1374
|
-
}, children: "Opnieuw printen" })] }, r.cartId))) }) })), lastCartResults.length > 1 && (_jsxs("div", { className: "rounded-md border p-3 text-sm", "aria-label": "Resultaat per kar", children: [_jsx("p", { className: "mb-1 font-semibold text-foreground", children: "Resultaat per kar" }), _jsx("ul", { className: "space-y-0.5 text-muted-foreground", children: lastCartResults.map((r) => (_jsx("li", { className: r.outcome === "created" ? "text-foreground" : r.outcome === "error" ? "text-destructive" : "", children: cartResultLine(r) }, r.cartId))) })] })), _jsx(ShippingNoteScan, { stationId: station.id }), !pending && emptyNotice && (_jsx("p", { className: "text-sm text-muted-foreground", children: emptyNotice })), pending && (_jsxs(Card, { className: "border-2 border-primary", children: [_jsxs(CardContent, { className: "flex flex-col gap-4 p-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("confirmPrintTitle") }), _jsx("p", { className: "truncate text-xl font-bold text-foreground sm:text-2xl", children: pending.document_number ?? t("document") }), _jsx("p", { className: "truncate text-sm text-muted-foreground", children: [pending.order_number, pending.customer_name].filter(Boolean).join(" · ") })] }), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [_jsx(Button, { variant: "outline", size: "lg", className: "h-12 w-full sm:w-auto", onClick: cancelPending, disabled: (busyId !== null || actionBusy), children: t("cancel") }), _jsxs(Button, { size: "lg", className: "h-14 w-full px-8 text-lg sm:w-auto", onClick: confirmPending, disabled: (busyId !== null || actionBusy) || fetchingData, variant: readiness.ready ? "default" : "secondary", children: [busyId === "confirm" || fetchingData ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : readiness.ready ? (_jsx(Printer, { className: "mr-2 h-5 w-5" })) : (_jsx(RefreshCw, { className: "mr-2 h-5 w-5" })), readiness.ready ? t("print") : "Pakbon ophalen"] })] })] }), !readiness.ready && (_jsx(CardContent, { className: "border-t p-4 sm:p-5", children: _jsxs("div", { className: "flex items-start gap-2 rounded-md border bg-muted/30 p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: fetchingData
|
|
1381
|
+
}, children: "Opnieuw printen" })] }, r.cartId))) }) })), lastCartResults.length > 1 && (_jsxs("div", { className: "rounded-md border p-3 text-sm", "aria-label": "Resultaat per kar", children: [_jsx("p", { className: "mb-1 font-semibold text-foreground", children: "Resultaat per kar" }), _jsx("ul", { className: "space-y-0.5 text-muted-foreground", children: lastCartResults.map((r) => (_jsx("li", { className: r.outcome === "created" ? "text-foreground" : r.outcome === "error" ? "text-destructive" : "", children: cartResultLine(r) }, r.cartId))) })] })), _jsx(VroegeStickerWaarschuwing, { stationId: station.id }), _jsx(ShippingNoteScan, { stationId: station.id }), !pending && emptyNotice && (_jsx("p", { className: "text-sm text-muted-foreground", children: emptyNotice })), pending && (_jsxs(Card, { className: "border-2 border-primary", children: [_jsxs(CardContent, { className: "flex flex-col gap-4 p-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between sm:p-5", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("confirmPrintTitle") }), _jsx("p", { className: "truncate text-xl font-bold text-foreground sm:text-2xl", children: pending.document_number ?? t("document") }), _jsx("p", { className: "truncate text-sm text-muted-foreground", children: [pending.order_number, pending.customer_name].filter(Boolean).join(" · ") })] }), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [_jsx(Button, { variant: "outline", size: "lg", className: "h-12 w-full sm:w-auto", onClick: cancelPending, disabled: (busyId !== null || actionBusy), children: t("cancel") }), _jsxs(Button, { size: "lg", className: "h-14 w-full px-8 text-lg sm:w-auto", onClick: confirmPending, disabled: (busyId !== null || actionBusy) || fetchingData, variant: readiness.ready ? "default" : "secondary", children: [busyId === "confirm" || fetchingData ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : readiness.ready ? (_jsx(Printer, { className: "mr-2 h-5 w-5" })) : (_jsx(RefreshCw, { className: "mr-2 h-5 w-5" })), readiness.ready ? t("print") : "Pakbon ophalen"] })] })] }), !readiness.ready && (_jsx(CardContent, { className: "border-t p-4 sm:p-5", children: _jsxs("div", { className: "flex items-start gap-2 rounded-md border bg-muted/30 p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: fetchingData
|
|
1375
1382
|
? "De pakbon wordt opgevraagd. Zodra alles compleet is, verschijnt de printknop weer."
|
|
1376
1383
|
: planReason
|
|
1377
1384
|
? `${planReason} Klik op "Pakbon ophalen" om hem op te vragen.`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShippingNoteScan.d.ts","sourceRoot":"","sources":["../../../src/components/pick/ShippingNoteScan.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShippingNoteScan.d.ts","sourceRoot":"","sources":["../../../src/components/pick/ShippingNoteScan.tsx"],"names":[],"mappings":"AAkBA,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;CACxE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,KAAK,+BA0NlE"}
|
|
@@ -3,6 +3,16 @@ import { useCallback, useState } from "react";
|
|
|
3
3
|
import { Badge, Button, Card, CardContent, Input, toast } from "@flowselections/core";
|
|
4
4
|
import { AlertTriangle, CheckCircle2, Loader2, ScanLine } from "lucide-react";
|
|
5
5
|
import { createShippingNote, lookupBarcode, } from "../../lib/shippingNote.js";
|
|
6
|
+
import { friendlyEngineMessage, isPakbonNumber, quantityText, SCAN_UNKNOWN, slipVariantText } from "../../lib/pick161.js";
|
|
7
|
+
import { pickDb } from "../../lib/pickApi.js";
|
|
8
|
+
async function toCartBarcode(code) {
|
|
9
|
+
if (!isPakbonNumber(code))
|
|
10
|
+
return code;
|
|
11
|
+
const { data, error } = await pickDb.rpc("pick_resolve_scan_code", { p_code: code });
|
|
12
|
+
if (error)
|
|
13
|
+
throw new Error(error.message);
|
|
14
|
+
return typeof data === "string" && data ? data : null;
|
|
15
|
+
}
|
|
6
16
|
/**
|
|
7
17
|
* Pakbon scannen -> verzendbrief. De module zoekt eerst op (leest alleen) en
|
|
8
18
|
* maakt pas na een expliciete bevestiging een verzendbrief aan via de Engine.
|
|
@@ -11,7 +21,19 @@ export function ShippingNoteScan({ stationId, onJobCreated }) {
|
|
|
11
21
|
const [code, setCode] = useState("");
|
|
12
22
|
const [busy, setBusy] = useState(false);
|
|
13
23
|
const [found, setFound] = useState(null);
|
|
14
|
-
const [notice,
|
|
24
|
+
const [notice, setNoticeRaw] = useState(null);
|
|
25
|
+
const [detail, setDetail] = useState(null);
|
|
26
|
+
const [status, setStatus] = useState(null);
|
|
27
|
+
const setNotice = useCallback((raw, fallback = SCAN_UNKNOWN) => {
|
|
28
|
+
if (raw == null) {
|
|
29
|
+
setNoticeRaw(null);
|
|
30
|
+
setDetail(null);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const f = friendlyEngineMessage(raw, fallback);
|
|
34
|
+
setNoticeRaw(f.message);
|
|
35
|
+
setDetail(f.detail);
|
|
36
|
+
}, []);
|
|
15
37
|
const [reprintNotice, setReprintNotice] = useState(null);
|
|
16
38
|
const [warning, setWarning] = useState(null);
|
|
17
39
|
const reset = useCallback(() => {
|
|
@@ -23,31 +45,43 @@ export function ShippingNoteScan({ stationId, onJobCreated }) {
|
|
|
23
45
|
const barcode = raw.trim();
|
|
24
46
|
if (!barcode)
|
|
25
47
|
return;
|
|
48
|
+
let found_barcode = barcode;
|
|
26
49
|
setBusy(true);
|
|
27
50
|
reset();
|
|
28
51
|
setNotice(null);
|
|
52
|
+
setStatus("Pakbon opzoeken…");
|
|
29
53
|
try {
|
|
30
|
-
const
|
|
54
|
+
const cartBarcode = await toCartBarcode(barcode);
|
|
55
|
+
if (!cartBarcode) {
|
|
56
|
+
setNotice(null);
|
|
57
|
+
setNoticeRaw(SCAN_UNKNOWN);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const lookup = await lookupBarcode(cartBarcode);
|
|
31
61
|
if (!lookup.ok) {
|
|
32
|
-
|
|
33
|
-
|
|
62
|
+
setNoticeRaw(SCAN_UNKNOWN);
|
|
63
|
+
setDetail(lookup.error);
|
|
34
64
|
return;
|
|
35
65
|
}
|
|
36
|
-
|
|
66
|
+
found_barcode = cartBarcode;
|
|
67
|
+
setFound({ barcode: found_barcode, lookup });
|
|
37
68
|
setCode("");
|
|
38
69
|
}
|
|
39
70
|
catch (e) {
|
|
40
|
-
|
|
71
|
+
setNoticeRaw("De pakbon kon niet worden opgezocht. Probeer het opnieuw.");
|
|
72
|
+
setDetail(e instanceof Error ? e.message : null);
|
|
41
73
|
}
|
|
42
74
|
finally {
|
|
43
75
|
setBusy(false);
|
|
76
|
+
setStatus(null);
|
|
44
77
|
}
|
|
45
|
-
}, [reset]);
|
|
78
|
+
}, [reset, setNotice]);
|
|
46
79
|
const handleConfirm = useCallback(async (allowReprint) => {
|
|
47
80
|
if (!found)
|
|
48
81
|
return;
|
|
49
82
|
setBusy(true);
|
|
50
83
|
setWarning(null);
|
|
84
|
+
setStatus("Verzendbrief klaarzetten…");
|
|
51
85
|
try {
|
|
52
86
|
const result = await createShippingNote({
|
|
53
87
|
barcode: found.barcode,
|
|
@@ -56,10 +90,12 @@ export function ShippingNoteScan({ stationId, onJobCreated }) {
|
|
|
56
90
|
});
|
|
57
91
|
if (!result.ok) {
|
|
58
92
|
if (result.errorCode === "al_geprint") {
|
|
59
|
-
setReprintNotice(
|
|
93
|
+
setReprintNotice("Er is al een verzendbrief voor deze kar gemaakt.");
|
|
60
94
|
return;
|
|
61
95
|
}
|
|
62
|
-
setNotice(result.error ?? "De verzendbrief kon niet worden klaargezet.");
|
|
96
|
+
setNotice(result.error ?? result.errorCode ?? null, "De verzendbrief kon niet worden klaargezet. Meld dit bij kantoor.");
|
|
97
|
+
if (!result.error && !result.errorCode)
|
|
98
|
+
setNoticeRaw("De verzendbrief kon niet worden klaargezet. Meld dit bij kantoor.");
|
|
63
99
|
reset();
|
|
64
100
|
return;
|
|
65
101
|
}
|
|
@@ -73,17 +109,20 @@ export function ShippingNoteScan({ stationId, onJobCreated }) {
|
|
|
73
109
|
setReprintNotice(null);
|
|
74
110
|
}
|
|
75
111
|
catch (e) {
|
|
76
|
-
setNotice(e instanceof Error ? e.message : "De verzendbrief kon niet worden klaargezet.");
|
|
112
|
+
setNotice(e instanceof Error ? e.message : null, "De verzendbrief kon niet worden klaargezet. Probeer het opnieuw.");
|
|
113
|
+
if (!(e instanceof Error))
|
|
114
|
+
setNoticeRaw("De verzendbrief kon niet worden klaargezet. Probeer het opnieuw.");
|
|
77
115
|
}
|
|
78
116
|
finally {
|
|
79
117
|
setBusy(false);
|
|
118
|
+
setStatus(null);
|
|
80
119
|
}
|
|
81
|
-
}, [found, stationId, onJobCreated, reset]);
|
|
120
|
+
}, [found, stationId, onJobCreated, reset, setNotice]);
|
|
82
121
|
const cart = found?.lookup.cart ?? null;
|
|
83
|
-
return (_jsx(Card, { children: _jsxs(CardContent, { className: "space-y-3 p-3 sm:p-4", children: [_jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", children: [_jsx("p", { className: "text-sm font-semibold text-foreground", children: "Pakbon scannen" }), _jsxs("div", { className: "relative w-full min-w-0 sm:w-72", children: [_jsx(ScanLine, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { className: "h-12 pl-9 text-base", placeholder: "
|
|
122
|
+
return (_jsx(Card, { children: _jsxs(CardContent, { className: "space-y-3 p-3 sm:p-4", children: [_jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", children: [_jsx("p", { className: "text-sm font-semibold text-foreground", children: "Pakbon scannen" }), _jsxs("div", { className: "relative w-full min-w-0 sm:w-72", children: [_jsx(ScanLine, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { className: "h-12 pl-9 text-base", placeholder: "Pakbonnummer of barcode onderaan de pakbon", value: code, disabled: busy, onChange: (e) => setCode(e.target.value), onKeyDown: (e) => {
|
|
84
123
|
if (e.key !== "Enter")
|
|
85
124
|
return;
|
|
86
125
|
e.preventDefault();
|
|
87
126
|
void handleLookup(code);
|
|
88
|
-
} })] })] }), notice && (_jsxs("div", { className: "flex items-start gap-2 rounded-md border-2 border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: notice })] })), warning && (_jsxs("div", { className: "flex items-start gap-2 rounded-md border p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: warning })] })), found && (_jsxs("div", { className: "rounded-md border-2 border-primary/40 bg-muted/20 p-3 sm:p-4", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "truncate text-lg font-bold text-foreground", children: found.lookup.orderNumber ?? "Order" }), _jsx("p", { className: "truncate text-sm text-muted-foreground", children: [found.lookup.customerName, cart?.cartLabel].filter(Boolean).join(" · ") })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [cart?.slipVariant && _jsx(Badge, { variant: "outline", children: cart
|
|
127
|
+
} })] })] }), notice && (_jsxs("div", { className: "flex items-start gap-2 rounded-md border-2 border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: notice })] })), status && (_jsxs("p", { role: "status", className: "flex items-center gap-2 text-sm text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " ", status] })), detail && notice && (_jsxs("details", { className: "text-xs text-muted-foreground", children: [_jsx("summary", { className: "cursor-pointer", children: "Details voor beheer" }), _jsx("p", { children: detail })] })), warning && (_jsxs("div", { className: "flex items-start gap-2 rounded-md border p-3 text-sm text-muted-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: warning })] })), found && (_jsxs("div", { className: "rounded-md border-2 border-primary/40 bg-muted/20 p-3 sm:p-4", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "truncate text-lg font-bold text-foreground", children: found.lookup.orderNumber ?? "Order" }), _jsx("p", { className: "truncate text-sm text-muted-foreground", children: [found.lookup.customerName, cart?.cartLabel].filter(Boolean).join(" · ") })] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [slipVariantText(cart?.slipVariant) && _jsx(Badge, { variant: "outline", children: slipVariantText(cart?.slipVariant) }), cart?.barcode && _jsx(Badge, { variant: "outline", children: cart.barcode }), found.lookup.alreadyPrinted && (_jsxs(Badge, { className: "bg-destructive text-destructive-foreground", children: ["Al geprint (", found.lookup.printCount, ")"] }))] })] }), _jsx("div", { className: "mt-3 divide-y rounded-md border bg-background", children: cart && cart.items.length > 0 ? (cart.items.map((item, index) => (_jsxs("div", { className: "flex items-center justify-between gap-3 p-3", children: [_jsx("span", { className: "min-w-0 truncate text-sm text-foreground", children: item.productName }), _jsx("span", { className: "shrink-0 text-sm font-semibold text-foreground", children: quantityText(item.quantity, item.crates) })] }, `${item.productName}-${index}`)))) : (_jsx("p", { className: "p-3 text-sm text-muted-foreground", children: "Geen regels bij deze kar." })) }), reprintNotice && (_jsxs("div", { className: "mt-3 flex items-start gap-2 rounded-md border-2 border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsx("span", { children: reprintNotice })] })), _jsxs("div", { className: "mt-3 flex flex-col gap-2 sm:flex-row sm:justify-end", children: [_jsx(Button, { variant: "outline", size: "lg", className: "h-12 w-full sm:w-auto", onClick: reset, disabled: busy, children: "Annuleren" }), _jsxs(Button, { size: "lg", className: "h-12 w-full sm:w-auto", onClick: () => void handleConfirm(reprintNotice !== null), disabled: busy, children: [busy ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(CheckCircle2, { className: "mr-2 h-5 w-5" })), reprintNotice ? "Toch opnieuw printen" : "Verzendbrief klaarzetten"] })] })] }))] }) }));
|
|
89
128
|
}
|
|
@@ -13,4 +13,8 @@ export declare function CartStickerState({ cartId, slug }: {
|
|
|
13
13
|
cartId: string;
|
|
14
14
|
slug: string | null;
|
|
15
15
|
}): import("react").JSX.Element | null;
|
|
16
|
+
/** Bovenaan het pickstation: stickers die vandaag/morgen via A4 of verkleind gaan. Niets als Layouts het nog niet levert. */
|
|
17
|
+
export declare function VroegeStickerWaarschuwing({ stationId }: {
|
|
18
|
+
stationId: string | null;
|
|
19
|
+
}): import("react").JSX.Element | null;
|
|
16
20
|
//# sourceMappingURL=StickerState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickerState.d.ts","sourceRoot":"","sources":["../../../src/components/pick/StickerState.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StickerState.d.ts","sourceRoot":"","sources":["../../../src/components/pick/StickerState.tsx"],"names":[],"mappings":"AAcA,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAuC5F;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAoBvG;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCA8CzF;AAED,6HAA6H;AAC7H,wBAAgB,yBAAyB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAiBpF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
|
-
import { fetchCartStickerState, fetchOrderStickerMeldingen, STICKER_UNKNOWN, stickerStatusLabel,
|
|
3
|
+
import { fetchCartStickerState, fetchOrderStickerMeldingen, STICKER_UNKNOWN, stickerStatusLabel, } from "../../lib/pickStickers.js";
|
|
4
|
+
import { stickerLine } from "../../lib/pick161.js";
|
|
5
|
+
import { fetchUitwijk, fetchVroegeWaarschuwing, vroegeWaarschuwingText } from "../../lib/pickUitwijk.js";
|
|
4
6
|
import { fetchStickerFit, STICKER_FIT_UNKNOWN, stickerFitTone } from "../../lib/pick150.js";
|
|
5
7
|
const POLL = 15000;
|
|
6
8
|
/** Controle vooraf of de klantstickers van de kar passen; vóór het printen. */
|
|
@@ -59,15 +61,39 @@ export function CartStickerState({ cartId, slug }) {
|
|
|
59
61
|
placeholderData: (prev) => prev,
|
|
60
62
|
retry: 1,
|
|
61
63
|
});
|
|
64
|
+
const jobIds = Array.isArray(q.data?.regels) ? q.data.regels.map((r) => r.printJobId).filter((x) => !!x).sort() : [];
|
|
65
|
+
const u = useQuery({
|
|
66
|
+
queryKey: ["pick", "uitwijk", jobIds.join(",")],
|
|
67
|
+
queryFn: () => fetchUitwijk(jobIds),
|
|
68
|
+
enabled: jobIds.length > 0,
|
|
69
|
+
refetchInterval: POLL,
|
|
70
|
+
placeholderData: (prev) => prev,
|
|
71
|
+
retry: 1,
|
|
72
|
+
});
|
|
62
73
|
if (q.isLoading)
|
|
63
74
|
return null;
|
|
64
75
|
if (q.isError || !q.data) {
|
|
65
76
|
return _jsx("p", { className: "mt-3 text-xs text-muted-foreground", children: STICKER_UNKNOWN });
|
|
66
77
|
}
|
|
67
78
|
const s = q.data;
|
|
79
|
+
const line = stickerLine(s, u.data);
|
|
68
80
|
const regels = Array.isArray(s.regels) ? s.regels : [];
|
|
69
|
-
const summary = stickerSummary(s);
|
|
70
81
|
if (s.totaal === 0)
|
|
71
|
-
return _jsx("p", { className: "mt-3 text-
|
|
72
|
-
return (_jsxs("details", { className: "mt-3 rounded-md border bg-background p-3 text-sm", children: [_jsxs("summary", { className: "cursor-pointer font-medium text-foreground", children: ["Stickers: ",
|
|
82
|
+
return _jsx("p", { className: "mt-3 text-sm text-muted-foreground", children: line });
|
|
83
|
+
return (_jsxs("details", { className: "mt-3 rounded-md border bg-background p-3 text-sm", children: [_jsxs("summary", { className: "cursor-pointer font-medium text-foreground", children: ["Stickers: ", line] }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "In de printwachtrij betekent nog niet fysiek geprint." }), _jsx("ul", { className: "mt-2 divide-y", children: regels.map((r, i) => (_jsxs("li", { className: "flex flex-wrap justify-between gap-2 py-1.5 text-xs", children: [_jsxs("span", { className: "text-foreground", children: [r.soort ?? "sticker", " \u00B7 ", r.kopieen ?? "—", "x", r.breedteMm && r.hoogteMm ? ` · ${r.breedteMm}x${r.hoogteMm} mm` : ""] }), _jsxs("span", { className: "text-muted-foreground", children: [stickerStatusLabel(r.status), r.reden ? ` — ${r.reden}` : ""] })] }, r.stickerId ?? i))) })] }));
|
|
84
|
+
}
|
|
85
|
+
/** Bovenaan het pickstation: stickers die vandaag/morgen via A4 of verkleind gaan. Niets als Layouts het nog niet levert. */
|
|
86
|
+
export function VroegeStickerWaarschuwing({ stationId }) {
|
|
87
|
+
const q = useQuery({
|
|
88
|
+
queryKey: ["pick", "vroege-sticker", stationId],
|
|
89
|
+
queryFn: () => fetchVroegeWaarschuwing(stationId),
|
|
90
|
+
refetchInterval: 5 * 60000,
|
|
91
|
+
placeholderData: (prev) => prev,
|
|
92
|
+
retry: 1,
|
|
93
|
+
});
|
|
94
|
+
const list = Array.isArray(q.data) ? q.data : [];
|
|
95
|
+
if (list.length === 0)
|
|
96
|
+
return null;
|
|
97
|
+
const today = new Date().toLocaleDateString("sv-SE");
|
|
98
|
+
return (_jsxs("div", { role: "status", className: "mb-3 space-y-1 rounded-md border-2 border-primary/40 bg-primary/5 p-3 text-sm text-foreground", children: [_jsx("p", { className: "font-medium", children: "Let op: stickers passen niet op het gewone etiket" }), list.map((w, i) => _jsx("p", { children: vroegeWaarschuwingText(w, today) }, i))] }));
|
|
73
99
|
}
|