@flowselections/pick-schermen-kwekers 1.0.11 → 1.0.13
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/PickstationsPage.d.ts.map +1 -1
- package/dist-lib/components/PickstationsPage.js +11 -4
- package/dist-lib/components/pick/PickScherm.d.ts.map +1 -1
- package/dist-lib/components/pick/PickScherm.js +3 -2
- package/dist-lib/hooks/useKoppelingVoorBron.d.ts +12 -0
- package/dist-lib/hooks/useKoppelingVoorBron.d.ts.map +1 -0
- package/dist-lib/hooks/useKoppelingVoorBron.js +48 -0
- package/dist-lib/hooks/usePickConfig.d.ts +6 -0
- package/dist-lib/hooks/usePickConfig.d.ts.map +1 -1
- package/dist-lib/hooks/usePickConfig.js +19 -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/auth-middleware.d.ts +371 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +371 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.js +2 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +371 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/previewAuthStorage.d.ts +6 -0
- package/dist-lib/integrations/supabase/previewAuthStorage.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/previewAuthStorage.js +92 -0
- package/dist-lib/integrations/supabase/types.d.ts +378 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/pickApi.d.ts +9 -1
- package/dist-lib/lib/pickApi.d.ts.map +1 -1
- package/dist-lib/lib/pickApi.js +30 -0
- package/dist-lib/lib/pickTypes.d.ts +15 -0
- package/dist-lib/lib/pickTypes.d.ts.map +1 -1
- package/package.json +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickstationsPage.d.ts","sourceRoot":"","sources":["../../src/components/PickstationsPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PickstationsPage.d.ts","sourceRoot":"","sources":["../../src/components/PickstationsPage.tsx"],"names":[],"mappings":"AA+FA,wBAAgB,gBAAgB,gCAuL/B"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import { Button, Card, CardContent, Dialog, DialogContent, DialogHeader, DialogTitle, Input, Label, Switch, Textarea, toast, } from "@flowselections/core";
|
|
5
|
-
import { Copy, ExternalLink, Loader2, Pencil, Plus, Trash2 } from "lucide-react";
|
|
4
|
+
import { Button, Card, CardContent, Dialog, DialogContent, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, Textarea, toast, } from "@flowselections/core";
|
|
5
|
+
import { AlertTriangle, Copy, ExternalLink, Loader2, Pencil, Plus, Printer, Trash2, Unlink, } from "lucide-react";
|
|
6
6
|
import { pickApi } from "../lib/pickApi";
|
|
7
7
|
import { usePickStations } from "../hooks/usePickConfig";
|
|
8
|
+
import { useKoppelingVoorBron } from "../hooks/useKoppelingVoorBron";
|
|
8
9
|
const emptyDraft = { name: "", description: "", active: true };
|
|
9
10
|
function publicUrl(slug) {
|
|
10
11
|
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
|
11
12
|
return `${origin}/pickstation/${slug ?? ""}`;
|
|
12
13
|
}
|
|
14
|
+
function StationPrintplek({ station }) {
|
|
15
|
+
const { plekken, printplekId, printplekNaam, gekoppeld, laden, koppel, ontkoppel } = useKoppelingVoorBron("pickstation", station.id, station.name);
|
|
16
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `plek-${station.id}`, children: "Printplek" }), _jsxs(Select, { value: printplekId ?? undefined, onValueChange: (id) => void koppel(id), disabled: laden, children: [_jsx(SelectTrigger, { id: `plek-${station.id}`, children: _jsx(SelectValue, { placeholder: "Kies een printplek" }) }), _jsx(SelectContent, { children: plekken.map((p) => (_jsx(SelectItem, { value: p.id, children: p.naam }, p.id))) })] }), gekoppeld ? (_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("p", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [_jsx(Printer, { className: "h-4 w-4 shrink-0" }), _jsx("span", { className: "truncate", children: printplekNaam })] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => void ontkoppel(), children: [_jsx(Unlink, { className: "mr-2 h-4 w-4" }), " Loskoppelen"] })] })) : (_jsxs("p", { className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-2 py-1.5 text-sm text-destructive", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), "Nog geen printplek gekoppeld \u2014 de opdracht blijft in de wachtrij staan."] }))] }));
|
|
17
|
+
}
|
|
13
18
|
export function PickstationsPage() {
|
|
14
19
|
const { data: stations, isLoading } = usePickStations();
|
|
15
20
|
const queryClient = useQueryClient();
|
|
@@ -32,7 +37,9 @@ export function PickstationsPage() {
|
|
|
32
37
|
onError: (e) => toast.error(e instanceof Error ? e.message : "Opslaan mislukt."),
|
|
33
38
|
});
|
|
34
39
|
const remove = useMutation({
|
|
35
|
-
mutationFn: (id) =>
|
|
40
|
+
mutationFn: async (id) => {
|
|
41
|
+
await pickApi.remove("pick_stations", id);
|
|
42
|
+
},
|
|
36
43
|
onSuccess: () => {
|
|
37
44
|
toast.success("Pickstation verwijderd.");
|
|
38
45
|
queryClient.invalidateQueries({ queryKey: ["pick", "stations"] });
|
|
@@ -52,7 +59,7 @@ export function PickstationsPage() {
|
|
|
52
59
|
return (_jsxs("main", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Pickstations" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Beheer je pickstations en hun openbare link. Alle logica komt uit de Logistiek Engine." })] }), _jsxs(Button, { onClick: () => setDraft({ ...emptyDraft }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Nieuw pickstation"] })] }), isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Laden..."] })) : safeStations.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen pickstations." })) : (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-3", children: safeStations.map((station) => (_jsx(Card, { className: "border-2", children: _jsxs(CardContent, { className: "space-y-4 p-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: station.name }), _jsx("p", { className: "text-sm text-muted-foreground", children: station.description })] }), _jsx("span", { className: "rounded-full px-2 py-1 text-xs font-medium " +
|
|
53
60
|
(station.active
|
|
54
61
|
? "bg-primary/10 text-primary"
|
|
55
|
-
: "bg-muted text-muted-foreground"), children: station.active ? "Actief" : "Inactief" })] }), _jsx("code", { className: "block truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground", children: publicUrl(station.slug) }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { className: "flex-1", asChild: true, children: _jsxs("a", { href: publicUrl(station.slug), target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " Open pickstation"] }) }), _jsxs(Button, { variant: "outline", onClick: () => copyLink(station), children: [_jsx(Copy, { className: "mr-2 h-4 w-4" }), " Link kopi\u00EBren"] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setDraft({
|
|
62
|
+
: "bg-muted text-muted-foreground"), children: station.active ? "Actief" : "Inactief" })] }), _jsx("code", { className: "block truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground", children: publicUrl(station.slug) }), _jsx(StationPrintplek, { station: station }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { className: "flex-1", asChild: true, children: _jsxs("a", { href: publicUrl(station.slug), target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " Open pickstation"] }) }), _jsxs(Button, { variant: "outline", onClick: () => copyLink(station), children: [_jsx(Copy, { className: "mr-2 h-4 w-4" }), " Link kopi\u00EBren"] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setDraft({
|
|
56
63
|
id: station.id,
|
|
57
64
|
name: station.name,
|
|
58
65
|
description: station.description ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAkBtE,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,+BAgmBpD"}
|
|
@@ -10,7 +10,7 @@ import { getPickTranslator } from "../../lib/pickI18n";
|
|
|
10
10
|
import { friendlyPickError, getPickUiTexts } from "../../lib/pickUiText";
|
|
11
11
|
import { getPrintJobTexts, printJobStatusLabel } from "../../lib/pickPrintJobText";
|
|
12
12
|
import { defaultFilters, usePickHeartbeat, usePickQueue, } from "../../hooks/usePickQueue";
|
|
13
|
-
import { usePickDocumentTypes, usePickStatuses } from "../../hooks/usePickConfig";
|
|
13
|
+
import { usePickDocumentTypes, usePickStatuses, useStationPrintPlek, } from "../../hooks/usePickConfig";
|
|
14
14
|
import { usePrintJob } from "../../hooks/usePrintJob";
|
|
15
15
|
const LANG_STORAGE_KEY = "pick.language";
|
|
16
16
|
/**
|
|
@@ -33,6 +33,7 @@ export function PickScherm({ station, onBack }) {
|
|
|
33
33
|
const { data: statuses } = usePickStatuses();
|
|
34
34
|
const { data: documentTypes } = usePickDocumentTypes();
|
|
35
35
|
const { online } = usePickHeartbeat(station.id, null, sessionId);
|
|
36
|
+
const { data: printPlek, isLoading: plekLoading } = useStationPrintPlek(station.id);
|
|
36
37
|
const { tracked, track, clear: clearJob } = usePrintJob();
|
|
37
38
|
const t = useMemo(() => getPickTranslator(lang ?? "nl"), [lang]);
|
|
38
39
|
const jobTexts = useMemo(() => getPrintJobTexts(t.lang), [t]);
|
|
@@ -295,7 +296,7 @@ export function PickScherm({ station, onBack }) {
|
|
|
295
296
|
const totalPages = Math.max(1, Math.ceil(total / filters.pageSize));
|
|
296
297
|
const jobStatus = tracked?.job?.status ?? null;
|
|
297
298
|
const jobFailed = jobStatus === "mislukt" || jobStatus === "geannuleerd";
|
|
298
|
-
return (_jsxs("div", { className: "space-y-4 pb-24 md:pb-0", children: [_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")] })] })] }), _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, { size: "lg", className: "hidden h-14 px-8 text-lg md:inline-flex", onClick: () => (pending ? confirmPending() : fetchNext()), disabled: busyId !== null, children: [busyId !== null ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), t("printNext"), pending?.document_number ? ` · ${pending.document_number}` : ""] })] })] }), !pending && emptyNotice && (_jsx("p", { className: "text-sm text-muted-foreground", children: emptyNotice })), pending && (_jsx(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, children: t("cancel") }), _jsxs(Button, { size: "lg", className: "h-14 w-full px-8 text-lg sm:w-auto", onClick: confirmPending, disabled: busyId !== null, children: [busyId === "confirm" ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), t("print")] })] })] }) })), tracked && (_jsx(Card, { className: jobFailed ? "border-2 border-destructive" : "border-2 border-primary/40", children: _jsxs(CardContent, { className: "flex flex-col gap-4 p-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [jobFailed ? (_jsx(AlertTriangle, { className: "h-6 w-6 shrink-0 text-destructive" })) : jobStatus === "voltooid" ? (_jsx(CheckCircle2, { className: "h-6 w-6 shrink-0 text-primary" })) : (_jsx(Loader2, { className: "h-6 w-6 shrink-0 animate-spin text-muted-foreground" })), _jsxs("div", { className: "min-w-0", children: [_jsxs("p", { className: "truncate text-sm font-medium text-muted-foreground", children: [jobTexts.jobTitle, " ", tracked.documentNumber ? `· ${tracked.documentNumber}` : ""] }), _jsx("p", { className: "text-lg font-semibold text-foreground", children: printJobStatusLabel(jobStatus, t.lang) }), tracked.job?.printer_naam && (_jsxs("p", { className: "truncate text-sm text-muted-foreground", children: [jobTexts.printerLabel, ": ", tracked.job.printer_naam] })), jobFailed && (_jsxs("p", { className: "text-sm text-destructive", children: [tracked.job?.foutmelding ?? jobTexts.unknown, " \u00B7 ", jobTexts.requeued] }))] })] }), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [jobFailed && lastPrinted && (_jsxs(Button, { size: "lg", className: "h-12 w-full sm:w-auto", onClick: () => {
|
|
299
|
+
return (_jsxs("div", { className: "space-y-4 pb-24 md:pb-0", children: [_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")] })] })] }), _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, { size: "lg", className: "hidden h-14 px-8 text-lg md:inline-flex", onClick: () => (pending ? confirmPending() : fetchNext()), disabled: busyId !== null, children: [busyId !== null ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), t("printNext"), pending?.document_number ? ` · ${pending.document_number}` : ""] })] })] }), !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." })] })), !pending && emptyNotice && (_jsx("p", { className: "text-sm text-muted-foreground", children: emptyNotice })), pending && (_jsx(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, children: t("cancel") }), _jsxs(Button, { size: "lg", className: "h-14 w-full px-8 text-lg sm:w-auto", onClick: confirmPending, disabled: busyId !== null, children: [busyId === "confirm" ? (_jsx(Loader2, { className: "mr-2 h-5 w-5 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-5 w-5" })), t("print")] })] })] }) })), tracked && (_jsx(Card, { className: jobFailed ? "border-2 border-destructive" : "border-2 border-primary/40", children: _jsxs(CardContent, { className: "flex flex-col gap-4 p-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [jobFailed ? (_jsx(AlertTriangle, { className: "h-6 w-6 shrink-0 text-destructive" })) : jobStatus === "voltooid" ? (_jsx(CheckCircle2, { className: "h-6 w-6 shrink-0 text-primary" })) : (_jsx(Loader2, { className: "h-6 w-6 shrink-0 animate-spin text-muted-foreground" })), _jsxs("div", { className: "min-w-0", children: [_jsxs("p", { className: "truncate text-sm font-medium text-muted-foreground", children: [jobTexts.jobTitle, " ", tracked.documentNumber ? `· ${tracked.documentNumber}` : ""] }), _jsx("p", { className: "text-lg font-semibold text-foreground", children: printJobStatusLabel(jobStatus, t.lang) }), tracked.job?.printer_naam && (_jsxs("p", { className: "truncate text-sm text-muted-foreground", children: [jobTexts.printerLabel, ": ", tracked.job.printer_naam] })), jobFailed && (_jsxs("p", { className: "text-sm text-destructive", children: [tracked.job?.foutmelding ?? jobTexts.unknown, " \u00B7 ", jobTexts.requeued] }))] })] }), _jsxs("div", { className: "flex flex-col gap-2 sm:flex-row", children: [jobFailed && lastPrinted && (_jsxs(Button, { size: "lg", className: "h-12 w-full sm:w-auto", onClick: () => {
|
|
299
300
|
clearJob();
|
|
300
301
|
void handlePick(lastPrinted);
|
|
301
302
|
}, disabled: busyId !== null, children: [_jsx(Printer, { className: "mr-2 h-5 w-5" }), " ", jobTexts.retry] })), _jsx(Button, { variant: "outline", size: "lg", className: "h-12 w-full sm:w-auto", onClick: clearJob, children: jobTexts.close })] })] }) })), _jsx(Card, { 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("div", { className: "relative w-full min-w-0 sm:w-56", 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: ui.scanPlaceholder, value: scanInput, onChange: (e) => setScanInput(e.target.value), onKeyDown: (e) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Printplek } from "@flowselections/layout-maker";
|
|
2
|
+
export interface KoppelingVoorBron {
|
|
3
|
+
plekken: Printplek[];
|
|
4
|
+
printplekId: string | null;
|
|
5
|
+
printplekNaam: string | null;
|
|
6
|
+
gekoppeld: boolean;
|
|
7
|
+
laden: boolean;
|
|
8
|
+
koppel: (printPlekId: string) => Promise<void>;
|
|
9
|
+
ontkoppel: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function useKoppelingVoorBron(bron: string, bronId: string, label?: string): KoppelingVoorBron;
|
|
12
|
+
//# sourceMappingURL=useKoppelingVoorBron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKoppelingVoorBron.d.ts","sourceRoot":"","sources":["../../src/hooks/useKoppelingVoorBron.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,iBAAiB,CAmDnB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Koppeling bron → printplek, volledig via @flowselections/layout-maker.
|
|
2
|
+
// Niets hardcoded: plekken, koppelingen en namen komen uit de Layout maker.
|
|
3
|
+
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { koppelBronAanPrintplek, ontkoppelBron, printplekVoorBron, useBeschikbarePrintplekken, } from "@flowselections/layout-maker";
|
|
5
|
+
export function useKoppelingVoorBron(bron, bronId, label) {
|
|
6
|
+
const { plekken, laden: plekkenLaden } = useBeschikbarePrintplekken();
|
|
7
|
+
const safePlekken = Array.isArray(plekken) ? plekken : [];
|
|
8
|
+
const [printplekId, setPrintplekId] = useState(null);
|
|
9
|
+
const [laden, setLaden] = useState(true);
|
|
10
|
+
const herlaad = useCallback(async () => {
|
|
11
|
+
if (!bronId) {
|
|
12
|
+
setPrintplekId(null);
|
|
13
|
+
setLaden(false);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
setLaden(true);
|
|
17
|
+
try {
|
|
18
|
+
setPrintplekId(await printplekVoorBron(bron, bronId));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
setPrintplekId(null);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
setLaden(false);
|
|
25
|
+
}
|
|
26
|
+
}, [bron, bronId]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
void herlaad();
|
|
29
|
+
}, [herlaad]);
|
|
30
|
+
const koppel = useCallback(async (nieuwId) => {
|
|
31
|
+
await koppelBronAanPrintplek(nieuwId, bron, bronId, label);
|
|
32
|
+
await herlaad();
|
|
33
|
+
}, [bron, bronId, label, herlaad]);
|
|
34
|
+
const ontkoppel = useCallback(async () => {
|
|
35
|
+
await ontkoppelBron(bron, bronId);
|
|
36
|
+
await herlaad();
|
|
37
|
+
}, [bron, bronId, herlaad]);
|
|
38
|
+
const printplekNaam = safePlekken.find((p) => p.id === printplekId)?.naam ?? null;
|
|
39
|
+
return {
|
|
40
|
+
plekken: safePlekken,
|
|
41
|
+
printplekId,
|
|
42
|
+
printplekNaam,
|
|
43
|
+
gekoppeld: Boolean(printplekId),
|
|
44
|
+
laden: laden || plekkenLaden,
|
|
45
|
+
koppel,
|
|
46
|
+
ontkoppel,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -5,5 +5,11 @@ export declare function usePickDocumentTypes(): import("@tanstack/react-query").
|
|
|
5
5
|
export declare function usePickStationTypes(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickStationType[]>, Error>;
|
|
6
6
|
export declare function usePickTasks(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickTask[]>, Error>;
|
|
7
7
|
export declare function usePickStations(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickStation[]>, Error>;
|
|
8
|
+
/** Actieve printplekken uit de Layout maker. */
|
|
9
|
+
export declare function usePickPrintPlekken(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickPrintPlek[]>, Error>;
|
|
10
|
+
/** Koppelingen pickstation → printplek (beheerpagina). */
|
|
11
|
+
export declare function useStationPrintPlekken(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickStationPrintPlekRow[]>, Error>;
|
|
12
|
+
/** De printplek van één pickstation (ook in openbare pickschermen). */
|
|
13
|
+
export declare function useStationPrintPlek(stationId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickStationPrintPlek | null>, Error>;
|
|
8
14
|
export declare function usePickScreens(stationId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<import("..").PickScreen[]>, Error>;
|
|
9
15
|
//# sourceMappingURL=usePickConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePickConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/usePickConfig.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,+FAE/B;AACD,wBAAgB,eAAe,8FAE9B;AACD,wBAAgB,eAAe,+FAE9B;AACD,wBAAgB,oBAAoB,oGAEnC;AACD,wBAAgB,mBAAmB,mGAElC;AACD,wBAAgB,YAAY,4FAE3B;AACD,wBAAgB,eAAe,+FAE9B;AACD,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,6FAKhD"}
|
|
1
|
+
{"version":3,"file":"usePickConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/usePickConfig.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,+FAE/B;AACD,wBAAgB,eAAe,8FAE9B;AACD,wBAAgB,eAAe,+FAE9B;AACD,wBAAgB,oBAAoB,oGAEnC;AACD,wBAAgB,mBAAmB,mGAElC;AACD,wBAAgB,YAAY,4FAE3B;AACD,wBAAgB,eAAe,+FAE9B;AACD,gDAAgD;AAChD,wBAAgB,mBAAmB,iGAElC;AACD,0DAA0D;AAC1D,wBAAgB,sBAAsB,2GAKrC;AACD,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,4GAMrD;AAED,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,6FAKhD"}
|
|
@@ -21,6 +21,25 @@ export function usePickTasks() {
|
|
|
21
21
|
export function usePickStations() {
|
|
22
22
|
return useQuery({ queryKey: ["pick", "stations"], queryFn: pickApi.stations });
|
|
23
23
|
}
|
|
24
|
+
/** Actieve printplekken uit de Layout maker. */
|
|
25
|
+
export function usePickPrintPlekken() {
|
|
26
|
+
return useQuery({ queryKey: ["pick", "printPlekken"], queryFn: pickApi.printPlekken });
|
|
27
|
+
}
|
|
28
|
+
/** Koppelingen pickstation → printplek (beheerpagina). */
|
|
29
|
+
export function useStationPrintPlekken() {
|
|
30
|
+
return useQuery({
|
|
31
|
+
queryKey: ["pick", "stationPrintPlekken"],
|
|
32
|
+
queryFn: pickApi.stationPrintPlekken,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** De printplek van één pickstation (ook in openbare pickschermen). */
|
|
36
|
+
export function useStationPrintPlek(stationId) {
|
|
37
|
+
return useQuery({
|
|
38
|
+
queryKey: ["pick", "stationPrintPlek", stationId ?? "none"],
|
|
39
|
+
queryFn: () => (stationId ? pickApi.stationPrintPlek(stationId) : null),
|
|
40
|
+
enabled: Boolean(stationId),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
24
43
|
export function usePickScreens(stationId) {
|
|
25
44
|
return useQuery({
|
|
26
45
|
queryKey: ["pick", "screens", stationId ?? "all"],
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './lib/pickApi';
|
|
|
7
7
|
export * from './lib/logisticsTypes';
|
|
8
8
|
export * from './lib/logisticsApi';
|
|
9
9
|
export * from './hooks/usePickConfig';
|
|
10
|
+
export * from './hooks/useKoppelingVoorBron';
|
|
10
11
|
export * from './hooks/usePickQueue';
|
|
11
12
|
export { LanguageTiles } from './components/pick/LanguageTiles';
|
|
12
13
|
export * from './lib/pickI18n';
|
package/dist-lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAOpE,eAAO,MAAM,kBAAkB,EAAE,UAYhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAOpE,eAAO,MAAM,kBAAkB,EAAE,UAYhC,CAAC"}
|
package/dist-lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export * from './lib/pickApi';
|
|
|
22
22
|
export * from './lib/logisticsTypes';
|
|
23
23
|
export * from './lib/logisticsApi';
|
|
24
24
|
export * from './hooks/usePickConfig';
|
|
25
|
+
export * from './hooks/useKoppelingVoorBron';
|
|
25
26
|
export * from './hooks/usePickQueue';
|
|
26
27
|
export { LanguageTiles } from './components/pick/LanguageTiles';
|
|
27
28
|
export * from './lib/pickI18n';
|