@flowselections/scan-module 1.0.57 → 1.0.58

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ScanModulePage.d.ts","sourceRoot":"","sources":["../../src/components/ScanModulePage.tsx"],"names":[],"mappings":"AA4UA,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,+BAiF/E"}
1
+ {"version":3,"file":"ScanModulePage.d.ts","sourceRoot":"","sources":["../../src/components/ScanModulePage.tsx"],"names":[],"mappings":"AAwWA,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,+BA8H/E"}
@@ -6,16 +6,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  // scan_ensure_defaults). Links de lijst, rechts de gekozen scanner met openen
7
7
  // (QR + link), printplek, pincode. Alleen de naam en de pincode zijn te wijzigen.
8
8
  // ============================================================================
9
- import { useCallback, useEffect, useMemo, useState } from "react";
9
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
10
10
  import { useRouter } from "@tanstack/react-router";
11
- import { Button, Card, CardContent, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Label, PageContainer, cn, formatTijd, meldFout, meldSucces, } from "@flowselections/core";
12
- import { AlertTriangle, Check, CheckCircle2, Copy, ExternalLink, KeyRound, Loader2, MoreHorizontal, Printer } from "lucide-react";
11
+ import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Label, PageContainer, cn, formatTijd, meldFout, meldSucces, } from "@flowselections/core";
12
+ import { AlertTriangle, Check, Copy, ExternalLink, KeyRound, Loader2, MoreHorizontal, Pencil, Printer, Search } from "lucide-react";
13
13
  import { supabase } from "../integrations/supabase/client.js";
14
14
  import { useScanners } from "../hooks/useScanners.js";
15
15
  import { scannerType, normaliseerScannerType } from "../lib/scannerTypes.js";
16
16
  import { scannerSoortLabel } from "../lib/labels.js";
17
17
  import { KoppelQr } from "./scanners/KoppelQr.js";
18
18
  import { TableSkeleton } from "./fs-ui/TableSkeleton.js";
19
+ import { LijstDetail, LijstRij, Toetsje } from "./fs-ui/LijstDetail.js";
20
+ import { ShortcutHelp } from "./fs-ui/ShortcutHelp.js";
21
+ import { useSneltoetsen } from "../lib/sneltoetsen.js";
19
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
23
  const db = supabase;
21
24
  /** Pad van de openbare scannerroute zoals de shell (of de module) hem registreert. */
@@ -92,14 +95,18 @@ function PincodeDialoog({ scanner, onClose, onKlaar }) {
92
95
  const [pin, setPin] = useState("");
93
96
  const [bezig, setBezig] = useState(false);
94
97
  const [fout, setFout] = useState(null);
95
- useEffect(() => { setPin(""); setFout(null); }, [scanner]);
96
- const opslaan = async () => {
97
- if (!scanner)
98
- return;
98
+ const [bevestigen, setBevestigen] = useState(false);
99
+ useEffect(() => { setPin(""); setFout(null); setBevestigen(false); }, [scanner]);
100
+ const verder = () => {
99
101
  if (!/^\d{4,12}$/.test(pin)) {
100
102
  setFout("Gebruik minimaal 4 cijfers.");
101
103
  return;
102
104
  }
105
+ setBevestigen(true);
106
+ };
107
+ const opslaan = async () => {
108
+ if (!scanner)
109
+ return;
103
110
  setBezig(true);
104
111
  const { data, error } = await db.rpc("scan_pincode_wijzigen_v1", { p_scanner_id: scanner.id, p_pin: pin });
105
112
  setBezig(false);
@@ -110,8 +117,8 @@ function PincodeDialoog({ scanner, onClose, onKlaar }) {
110
117
  meldSucces("Pincode opgeslagen. Telefoons voeren nu de nieuwe pincode in.");
111
118
  onKlaar();
112
119
  };
113
- return (_jsx(Dialog, { open: !!scanner, onOpenChange: (o) => !o && onClose(), children: _jsxs(DialogContent, { className: "sm:max-w-md", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Pincode wijzigen" }), _jsx(DialogDescription, { children: "Alle telefoons van deze scanner moeten daarna de nieuwe pincode invoeren." })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "scanner-pin", required: true, children: "Nieuwe pincode" }), _jsx(Input, { id: "scanner-pin", type: "password", inputMode: "numeric", autoComplete: "new-password", value: pin, onChange: (e) => { setPin(e.target.value.replace(/\D/g, "").slice(0, 12)); setFout(null); }, onKeyDown: (e) => { if (e.key === "Enter")
114
- void opslaan(); }, className: "font-mono tracking-[0.3em]" }), _jsx("p", { className: cn("text-sm", fout ? "text-destructive" : "text-muted-foreground"), children: fout ?? "Minimaal 4 cijfers." })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onClose, children: "Annuleren" }), _jsxs(Button, { disabled: bezig, onClick: () => void opslaan(), children: [bezig ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, "Pincode opslaan"] })] })] }) }));
120
+ return (_jsx(Dialog, { open: !!scanner, onOpenChange: (o) => !o && onClose(), children: _jsxs(DialogContent, { className: "sm:max-w-md", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Pincode wijzigen" }), _jsx(DialogDescription, { children: bevestigen ? "Na het wijzigen moeten alle telefoons van deze scanner de nieuwe pincode invoeren." : `Nieuwe pincode voor ${scanner?.naam ?? "deze scanner"}.` })] }), bevestigen ? null : (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { htmlFor: "scanner-pin", required: true, children: "Nieuwe pincode" }), _jsx(Input, { id: "scanner-pin", inputMode: "numeric", autoComplete: "off", value: pin, onChange: (e) => { setPin(e.target.value.replace(/\D/g, "").slice(0, 12)); setFout(null); }, onKeyDown: (e) => { if (e.key === "Enter")
121
+ verder(); }, className: "font-mono tracking-[0.3em]" }), _jsx("p", { className: cn("text-sm", fout ? "text-destructive" : "text-muted-foreground"), children: fout ?? "Minimaal 4 cijfers." })] })), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onClose, children: "Annuleren" }), bevestigen ? (_jsxs(Button, { disabled: bezig, onClick: () => void opslaan(), children: [bezig ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : null, "Pincode wijzigen"] })) : (_jsx(Button, { onClick: verder, children: "Verder" }))] })] }) }));
115
122
  }
