@flowselections/pick-schermen-kwekers 1.0.48 → 1.0.50
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.js +2 -2
- package/dist-lib/components/pick/QueueTable.d.ts.map +1 -1
- package/dist-lib/components/pick/QueueTable.js +29 -2
- package/dist-lib/hooks/usePickQueue.d.ts +2 -0
- package/dist-lib/hooks/usePickQueue.d.ts.map +1 -1
- package/dist-lib/hooks/usePickQueue.js +9 -3
- package/dist-lib/integrations/supabase/types.d.ts +12 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/__tests__/pick142.test.js +11 -4
- package/dist-lib/lib/pick142.d.ts +13 -8
- package/dist-lib/lib/pick142.d.ts.map +1 -1
- package/dist-lib/lib/pick142.js +15 -5
- package/dist-lib/lib/pickTypes.d.ts +2 -0
- package/dist-lib/lib/pickTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1346,7 +1346,7 @@ export function PickScherm({ station, onBack }) {
|
|
|
1346
1346
|
? 100
|
|
1347
1347
|
: Math.round((checkDone / checkTotal) * 100);
|
|
1348
1348
|
return (_jsxs("div", { className: "space-y-4 pb-24 md:pb-0", children: [busyLoading && (_jsxs("div", { className: "space-y-1", role: "status", "aria-live": "polite", "aria-label": "Gegevens worden geladen", children: [_jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [_jsx("span", { children: loading || loadingDay
|
|
1349
|
-
? "
|
|
1349
|
+
? "Pickwachtrij laden…"
|
|
1350
1350
|
: checkDone > 0
|
|
1351
1351
|
? `Pakbonnen controleren (${checkDone} van ${checkTotal})…`
|
|
1352
1352
|
: `Pakbonnen controleren (${checkTotal})…` }), _jsxs("span", { className: "tabular-nums", children: [loadPercent, "%"] })] }), _jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-muted", children: _jsx("div", { className: "h-full rounded-full bg-primary transition-all duration-300", style: { width: `${Math.max(5, loadPercent)}%` } }) })] })), _jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:flex-wrap md:items-center md:justify-between", children: [_jsxs("div", { className: "grid grid-cols-[auto_minmax(0,1fr)] items-center gap-3", children: [_jsxs(Button, { variant: "outline", size: "lg", className: "h-12 shrink-0 px-3 sm:px-4", onClick: () => setLang(null), "aria-label": t("changeLanguage"), children: [_jsx(Globe, { className: "h-5 w-5 sm:mr-2" }), _jsx("span", { className: "hidden sm:inline", children: t("changeLanguage") })] }), _jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "truncate text-lg font-bold text-foreground sm:text-xl", children: station.name }), _jsxs("p", { className: "truncate text-sm text-muted-foreground", children: [pendingCount, " ", t("statusToPrint"), " \u00B7 ", printedCount, " ", t("statusPrinted"), openJobIds.length > 0 ? ` · ${openJobIds.length} wacht op printer` : ""] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "lg", className: "h-12 px-3", onClick: () => void shiftDay(-1), disabled: loadingDay || !(chosenDay ?? pickDay), "aria-label": ui.pickDayPrev, children: [_jsx(ChevronLeft, { className: "h-5 w-5 sm:mr-1" }), _jsx("span", { className: "hidden sm:inline", children: ui.pickDayPrev })] }), _jsx("div", { className: "flex h-12 items-center rounded-md border bg-muted px-4 text-sm font-semibold text-foreground", children: chosenDay ? dayLabel(chosenDay) : ui.pickDayToday }), _jsxs(Button, { variant: "outline", size: "lg", className: "h-12 px-3", onClick: () => void shiftDay(1), disabled: loadingDay || !(chosenDay ?? pickDay), "aria-label": ui.pickDayNext, children: [_jsx("span", { className: "hidden sm:inline", children: ui.pickDayNext }), _jsx(ChevronRight, { className: "h-5 w-5 sm:ml-1" })] }), chosenDay && (_jsx(Button, { variant: "secondary", size: "lg", className: "h-12 px-4", onClick: () => void chooseDay("current"), disabled: loadingDay, children: ui.pickDayBackToToday }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [!online && (_jsxs(Badge, { className: "bg-destructive text-destructive-foreground", children: [_jsx(WifiOff, { className: "mr-1 h-3.5 w-3.5" }), " ", t("offline")] })), _jsx(Button, { variant: "outline", size: "icon", className: "h-12 w-12 shrink-0", onClick: refresh, "aria-label": t("refresh"), children: _jsx(RefreshCw, { className: "h-4 w-4" }) }), _jsxs(Button, { variant: "outline", size: "lg", className: "hidden h-14 px-5 md:inline-flex", 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" })), fetchingNotes ? "Ophalen…" : "Verzendbrieven ophalen"] }), cartsPerPrint != null && (_jsxs(Button, { size: "lg", className: "hidden h-14 px-6 text-lg md:inline-flex", disabled: loading || batchPrinting || (busyId != null || actionBusy), onClick: () => void printNextCarts(), children: [batchPrinting ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), "Volgende printen (", cartsPerPrint, " karren)"] })), _jsxs(Button, { size: "lg", className: "hidden h-14 px-8 text-lg md:inline-flex", onClick: () => (pending ? confirmPending() : fetchNextLocked()), disabled: (busyId !== null || actionBusy) || fetchingData, children: [(busyId !== null || actionBusy) || fetchingData ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : pending && !readiness.ready ? (_jsx(RefreshCw, { className: "mr-2 h-5 w-5" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), pending && !readiness.ready ? "Pakbon ophalen" : t("printNext")] })] })] }), syncError && (_jsxs("div", { role: "alert", 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" }), _jsxs("span", { children: [SYNC_ERROR_MESSAGE, _jsxs("details", { className: "mt-1 text-xs text-muted-foreground", children: [_jsx("summary", { children: "Details voor beheer" }), syncError] })] })] })), !plekLoading && !printPlek && (_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: "Nog geen printplek gekoppeld \u2014 de opdracht blijft in de wachtrij staan." })] })), (cartMissing || rowGone) && (_jsxs("div", { role: "alert", className: "flex flex-col gap-2 rounded-md border-2 border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("span", { className: "flex items-start gap-2", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), rowGone ? ROW_GONE_MESSAGE : CART_MISSING_MESSAGE] }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
@@ -1420,5 +1420,5 @@ export function PickScherm({ station, onBack }) {
|
|
|
1420
1420
|
})] }) })), _jsxs(Button, { variant: "outline", size: "lg", className: "h-12 w-full sm:hidden", "aria-expanded": filtersOpen, onClick: () => setFiltersOpen((v) => !v), children: [_jsx(Search, { className: "mr-2 h-4 w-4" }), " ", ui.filters] }), _jsx(Card, { className: filtersOpen ? "" : "hidden sm:block", children: _jsxs(CardContent, { className: "flex flex-wrap items-center gap-3 p-3 sm:p-4", children: [_jsxs("div", { className: "relative w-full min-w-0 flex-1 sm:min-w-64", children: [_jsx(Search, { 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: t("search"), value: searchInput, onChange: (e) => setSearchInput(e.target.value) })] }), _jsxs(Select, { value: chosenDay ?? "current", onValueChange: (v) => void chooseDay(v), children: [_jsx(SelectTrigger, { className: "h-12 w-full sm:w-56", disabled: loadingDay, children: _jsx(SelectValue, { placeholder: ui.pickDay }) }), _jsxs(SelectContent, { className: "z-[100] bg-popover opacity-100", children: [_jsx(SelectItem, { value: "current", children: ui.pickDayToday }), safePickDays.map((d) => (_jsxs(SelectItem, { value: d.day, children: [dayLabel(d.day), d.orders > 0 ? ` (${d.orders})` : ""] }, d.day)))] })] }), _jsxs(Select, { value: filters.documentTypeId ?? "all", onValueChange: (v) => setFilters((f) => ({ ...f, documentTypeId: v === "all" ? null : v, page: 0 })), children: [_jsx(SelectTrigger, { className: "h-12 w-full sm:w-52", children: _jsx(SelectValue, { placeholder: ui.allDocumentTypes }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: ui.allDocumentTypes }), (Array.isArray(documentTypes) ? documentTypes : []).map((dt) => (_jsx(SelectItem, { value: dt.id, children: dt.name }, dt.id)))] })] }), _jsx(Button, { variant: filters.onlyPending ? "default" : "outline", className: "h-12", onClick: () => setFilters((f) => ({ ...f, onlyPending: !f.onlyPending, page: 0 })), children: ui.onlyPending }), _jsxs(Button, { variant: filters.urgentOnly ? "default" : "outline", className: "h-12", onClick: () => setFilters((f) => ({ ...f, urgentOnly: !f.urgentOnly, page: 0 })), children: [_jsx(Zap, { className: "mr-2 h-4 w-4" }), ui.onlyUrgent, urgentCount > 0 ? ` (${urgentCount})` : ""] })] }) }), !realtimeOk && (_jsx("p", { className: "text-sm text-muted-foreground", children: ui.connectionLost })), cartsPerPrint != null && (_jsx("div", { className: "flex justify-end md:hidden", children: _jsxs(Button, { className: "h-12", disabled: loading || batchPrinting || (busyId != null || actionBusy), onClick: () => void printNextCarts(), children: [batchPrinting ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-4 w-4" })), "Volgende printen (", cartsPerPrint, " karren)"] }) })), _jsx("div", { className: "md:hidden", children: _jsxs(Button, { variant: "outline", className: "h-12 w-full", disabled: fetchingNotes, onClick: () => void fetchShippingNotes(), children: [fetchingNotes ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(FileDown, { className: "mr-2 h-4 w-4" })), fetchingNotes ? "Ophalen…" : "Verzendbrieven ophalen"] }) }), loading ? (_jsxs("div", { className: "flex items-center justify-center py-16 text-muted-foreground", children: [_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" }), " ", t("loadingQueue")] })) : (_jsxs(_Fragment, { children: [earlierRows.length > 0 && (_jsxs("section", { className: "mb-4 rounded-lg border border-primary/40 bg-muted/40 p-3", "aria-label": "Nog niet gescand van eerdere dagen", children: [_jsxs("h3", { className: "mb-2 text-sm font-semibold text-foreground", children: ["Nog niet gescand van eerdere dagen (", 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("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", children: row.document_number ?? row.order_number ?? "Pakbon" }), _jsxs("div", { className: "text-xs text-muted-foreground", children: [pickDayShortLabel(pickDayOf(row)), row.customer_name ? ` · ${row.customer_name}` : ""] })] }), _jsx(Button, { size: "sm", variant: "outline", disabled: busyId !== null || actionBusy, onClick: async () => {
|
|
1421
1421
|
await printAllForItem(row);
|
|
1422
1422
|
void refetchEarlier();
|
|
1423
|
-
}, children: "Opnieuw printen" })] }, row.id))) })] })), _jsx(QueueTable, { items: items, lockedIds: lockedIds, statuses: Array.isArray(statuses) ? statuses : [], documentTypes: Array.isArray(documentTypes) ? documentTypes : [], busyId: busyId, readinessById: readinessById, siteTimeZone: siteTz, pickDay: chosenDay ?? pickDay ?? null, waitingIds: waitingQueueIds, onPick: handlePick, onReprint: handleReprintLocked, onPrintAll: printAllForItem, onSelectPrinted: selectPrintedForReprint, onMarkPrinted: markPrinted, onPreview: setPreviewItem, t: t })] })), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("span", { className: "text-center text-sm text-muted-foreground sm:text-left", children: [t("page"), " ", filters.page + 1, " ", t("of"), " ", totalPages] }), _jsxs("div", { className: "grid grid-cols-2 gap-2 sm:flex", children: [_jsx(Button, { variant: "outline", className: "h-12 w-full sm:w-auto", disabled: filters.page === 0, onClick: () => setFilters((f) => ({ ...f, page: Math.max(0, f.page - 1) })), children: t("previous") }), _jsx(Button, { variant: "outline", className: "h-12 w-full sm:w-auto", disabled: filters.page + 1 >= totalPages, onClick: () => setFilters((f) => ({ ...f, page: f.page + 1 })), children: t("next") })] })] }), _jsx("div", { className: "fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur md:hidden", children: _jsxs(Button, { size: "lg", className: "h-14 w-full text-lg", onClick: () => (pending ? confirmPending() : fetchNextLocked()), disabled: (busyId !== null || actionBusy) || fetchingData, children: [(busyId !== null || actionBusy) || fetchingData ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : pending && !readiness.ready ? (_jsx(RefreshCw, { className: "mr-2 h-5 w-5" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), _jsxs("span", { className: "truncate", children: [pending && !readiness.ready ? "Pakbon ophalen" : t("printNext"), pending?.document_number ? ` · ${pending.document_number}` : ""] })] }) }), _jsx(PreviewDialog, { item: previewItem, stationSlug: station.slug, onClose: () => setPreviewItem(null) })] }));
|
|
1423
|
+
}, children: "Opnieuw printen" })] }, row.id))) })] })), _jsx(QueueTable, { items: items.filter((item) => readinessById[item.id]?.replaced !== true), lockedIds: lockedIds, statuses: Array.isArray(statuses) ? statuses : [], documentTypes: Array.isArray(documentTypes) ? documentTypes : [], busyId: busyId, readinessById: readinessById, siteTimeZone: siteTz, pickDay: chosenDay ?? pickDay ?? null, waitingIds: waitingQueueIds, onPick: handlePick, onReprint: handleReprintLocked, onPrintAll: printAllForItem, onSelectPrinted: selectPrintedForReprint, onMarkPrinted: markPrinted, onPreview: setPreviewItem, t: t })] })), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("span", { className: "text-center text-sm text-muted-foreground sm:text-left", children: [t("page"), " ", filters.page + 1, " ", t("of"), " ", totalPages] }), _jsxs("div", { className: "grid grid-cols-2 gap-2 sm:flex", children: [_jsx(Button, { variant: "outline", className: "h-12 w-full sm:w-auto", disabled: filters.page === 0, onClick: () => setFilters((f) => ({ ...f, page: Math.max(0, f.page - 1) })), children: t("previous") }), _jsx(Button, { variant: "outline", className: "h-12 w-full sm:w-auto", disabled: filters.page + 1 >= totalPages, onClick: () => setFilters((f) => ({ ...f, page: f.page + 1 })), children: t("next") })] })] }), _jsx("div", { className: "fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] backdrop-blur md:hidden", children: _jsxs(Button, { size: "lg", className: "h-14 w-full text-lg", onClick: () => (pending ? confirmPending() : fetchNextLocked()), disabled: (busyId !== null || actionBusy) || fetchingData, children: [(busyId !== null || actionBusy) || fetchingData ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : pending && !readiness.ready ? (_jsx(RefreshCw, { className: "mr-2 h-5 w-5" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), _jsxs("span", { className: "truncate", children: [pending && !readiness.ready ? "Pakbon ophalen" : t("printNext"), pending?.document_number ? ` · ${pending.document_number}` : ""] })] }) }), _jsx(PreviewDialog, { item: previewItem, stationSlug: station.slug, onClose: () => setPreviewItem(null) })] }));
|
|
1424
1424
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueTable.d.ts","sourceRoot":"","sources":["../../../src/components/pick/QueueTable.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"QueueTable.d.ts","sourceRoot":"","sources":["../../../src/components/pick/QueueTable.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUvF,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAA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,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,CAAC,EAAE,cAAc,CAAC;CACpB;AA8DD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,MAAM,EACN,aAAa,EACb,UAAU,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACV,eAAe,EACf,aAAa,EACb,SAAS,EAGT,QAAQ,EACR,CAAC,EAAE,UAAU,EACb,YAAmB,EACnB,OAAc,GACf,EAAE,KAAK,+BAggBP"}
|
|
@@ -5,6 +5,9 @@ import { Badge, Button, Table, TableBody, TableCell, TableHead, TableHeader, Tab
|
|
|
5
5
|
import { AlertTriangle, Check, Eye, Loader2, Lock, Printer, RefreshCw, RotateCcw } from "lucide-react";
|
|
6
6
|
import { cartColumnInfo, comparePickQueue, dedupeByUnit, displayCartCount, displayPageCount, sinceLabel, unitTitleOf } from "../../lib/pickTypes.js";
|
|
7
7
|
import { duplicateNameTag } from "../../lib/pickRowState.js";
|
|
8
|
+
import { useQuery } from "@tanstack/react-query";
|
|
9
|
+
import { pickApi } from "../../lib/pickApi.js";
|
|
10
|
+
import { PRINT_MANUAL, printStage, printStageLabel } from "../../lib/pick142.js";
|
|
8
11
|
import { CART_PLAN_MISMATCH_MESSAGE, orderNumbersLabel } from "../../lib/pick142.js";
|
|
9
12
|
import { isRowPrintable, rowWaitMessage, rowWaitOf } from "../../lib/pick143.js";
|
|
10
13
|
import { getPickTranslator } from "../../lib/pickI18n.js";
|
|
@@ -69,6 +72,19 @@ function priorityTone(priority, urgent) {
|
|
|
69
72
|
}
|
|
70
73
|
export function QueueTable({ items, lockedIds, statuses, documentTypes, busyId, readinessById, waitingIds, onPick, onReprint, onPrintAll, onSelectPrinted, onMarkPrinted, onPreview, readOnly, t: translator, siteTimeZone = null, pickDay = null, }) {
|
|
71
74
|
const t = translator ?? getPickTranslator("nl");
|
|
75
|
+
// Echte printstatus per regel uit de printopdrachten (één aanvraag, ververst mee).
|
|
76
|
+
const jobIds = Array.from(new Set((Array.isArray(items) ? items : []).filter((i) => i.printed_at && i.print_job_id).map((i) => i.print_job_id))).sort();
|
|
77
|
+
const jobsQuery = useQuery({
|
|
78
|
+
queryKey: ["pick", "rowPrintJobs", jobIds.join(",")],
|
|
79
|
+
enabled: jobIds.length > 0,
|
|
80
|
+
queryFn: () => pickApi.printJobsStatus(jobIds),
|
|
81
|
+
refetchInterval: (q) => {
|
|
82
|
+
const data = Array.isArray(q.state.data) ? q.state.data : [];
|
|
83
|
+
return data.some((j) => printStage(j) === "rendering") ? 5000 : 30000;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
const jobsLoaded = jobsQuery.isSuccess;
|
|
87
|
+
const jobsById = new Map((Array.isArray(jobsQuery.data) ? jobsQuery.data : []).map((j) => [j.id, j]));
|
|
72
88
|
// Volgorde identiek aan de keuze van "volgende uitprinten" (zie
|
|
73
89
|
// comparePickQueue): niet-geprinte regels bovenaan, en bij gelijke stand op
|
|
74
90
|
// kar-nummer, zodat K1 boven K2 boven K3 staat en het printen van boven naar
|
|
@@ -101,7 +117,7 @@ export function QueueTable({ items, lockedIds, statuses, documentTypes, busyId,
|
|
|
101
117
|
}, children: [_jsxs(TableCell, { className: "font-medium", children: [_jsxs("div", { className: "flex items-center gap-2", children: [unitTitleOf(item), dupTag && _jsxs("span", { className: "text-xs font-normal text-muted-foreground", children: ["(", dupTag, ")"] }), replaced && (_jsx("span", { className: "rounded bg-destructive/10 px-1.5 py-0.5 text-xs font-semibold text-destructive", title: readiness?.reason ?? undefined, children: "Vervangen" })), replaced && readiness?.reason && (_jsx("span", { className: "text-xs font-normal text-destructive", children: readiness.reason })), waiting && (_jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground", children: "Wacht op printer" })), sentElsewhereLines(item).map((line) => (_jsx("span", { className: "text-xs font-normal text-muted-foreground", children: line }, line))), warnings.length > 0 && (_jsx(AlertTriangle, { className: "h-4 w-4 text-destructive", "aria-label": t("warning") }))] }), _jsx("div", { className: "text-xs text-muted-foreground", children: doc?.name ?? "-" })] }), _jsx(TableCell, { children: orderNumbersLabel(item) }), _jsx(TableCell, { children: item.customer_name }), _jsx(TableCell, { className: "text-right", children: item.line_count }), _jsx(TableCell, { className: "text-right", children: (() => {
|
|
102
118
|
const info = cartColumnInfo(item);
|
|
103
119
|
return (_jsxs("div", { className: "flex flex-col items-end", children: [_jsx("span", { children: info.carts }), info.cartLabel && (_jsx("span", { className: "text-xs text-muted-foreground", children: info.cartLabel })), info.reason && (_jsx("span", { className: "text-xs text-muted-foreground", children: info.reason }))] }));
|
|
104
|
-
})() }), _jsx(TableCell, { className: "text-right", children: printedSlipCount(item) ?? "—" }), _jsx(TableCell, { className: "text-right", children: displayPageCount(item.line_count) }), _jsxs(TableCell, { children: [_jsx(
|
|
120
|
+
})() }), _jsx(TableCell, { className: "text-right", children: printedSlipCount(item) ?? "—" }), _jsx(TableCell, { className: "text-right", children: displayPageCount(item.line_count) }), _jsxs(TableCell, { children: [_jsx(RowPrintBadge, { printed: printed, hasJob: !!item.print_job_id, job: item.print_job_id ? jobsById.get(item.print_job_id) : undefined, jobsLoaded: jobsLoaded, toPrintLabel: t("statusToPrint") }), printed && (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: new Date(item.printed_at).toLocaleTimeString([], {
|
|
105
121
|
hour: "2-digit",
|
|
106
122
|
minute: "2-digit",
|
|
107
123
|
}) }))] }), _jsx(TableCell, { children: _jsx("span", { className: "rounded px-2 py-1 text-xs font-semibold " +
|
|
@@ -145,7 +161,7 @@ export function QueueTable({ items, lockedIds, statuses, documentTypes, busyId,
|
|
|
145
161
|
}, children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsxs("span", { className: "truncate text-lg font-bold text-foreground", children: [unitTitleOf(item), dupTag && _jsxs("span", { className: "text-xs font-normal text-muted-foreground", children: ["(", dupTag, ")"] }), replaced && (_jsx("span", { className: "rounded bg-destructive/10 px-1.5 py-0.5 text-xs font-semibold text-destructive", title: readiness?.reason ?? undefined, children: "Vervangen" })), replaced && readiness?.reason && (_jsx("span", { className: "text-xs font-normal text-destructive", children: readiness.reason })), waiting && (_jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground", children: "Wacht op printer" }))] }), warnings.length > 0 && (_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0 text-destructive", "aria-label": t("warning") }))] }), _jsx("p", { className: "truncate text-xs text-muted-foreground", children: doc?.name ?? "-" })] }), _jsxs("div", { className: "flex shrink-0 items-start gap-1", children: [onPreview && (_jsx("button", { type: "button", "aria-label": "Voorbeeld " + item.document_number, title: "Voorbeeld " + item.document_number, className: "inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground", onClick: (e) => {
|
|
146
162
|
e.stopPropagation();
|
|
147
163
|
onPreview(item);
|
|
148
|
-
}, children: _jsx(Eye, { className: "h-5 w-5" }) })), _jsxs("div", { className: "flex shrink-0 flex-col items-end gap-1", children: [_jsx(
|
|
164
|
+
}, children: _jsx(Eye, { className: "h-5 w-5" }) })), _jsxs("div", { className: "flex shrink-0 flex-col items-end gap-1", children: [_jsx(RowPrintBadge, { printed: printed, hasJob: !!item.print_job_id, job: item.print_job_id ? jobsById.get(item.print_job_id) : undefined, jobsLoaded: jobsLoaded, toPrintLabel: t("statusToPrint") }), printed && (_jsx("span", { className: "text-xs text-muted-foreground", children: new Date(item.printed_at).toLocaleTimeString([], {
|
|
149
165
|
hour: "2-digit",
|
|
150
166
|
minute: "2-digit",
|
|
151
167
|
}) })), _jsx("span", { className: "rounded px-2 py-0.5 text-xs font-semibold " +
|
|
@@ -179,3 +195,14 @@ export function QueueTable({ items, lockedIds, statuses, documentTypes, busyId,
|
|
|
179
195
|
}, children: [_jsx(Check, { className: "mr-2 h-4 w-4" }), "Markeer als geprint"] })] }))] })] }, item.id));
|
|
180
196
|
}), safeItems.length === 0 && (_jsx("div", { className: "rounded-lg border py-10 text-center text-muted-foreground", children: t("emptyQueue") }))] })] }));
|
|
181
197
|
}
|
|
198
|
+
/** Statuslabel van een regel: alleen de echte stand uit de printopdracht, nooit een aanname. */
|
|
199
|
+
function RowPrintBadge({ printed, hasJob, job, jobsLoaded, toPrintLabel }) {
|
|
200
|
+
if (!printed)
|
|
201
|
+
return _jsx(Badge, { variant: "default", children: toPrintLabel });
|
|
202
|
+
if (!hasJob)
|
|
203
|
+
return _jsx(Badge, { variant: "secondary", children: PRINT_MANUAL });
|
|
204
|
+
if (!job && !jobsLoaded)
|
|
205
|
+
return _jsx(Badge, { variant: "secondary", children: "Status laden\u2026" });
|
|
206
|
+
const stage = printStage(job);
|
|
207
|
+
return (_jsx(Badge, { variant: stage === "failed" ? "destructive" : "secondary", children: printStageLabel(job) }));
|
|
208
|
+
}
|
|
@@ -52,4 +52,6 @@ export declare function usePickDays(enabled?: boolean): import("@tanstack/react-
|
|
|
52
52
|
day: string;
|
|
53
53
|
orders: number;
|
|
54
54
|
}[], Error>;
|
|
55
|
+
/** Zelfde station, scherm en pickdag (positie 2-4 van de wachtrij-sleutel). */
|
|
56
|
+
export declare function sameQueueScope(a: readonly unknown[], b: readonly unknown[]): boolean;
|
|
55
57
|
//# sourceMappingURL=usePickQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickQueue.d.ts","sourceRoot":"","sources":["../../src/hooks/usePickQueue.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;I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CAAC;CACjC;;;;;;;;;;;IA4LG,gEAAgE;;IAEhE,6EAA6E;;;EAIhF;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,MAAM;;EAuBhG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,iFAOnF;AACD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,OAAO,UAAO;;;YAQzC;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAEpF"}
|
|
@@ -94,7 +94,8 @@ export function usePickQueue(args) {
|
|
|
94
94
|
const key = useMemo(() => ["pick", "queue", stationId ?? "-", screenId ?? "-", pickDay ?? "-", filters], [stationId, screenId, pickDay, filters]);
|
|
95
95
|
const queueQuery = useQuery({
|
|
96
96
|
queryKey: key,
|
|
97
|
-
|
|
97
|
+
// Pas laden als de pickdag bekend is, anders flitst een oude lijst.
|
|
98
|
+
enabled: enabled && (pickDayOverride != null || pickDayQuery.isFetched),
|
|
98
99
|
queryFn: () => pickApi.queue({
|
|
99
100
|
stationId,
|
|
100
101
|
screenId,
|
|
@@ -108,7 +109,8 @@ export function usePickQueue(args) {
|
|
|
108
109
|
page: filters.page,
|
|
109
110
|
pageSize: filters.pageSize,
|
|
110
111
|
}),
|
|
111
|
-
|
|
112
|
+
// Vorige lijst alleen vasthouden bij filteren/bladeren binnen hetzelfde station en dezelfde pickdag.
|
|
113
|
+
placeholderData: (prev, prevQuery) => (prevQuery && sameQueueScope(prevQuery.queryKey, key) ? prev : undefined),
|
|
112
114
|
});
|
|
113
115
|
const countsQuery = useQuery({
|
|
114
116
|
queryKey: ["pick", "dayCounts", stationId ?? "-", screenId ?? "-", pickDay ?? "-"],
|
|
@@ -177,7 +179,7 @@ export function usePickQueue(args) {
|
|
|
177
179
|
pendingCount: countsQuery.data?.pending ?? 0,
|
|
178
180
|
printedCount: countsQuery.data?.printed ?? 0,
|
|
179
181
|
urgentCount: countsQuery.data?.urgent ?? 0,
|
|
180
|
-
loading: queueQuery.
|
|
182
|
+
loading: queueQuery.isPending,
|
|
181
183
|
error: queueQuery.error instanceof Error ? queueQuery.error.message : null,
|
|
182
184
|
lockedIds,
|
|
183
185
|
realtimeOk,
|
|
@@ -232,3 +234,7 @@ export function usePickDays(enabled = true) {
|
|
|
232
234
|
refetchInterval: 120000,
|
|
233
235
|
});
|
|
234
236
|
}
|
|
237
|
+
/** Zelfde station, scherm en pickdag (positie 2-4 van de wachtrij-sleutel). */
|
|
238
|
+
export function sameQueueScope(a, b) {
|
|
239
|
+
return a[2] === b[2] && a[3] === b[3] && a[4] === b[4];
|
|
240
|
+
}
|
|
@@ -7153,7 +7153,11 @@ export type Database = {
|
|
|
7153
7153
|
quantity: number | null;
|
|
7154
7154
|
sales_order_id: string | null;
|
|
7155
7155
|
sequence_number: number;
|
|
7156
|
+
should_be_printed: boolean | null;
|
|
7156
7157
|
status: string | null;
|
|
7158
|
+
sticker_height_mm: number | null;
|
|
7159
|
+
sticker_type: string | null;
|
|
7160
|
+
sticker_width_mm: number | null;
|
|
7157
7161
|
trade_item_id: string | null;
|
|
7158
7162
|
updated_at: string;
|
|
7159
7163
|
};
|
|
@@ -7168,7 +7172,11 @@ export type Database = {
|
|
|
7168
7172
|
quantity?: number | null;
|
|
7169
7173
|
sales_order_id?: string | null;
|
|
7170
7174
|
sequence_number?: number;
|
|
7175
|
+
should_be_printed?: boolean | null;
|
|
7171
7176
|
status?: string | null;
|
|
7177
|
+
sticker_height_mm?: number | null;
|
|
7178
|
+
sticker_type?: string | null;
|
|
7179
|
+
sticker_width_mm?: number | null;
|
|
7172
7180
|
trade_item_id?: string | null;
|
|
7173
7181
|
updated_at?: string;
|
|
7174
7182
|
};
|
|
@@ -7183,7 +7191,11 @@ export type Database = {
|
|
|
7183
7191
|
quantity?: number | null;
|
|
7184
7192
|
sales_order_id?: string | null;
|
|
7185
7193
|
sequence_number?: number;
|
|
7194
|
+
should_be_printed?: boolean | null;
|
|
7186
7195
|
status?: string | null;
|
|
7196
|
+
sticker_height_mm?: number | null;
|
|
7197
|
+
sticker_type?: string | null;
|
|
7198
|
+
sticker_width_mm?: number | null;
|
|
7187
7199
|
trade_item_id?: string | null;
|
|
7188
7200
|
updated_at?: string;
|
|
7189
7201
|
};
|