@flowselections/pick-schermen-kwekers 1.0.82 → 1.0.84

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.
Files changed (48) hide show
  1. package/dist-lib/components/fs-ui/DataTable.js +2 -2
  2. package/dist-lib/components/fs-ui/TableSkeleton.js +1 -1
  3. package/dist-lib/components/pick/DocumentChoiceMelding.d.ts +1 -1
  4. package/dist-lib/components/pick/DocumentChoiceMelding.d.ts.map +1 -1
  5. package/dist-lib/components/settings/ReferentiedataPickdocumentenCard.d.ts.map +1 -1
  6. package/dist-lib/components/settings/ReferentiedataPickdocumentenCard.js +10 -3
  7. package/dist-lib/hooks/useCartStickerStates.d.ts +1 -1
  8. package/dist-lib/hooks/useCartStickerStates.d.ts.map +1 -1
  9. package/dist-lib/hooks/usePickConfig.d.ts +11 -11
  10. package/dist-lib/hooks/usePickConfig.d.ts.map +1 -1
  11. package/dist-lib/hooks/usePickPrintStatus.d.ts +2 -2
  12. package/dist-lib/hooks/usePickQueue.d.ts +3 -3
  13. package/dist-lib/hooks/usePickQueue.d.ts.map +1 -1
  14. package/dist-lib/hooks/usePickReferenceData.d.ts +1 -1
  15. package/dist-lib/hooks/usePickReferenceData.d.ts.map +1 -1
  16. package/dist-lib/integrations/supabase/client.js +1 -1
  17. package/dist-lib/integrations/supabase/client.server.js +1 -1
  18. package/dist-lib/lib/layoutApi.d.ts +23 -0
  19. package/dist-lib/lib/layoutApi.d.ts.map +1 -0
  20. package/dist-lib/lib/layoutApi.js +94 -0
  21. package/dist-lib/lib/layoutMaker/documentProfiles.d.ts +50 -0
  22. package/dist-lib/lib/layoutMaker/documentProfiles.d.ts.map +1 -0
  23. package/dist-lib/lib/layoutMaker/documentProfiles.js +458 -0
  24. package/dist-lib/lib/layoutMaker/documentTypes.d.ts +123 -0
  25. package/dist-lib/lib/layoutMaker/documentTypes.d.ts.map +1 -0
  26. package/dist-lib/lib/layoutMaker/documentTypes.js +74 -0
  27. package/dist-lib/lib/layoutMaker/logoLibrary.d.ts +13 -0
  28. package/dist-lib/lib/layoutMaker/logoLibrary.d.ts.map +1 -0
  29. package/dist-lib/lib/layoutMaker/logoLibrary.js +54 -0
  30. package/dist-lib/lib/layoutMaker/pakbonBuilder.d.ts +196 -0
  31. package/dist-lib/lib/layoutMaker/pakbonBuilder.d.ts.map +1 -0
  32. package/dist-lib/lib/layoutMaker/pakbonBuilder.js +813 -0
  33. package/dist-lib/lib/layoutMaker/pakbonHtml.d.ts +48 -0
  34. package/dist-lib/lib/layoutMaker/pakbonHtml.d.ts.map +1 -0
  35. package/dist-lib/lib/layoutMaker/pakbonHtml.js +703 -0
  36. package/dist-lib/lib/layoutRenderer.d.ts +7 -0
  37. package/dist-lib/lib/layoutRenderer.d.ts.map +1 -0
  38. package/dist-lib/lib/layoutRenderer.js +233 -0
  39. package/dist-lib/lib/layoutTypes.d.ts +84 -0
  40. package/dist-lib/lib/layoutTypes.d.ts.map +1 -0
  41. package/dist-lib/lib/layoutTypes.js +25 -0
  42. package/dist-lib/lib/orderContext.d.ts +50 -0
  43. package/dist-lib/lib/orderContext.d.ts.map +1 -0
  44. package/dist-lib/lib/orderContext.js +162 -0
  45. package/dist-lib/lib/pakbonOrderInput.d.ts +8 -0
  46. package/dist-lib/lib/pakbonOrderInput.d.ts.map +1 -0
  47. package/dist-lib/lib/pakbonOrderInput.js +150 -0
  48. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** Tabel exact als Verkooporders: table-fixed, colgroup in px, min 900 px, kop 40 px/11 px, rij 60 px, selectiestreep 3 px. */