116
123
  function ScannerDetail({ scanner, basis, pincode, onNaam, onPincode, onSlotOpheffen }) {
117
124
  const pad = usePrintplekkenPad();
@@ -133,17 +140,29 @@ function ScannerDetail({ scanner, basis, pincode, onNaam, onPincode, onSlotOphef
133
140
  meldFout("Kopiëren lukt niet. Selecteer de link en kopieer hem zelf.", error);
134
141
  }
135
142
  };
136
- return (_jsx(Card, { children: _jsxs(CardContent, { className: "space-y-6 p-5", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("span", { className: "grid h-11 w-11 shrink-0 place-items-center rounded-xl bg-primary/10 text-primary", children: _jsx(Icoon, { className: "h-5 w-5", "aria-hidden": true }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h2", { className: "truncate text-lg font-semibold", children: scanner.naam }), _jsx("p", { className: "text-sm text-muted-foreground", children: scannerSoortLabel(scanner.type) })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": `Acties voor ${scanner.naam}`, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuItem, { onSelect: onNaam, children: "Naam wijzigen" }), _jsx(DropdownMenuItem, { onSelect: onPincode, children: "Pincode wijzigen" })] })] })] }), _jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-sm font-semibold", children: "Openen" }), basis.staat === "laden" ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Link wordt opgehaald\u2026" })) : url ? (_jsxs("div", { className: "grid gap-4 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center", children: [_jsx(KoppelQr, { link: url, alt: `QR-code om ${scanner.naam} op een telefoon te openen` }), _jsxs("div", { className: "min-w-0 space-y-2", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "Scan de QR-code met de telefoon, of open of kopieer de link." }), _jsxs("div", { className: "relative", children: [_jsx(Input, { readOnly: true, value: url, onFocus: (e) => e.currentTarget.select(), "aria-label": "Scannerlink", className: "pr-11 text-sm" }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", onClick: () => void kopieer(), "aria-label": gekopieerd ? "Link gekopieerd" : "Link kopiëren", title: gekopieerd ? "Gekopieerd" : "Link kopiëren", className: "absolute right-0.5 top-1/2 h-8 w-8 -translate-y-1/2", children: gekopieerd ? _jsx(Check, { className: "h-4 w-4" }) : _jsx(Copy, { className: "h-4 w-4" }) })] }), _jsx(Button, { asChild: true, className: "w-full", children: _jsxs("a", { href: url, target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), "Scanner openen"] }) })] })] })) : (_jsx("p", { className: "text-sm text-destructive", children: "De link kan nu niet worden gemaakt. Probeer het later opnieuw; blijft het misgaan, neem contact op met de beheerder." }))] }), _jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "text-sm font-semibold", children: "Printen" }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-sm", children: [_jsx(Printer, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }), print.laden ? (_jsx("span", { className: "text-muted-foreground", children: "Laden\u2026" })) : print.fout ? (_jsx("span", { className: "text-warning-soft-foreground", children: "De printplek kan nu niet worden gelezen. Werk de Layout-maker bij of probeer het later opnieuw." })) : print.plek ? (_jsxs("span", { children: [eind ? "Afleverbrief, controlelijst en pakbon printen op: " : "Verzendbrief en restpakbon printen op: ", _jsx("strong", { children: print.plek }), print.probleem ? _jsxs("span", { className: "ml-2 inline-flex items-center gap-1 text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5", "aria-hidden": true }), print.probleem] }) : null] })) : (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5", "aria-hidden": true }), eind ? "Nog geen controleplek gekozen" : "Nog geen printplek gekozen"] })), _jsx(PrintplekkenLink, { pad: pad })] })] }), _jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "text-sm font-semibold", children: "Pincode" }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 text-sm", children: [pincode === undefined ? (_jsx("span", { className: "text-muted-foreground", children: "Laden\u2026" })) : pincode.standaard ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4", "aria-hidden": true }), "Standaardpincode 0000: wijzig hem, anders kan iedereen met de link scannen."] })) : pincode.ingesteld ? (_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(CheckCircle2, { className: "h-4 w-4 text-primary", "aria-hidden": true }), "Pincode ingesteld"] })) : (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-4 w-4", "aria-hidden": true }), "Nog geen pincode: telefoons kunnen deze scanner nog niet openen"] })), _jsxs(Button, { variant: "outline", size: "sm", onClick: onPincode, children: [_jsx(KeyRound, { className: "mr-2 h-4 w-4" }), "Pincode wijzigen"] })] }), pincode?.geblokkeerdTot ? (_jsxs("div", { className: "flex flex-wrap items-center gap-3 text-sm text-warning-soft-foreground", children: [_jsxs("span", { children: ["Te vaak een verkeerde pincode: telefoons wachten tot ", formatTijd(pincode.geblokkeerdTot), "."] }), _jsx(Button, { variant: "outline", size: "sm", onClick: onSlotOpheffen, children: "Slot opheffen" })] })) : null] })] }) }));
143
+ return (_jsxs("div", { children: [_jsxs("header", { className: "flex items-center gap-3 border-b border-border p-4", children: [_jsx("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-muted text-primary", children: _jsx(Icoon, { className: "h-5 w-5", "aria-hidden": true }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-lg font-semibold text-card-foreground", children: scanner.naam }), _jsx("span", { className: "text-xs text-muted-foreground", children: scannerSoortLabel(scanner.type) })] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": `Meer voor ${scanner.naam}`, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onSelect: onNaam, children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Naam wijzigen"] }), _jsxs(DropdownMenuItem, { onSelect: onPincode, children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Pincode wijzigen"] })] })] })] }), _jsxs("div", { className: "space-y-4 p-4", children: [_jsxs("section", { className: "space-y-2", children: [_jsx("h3", { className: "font-semibold text-card-foreground", children: "Openen" }), basis.staat === "laden" ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Link wordt opgehaald\u2026" })) : url ? (_jsxs("div", { className: "grid gap-4 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center", children: [_jsx(KoppelQr, { link: url, alt: `QR-code om ${scanner.naam} op een telefoon te openen` }), _jsxs("div", { className: "min-w-0 space-y-2", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "Scan de QR-code met de telefoon, of open of kopieer de link." }), _jsxs("div", { className: "relative", children: [_jsx(Input, { readOnly: true, value: url, onFocus: (e) => e.currentTarget.select(), "aria-label": "Scannerlink", className: "pr-11 text-sm" }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", onClick: () => void kopieer(), "aria-label": gekopieerd ? "Link gekopieerd" : "Link kopiëren", title: gekopieerd ? "Gekopieerd" : "Link kopiëren", className: "absolute right-0.5 top-1/2 h-8 w-8 -translate-y-1/2", children: gekopieerd ? _jsx(Check, { className: "h-4 w-4" }) : _jsx(Copy, { className: "h-4 w-4" }) })] }), _jsx(Button, { asChild: true, className: "w-full", children: _jsxs("a", { href: url, target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), "Scanner openen"] }) })] })] })) : (_jsx("p", { className: "text-sm text-destructive", children: "De link kan nu niet worden gemaakt. Probeer het later opnieuw; blijft het misgaan, neem contact op met de beheerder." }))] }), _jsxs("section", { className: "space-y-2 border-t border-border pt-4", children: [_jsx("h3", { className: "font-semibold text-card-foreground", children: "Printen" }), _jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-sm", children: [_jsx(Printer, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }), print.laden ? (_jsx("span", { className: "text-muted-foreground", children: "Laden\u2026" })) : print.fout ? (_jsx("span", { className: "text-warning", children: "De printplek kan nu niet worden gelezen. Werk de Layout-maker bij of probeer het later opnieuw." })) : print.plek ? (_jsxs("span", { children: [eind ? "Afleverbrief, controlelijst en pakbon printen op: " : "Verzendbrief en restpakbon printen op: ", _jsx("strong", { children: print.plek }), print.probleem ? _jsxs("span", { className: "ml-2 inline-flex items-center gap-1 text-warning", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5", "aria-hidden": true }), print.probleem] }) : null] })) : (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5", "aria-hidden": true }), eind ? "Nog geen controleplek gekozen" : "Nog geen printplek gekozen"] })), _jsx(PrintplekkenLink, { pad: pad })] })] }), _jsxs("section", { className: "space-y-2 border-t border-border pt-4", children: [_jsx("h3", { className: "font-semibold text-card-foreground", children: "Pincode" }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-sm", children: [_jsx(KeyRound, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true }), pincode === undefined ? (_jsx("span", { className: "text-muted-foreground", children: "Laden\u2026" })) : !pincode.ingesteld ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning", children: [_jsx(AlertTriangle, { className: "h-4 w-4", "aria-hidden": true }), "Nog geen pincode: telefoons kunnen deze scanner nog niet openen"] })) : pincode.pincode ? (_jsxs("span", { children: ["Pincode ", _jsx("span", { className: "font-mono font-semibold tracking-widest", children: pincode.pincode })] })) : (_jsxs("span", { className: "inline-flex items-center gap-1 text-warning", children: [_jsx(AlertTriangle, { className: "h-4 w-4", "aria-hidden": true }), "Onbekend: stel opnieuw in"] })), _jsx(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", onClick: onPincode, "aria-label": "Pincode wijzigen", title: "Pincode wijzigen", children: _jsx(Pencil, { className: "h-4 w-4" }) })] }), pincode?.standaard ? (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md bg-warning/10 p-3 text-sm text-warning", children: [_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(AlertTriangle, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), "Standaardpincode 0000: wijzig hem, anders kan iedereen met de link scannen."] }), _jsx(Button, { variant: "link", className: "h-auto p-0", onClick: onPincode, children: "Pincode wijzigen" })] })) : null, pincode?.geblokkeerdTot ? (_jsxs("div", { className: "flex flex-wrap items-center gap-3 text-sm text-warning", children: [_jsxs("span", { children: ["Te vaak een verkeerde pincode: telefoons wachten tot ", formatTijd(pincode.geblokkeerdTot), "."] }), _jsx(Button, { variant: "outline", size: "sm", onClick: onSlotOpheffen, children: "Slot opheffen" })] })) : null] })] })] }));
144
+ }
145
+ const KOLOMMEN = "grid grid-cols-1 items-center gap-3 @2xl:grid-cols-[minmax(10rem,1.3fr)_minmax(0,1fr)_10rem]";
146
+ function PincodeLabel({ pin }) {
147
+ if (!pin)
148
+ return _jsx("span", { className: "inline-block h-5 w-28 animate-pulse rounded-md bg-muted", "aria-label": "Pincode wordt geladen" });
149
+ const goed = pin.ingesteld && !pin.standaard;
150
+ const tekst = !pin.ingesteld ? "Geen pincode" : pin.standaard ? "Standaardpincode 0000" : "Pincode ingesteld";
151
+ return (_jsxs("span", { className: cn("inline-flex w-fit shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2 py-0.5 text-xs font-medium", goed ? "bg-success/10 text-success" : "bg-warning/10 text-warning"), children: [goed ? _jsx(Check, { className: "h-3 w-3", "aria-hidden": true }) : _jsx(AlertTriangle, { className: "h-3 w-3", "aria-hidden": true }), " ", tekst] }));
137
152
  }
