@flowselections/pick-schermen-kwekers 1.0.93 → 1.0.95
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 +15 -3
- package/dist-lib/integrations/supabase/types.d.ts +4869 -88
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/werkvloer.d.ts +6 -0
- package/dist-lib/lib/werkvloer.d.ts.map +1 -1
- package/dist-lib/lib/werkvloer.js +15 -0
- package/dist-lib/lib/werkvloer.test.js +10 -0
- package/package.json +9 -1
- package/schema/pickschermen.sql +179 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AAuFA,OAAO,EAaL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAwF7B,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAGD,wCAAwC;AACxC,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,WAAuC,CAAC;AAsBxF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,sCAs9DpD"}
|
|
@@ -13,7 +13,7 @@ import { ShippingNoteScan } from "./ShippingNoteScan.js";
|
|
|
13
13
|
import { MeldingsPlek, WerkvloerKaart } from "./werkvloer/Werkvloer.js";
|
|
14
14
|
import { useBrowserOnline, useIdle, useStableList } from "../../hooks/useWerkvloer.js";
|
|
15
15
|
import { label, wv } from "../../lib/labels.js";
|
|
16
|
-
import { ACCEPTED_STATUSES, cardSummary, groupCards, partialFailText, reprintQuestion, sentText, todoCountText, } from "../../lib/werkvloer.js";
|
|
16
|
+
import { ACCEPTED_STATUSES, cardSummary, groupCards, partialFailText, reprintQuestion, sentText, todoCountText, confirmQuestionOf, } from "../../lib/werkvloer.js";
|
|
17
17
|
import { getSessionId, pickApi } from "../../lib/pickApi.js";
|
|
18
18
|
import { CART_PLAN_MISMATCH_MESSAGE, WORKDAYS_UNKNOWN, fetchAutoSend, isPickWorkday, mismatchReason, nextWorkday, printErrorText, PRINT_FAILED_HINT, siteTimeZone, siteToday, } from "../../lib/pick142.js";
|
|
19
19
|
import { completeLogisticsTaskForItem, documentTypeOf } from "../../lib/pickPrint.js";
|
|
@@ -1384,6 +1384,8 @@ export function PickScherm({ station, onBack }) {
|
|
|
1384
1384
|
const [slot, setSlot] = useState({ kind: "none" });
|
|
1385
1385
|
const [orderBusy, setOrderBusy] = useState(false);
|
|
1386
1386
|
const [reprintAsk, setReprintAsk] = useState(null);
|
|
1387
|
+
// Engine-vraag bij een niet-volle kar op een vooruit gekozen pickdag.
|
|
1388
|
+
const [confirmAsk, setConfirmAsk] = useState(null);
|
|
1387
1389
|
const ownClaimIds = useRef(new Set());
|
|
1388
1390
|
const orderLock = useRef(false);
|
|
1389
1391
|
const [orderTrack, setOrderTrack] = useState(null);
|
|
@@ -1624,6 +1626,14 @@ export function PickScherm({ station, onBack }) {
|
|
|
1624
1626
|
}
|
|
1625
1627
|
}, [isOnline, printPlek, station.id, sessionId, refresh, printAllForItemInner, t]);
|
|
1626
1628
|
/** Opnieuw printen (tabblad Geprint vandaag), na bevestiging. */
|
|
1629
|
+
/** Vraagt de Engine om bevestiging (bevestigVraag), dan eerst die vraag; anders direct printen. */
|
|
1630
|
+
const askOrPrint = (cards) => {
|
|
1631
|
+
const question = confirmQuestionOf(cards[0]);
|
|
1632
|
+
if (question)
|
|
1633
|
+
setConfirmAsk({ cards, question });
|
|
1634
|
+
else
|
|
1635
|
+
void printOrder(cards);
|
|
1636
|
+
};
|
|
1627
1637
|
const reprintOrder = useCallback(async (card) => {
|
|
1628
1638
|
if (orderLock.current || !isOnline)
|
|
1629
1639
|
return;
|
|
@@ -1698,8 +1708,10 @@ export function PickScherm({ station, onBack }) {
|
|
|
1698
1708
|
: Math.round((checkDone / checkTotal) * 100);
|
|
1699
1709
|
const dayText = chosenDay ? dayLabel(chosenDay) : wv("today");
|
|
1700
1710
|
const allLoaded = total <= filters.pageSize;
|
|
1701
|
-
return (_jsxs("div", { className: "space-y-4 pb-8 text-lg", children: [_jsxs("header", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("h2", { className: "truncate text-2xl font-bold text-foreground", children: [station.name, " ", _jsxs("span", { className: "font-semibold text-muted-foreground", children: ["\u00B7 ", dayText] })] }), tab === "todo" && !loading && allLoaded && (_jsx("p", { className: "text-lg tabular-nums text-muted-foreground", children: todoCountText(todoCards.length) }))] }), _jsx(Button, { variant: "outline", className: "h-14 w-14 shrink-0 [&_svg]:!size-6", onClick: () => setLang(null), "aria-label": wv("language"), children: _jsx(Globe, { className: "h-6 w-6" }) }), _jsxs(Button, { variant: "outline", className: "h-14 shrink-0 px-5 text-lg [&_svg]:!size-6", onClick: () => setMeerOpen(true), children: [_jsx(MoreHorizontal, { className: "mr-2 h-6 w-6" }), " ", wv("more")] })] }), _jsxs("div", { children: [_jsxs(Button, { className: "h-24 min-h-[80px] w-full text-2xl font-bold sm:text-3xl [&_svg]:!size-8", disabled: !isOnline || orderBusy || actionBusy || !nextCard, onClick: () =>
|
|
1702
|
-
await markPrinted(r); })() }, card.key))) })), totalPages > 1 && (_jsxs("div", { className: "grid grid-cols-[1fr_auto_1fr] items-center gap-2", children: [_jsx(Button, { variant: "outline", className: "h-14", disabled: filters.page === 0, onClick: () => setFilters((f) => ({ ...f, page: Math.max(0, f.page - 1) })), children: t("previous") }), _jsxs("span", { className: "text-center tabular-nums text-muted-foreground", children: [filters.page + 1, " / ", totalPages] }), _jsx(Button, { variant: "outline", className: "h-14", disabled: filters.page + 1 >= totalPages, onClick: () => setFilters((f) => ({ ...f, page: f.page + 1 })), children: t("next") })] })), _jsx(AlertDialog, { open:
|
|
1711
|
+
return (_jsxs("div", { className: "space-y-4 pb-8 text-lg", children: [_jsxs("header", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("h2", { className: "truncate text-2xl font-bold text-foreground", children: [station.name, " ", _jsxs("span", { className: "font-semibold text-muted-foreground", children: ["\u00B7 ", dayText] })] }), tab === "todo" && !loading && allLoaded && (_jsx("p", { className: "text-lg tabular-nums text-muted-foreground", children: todoCountText(todoCards.length) }))] }), _jsx(Button, { variant: "outline", className: "h-14 w-14 shrink-0 [&_svg]:!size-6", onClick: () => setLang(null), "aria-label": wv("language"), children: _jsx(Globe, { className: "h-6 w-6" }) }), _jsxs(Button, { variant: "outline", className: "h-14 shrink-0 px-5 text-lg [&_svg]:!size-6", onClick: () => setMeerOpen(true), children: [_jsx(MoreHorizontal, { className: "mr-2 h-6 w-6" }), " ", wv("more")] })] }), _jsxs("div", { children: [_jsxs(Button, { className: "h-24 min-h-[80px] w-full text-2xl font-bold sm:text-3xl [&_svg]:!size-8", disabled: !isOnline || orderBusy || actionBusy || !nextCard, onClick: () => askOrPrint(readyCards), children: [orderBusy ? _jsx(Loader2, { className: "mr-3 h-8 w-8 animate-spin" }) : _jsx(Printer, { className: "mr-3 h-8 w-8" }), wv("printNext")] }), _jsx("p", { className: "mt-2 min-h-[1.75rem] truncate text-center text-xl font-semibold text-foreground", children: nextCard ? cardSummary(nextCard) : !loading && todoCards.length === 0 ? wv("emptyTodo") : "" })] }), _jsx(MeldingsPlek, { slot: slot, onDismiss: () => setSlot(isOnline ? { kind: "none" } : { kind: "offline" }) }), _jsx("div", { role: "tablist", className: "grid grid-cols-2 gap-2", children: ["todo", "printed"].map((k) => (_jsx(Button, { role: "tab", "aria-selected": tab === k, variant: tab === k ? "default" : "outline", className: "h-14 text-xl", onClick: () => setTab(k), children: k === "todo" ? wv("tabTodo") : wv("tabPrinted") }, k))) }), _jsx(VroegeStickerWaarschuwing, { stationId: station.id }), loading && shown.length === 0 ? (_jsx("ul", { className: "space-y-3", "aria-hidden": true, children: [0, 1, 2].map((i) => (_jsx("li", { className: "h-28 rounded-xl bg-muted" }, i))) })) : shown.length === 0 ? (_jsx("p", { className: "py-10 text-center text-xl text-muted-foreground", children: tab === "todo" ? wv("emptyTodo") : wv("emptyPrinted") })) : (_jsx("ul", { className: "space-y-3", ...touchHandlers, children: shown.map(({ item: card, leaving }) => (_jsx(WerkvloerKaart, { card: card, state: cardStateOf(card, tab), tz: siteTz, mode: tab, leaving: leaving, showLead: showLead, disabled: !isOnline || orderBusy || actionBusy, onPrint: (c) => (tab === "printed" ? setReprintAsk(c) : askOrPrint([c])), onFetch: (c) => void requestData(c.rows[0]), onPreview: (c) => setPreviewItem(c.rows[0] ?? null), onMarkPrinted: (c) => void (async () => { for (const r of c.rows)
|
|
1712
|
+
await markPrinted(r); })() }, card.key))) })), totalPages > 1 && (_jsxs("div", { className: "grid grid-cols-[1fr_auto_1fr] items-center gap-2", children: [_jsx(Button, { variant: "outline", className: "h-14", disabled: filters.page === 0, onClick: () => setFilters((f) => ({ ...f, page: Math.max(0, f.page - 1) })), children: t("previous") }), _jsxs("span", { className: "text-center tabular-nums text-muted-foreground", children: [filters.page + 1, " / ", totalPages] }), _jsx(Button, { variant: "outline", className: "h-14", disabled: filters.page + 1 >= totalPages, onClick: () => setFilters((f) => ({ ...f, page: f.page + 1 })), children: t("next") })] })), _jsx(AlertDialog, { open: confirmAsk !== null, onOpenChange: (o) => { if (!o)
|
|
1713
|
+
setConfirmAsk(null); }, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "text-2xl", children: confirmAsk ? cardSummary(confirmAsk.cards[0]) : "" }), _jsx(AlertDialogDescription, { className: "text-xl text-foreground", children: confirmAsk?.question ?? "" })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { className: "h-14 text-lg", children: "Annuleren" }), _jsx(AlertDialogAction, { className: "h-14 text-lg", onClick: () => { const a = confirmAsk; setConfirmAsk(null); if (a)
|
|
1714
|
+
void printOrder(a.cards); }, children: "Toch printen" })] })] }) }), _jsx(AlertDialog, { open: reprintAsk !== null, onOpenChange: (o) => { if (!o)
|
|
1703
1715
|
setReprintAsk(null); }, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "text-2xl", children: reprintAsk ? cardSummary(reprintAsk) : "" }), _jsx(AlertDialogDescription, { className: "text-xl text-foreground", children: reprintAsk ? reprintQuestion(reprintAsk.printedAt, siteTz) : "" })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { className: "h-14 text-lg", children: wv("cancel") }), _jsx(AlertDialogAction, { className: "h-14 text-lg", onClick: () => { const c = reprintAsk; setReprintAsk(null); if (c)
|
|
1704
1716
|
void reprintOrder(c); }, children: wv("reprint") })] })] }) }), _jsx(Dialog, { open: meerOpen, onOpenChange: setMeerOpen, children: _jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-2xl", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { className: "text-2xl", children: wv("more") }) }), _jsxs("div", { className: "space-y-6 text-lg", children: [_jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "font-semibold text-foreground", children: wv("pickDay") }), _jsxs("div", { className: "grid grid-cols-3 gap-2", children: [_jsxs(Button, { variant: "outline", className: "h-14", disabled: loadingDay, onClick: () => void shiftDay(-1), children: [_jsx(ChevronLeft, { className: "mr-1 h-5 w-5" }), " ", ui.pickDayPrev] }), _jsx(Button, { variant: chosenDay ? "outline" : "default", className: "h-14", disabled: loadingDay, onClick: () => void chooseDay("current"), children: wv("today") }), _jsxs(Button, { variant: "outline", className: "h-14", disabled: loadingDay, onClick: () => void shiftDay(1), children: [ui.pickDayNext, " ", _jsx(ChevronRight, { className: "ml-1 h-5 w-5" })] })] }), _jsx("p", { className: "text-muted-foreground", children: dayText })] }), _jsxs("section", { className: "space-y-2", children: [_jsx("label", { htmlFor: "pick-search", className: "font-semibold text-foreground", children: wv("search") }), _jsxs("div", { className: "relative", children: [_jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { id: "pick-search", className: "h-14 pl-10 text-lg", value: searchInput, onChange: (e) => setSearchInput(e.target.value) })] })] }), _jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "font-semibold text-foreground", children: wv("documentFilter") }), _jsx("div", { className: "flex flex-wrap gap-2", children: [{ id: null, name: wv("allDocuments") }, ...(Array.isArray(documentTypes) ? documentTypes : []).map((dt) => ({ id: dt.id, name: dt.name }))].map((dt) => (_jsx(Button, { "aria-pressed": (filters.documentTypeId ?? null) === dt.id, variant: (filters.documentTypeId ?? null) === dt.id ? "default" : "outline", className: "h-14 px-4 text-lg", onClick: () => setFilters((f) => ({ ...f, documentTypeId: dt.id, page: 0 })), children: dt.name }, dt.id ?? "all"))) })] }), _jsx("section", { children: _jsxs(Button, { variant: showLead ? "default" : "outline", className: "h-14 w-full text-lg", "aria-pressed": showLead, onClick: () => setShowLead((v) => !v), children: [wv("markPrinted"), " \u2014 ", wv("leadActions")] }) }), showNotes && (_jsx("section", { children: _jsxs(Button, { variant: "outline", className: "h-14 w-full text-lg", disabled: fetchingNotes, onClick: () => void fetchShippingNotes(), children: [fetchingNotes ? _jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" }) : _jsx(FileDown, { className: "mr-2 h-5 w-5" }), wv("fetchNotes")] }) })), _jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "font-semibold text-foreground", children: wv("scan") }), _jsx(ShippingNoteScan, { stationId: station.id })] }), earlierRows.length > 0 && (_jsxs("section", { className: "space-y-2", "aria-label": wv("earlier"), children: [_jsxs("h3", { className: "font-semibold text-foreground", children: [wv("earlier"), " (", earlierRows.length, ")"] }), _jsx("ul", { className: "divide-y divide-border", children: earlierRows.map((row) => (_jsxs("li", { className: "flex flex-wrap items-center justify-between gap-2 py-2", children: [_jsxs("span", { className: "min-w-0 truncate", children: [row.order_number ?? row.document_number ?? "—", " \u00B7 ", pickDayShortLabel(pickDayOf(row)), row.customer_name ? ` · ${row.customer_name}` : ""] }), _jsx(Button, { variant: "outline", className: "h-14", disabled: busyId !== null || actionBusy || orderBusy, onClick: async () => { await printAllForItem(row); void refetchEarlier(); }, children: wv("reprint") })] }, row.id))) })] }))] }), _jsx(DialogFooter, { children: _jsx(Button, { className: "h-14 w-full text-lg", onClick: () => setMeerOpen(false), children: wv("close") }) })] }) }), _jsx(PreviewDialog, { item: previewItem, stationSlug: station.slug, onClose: () => setPreviewItem(null) })] }));
|
|
1705
1717
|
}
|