3
3
  export function DataTable({ columns, rows, rowKey, focusedKey, onOpen, label }) {
4
- return (_jsxs("table", { "aria-label": label, className: "w-full min-w-[900px] table-fixed caption-bottom text-sm [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:h-10 [&_thead_th]:bg-card [&_thead_th]:text-[11px] [&_thead_th]:font-semibold [&_thead_th]:uppercase [&_thead_th]:tracking-wide [&_thead_th]:text-muted-foreground", children: [_jsx("colgroup", { children: columns.map((c) => _jsx("col", { style: { width: `${c.width}px` } }, c.key)) }), _jsx("thead", { children: _jsx("tr", { className: "border-b border-border", children: columns.map((c) => _jsx("th", { scope: "col", className: "px-4 text-left align-middle", children: c.header }, c.key)) }) }), _jsx("tbody", { children: rows.map((r) => {
4
+ return (_jsxs("table", { "aria-label": label, className: "w-full min-w-[900px] table-fixed caption-bottom text-sm [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:h-10 [&_thead_th]:bg-card [&_thead_th]:text-[11px] [&_thead_th]:font-semibold [&_thead_th]:uppercase [&_thead_th]:tracking-wide [&_thead_th]:text-muted-foreground", children: [_jsx("colgroup", { children: columns.map((c) => _jsx("col", { style: { width: `${c.width}px` } }, c.key)) }), _jsx("thead", { children: _jsx("tr", { className: "border-b border-border", children: columns.map((c) => _jsx("th", { scope: "col", className: "px-2 text-left align-middle", children: c.header }, c.key)) }) }), _jsx("tbody", { children: rows.map((r) => {
5
5
  const k = rowKey(r);
6
6
  const focused = focusedKey === k;
7
- return (_jsx("tr", { "data-focused": focused ? "true" : undefined, onClick: () => onOpen?.(r), style: { height: 60 }, className: "group cursor-pointer border-b border-border transition-colors last:border-0 hover:bg-muted/50 " + (focused ? "bg-muted/60" : ""), children: columns.map((c, i) => (_jsxs("td", { className: "relative min-w-0 overflow-hidden px-4 py-0 align-middle " + (i === 0 ? "" : ""), children: [i === 0 && focused && _jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 w-[3px] bg-primary" }), c.cell(r)] }, c.key))) }, k));
7
+ return (_jsx("tr", { "data-focused": focused ? "true" : undefined, onClick: () => onOpen?.(r), style: { height: 60 }, className: "group cursor-pointer border-b border-border transition-colors last:border-0 hover:bg-muted/50 " + (focused ? "bg-muted/60" : ""), children: columns.map((c, i) => (_jsxs("td", { className: "relative min-w-0 overflow-hidden px-2 py-0 align-middle " + (i === 0 ? "" : ""), children: [i === 0 && focused && _jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 w-[3px] bg-primary" }), c.cell(r)] }, c.key))) }, k));
8
8
  }) })] }));
9
9
  }
10
10
  /** Cel met hooguit twee regels: 14 px en 12 px grijs, afgekapt met volledige tekst als title. */
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Skeleton } from "@flowselections/core";
3
3
  /** Skeletten in de echte vorm: 40 px kop, 60 px rijen; mobiel kaarten. */
4
4
  export function TableSkeleton({ cols, rows = 6 }) {
5
- return (_jsxs("div", { "aria-busy": "true", "aria-label": "Laden", children: [_jsx("div", { className: "hidden md:block", children: _jsxs("table", { className: "w-full min-w-[900px] table-fixed", children: [_jsx("colgroup", { children: cols.map((w, i) => _jsx("col", { style: { width: `${w}px` } }, i)) }), _jsx("thead", { children: _jsx("tr", { className: "h-10 border-b border-border", children: cols.map((_, i) => _jsx("th", { className: "px-4", children: _jsx(Skeleton, { className: "h-3 w-16" }) }, i)) }) }), _jsx("tbody", { children: Array.from({ length: rows }).map((_, r) => (_jsx("tr", { className: "h-[60px] border-b border-border last:border-0", children: cols.map((_, i) => _jsx("td", { className: "px-4 py-0", children: _jsx(Skeleton, { className: "h-4 w-3/4" }) }, i)) }, r))) })] }) }), _jsx("div", { className: "space-y-2 p-3 md:hidden", children: Array.from({ length: 4 }).map((_, r) => _jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, r)) })] }));
5
+ return (_jsxs("div", { "aria-busy": "true", "aria-label": "Laden", children: [_jsx("div", { className: "hidden md:block", children: _jsxs("table", { className: "w-full min-w-[900px] table-fixed", children: [_jsx("colgroup", { children: cols.map((w, i) => _jsx("col", { style: { width: `${w}px` } }, i)) }), _jsx("thead", { children: _jsx("tr", { className: "h-10 border-b border-border", children: cols.map((_, i) => _jsx("th", { className: "px-2", children: _jsx(Skeleton, { className: "h-3 w-16" }) }, i)) }) }), _jsx("tbody", { children: Array.from({ length: rows }).map((_, r) => (_jsx("tr", { className: "h-[60px] border-b border-border last:border-0", children: cols.map((_, i) => _jsx("td", { className: "px-2 py-0", children: _jsx(Skeleton, { className: "h-4 w-3/4" }) }, i)) }, r))) })] }) }), _jsx("div", { className: "space-y-2 p-3 md:hidden", children: Array.from({ length: 4 }).map((_, r) => _jsx(Skeleton, { className: "h-20 w-full rounded-lg" }, r)) })] }));
6
6
  }
@@ -4,7 +4,7 @@ export declare function useDocumentChoice(params: {
4
4
  payload: unknown;
5
5
  documentType: string;
6
6
  slug: string | null;
7
- }): import("@tanstack/react-query").UseQueryResult<DocumentChoice, Error>;
7
+ }): import("@tanstack/react-query").UseQueryResult<NoInfer<DocumentChoice>, Error>;
8
8
  export declare function DocumentChoiceMelding({ choice, isError }: {
9
9
  choice: DocumentChoice | undefined;
10
10
  isError: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentChoiceMelding.d.ts","sourceRoot":"","sources":["../../../src/components/pick/DocumentChoiceMelding.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,yEAeA;AAED,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,sCAclH"}
1
+ {"version":3,"file":"DocumentChoiceMelding.d.ts","sourceRoot":"","sources":["../../../src/components/pick/DocumentChoiceMelding.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,kFAeA;AAED,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,sCAclH"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReferentiedataPickdocumentenCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/ReferentiedataPickdocumentenCard.tsx"],"names":[],"mappings":"AAwEA,wBAAgB,gCAAgC,gCAyT/C"}
1
+ {"version":3,"file":"ReferentiedataPickdocumentenCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/ReferentiedataPickdocumentenCard.tsx"],"names":[],"mappings":"AA+EA,wBAAgB,gCAAgC,gCAqU/C"}
@@ -4,7 +4,10 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
4
4
  import { Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Input, Label, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, toast, } from "@flowselections/core";
5
5
  import { FileText, Loader2, Plus, RotateCcw } from "lucide-react";
6
6
  import { pickReferenceApi } from "../../lib/pickReferenceApi.js";
7
+ import { PillTabs } from "../fs-ui/PillTabs.js";
7
8
  import { usePickReferenceData, PICK_REFERENCE_QUERY_KEY } from "../../hooks/usePickReferenceData.js";
9
+ /** Tabelopmaak volgens Verkooporders: kop 40 px/11 px hoofdletters, rij 60 px, cellen 8 px links. */
10
+ const REF_TABLE = "w-full min-w-[900px] text-sm [&_thead_th]:h-10 [&_thead_th]:bg-card [&_thead_th]:px-2 [&_thead_th]:text-[11px] [&_thead_th]:font-semibold [&_thead_th]:uppercase [&_thead_th]:tracking-wide [&_thead_th]:text-muted-foreground [&_tbody_tr]:h-[60px] [&_tbody_td]:px-2 [&_tbody_td]:py-0 [&_tbody_td]:align-middle";
8
11
  function NumberCell({ value, onSave, }) {
9
12
  const [local, setLocal] = useState(String(value ?? 0));
10
13
  return (_jsx(Input, { className: "h-8 w-20", inputMode: "numeric", value: local, onChange: (e) => setLocal(e.target.value), onBlur: () => {
@@ -29,6 +32,7 @@ export function ReferentiedataPickdocumentenCard() {
29
32
  const { data, isLoading } = usePickReferenceData();
30
33
  const queryClient = useQueryClient();
31
34
  const [nieuw, setNieuw] = useState(null);
35
+ const [tab, setTab] = useState("types");
32
36
  const types = Array.isArray(data?.types) ? data.types : [];
33
37
  const statussen = Array.isArray(data?.statussen) ? data.statussen : [];
34
38
  const verplichteTypes = Array.isArray(data?.verplichte_types) ? data.verplichte_types : [];
@@ -74,11 +78,14 @@ export function ReferentiedataPickdocumentenCard() {
74
78
  },
75
79
  onError: (e) => toast.error(e instanceof Error ? e.message : "Herstellen mislukt."),
76
80
  });
77
- return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Referentiedata pickdocumenten" })] }), _jsx(CardDescription, { children: "De synchronisatie zoekt hardcoded op deze codes: zonder documenttype 'pakbon' komt er niets in de pickwachtrij. De kolom code is daarom niet te wijzigen." })] }), _jsxs(CardContent, { className: "space-y-8", children: [_jsx("div", { className: "flex flex-wrap gap-2", children: _jsxs(Button, { variant: "outline", onClick: () => seed.mutate(), disabled: seed.isPending, children: [seed.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(RotateCcw, { className: "mr-2 h-4 w-4" })), "Standaardwaarden herstellen"] }) }), isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Laden..."] })) : (_jsxs(_Fragment, { children: [_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("h3", { className: "font-semibold text-foreground", children: ["Documenttypes (", types.length, ")"] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setNieuw({ tabel: "types", code: "", naam: "" }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Type toevoegen"] })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Code" }), _jsx(TableHead, { children: "Naam" }), _jsx(TableHead, { children: "Kleur" }), _jsx(TableHead, { children: "Icoon" }), _jsx(TableHead, { children: "Prioriteit" }), _jsx(TableHead, { children: "Sortering" }), _jsx(TableHead, { children: "Actief" })] }) }), _jsx(TableBody, { children: types.map((t) => {
81
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Referentiedata pickdocumenten" })] }), _jsx(CardDescription, { children: "De synchronisatie zoekt hardcoded op deze codes: zonder documenttype 'pakbon' komt er niets in de pickwachtrij. De kolom code is daarom niet te wijzigen." })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsx("div", { className: "flex flex-wrap gap-2", children: _jsxs(Button, { variant: "outline", onClick: () => seed.mutate(), disabled: seed.isPending, children: [seed.isPending ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(RotateCcw, { className: "mr-2 h-4 w-4" })), "Standaardwaarden herstellen"] }) }), isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Laden..."] })) : (_jsxs(_Fragment, { children: [_jsx(PillTabs, { label: "Referentiedata", value: tab, onChange: setTab, tabs: [
82
+ { id: "types", label: "Documentsoorten", count: types.length },
83
+ { id: "statussen", label: "Statussen", count: statussen.length },
84
+ ] }), tab === "types" && (_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("h3", { className: "font-semibold text-foreground", children: ["Documenttypes (", types.length, ")"] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setNieuw({ tabel: "types", code: "", naam: "" }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Type toevoegen"] })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { className: REF_TABLE, children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Code" }), _jsx(TableHead, { children: "Naam" }), _jsx(TableHead, { children: "Kleur" }), _jsx(TableHead, { children: "Icoon" }), _jsx(TableHead, { children: "Prioriteit" }), _jsx(TableHead, { children: "Sortering" }), _jsx(TableHead, { children: "Actief" })] }) }), _jsx(TableBody, { children: types.map((t) => {
78
85
  const verplicht = verplichteTypes.includes(t.code);
79
86
  return (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-mono text-xs", children: t.code }), _jsx(TableCell, { children: _jsx(TextCell, { value: t.name, className: "w-40", onSave: (name) => saveType.mutate({ id: t.id, patch: { name } }) }) }), _jsx(TableCell, { children: _jsx(TextCell, { value: t.color ?? "", className: "w-28 font-mono text-xs", onSave: (color) => saveType.mutate({ id: t.id, patch: { color } }) }) }), _jsx(TableCell, { children: _jsx(TextCell, { value: t.icon ?? "", className: "w-32", onSave: (icon) => saveType.mutate({ id: t.id, patch: { icon } }) }) }), _jsx(TableCell, { children: _jsx(NumberCell, { value: t.priority, onSave: (priority) => saveType.mutate({ id: t.id, patch: { priority } }) }) }), _jsx(TableCell, { children: _jsx(NumberCell, { value: t.sort_order, onSave: (sort_order) => saveType.mutate({ id: t.id, patch: { sort_order } }) }) }), _jsx(TableCell, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: t.active, disabled: verplicht && t.active, onCheckedChange: (active) => saveType.mutate({ id: t.id, patch: { active } }) }), verplicht && (_jsx("span", { className: "text-xs text-muted-foreground", children: "Verplicht \u2014 kan niet uit" }))] }) })] }, t.id));
80
- }) })] }) })] }), _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("h3", { className: "font-semibold text-foreground", children: ["Documentstatussen (", statussen.length, ")"] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setNieuw({ tabel: "statussen", code: "", naam: "" }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Status toevoegen"] })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Code" }), _jsx(TableHead, { children: "Naam" }), _jsx(TableHead, { children: "Kleur" }), _jsx(TableHead, { children: "Sortering" }), _jsx(TableHead, { children: "Open" }), _jsx(TableHead, { children: "Eindstatus" }), _jsx(TableHead, { children: "Actief" })] }) }), _jsx(TableBody, { children: statussen.map((s) => {
87
+ }) })] }) })] })), tab === "statussen" && (_jsxs("section", { className: "space-y-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsxs("h3", { className: "font-semibold text-foreground", children: ["Documentstatussen (", statussen.length, ")"] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setNieuw({ tabel: "statussen", code: "", naam: "" }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Status toevoegen"] })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs(Table, { className: REF_TABLE, children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: "Code" }), _jsx(TableHead, { children: "Naam" }), _jsx(TableHead, { children: "Kleur" }), _jsx(TableHead, { children: "Sortering" }), _jsx(TableHead, { children: "Open" }), _jsx(TableHead, { children: "Eindstatus" }), _jsx(TableHead, { children: "Actief" })] }) }), _jsx(TableBody, { children: statussen.map((s) => {
81
88
  const verplicht = verplichteStatussen.includes(s.code);
82
89
  return (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-mono text-xs", children: s.code }), _jsx(TableCell, { children: _jsx(TextCell, { value: s.name, className: "w-40", onSave: (name) => saveStatus.mutate({ id: s.id, patch: { name } }) }) }), _jsx(TableCell, { children: _jsx(TextCell, { value: s.color ?? "", className: "w-28 font-mono text-xs", onSave: (color) => saveStatus.mutate({ id: s.id, patch: { color } }) }) }), _jsx(TableCell, { children: _jsx(NumberCell, { value: s.sort_order, onSave: (sort_order) => saveStatus.mutate({ id: s.id, patch: { sort_order } }) }) }), _jsx(TableCell, { children: _jsx(Switch, { checked: s.is_open, onCheckedChange: (is_open) => saveStatus.mutate({ id: s.id, patch: { is_open } }) }) }), _jsx(TableCell, { children: _jsx(Switch, { checked: s.is_terminal, onCheckedChange: (is_terminal) => saveStatus.mutate({ id: s.id, patch: { is_terminal } }) }) }), _jsx(TableCell, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Switch, { checked: s.active, disabled: verplicht && s.active, onCheckedChange: (active) => saveStatus.mutate({ id: s.id, patch: { active } }) }), verplicht && (_jsx("span", { className: "text-xs text-muted-foreground", children: "Verplicht \u2014 kan niet uit" }))] }) })] }, s.id));
83
- }) })] }) })] })] })), nieuw && (_jsxs("div", { className: "space-y-3 rounded-md border p-4", children: [_jsxs("p", { className: "text-sm font-medium text-foreground", children: ["Nieuwe ", nieuw.tabel === "types" ? "documenttype" : "documentstatus"] }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "ref-code", children: "Code" }), _jsx(Input, { id: "ref-code", value: nieuw.code, onChange: (e) => setNieuw({ ...nieuw, code: e.target.value }), placeholder: "bijv. wagenlijst" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "ref-naam", children: "Naam" }), _jsx(Input, { id: "ref-naam", value: nieuw.naam, onChange: (e) => setNieuw({ ...nieuw, naam: e.target.value }) })] })] }), _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => setNieuw(null), children: "Annuleren" }), _jsxs(Button, { disabled: !nieuw.code.trim() || !nieuw.naam.trim() || addRow.isPending, onClick: () => addRow.mutate(nieuw), children: [addRow.isPending && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), " Toevoegen"] })] })] }))] })] }));
90
+ }) })] }) })] }))] })), nieuw && (_jsxs("div", { className: "space-y-3 rounded-md border p-4", children: [_jsxs("p", { className: "text-sm font-medium text-foreground", children: ["Nieuwe ", nieuw.tabel === "types" ? "documenttype" : "documentstatus"] }), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "ref-code", children: "Code" }), _jsx(Input, { id: "ref-code", value: nieuw.code, onChange: (e) => setNieuw({ ...nieuw, code: e.target.value }), placeholder: "bijv. wagenlijst" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "ref-naam", children: "Naam" }), _jsx(Input, { id: "ref-naam", value: nieuw.naam, onChange: (e) => setNieuw({ ...nieuw, naam: e.target.value }) })] })] }), _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", onClick: () => setNieuw(null), children: "Annuleren" }), _jsxs(Button, { disabled: !nieuw.code.trim() || !nieuw.naam.trim() || addRow.isPending, onClick: () => addRow.mutate(nieuw), children: [addRow.isPending && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), " Toevoegen"] })] })] }))] })] }));
84
91
  }