138
- function ScannerRij({ scanner, actief, pin, onKies }) {
153
+ function ScannerRij({ scanner, gekozen, pin, onKies }) {
139
154
  const Icoon = scannerType(scanner.type).icon;
140
155
  const print = usePrintStand(scanner);
141
- const plek = print.laden ? "Printplek laden…" : print.fout ? "Printplek onbekend" : print.plek ? `Printplek: ${print.plek}` : "Nog geen printplek";
142
- return (_jsx("li", { children: _jsxs(Button, { variant: "ghost", onClick: onKies, "aria-current": actief ? "true" : undefined, className: cn("h-auto w-full items-start justify-start gap-3 whitespace-normal px-3 py-2.5 text-left", actief && "bg-muted"), children: [_jsx(Icoon, { className: "mt-0.5 h-4 w-4 shrink-0 text-primary", "aria-hidden": true }), _jsxs("span", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsx("span", { className: "block break-words font-semibold", children: scanner.naam }), _jsx("span", { className: "block text-xs font-normal text-muted-foreground", children: scannerSoortLabel(scanner.type) }), _jsx("span", { className: "block break-words text-xs font-normal text-muted-foreground", children: plek }), pin && !pin.ingesteld ? (_jsxs("span", { className: "flex items-center gap-1 text-xs font-normal text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": true }), "Geen pincode"] })) : pin?.standaard ? (_jsxs("span", { className: "flex items-center gap-1 text-xs font-normal text-warning-soft-foreground", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": true }), "Standaardpincode 0000"] })) : null] })] }) }));
156
+ const plek = print.laden ? "Laden…" : print.fout ? "Onbekend" : print.plek ?? "Nog geen printplek";
157
+ return (_jsx(LijstRij, { rijId: scanner.id, gekozen: gekozen, label: scanner.naam, onKies: onKies, children: _jsxs("div", { className: KOLOMMEN, children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx("span", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-primary", children: _jsx(Icoon, { className: "h-4 w-4", "aria-hidden": true }) }), _jsxs("span", { className: "min-w-0 space-y-1", children: [_jsx("span", { className: "block whitespace-normal font-medium text-card-foreground", children: scanner.naam }), _jsx("span", { className: "block text-xs text-muted-foreground", children: scannerSoortLabel(scanner.type) }), _jsxs("span", { className: "block text-xs text-muted-foreground @2xl:hidden", children: ["Printplek: ", plek] }), _jsx("span", { className: "block @2xl:hidden", children: _jsx(PincodeLabel, { pin: pin }) })] })] }), _jsx("span", { className: "hidden truncate text-sm text-foreground @2xl:block", children: plek }), _jsx("span", { className: "hidden @2xl:block", children: _jsx(PincodeLabel, { pin: pin }) })] }) }));
143
158
  }
144
159
  export function ScanModulePage({ linkBasis } = {}) {
145
160
  const { scanners, laden, wijzigScanner } = useScanners();
146
- const [gekozenId, setGekozenId] = useState(null);
161
+ const [keuze, setKeuze] = useState(null);
162
+ const [detailOpen, setDetailOpen] = useState(false);
163
+ const [zoek, setZoek] = useState("");
164
+ const [hulp, setHulp] = useState(false);
165
+ const zoekRef = useRef(null);
147
166
  const [basis, setBasis] = useState({ staat: "laden" });
148
167
  const [pincodes, setPincodes] = useState(null);
149
168
  const [naamVoor, setNaamVoor] = useState(null);
@@ -152,7 +171,19 @@ export function ScanModulePage({ linkBasis } = {}) {
152
171
  const volgorde = (s) => (normaliseerScannerType(s.type) === "eindcontrole" ? 0 : 1);
153
172
  return [...scanners].sort((a, b) => volgorde(a) - volgorde(b) || a.created_at.localeCompare(b.created_at));
154
173
  }, [scanners]);
155
- const gekozen = lijst.find((s) => s.id === gekozenId) ?? lijst[0] ?? null;
174
+ // Er zijn altijd maar enkele vaste scanners; zoeken over naam en soort in de al geladen lijst.
175
+ const zoekNorm = zoek.trim().toLowerCase();
176
+ const zichtbaar = lijst.filter((s) => !zoekNorm || s.naam.toLowerCase().includes(zoekNorm) || scannerSoortLabel(s.type).toLowerCase().includes(zoekNorm));
177
+ const gekozenId = keuze && zichtbaar.some((s) => s.id === keuze) ? keuze : zichtbaar[0]?.id ?? null;
178
+ const gekozen = lijst.find((s) => s.id === gekozenId) ?? null;
179
+ useSneltoetsen({
180
+ zoek: zoekRef,
181
+ hulp: () => setHulp(true),
182
+ rijen: () => zichtbaar.map((s) => s.id),
183
+ gekozen: () => gekozenId,
184
+ kies: (id) => setKeuze(id),
185
+ open: (id) => { setKeuze(id); setDetailOpen(true); },
186
+ });
156
187
  // In een shell: altijd het eigen adres van de shell. Alleen de losse
157
188
  // module-preview kan bewust een ander adres meegeven (SCAN_PREVIEW_LINK_BASIS).
158
189
  useEffect(() => {
@@ -161,17 +192,22 @@ export function ScanModulePage({ linkBasis } = {}) {
161
192
  setBasis(basisAdres ? { staat: "ok", basis: basisAdres } : { staat: "fout" });
162
193
  }, [linkBasis]);
163
194
  const laadPincodes = useCallback(async () => {
164
- const { data, error } = await db.rpc("scan_pincode_stand_v1");
195
+ const { data, error } = await db.rpc("scan_pincode_stand_v2");
165
196
  if (error) {
166
197
  console.error("[scanners] pincodestand", error);
167
- meldFout("De pincodestand kan nu niet worden gelezen. Probeer het later opnieuw.", error);
198
+ meldFout("De pincodes kunnen nu niet worden gelezen. Probeer het later opnieuw; blijft het misgaan, neem contact op met de beheerder.", error);
168
199
  setPincodes({});
169
200
  return;
170
201
  }
171
202
  const kaart = {};
172
203
  for (const r of Array.isArray(data) ? data : []) {
173
204
  if (r?.scannerId)
174
- kaart[r.scannerId] = { ingesteld: r.ingesteld === true, standaard: r.standaard === true, geblokkeerdTot: r.geblokkeerdTot ?? null };
205
+ kaart[r.scannerId] = {
206
+ ingesteld: r.ingesteld === true,
207
+ standaard: r.standaard === true,
208
+ pincode: typeof r.pincode === "string" && r.pincode ? r.pincode : null,
209
+ geblokkeerdTot: r.geblokkeerdTot ?? null,
210
+ };
175
211
  }
176
212
  setPincodes(kaart);
177
213
  }, []);
@@ -185,6 +221,14 @@ export function ScanModulePage({ linkBasis } = {}) {
185
221
  meldSucces("Slot opgeheven");
186
222
  await laadPincodes();
187
223
  };
188
- return (_jsxs(PageContainer, { children: [_jsxs("div", { className: "grid grid-cols-1 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_26rem] xl:grid-cols-[minmax(0,1fr)_28rem]", children: [_jsx(Card, { className: "h-fit", children: _jsx(CardContent, { className: "p-2", children: laden ? (_jsx(TableSkeleton, { widths: [280], rows: 2 })) : lijst.length === 0 ? (_jsx("p", { className: "p-3 text-sm text-muted-foreground", children: "Er zijn nog geen scanners. Vraag je beheerder de installatie van Scan te controleren." })) : (_jsx("ul", { className: "grid gap-1", children: lijst.map((s) => (_jsx(ScannerRij, { scanner: s, actief: gekozen?.id === s.id, pin: pincodes?.[s.id], onKies: () => setGekozenId(s.id) }, s.id))) })) }) }), gekozen ? (_jsx(ScannerDetail, { scanner: gekozen, basis: basis, pincode: pincodes ? (pincodes[gekozen.id] ?? { ingesteld: false, standaard: false, geblokkeerdTot: null }) : undefined, onNaam: () => setNaamVoor(gekozen), onPincode: () => setPinVoor(gekozen), onSlotOpheffen: () => void slotOpheffen(gekozen) })) : null] }), _jsx(NaamDialoog, { scanner: naamVoor, onClose: () => setNaamVoor(null), onOpslaan: async (naam) => { if (naamVoor && await wijzigScanner(naamVoor.id, { naam }))
224
+ const lijstBlok = (_jsxs("div", { className: "@container", children: [_jsxs("div", { className: "hidden gap-3 px-4 py-3 pr-11 text-sm font-semibold text-card-foreground @2xl:grid @2xl:grid-cols-[minmax(10rem,1.3fr)_minmax(0,1fr)_10rem]", children: [_jsx("span", { children: "Scanner" }), _jsx("span", { children: "Printplek" }), _jsx("span", { children: "Pincode" })] }), laden ? (_jsx("div", { className: "border-t border-border", children: _jsx(TableSkeleton, { widths: [280], rows: 2 }) })) : (zichtbaar.map((s) => (_jsx(ScannerRij, { scanner: s, gekozen: s.id === gekozenId, pin: pincodes?.[s.id], onKies: () => { setKeuze(s.id); setDetailOpen(true); } }, s.id)))), !laden && zichtbaar.length === 0 ? (_jsx("p", { className: "border-t border-border px-4 py-6 text-sm text-muted-foreground", children: lijst.length === 0 ? "Er zijn nog geen scanners. Vraag je beheerder de installatie van Scan te controleren." : "Niets gevonden." })) : null] }));
225
+ const detail = gekozen ? (_jsx(ScannerDetail, { scanner: gekozen, basis: basis, pincode: pincodes ? (pincodes[gekozen.id] ?? { ingesteld: false, standaard: false, pincode: null, geblokkeerdTot: null }) : undefined, onNaam: () => setNaamVoor(gekozen), onPincode: () => setPinVoor(gekozen), onSlotOpheffen: () => void slotOpheffen(gekozen) })) : (_jsx("p", { className: "p-4 text-sm text-muted-foreground", children: "Kies een scanner." }));
226
+ return (_jsxs(PageContainer, { children: [_jsx("div", { className: "mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3", children: _jsx("h1", { className: "truncate text-2xl font-semibold text-foreground", children: "Scanners" }) }), _jsxs("div", { className: "relative mb-4 w-full sm:max-w-sm", children: [_jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": true }), _jsx(Input, { ref: zoekRef, value: zoek, onChange: (e) => setZoek(e.target.value), placeholder: "Zoek scanner\u2026", className: "pl-9 pr-9", "aria-label": "Zoek scanner" }), _jsx("span", { className: "pointer-events-none absolute right-3 top-1/2 -translate-y-1/2", children: _jsx(Toetsje, { children: "/" }) })] }), _jsx(LijstDetail, { lijst: lijstBlok, detail: detail, detailOpen: detailOpen, onTerug: () => setDetailOpen(false), terugTekst: "Scanners" }), _jsx(ShortcutHelp, { open: hulp, onOpenChange: setHulp, shortcuts: [
227
+ [["/"], "Zoeken"],
228
+ [["J", "K"], "Volgende / vorige scanner"],
229
+ [["Enter"], "Gekozen scanner openen"],
230
+ [["Esc"], "Zoeken verlaten / sluiten"],
231
+ [["?"], "Dit overzicht"],
232
+ ] }), _jsx(NaamDialoog, { scanner: naamVoor, onClose: () => setNaamVoor(null), onOpslaan: async (naam) => { if (naamVoor && await wijzigScanner(naamVoor.id, { naam }))
189
233
  setNaamVoor(null); } }), _jsx(PincodeDialoog, { scanner: pinVoor, onClose: () => setPinVoor(null), onKlaar: () => { setPinVoor(null); void laadPincodes(); } })] }));
190
234
  }
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from "react";
2
+ /** Lijst links, gekozen item rechts; zelfde maten als Printen › Printplekken (Layout-maker). */
3
+ export declare function LijstDetail({ lijst, detail, detailOpen, onTerug, terugTekst }: {
4
+ lijst: ReactNode;
5
+ detail: ReactNode;
6
+ detailOpen: boolean;
7
+ onTerug: () => void;
8
+ terugTekst: string;
9
+ }): import("react").JSX.Element;
10
+ /** Eén rij: lichtgroen als gekozen, pijltje rechts. */
11
+ export declare function LijstRij({ gekozen, onKies, children, label, rijId }: {
12
+ gekozen: boolean;
13
+ onKies: () => void;
14
+ children: ReactNode;
15
+ label: string;
16
+ rijId: string;
17
+ }): import("react").JSX.Element;
18
+ /** Klein toetsje achter een zoekveld; verborgen op mobiel. */
19
+ export declare function Toetsje({ children }: {
20
+ children: ReactNode;
21
+ }): import("react").JSX.Element;
22
+ //# sourceMappingURL=LijstDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LijstDetail.d.ts","sourceRoot":"","sources":["../../../src/components/fs-ui/LijstDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE;IAC9E,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CACnG,+BAYA;AAED,uDAAuD;AACvD,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACpE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;CACzF,+BAWA;AAED,8DAA8D;AAC9D,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE5D"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeft, ChevronRight } from "lucide-react";
3
+ import { Button, cn } from "@flowselections/core";
4
+ /** Lijst links, gekozen item rechts; zelfde maten als Printen › Printplekken (Layout-maker). */
5
+ export function LijstDetail({ lijst, detail, detailOpen, onTerug, terugTekst }) {
6
+ return (_jsxs("div", { className: "grid grid-cols-1 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_26rem] xl:grid-cols-[minmax(0,1fr)_28rem]", children: [_jsx("div", { className: cn("min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-sm", detailOpen && "hidden lg:block"), children: lijst }), _jsxs("div", { className: cn("min-w-0 lg:w-[26rem] xl:w-[28rem]", !detailOpen && "hidden lg:block"), children: [_jsxs(Button, { variant: "ghost", size: "sm", className: "mb-2 lg:hidden", onClick: onTerug, children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " ", terugTekst] }), _jsx("div", { className: "overflow-hidden rounded-lg border border-border bg-card shadow-sm", children: detail })] })] }));
7
+ }
8
+ /** Eén rij: lichtgroen als gekozen, pijltje rechts. */
9
+ export function LijstRij({ gekozen, onKies, children, label, rijId }) {
10
+ return (_jsxs("div", { role: "button", tabIndex: 0, "aria-label": label, "data-rij-id": rijId, "aria-current": gekozen ? "true" : undefined, onClick: onKies, onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ") {
11
+ e.preventDefault();
12
+ onKies();
13
+ } }, className: cn("flex cursor-pointer items-center gap-3 border-t border-border px-4 py-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", gekozen ? "bg-primary/10" : "hover:bg-accent/40"), children: [_jsx("div", { className: "min-w-0 flex-1", children: children }), _jsx(ChevronRight, { className: "h-4 w-4 shrink-0 text-muted-foreground", "aria-hidden": true })] }));
14
+ }
15
+ /** Klein toetsje achter een zoekveld; verborgen op mobiel. */
16
+ export function Toetsje({ children }) {
17
+ return _jsx("kbd", { "aria-hidden": true, className: "pointer-events-none hidden rounded border border-border px-1.5 font-mono text-[11px] leading-5 text-muted-foreground sm:inline-block", children: children });
18
+ }
@@ -31293,7 +31293,9 @@ export type Database = {
31293
31293
  Row: {
31294
31294
  created_at: string;
31295
31295
  gewijzigd_door: string | null;
31296
+ herkomst: string;
31296
31297
  pincode_hash: string;
31298
+ pincode_leesbaar: string | null;
31297
31299
  scanner_id: string;
31298
31300
  updated_at: string;
31299
31301
  versie: number;
@@ -31301,7 +31303,9 @@ export type Database = {
31301
31303
  Insert: {
31302
31304
  created_at?: string;
31303
31305
  gewijzigd_door?: string | null;
31306
+ herkomst?: string;
31304
31307
  pincode_hash: string;
31308
+ pincode_leesbaar?: string | null;
31305
31309
  scanner_id: string;
31306
31310
  updated_at?: string;
31307
31311
  versie?: number;
@@ -31309,7 +31313,9 @@ export type Database = {
31309
31313
  Update: {
31310
31314
  created_at?: string;
31311
31315
  gewijzigd_door?: string | null;
31316
+ herkomst?: string;
31312
31317
  pincode_hash?: string;
31318
+ pincode_leesbaar?: string | null;
31313
31319
  scanner_id?: string;
31314
31320
  updated_at?: string;
31315
31321
  versie?: number;
@@ -49066,6 +49072,28 @@ export type Database = {
49066
49072
  };
49067
49073
  Returns: number;
49068
49074
  };
49075
+ logistics_geannuleerd_open_kandidaten: {
49076
+ Args: {
49077
+ p_limit?: number;
49078
+ };
49079
+ Returns: {
49080
+ order_id: string;
49081
+ order_number: string;
49082
+ }[];
49083
+ };
49084
+ logistics_geannuleerd_opruimen: {
49085
+ Args: {
49086
+ p_order_id: string;
49087
+ };
49088
+ Returns: Json;
49089
+ };
49090
+ logistics_geannuleerd_opruimen_ronde: {
49091
+ Args: {
49092
+ p_budget_ms?: number;
49093
+ p_max?: number;
49094
+ };
49095
+ Returns: Json;
49096
+ };
49069
49097
  logistics_geplande_taken: {
49070
49098
  Args: never;
49071
49099
  Returns: Json;
@@ -49228,6 +49256,14 @@ export type Database = {
49228
49256
  uitleg: string;
49229
49257
  }[];
49230
49258
  };
49259
+ logistics_install_check_20b: {
49260
+ Args: never;
49261
+ Returns: {
49262
+ ok: boolean;
49263
+ onderdeel: string;
49264
+ toelichting: string;
49265
+ }[];
49266
+ };
49231
49267
  logistics_install_check_210: {
49232
49268
  Args: never;
49233
49269
  Returns: {
@@ -53236,6 +53272,12 @@ export type Database = {
53236
53272
  };
53237
53273
  Returns: number;
53238
53274
  };
53275
+ logistics_veilbrieforders_aanmelden: {
53276
+ Args: {
53277
+ p_max?: number;
53278
+ };
53279
+ Returns: Json;
53280
+ };
53239
53281
  logistics_verkoop_order_link: {
53240
53282
  Args: {
53241
53283
  p_order_id: string;
@@ -57688,6 +57730,10 @@ export type Database = {
57688
57730
  Args: never;
57689
57731
  Returns: Json;
57690
57732
  };
57733
+ scan_pincode_stand_v2: {
57734
+ Args: never;
57735
+ Returns: Json;
57736
+ };
57691
57737
  scan_pincode_wijzigen_v1: {
57692
57738
  Args: {
57693
57739
  p_pin: string;