@@ -4,5 +4,5 @@ export declare const STICKER_POLL = 15000;
4
4
  * karren van de order in één aanroep. Vult de cache van de losse onderdelen,
5
5
  * die met een slug zelf niet meer opvragen.
6
6
  */
7
- export declare function useCartStickerStates(cartIds: string[], slug: string | null): import("@tanstack/react-query").UseQueryResult<import("../lib/pickStickerBundle.js").CartStickerBundleItem[], Error>;
7
+ export declare function useCartStickerStates(cartIds: string[], slug: string | null): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../lib/pickStickerBundle.js").CartStickerBundleItem[]>, Error>;
8
8
  //# sourceMappingURL=useCartStickerStates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCartStickerStates.d.ts","sourceRoot":"","sources":["../../src/hooks/useCartStickerStates.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,qHA2B1E"}
1
+ {"version":3,"file":"useCartStickerStates.d.ts","sourceRoot":"","sources":["../../src/hooks/useCartStickerStates.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,8HA2B1E"}
@@ -1,15 +1,15 @@
1
- export declare function usePickCountries(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickCountry[], Error>;
2
- export declare function usePickStatuses(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickStatus[], Error>;
3
- export declare function usePickPrinters(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickPrinter[], Error>;
4
- export declare function usePickDocumentTypes(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickDocumentType[], Error>;
5
- export declare function usePickStationTypes(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickStationType[], Error>;
6
- export declare function usePickTasks(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickTask[], Error>;
7
- export declare function usePickStations(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickStation[], Error>;
1
+ export declare function usePickCountries(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickCountry[]>, Error>;
2
+ export declare function usePickStatuses(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickStatus[]>, Error>;
3
+ export declare function usePickPrinters(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickPrinter[]>, Error>;
4
+ export declare function usePickDocumentTypes(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickDocumentType[]>, Error>;
5
+ export declare function usePickStationTypes(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickStationType[]>, Error>;
6
+ export declare function usePickTasks(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickTask[]>, Error>;
7
+ export declare function usePickStations(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickStation[]>, Error>;
8
8
  /** Actieve printplekken uit de Layout maker. */
9
- export declare function usePickPrintPlekken(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickPrintPlek[], Error>;
9
+ export declare function usePickPrintPlekken(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickPrintPlek[]>, Error>;
10
10
  /** Koppelingen pickstation → printplek (beheerpagina). */
11
- export declare function useStationPrintPlekken(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickStationPrintPlekRow[], Error>;
11
+ export declare function useStationPrintPlekken(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickStationPrintPlekRow[]>, Error>;
12
12
  /** De printplek van één pickstation (ook in openbare pickschermen). */
13
- export declare function useStationPrintPlek(stationId?: string): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickStationPrintPlek | null, Error>;
14
- export declare function usePickScreens(stationId?: string): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickScreen[], Error>;
13
+ export declare function useStationPrintPlek(stationId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickStationPrintPlek | null>, Error>;
14
+ export declare function usePickScreens(stationId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickScreen[]>, Error>;
15
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,sFAE/B;AACD,wBAAgB,eAAe,qFAE9B;AACD,wBAAgB,eAAe,sFAE9B;AACD,wBAAgB,oBAAoB,2FAEnC;AACD,wBAAgB,mBAAmB,0FAElC;AACD,wBAAgB,YAAY,mFAE3B;AACD,wBAAgB,eAAe,sFAE9B;AACD,gDAAgD;AAChD,wBAAgB,mBAAmB,wFAElC;AACD,0DAA0D;AAC1D,wBAAgB,sBAAsB,kGAKrC;AACD,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,mGAMrD;AAED,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,oFAKhD"}
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"}
@@ -6,9 +6,9 @@ import { type PrintStatusResult } from "../lib/pickPrintStatus.js";
6
6
  */
7
7
  export declare function fetchPrintStatus(ids: string[], slug: string | null): Promise<PrintStatusResult>;
8
8
  export declare function usePickPrintStatus(ids: string[], slug: string | null, enabled?: boolean): {
9
- result: PrintStatusResult | null;
9
+ result: NoInfer<PrintStatusResult> | null;
10
10
  loading: boolean;
11
11
  inPrint: Set<string>;
12
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PrintStatusResult, Error>>;
12
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<PrintStatusResult>, Error>>;
13
13
  };
14
14
  //# sourceMappingURL=usePickPrintStatus.d.ts.map
@@ -50,12 +50,12 @@ export declare function usePickHeartbeat(stationId?: string, screenId?: string |
50
50
  export declare function usePickCountryCounts(args: {
51
51
  stationId?: string;
52
52
  screenId?: string;
53
- }): import("@tanstack/react-query").UseQueryResult<Record<string, number>, Error>;
53
+ }): import("@tanstack/react-query").UseQueryResult<NoInfer<Record<string, number>>, Error>;
54
54
  /** Pickdagen waarop nog orders klaarstaan (vandaag en later). */
55
- export declare function usePickDays(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
55
+ export declare function usePickDays(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<{
56
56
  day: string;
57
57
  orders: number;
58
- }[], Error>;
58
+ }[]>, Error>;
59
59
  /** Zelfde station, scherm en pickdag (positie 2-4 van de wachtrij-sleutel). */
60
60
  export declare function sameQueueScope(a: readonly unknown[], b: readonly unknown[]): boolean;
61
61
  //# 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;AAM9E,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;IACpB,mDAAmD;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,YAS5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;;;;;;;IAuNG,sDAAsD;;;;;;IAMtD,gEAAgE;;IAEhE,4EAA4E;;IAE5E,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"}
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;AAM9E,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;IACpB,mDAAmD;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,EAAE,YAS5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;;;;;;;IAuNG,sDAAsD;;;;;;IAMtD,gEAAgE;;IAEhE,4EAA4E;;IAE5E,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,0FAOnF;AACD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,OAAO,UAAO;;;aAQzC;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAEpF"}
@@ -1,4 +1,4 @@
1
1
  export declare const PICK_REFERENCE_QUERY_KEY: readonly ["pick", "referenceData"];
2
2
  /** Eén bron voor de instellingenkaart en de waarschuwingsbanner. */
3
- export declare function usePickReferenceData(): import("@tanstack/react-query").UseQueryResult<import("../index.js").PickReferenceStatus, Error>;
3
+ export declare function usePickReferenceData(): import("@tanstack/react-query").UseQueryResult<NoInfer<import("../index.js").PickReferenceStatus>, Error>;
4
4
  //# sourceMappingURL=usePickReferenceData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePickReferenceData.d.ts","sourceRoot":"","sources":["../../src/hooks/usePickReferenceData.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,oCAAqC,CAAC;AAE3E,oEAAoE;AACpE,wBAAgB,oBAAoB,4FAKnC"}
1
+ {"version":3,"file":"usePickReferenceData.d.ts","sourceRoot":"","sources":["../../src/hooks/usePickReferenceData.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,oCAAqC,CAAC;AAE3E,oEAAoE;AACpE,wBAAgB,oBAAoB,qGAKnC"}
@@ -1,5 +1,5 @@
1
1
  // Geen project-URL of sleutel in module-code: de client komt van @flowselections/core (env-gebaseerd, dezelfde sessie als de shell).
2
2
  import { supabase as coreSupabase } from "@flowselections/core";
3
3
  // Import the supabase client like this:
4
- // import { supabase } from "./client.js";
4
+ // import { supabase } from "../../integrations/supabase/client.js";
5
5
  export const supabase = coreSupabase;
@@ -20,7 +20,7 @@ function createSupabaseAdminClient() {
20
20
  let _supabaseAdmin;
21
21
  // Server-side Supabase client with service role - bypasses RLS
22
22
  // SECURITY: Only use this for trusted server-side operations, never expose to client code
23
- // Import like: import { supabaseAdmin } from "./client.server.js";
23
+ // Import like: import { supabaseAdmin } from "../../integrations/supabase/client.server.js";
24
24
  export const supabaseAdmin = new Proxy({}, {
25
25
  get(_, prop, receiver) {
26
26
  if (!_supabaseAdmin)
@@ -0,0 +1,23 @@
1
+ import { type LayoutLogoRow, type LayoutRef, type ResolvedLayout } from "./layoutTypes.js";
2
+ /** Vraagt de actieve layout voor een documentsoort op bij de Logistiek Engine. */
3
+ export declare function fetchLayoutRef(documentType: string): Promise<LayoutRef | null>;
4
+ /** Haalt de layoutrij plus elementen, variabelen en logo's op. */
5
+ export declare function fetchLayout(layoutId: string, documentType: string): Promise<ResolvedLayout>;
6
+ /**
7
+ * Bepaalt en laadt de layout voor een documentsoort. Gebruikt bij voorkeur de
8
+ * layoutId die de Engine in de wachtrijregel heeft meegegeven.
9
+ */
10
+ export declare function resolveLayout(args: {
11
+ documentType: string;
12
+ layoutId?: string | null;
13
+ }): Promise<ResolvedLayout>;
14
+ /**
15
+ * Zet de logo-records uit de layout om in de vorm die de layout-module
16
+ * verwacht: een publiek bereikbare `viewUrl` per logo.
17
+ */
18
+ export declare function logosMetViewUrl(logos: Record<string, LayoutLogoRow>): Promise<{
19
+ id: string;
20
+ naam: string;
21
+ viewUrl: string | null;
22
+ }[]>;
23
+ //# sourceMappingURL=layoutApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layoutApi.d.ts","sourceRoot":"","sources":["../../src/lib/layoutApi.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAEvB,kFAAkF;AAClF,wBAAsB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAOpF;AAED,kEAAkE;AAClE,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAmBjG;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,OAAO,CAAC,cAAc,CAAC,CAS1B;AAID;;;GAGG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,CAAC,CAgCjE"}
@@ -0,0 +1,94 @@
1
+ // Leest documentlayouts uit de gedeelde database. De module bepaalt zelf nooit
2
+ // welke layout bij een documentsoort hoort: dat doet logistics_document_layout.
3
+ import { pickDb } from "./pickApi.js";
4
+ import { safeArray } from "./pickTypes.js";
5
+ import { MissingLayoutError, } from "./layoutTypes.js";
6
+ /** Vraagt de actieve layout voor een documentsoort op bij de Logistiek Engine. */
7
+ export async function fetchLayoutRef(documentType) {
8
+ const { data, error } = await pickDb.rpc("logistics_document_layout", {
9
+ _document_code: documentType,
10
+ });
11
+ if (error)
12
+ throw new Error(error.message);
13
+ const ref = data;
14
+ return ref && ref.layoutId ? ref : null;
15
+ }
16
+ /** Haalt de layoutrij plus elementen, variabelen en logo's op. */
17
+ export async function fetchLayout(layoutId, documentType) {
18
+ // Het pickscherm is openbaar. Lees daarom via de beperkte SECURITY DEFINER
19
+ // functie in plaats van rechtstreeks door de RLS van de Layout maker heen.
20
+ const { data, error } = await pickDb.rpc("pick_document_layout_data", {
21
+ _layout_id: layoutId,
22
+ });
23
+ if (error)
24
+ throw new Error(error.message);
25
+ const bundle = data && typeof data === "object" && !Array.isArray(data)
26
+ ? data
27
+ : {};
28
+ const layout = bundle["layout"];
29
+ if (!layout || layout.actief === false)
30
+ throw new MissingLayoutError(documentType);
31
+ const elements = safeArray(bundle["elements"]);
32
+ const variables = safeArray(bundle["variables"]);
33
+ const logos = {};
34
+ for (const logo of safeArray(bundle["logos"]))
35
+ logos[logo.id] = logo;
36
+ return { layout, elements, variables, logos };
37
+ }
38
+ /**
39
+ * Bepaalt en laadt de layout voor een documentsoort. Gebruikt bij voorkeur de
40
+ * layoutId die de Engine in de wachtrijregel heeft meegegeven.
41
+ */
42
+ export async function resolveLayout(args) {
43
+ const documentType = args.documentType || "pakbon";
44
+ let layoutId = args.layoutId ?? null;
45
+ if (!layoutId) {
46
+ const ref = await fetchLayoutRef(documentType);
47
+ if (!ref)
48
+ throw new MissingLayoutError(documentType);
49
+ layoutId = ref.layoutId;
50
+ }
51
+ return fetchLayout(layoutId, documentType);
52
+ }
53
+ const LOGO_BUCKET = "layout-logos";
54
+ /**
55
+ * Zet de logo-records uit de layout om in de vorm die de layout-module
56
+ * verwacht: een publiek bereikbare `viewUrl` per logo.
57
+ */
58
+ export async function logosMetViewUrl(logos) {
59
+ const rijen = Object.values(logos ?? {});
60
+ if (!rijen.length)
61
+ return [];
62
+ const storage = pickDb.storage;
63
+ const paden = rijen.map((l) => l.bestandspad ?? l.bestand_url).filter(Boolean);
64
+ const map = new Map();
65
+ if (storage && paden.length) {
66
+ try {
67
+ const { data } = await storage.from(LOGO_BUCKET).createSignedUrls(paden, 60 * 60);
68
+ for (const r of safeArray(data)) {
69
+ if (r.path && r.signedUrl)
70
+ map.set(r.path, r.signedUrl);
71
+ }
72
+ }
73
+ catch {
74
+ // geen leesrechten op ondertekende URL's: hieronder valt de publieke URL in
75
+ }
76
+ for (const pad of paden) {
77
+ if (map.has(pad))
78
+ continue;
79
+ try {
80
+ const { data } = storage.from(LOGO_BUCKET).getPublicUrl(pad);
81
+ if (data?.publicUrl)
82
+ map.set(pad, data.publicUrl);
83
+ }
84
+ catch {
85
+ // logo blijft leeg
86
+ }
87
+ }
88
+ }
89
+ return rijen.map((l) => {
90
+ const pad = l.bestandspad ?? l.bestand_url ?? "";
91
+ const url = map.get(pad) ?? (/^https?:\/\//.test(pad) ? pad : null);
92
+ return { id: l.id, naam: l.naam, viewUrl: url };
93
+ });
94
+ }
@@ -0,0 +1,50 @@
1
+ import type { PapierFormaatDef } from "./documentTypes.js";
2
+ export type InstellingType = "schakelaar" | "keuze" | "meerkeuze" | "tekst" | "getal" | "kleur";
3
+ export interface InstellingDef {
4
+ key: string;
5
+ label: string;
6
+ type: InstellingType;
7
+ hint?: string;
8
+ /** opties voor keuze / meerkeuze */
9
+ opties?: {
10
+ value: string;
11
+ label: string;
12
+ }[];
13
+ standaard?: unknown;
14
+ }
15
+ export interface InstellingGroep {
16
+ key: string;
17
+ label: string;
18
+ omschrijving?: string;
19
+ instellingen: InstellingDef[];
20
+ }
21
+ export interface DocumentProfiel {
22
+ /** komt overeen met document_layouts.documenttype */
23
+ id: string;
24
+ label: string;
25
+ omschrijving: string;
26
+ /** getoond in stap 1 van de wizard */
27
+ primair?: boolean;
28
+ /** formaten die bij dit documenttype horen */
29
+ formaten: PapierFormaatDef[];
30
+ standaardFormaat: string;
31
+ standaardOrientatie: "portrait" | "landscape";
32
+ /** entiteiten uit het veldregister die relevant zijn */
33
+ entiteiten: string[];
34
+ /** extra aanwijzing voor de AI-layoutimport */
35
+ aiHint: string;
36
+ /** kan per formaat een standaardprinter krijgen */
37
+ printerPerFormaat?: boolean;
38
+ groepen: InstellingGroep[];
39
+ }
40
+ export declare const STICKER_FORMATEN: PapierFormaatDef[];
41
+ export declare const VERZENDLABEL_FORMATEN: PapierFormaatDef[];
42
+ export declare const DOCUMENT_PROFIELEN: DocumentProfiel[];
43
+ export declare function documentProfiel(id: string): DocumentProfiel;
44
+ export declare function primaireProfielen(): DocumentProfiel[];
45
+ export type DocumentConfig = Record<string, Record<string, unknown>>;
46
+ /** Standaardwaarden van een profiel als opslagbaar configuratieobject. */
47
+ export declare function standaardConfig(profiel: DocumentProfiel): DocumentConfig;
48
+ /** Waarde uit de opgeslagen config, met terugval op de profielstandaard. */
49
+ export declare function configWaarde(config: DocumentConfig | null | undefined, groep: InstellingGroep, inst: InstellingDef): unknown;
50
+ //# sourceMappingURL=documentProfiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentProfiles.d.ts","sourceRoot":"","sources":["../../../src/lib/layoutMaker/documentProfiles.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhG,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,aAAa,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,UAAU,GAAG,WAAW,CAAC;IAC9C,wDAAwD;IACxD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAyBD,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAO9C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,EAOnD,CAAC;AA4YF,eAAO,MAAM,kBAAkB,EAAE,eAAe,EAe/C,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,CAK3D;AAED,wBAAgB,iBAAiB,IAAI,eAAe,EAAE,CAErD;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAErE,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAUxE;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EACzC,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,aAAa,GAClB,OAAO,CAIT"}