@flowselections/layout-maker 1.69.62 → 1.69.64
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/AfleverbriefBuilderPage.d.ts.map +1 -1
- package/dist-lib/components/AfleverbriefBuilderPage.js +2 -1
- package/dist-lib/components/BlokOntwerperPage.js +2 -2
- package/dist-lib/components/DocumentSettingsPanel.js +1 -1
- package/dist-lib/components/DocumentenPage.js +1 -1
- package/dist-lib/components/FactuurOntwerpPage.d.ts.map +1 -1
- package/dist-lib/components/FactuurOntwerpPage.js +38 -3
- package/dist-lib/components/PakbonBuilderPage.d.ts.map +1 -1
- package/dist-lib/components/PakbonBuilderPage.js +2 -1
- package/dist-lib/components/PakbonPreview.js +1 -1
- package/dist-lib/components/PakbonSectiesPanel.d.ts +9 -6
- package/dist-lib/components/PakbonSectiesPanel.d.ts.map +1 -1
- package/dist-lib/components/PakbonSectiesPanel.js +95 -53
- package/dist-lib/components/ProductiebonBlokkenPanel.d.ts +4 -3
- package/dist-lib/components/ProductiebonBlokkenPanel.d.ts.map +1 -1
- package/dist-lib/components/ProductiebonBlokkenPanel.js +50 -23
- package/dist-lib/components/ProductiebonBuilderPage.js +1 -1
- package/dist-lib/components/VersieBewerkenPage.d.ts.map +1 -1
- package/dist-lib/components/VersieBewerkenPage.js +29 -17
- package/dist-lib/components/layoutBewerker/NogGeenLogo.d.ts +7 -0
- package/dist-lib/components/layoutBewerker/NogGeenLogo.d.ts.map +1 -0
- package/dist-lib/components/layoutBewerker/NogGeenLogo.js +22 -0
- package/dist-lib/components/layoutBewerker/OnderdelenLijst.d.ts +28 -0
- package/dist-lib/components/layoutBewerker/OnderdelenLijst.d.ts.map +1 -0
- package/dist-lib/components/layoutBewerker/OnderdelenLijst.js +31 -0
- package/dist-lib/integrations/supabase/types.d.ts +1187 -6
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/bewerkerContext.d.ts +21 -0
- package/dist-lib/lib/bewerkerContext.d.ts.map +1 -0
- package/dist-lib/lib/bewerkerContext.js +8 -0
- package/dist-lib/lib/factuurPdf.d.ts.map +1 -1
- package/dist-lib/lib/factuurPdf.js +7 -0
- package/dist-lib/lib/factuurVoorbeeldBedrijf.d.ts +6 -0
- package/dist-lib/lib/factuurVoorbeeldBedrijf.d.ts.map +1 -0
- package/dist-lib/lib/factuurVoorbeeldBedrijf.js +34 -0
- package/dist-lib/lib/htmlPdf.server.d.ts.map +1 -1
- package/dist-lib/lib/htmlPdf.server.js +5 -3
- package/dist-lib/lib/layoutOpslaan.d.ts +1 -0
- package/dist-lib/lib/layoutOpslaan.d.ts.map +1 -1
- package/dist-lib/lib/layoutOpslaan.js +7 -2
- package/dist-lib/lib/layoutStand.d.ts +11 -0
- package/dist-lib/lib/layoutStand.d.ts.map +1 -0
- package/dist-lib/lib/layoutStand.js +17 -0
- package/dist-lib/lib/onderdelenPerSoort.d.ts +9 -0
- package/dist-lib/lib/onderdelenPerSoort.d.ts.map +1 -0
- package/dist-lib/lib/onderdelenPerSoort.js +80 -0
- package/dist-lib/lib/paginaVoet.d.ts +6 -0
- package/dist-lib/lib/paginaVoet.d.ts.map +1 -0
- package/dist-lib/lib/paginaVoet.js +15 -0
- package/dist-lib/lib/pakbonContent.d.ts.map +1 -1
- package/dist-lib/lib/pakbonContent.js +4 -1
- package/dist-lib/lib/pakbonHtml.d.ts +2 -0
- package/dist-lib/lib/pakbonHtml.d.ts.map +1 -1
- package/dist-lib/lib/pakbonHtml.js +28 -11
- package/dist-lib/lib/productiebonBuilder.d.ts +1 -1
- package/dist-lib/lib/productiebonBuilder.d.ts.map +1 -1
- package/dist-lib/lib/productiebonBuilder.js +9 -0
- package/dist-lib/lib/productiebonHtml.d.ts.map +1 -1
- package/dist-lib/lib/productiebonHtml.js +5 -0
- package/dist-lib/lib/terugPad.d.ts +3 -0
- package/dist-lib/lib/terugPad.d.ts.map +1 -0
- package/dist-lib/lib/terugPad.js +10 -0
- package/dist-lib/lib/useDocumentData.d.ts.map +1 -1
- package/dist-lib/lib/useDocumentData.js +2 -0
- package/dist-lib/lib/useMinBreedte.d.ts +2 -0
- package/dist-lib/lib/useMinBreedte.d.ts.map +1 -0
- package/dist-lib/lib/useMinBreedte.js +14 -0
- package/dist-lib/lib/vanzelfOpslaan.d.ts +3 -1
- package/dist-lib/lib/vanzelfOpslaan.d.ts.map +1 -1
- package/dist-lib/lib/vanzelfOpslaan.js +68 -15
- package/dist-lib/lib/versie.generated.d.ts +1 -1
- package/dist-lib/lib/versie.generated.js +1 -1
- package/package.json +1 -1
- package/sql/print-schema.sql +1 -1
- package/sql/print-schema.verslag.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AfleverbriefBuilderPage.d.ts","sourceRoot":"","sources":["../../src/components/AfleverbriefBuilderPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AfleverbriefBuilderPage.d.ts","sourceRoot":"","sources":["../../src/components/AfleverbriefBuilderPage.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG7E;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAe,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAiB,+BA0M7K"}
|
|
@@ -5,6 +5,7 @@ import { Badge, Button, Card, CardContent, CardDescription, CardHeader, CardTitl
|
|
|
5
5
|
import { AlertTriangle, ArrowLeft, CheckCircle2, Loader2, Printer, Save } from "lucide-react";
|
|
6
6
|
import { PakbonSectiesPanel } from "./PakbonSectiesPanel.js";
|
|
7
7
|
import { PrintbestandVoorbeeld } from "./PrintbestandVoorbeeld.js";
|
|
8
|
+
import { NogGeenLogo } from "./layoutBewerker/NogGeenLogo.js";
|
|
8
9
|
import { FormaatOrientatieBar } from "./FormaatOrientatieBar.js";
|
|
9
10
|
import { FustKolomVolgorde } from "./FustKolomVolgorde.js";
|
|
10
11
|
import { AFLEVERBRIEF_SECTIE_TYPES, leesAfleverbriefConfig, } from "../lib/pakbonBuilder.js";
|
|
@@ -116,5 +117,5 @@ export function AfleverbriefBuilderPage({ layoutId: layoutIdProp, ingebed = fals
|
|
|
116
117
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
117
118
|
if (!layout || !config)
|
|
118
119
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
119
|
-
return (_jsxs("main", { className: "space-y-4 p-6", children: [!ingebed && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: _jsxs(Link, { to: "/layouts-printers/documenten", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Layouts"] }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: layout.naam }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Afleverbrief per kar \u00B7 ", config.secties.length, " secties"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LayoutPrinterSelect, { layoutId: layoutId }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void voorbeeldPrinten(), disabled: printen || controle !== "gereed", children: [printen ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-4 w-4" })), "Voorbeeld printen"] }), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { to: "/layouts-printers/blokken/$layoutId", params: { layoutId }, children: "
|
|
120
|
+
return (_jsxs("main", { className: "space-y-4 p-6", children: [!ingebed && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: _jsxs(Link, { to: "/layouts-printers/documenten", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Layouts"] }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: layout.naam }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Afleverbrief per kar \u00B7 ", config.secties.length, " secties"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LayoutPrinterSelect, { layoutId: layoutId }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void voorbeeldPrinten(), disabled: printen || controle !== "gereed", children: [printen ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-4 w-4" })), "Voorbeeld printen"] }), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { to: "/layouts-printers/blokken/$layoutId", params: { layoutId }, children: "Onderdelen ontwerpen" }) }), _jsxs(Button, { size: "sm", onClick: opslaan, disabled: bezig || Boolean(layout.systeem), children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan"] })] })] })), layout.systeem ? _jsx(SysteemLayoutMelding, { layoutId: layout.id, route: "afleverbrief" }) : null, !ingebed && _jsx(FormaatOrientatieBar, { layout: layout, onChange: (patch) => setLayout((l) => (l ? { ...l, ...patch } : l)), vergrendeld: Boolean(layout.systeem) }), _jsxs("div", { className: ingebed ? "grid items-start gap-4 lg:grid-cols-[15rem_minmax(0,1fr)]" : "grid items-start gap-4 lg:grid-cols-[400px_1fr]", children: [_jsxs(Card, { className: ingebed ? "flex flex-col lg:sticky lg:top-4" : "flex h-[calc(100vh-14rem)] min-h-[420px] flex-col overflow-hidden lg:sticky lg:top-4", children: [!ingebed && (_jsxs(CardHeader, { className: "pb-3", children: [_jsx(CardTitle, { className: "text-base", children: "Onderdelen" }), _jsx(CardDescription, { children: "Voeg onderdelen toe, wijzig de volgorde en stel elk onderdeel afzonderlijk in." })] })), _jsx(CardContent, { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx(PakbonSectiesPanel, { config: config, onChange: setConfig, beschikbareTypes: AFLEVERBRIEF_SECTIE_TYPES, documenttype: "afleverbrief", uit: Boolean(layout.systeem), referentie: referentieConfig === undefined ? null : leesAfleverbriefConfig(referentieConfig).secties }) })] }), _jsxs(Card, { className: ingebed ? "flex min-h-[75vh] flex-col border-0 bg-transparent shadow-none" : "flex h-[calc(100vh-14rem)] min-h-[420px] flex-col overflow-hidden", children: [!ingebed && (_jsxs(CardHeader, { className: "flex-row items-center justify-between space-y-0 pb-3", children: [_jsxs("div", { children: [_jsx(CardTitle, { className: "text-base", children: "Live voorbeeld" }), _jsx(CardDescription, { children: "Voorbeeld van de afleverbrief van \u00E9\u00E9n kar." })] }), _jsxs(Badge, { variant: controle === "afwijking" ? "destructive" : "secondary", children: [controle === "controleren" ? _jsx(Loader2, { className: "mr-1 h-3 w-3 animate-spin" }) : controle === "gereed" ? _jsx(CheckCircle2, { className: "mr-1 h-3 w-3" }) : _jsx(AlertTriangle, { className: "mr-1 h-3 w-3" }), controle === "controleren" ? "Controleren" : controle === "gereed" ? "Afdruk gereed" : "Afwijking gevonden"] })] })), _jsxs(CardContent, { className: "flex min-h-0 flex-1 flex-col overflow-hidden p-0", children: [_jsx(FustKolomVolgorde, { config: config, onChange: setConfig }), _jsxs("div", { className: "min-h-0 flex-1 p-4 pt-3", children: [ingebed && _jsx(NogGeenLogo, { config: config }), _jsx("div", { className: ingebed ? "h-full" : "h-full rounded-md border bg-muted/30 p-2", children: voorbeeldHtml ? (_jsx(PrintbestandVoorbeeld, { layoutId: layout?.id ?? layoutId, sleutel: "afleverbrief", indeling: config, onControle: (status, fout) => { setControle(status); setControleFout(fout ?? null); } })) : null })] })] })] })] })] }));
|
|
120
121
|
}
|
|
@@ -69,7 +69,7 @@ export function BlokOntwerperPage({ layoutId: layoutIdProp } = {}) {
|
|
|
69
69
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
70
70
|
if (!layout || !config)
|
|
71
71
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
72
|
-
return (_jsxs("main", { className: "space-y-4 p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: layout.documenttype === "afleverbrief" || layout.documenttype === "veilingbrief" ? (_jsxs(Link, { to: "/layouts-printers/afleverbrief/$layoutId", params: { layoutId }, children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Afleverbriefopbouw"] })) : (_jsxs(Link, { to: "/layouts-printers/pakbon/$layoutId", params: { layoutId }, children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Pakbonopbouw"] })) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: "
|
|
72
|
+
return (_jsxs("main", { className: "space-y-4 p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: layout.documenttype === "afleverbrief" || layout.documenttype === "veilingbrief" ? (_jsxs(Link, { to: "/layouts-printers/afleverbrief/$layoutId", params: { layoutId }, children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Afleverbriefopbouw"] })) : (_jsxs(Link, { to: "/layouts-printers/pakbon/$layoutId", params: { layoutId }, children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Pakbonopbouw"] })) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: "Onderdelen ontwerpen" }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [layout.naam, " \u00B7 elk blok afzonderlijk vormgeven"] })] })] }), _jsxs(Button, { size: "sm", onClick: opslaan, disabled: bezig, children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan"] })] }), layout.systeem ? _jsx(SysteemLayoutMelding, { layoutId: layout.id, route: "blokken" }) : null, _jsxs("div", { className: "grid gap-4 lg:grid-cols-[240px_1fr_360px] 2xl:grid-cols-[240px_1fr_360px_360px]", children: [_jsxs(Card, { className: "h-fit", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsx(CardTitle, { className: "text-base", children: "Onderdelen" }), _jsx(CardDescription, { children: "Kies welk onderdeel je wilt ontwerpen." })] }), _jsxs(CardContent, { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [secties.map((s) => (_jsxs("button", { type: "button", onClick: () => setActief(s.id), className: `flex w-full items-center justify-between rounded-md border px-2 py-1.5 text-left text-sm ${s.id === actief ? "border-primary bg-accent" : "hover:bg-accent/50"}`, children: [_jsx("span", { className: "truncate", children: s.titel }), !s.zichtbaar && _jsx(Badge, { variant: "outline", children: "verborgen" })] }, s.id))), secties.length === 0 && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen onderdelen." }))] }), _jsx(Separator, {}), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Select, { value: toevoegen, onValueChange: (v) => setToevoegen(v), children: [_jsx(SelectTrigger, { className: "h-8", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: SECTIE_REGISTER.map((d) => (_jsx(SelectItem, { value: d.type, children: d.label }, d.type))) })] }), _jsx(Button, { size: "sm", onClick: () => {
|
|
73
73
|
const s = nieuweSectie(toevoegen);
|
|
74
74
|
setConfig({ ...config, secties: [...secties, s] });
|
|
75
75
|
setActief(s.id);
|
|
@@ -77,5 +77,5 @@ export function BlokOntwerperPage({ layoutId: layoutIdProp } = {}) {
|
|
|
77
77
|
transform: `scale(${zoom})`,
|
|
78
78
|
transformOrigin: "top left",
|
|
79
79
|
width: `${100 / zoom}%`,
|
|
80
|
-
}, children: _jsx(PakbonSectiePreview, { sectie: sectie, config: config, breedteMm: layout ? binnenBreedteMm(layout) || undefined : undefined, lettertype: BEWERKVLAK_LETTER, lettergroottePt: PAKBON_LETTER_PT }) })) : (_jsx("p", { className: "text-sm text-muted-foreground", children: "Geen
|
|
80
|
+
}, children: _jsx(PakbonSectiePreview, { sectie: sectie, config: config, breedteMm: layout ? binnenBreedteMm(layout) || undefined : undefined, lettertype: BEWERKVLAK_LETTER, lettergroottePt: PAKBON_LETTER_PT }) })) : (_jsx("p", { className: "text-sm text-muted-foreground", children: "Geen onderdeel gekozen." })) }) })] }), _jsxs(Card, { className: "h-fit", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsx(CardTitle, { className: "text-base", children: "Printbestand" }), _jsx(CardDescription, { children: "Zo komt het uit de printer, met voorbeeldgegevens." })] }), _jsx(CardContent, { children: layout && config ? (_jsx(PrintbestandVoorbeeld, { layoutId: layout.id, sleutel: layout.documenttype === "afleverbrief" || layout.documenttype === "veilingbrief" ? "afleverbrief" : "pakbon", indeling: config })) : null })] }), _jsxs(Card, { className: "h-fit", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsx(CardTitle, { className: "text-base", children: "Instellingen" }), _jsx(CardDescription, { children: "Inhoud, opmaak en kader van dit onderdeel." })] }), _jsx(CardContent, { className: "space-y-4", children: sectie ? (_jsxs(_Fragment, { children: [_jsx(PakbonBlokKaderEditor, { sectie: sectie, onChange: patch }), _jsx(Separator, {}), _jsx(PakbonSectieEditor, { sectie: sectie, onChange: patch })] })) : (_jsx("p", { className: "text-sm text-muted-foreground", children: "Kies eerst een onderdeel." })) })] })] })] }));
|
|
81
81
|
}
|
|
@@ -86,5 +86,5 @@ function FormaatPrinters({ documenttype }) {
|
|
|
86
86
|
meldFout("Opslaan mislukt");
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
return (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx(Label, { className: "text-xs uppercase text-muted-foreground", children: "Standaardprinter per formaat" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Bij afdrukken
|
|
89
|
+
return (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx(Label, { className: "text-xs uppercase text-muted-foreground", children: "Standaardprinter per formaat" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Bij afdrukken wordt automatisch de printer gekozen die bij het formaat hoort." })] }), profiel.formaten.map((f) => (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs", children: f.label }), _jsxs(Select, { value: huidige(f.code), onValueChange: (v) => void kies(f.code, v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Geen printer" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "geen", children: "Geen printer" }), printers.map((p) => (_jsx(SelectItem, { value: p.id, children: p.naam }, p.id)))] })] })] }, f.code))), _jsx(Separator, {})] }));
|
|
90
90
|
}
|
|
@@ -326,7 +326,7 @@ function DocumentenOverzicht({ focusKaart }) {
|
|
|
326
326
|
const leeg = legeVersie(v);
|
|
327
327
|
const magActiveren = !leeg && magSchakelaarAan(v, kaart.id, v.id === g.actiefId, v.id === g.stdId);
|
|
328
328
|
const magWeg = !std && !isActief && v.id !== g.actiefId && !v.actief && plekken.length === 0 && !v.systeem && String(v.bron ?? "eigen") === "eigen";
|
|
329
|
-
return (_jsxs("li", { className: REGEL, children: [_jsx("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-2 text-left text-sm text-card-foreground enabled:hover:underline", disabled: sticker, onClick: () => openOfKopie(v, kaart, bestaand), children: _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate", children: naam }), leeg && _jsx("span", { className: "block text-xs text-muted-foreground", children: "Leeg \u2013 nog geen
|
|
329
|
+
return (_jsxs("li", { className: REGEL, children: [_jsx("button", { type: "button", className: "flex min-w-0 flex-1 items-center gap-2 text-left text-sm text-card-foreground enabled:hover:underline", disabled: sticker, onClick: () => openOfKopie(v, kaart, bestaand), children: _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block truncate", children: naam }), leeg && _jsx("span", { className: "block text-xs text-muted-foreground", children: "Leeg \u2013 nog geen onderdelen" })] }) }), _jsx(VasteSchakelaar, { checked: isActief, "aria-label": `${naam} actief`, vastUitleg: isActief ? "Er is altijd één actieve versie" : !magActiveren ? "Deze versie kan nu niet actief worden" : null, className: "transition-colors duration-150 [&>span]:transition-transform [&>span]:duration-150", onCheckedChange: (aan) => { if (schakelaarActie(isActief, magActiveren, aan) === "activeren")
|
|
330
330
|
activeren(groepSleutel, v, naam); } }), (!sticker || magWeg) && _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: MEER_KNOP, "aria-label": `Meer voor ${naam}`, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [!sticker && _jsxs(DropdownMenuItem, { disabled: bezig, onSelect: () => openOfKopie(v, kaart, bestaand), children: [_jsx(Pencil, { className: "mr-2 h-4 w-4" }), " Bewerken"] }), !sticker && _jsxs(DropdownMenuItem, { disabled: bezig, onSelect: () => void kopie(v.id, kaart, bestaand), children: [_jsx(Copy, { className: "mr-2 h-4 w-4" }), " Kopie maken"] }), magWeg && (_jsxs(DropdownMenuItem, { className: "text-destructive", disabled: bezig, onSelect: () => void verwijderen(v), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] })] }, v.id));
|
|
331
331
|
}), floridayActief && MET_FLORIDAY.includes(kaart.id) && (_jsxs("li", { className: REGEL, children: [_jsx(FloridayMerk, {}), _jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-semibold text-card-foreground", children: "Floriday-orders" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Document van Floriday \u00B7 niet aan te passen" })] })] }))] })] })] }))] }));
|
|
332
332
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FactuurOntwerpPage.d.ts","sourceRoot":"","sources":["../../src/components/FactuurOntwerpPage.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"FactuurOntwerpPage.d.ts","sourceRoot":"","sources":["../../src/components/FactuurOntwerpPage.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAyB7E,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAe,EAAE,eAAe,EAAE,WAAW,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAiB,+BA4OtJ"}
|
|
@@ -15,6 +15,10 @@ import { useLayoutIdParam } from "../lib/useLayoutIdParam.js";
|
|
|
15
15
|
import { bewaarIndeling, foutTekstVan } from "../lib/layoutOpslaan.js";
|
|
16
16
|
import { FACTUUR_BLOKKEN, leesFactuurConfig, renderFactuurPdf } from "../lib/factuurPdf.js";
|
|
17
17
|
import { VOORBEELD_FACTUUR } from "../lib/factuurVoorbeeld.js";
|
|
18
|
+
import { createPortal } from "react-dom";
|
|
19
|
+
import { useBewerker } from "../lib/bewerkerContext.js";
|
|
20
|
+
import { haalBedrijfsgegevens } from "../lib/bedrijfsgegevens.functions.js";
|
|
21
|
+
import { factuurVoorbeeldMetBedrijf, factuurVoorbeeldHints } from "../lib/factuurVoorbeeldBedrijf.js";
|
|
18
22
|
const BLOK_LABEL = {
|
|
19
23
|
kweker: "Verkoper (uit Facturatie)",
|
|
20
24
|
klant: "Klant en factuuradres",
|
|
@@ -32,6 +36,27 @@ export function FactuurOntwerpPage({ layoutId: layoutIdProp, ingebed = false, do
|
|
|
32
36
|
const [geladen, setGeladen] = useState(null);
|
|
33
37
|
const [bezig, setBezig] = useState(false);
|
|
34
38
|
const [pdfUrl, setPdfUrl] = useState(null);
|
|
39
|
+
const [bedrijf, setBedrijf] = useState(null);
|
|
40
|
+
const [gekozen, setGekozen] = useState(null);
|
|
41
|
+
const bewerker = useBewerker();
|
|
42
|
+
// Echte bedrijfsgegevens in het voorbeeld (nooit vaste voorbeeldgegevens).
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
let weg = false;
|
|
45
|
+
haalBedrijfsgegevens()
|
|
46
|
+
.then((r) => {
|
|
47
|
+
if (weg)
|
|
48
|
+
return;
|
|
49
|
+
if (r?.ok)
|
|
50
|
+
setBedrijf((r.gegevens ?? {}));
|
|
51
|
+
else {
|
|
52
|
+
console.error("[factuur] bedrijfsgegevens lezen mislukt", r?.fout);
|
|
53
|
+
setBedrijf({});
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.catch((e) => { console.error("[factuur] bedrijfsgegevens lezen mislukt", e); if (!weg)
|
|
57
|
+
setBedrijf({}); });
|
|
58
|
+
return () => { weg = true; };
|
|
59
|
+
}, []);
|
|
35
60
|
const vergrendeld = useMemo(() => {
|
|
36
61
|
const v = layout?.config?.["vergrendeld"];
|
|
37
62
|
return new Set(Array.isArray(v) ? v.map(String) : []);
|
|
@@ -48,7 +73,8 @@ export function FactuurOntwerpPage({ layoutId: layoutIdProp, ingebed = false, do
|
|
|
48
73
|
let url = null;
|
|
49
74
|
const t = setTimeout(async () => {
|
|
50
75
|
try {
|
|
51
|
-
const
|
|
76
|
+
const gegevens = bedrijf ? factuurVoorbeeldMetBedrijf(VOORBEELD_FACTUUR, bedrijf) : VOORBEELD_FACTUUR;
|
|
77
|
+
const bytes = await renderFactuurPdf({ config: { factuur: { ...cfg, logo: { ...cfg.logo, logoId: null } } }, gegevens });
|
|
52
78
|
if (weg)
|
|
53
79
|
return;
|
|
54
80
|
url = URL.createObjectURL(new Blob([bytes], { type: "application/pdf" }));
|
|
@@ -64,7 +90,7 @@ export function FactuurOntwerpPage({ layoutId: layoutIdProp, ingebed = false, do
|
|
|
64
90
|
if (url)
|
|
65
91
|
URL.revokeObjectURL(url);
|
|
66
92
|
};
|
|
67
|
-
}, [cfg]);
|
|
93
|
+
}, [cfg, bedrijf]);
|
|
68
94
|
const zetBlok = (b, veld, waarde) => {
|
|
69
95
|
const n = Number(waarde.replace(",", "."));
|
|
70
96
|
setCfg((c) => ({ ...c, blokken: { ...(c.blokken ?? {}), [b]: { ...(c.blokken?.[b] ?? {}), [veld]: Number.isFinite(n) ? n : undefined } } }));
|
|
@@ -99,7 +125,16 @@ export function FactuurOntwerpPage({ layoutId: layoutIdProp, ingebed = false, do
|
|
|
99
125
|
return _jsx("div", { className: "p-6 text-sm text-muted-foreground", children: "Geen layout gekozen." });
|
|
100
126
|
if (loading || !layout)
|
|
101
127
|
return _jsx("div", { className: "p-6", children: _jsx(Loader2, { className: "h-5 w-5 animate-spin" }) });
|
|
102
|
-
|
|
128
|
+
// Alle acht onderdelen van de factuur zijn vast (slotje).
|
|
129
|
+
const isSlot = (_b) => true;
|
|
130
|
+
if (ingebed) {
|
|
131
|
+
const hints = factuurVoorbeeldHints(bedrijf, VOORBEELD_FACTUUR);
|
|
132
|
+
const opmaak = (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "f-pt", children: "Lettergrootte (pt)" }), _jsx(Input, { id: "f-pt", inputMode: "decimal", value: String(cfg.stijl?.grootte_pt ?? 9), onChange: (e) => setCfg((c) => ({ ...c, stijl: { ...c.stijl, grootte_pt: Number(e.target.value) || 9 } })) })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "f-kleur", children: "Accentkleur" }), _jsx(Input, { id: "f-kleur", type: "color", value: cfg.stijl?.accent ?? "#1F3A2E", onChange: (e) => setCfg((c) => ({ ...c, stijl: { ...c.stijl, accent: e.target.value } })) })] }), _jsxs("div", { className: "col-span-2", children: [_jsx(Label, { htmlFor: "f-voet", children: "Voettekst" }), _jsx(Input, { id: "f-voet", value: cfg.voettekst ?? "", onChange: (e) => setCfg((c) => ({ ...c, voettekst: e.target.value })) })] })] }));
|
|
133
|
+
const p = gekozen ? (cfg.blokken?.[gekozen] ?? {}) : null;
|
|
134
|
+
const instellingen = gekozen && p ? (_jsxs("div", { children: [_jsx("h3", { className: "mb-3 text-base font-semibold text-foreground", children: BLOK_LABEL[gekozen] }), _jsx("p", { className: "mb-3 text-sm text-muted-foreground", children: "Dit onderdeel is verplicht. Plaats en breedte kun je aanpassen." }), _jsx("div", { className: "grid grid-cols-3 gap-2", children: ["x_mm", "y_mm", "breedte_mm"].map((veld) => (_jsxs("div", { children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: veld === "x_mm" ? "Links (mm)" : veld === "y_mm" ? "Boven (mm)" : "Breedte (mm)" }), _jsx(Input, { inputMode: "decimal", value: p[veld] == null ? "" : String(p[veld]), placeholder: veld === "y_mm" ? "volgt" : "", onChange: (e) => zetBlok(gekozen, veld, e.target.value) })] }, veld))) })] })) : (_jsxs("div", { children: [_jsx("h3", { className: "mb-3 text-base font-semibold text-foreground", children: "Opmaak" }), opmaak] }));
|
|
135
|
+
return (_jsxs("div", { className: "grid items-start gap-4 lg:grid-cols-[15rem_minmax(0,1fr)]", children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("h2", { className: "text-base font-semibold text-foreground", children: "Onderdelen" }), _jsx("ul", { className: "flex flex-col gap-1.5", "aria-label": "Onderdelen op de factuur", children: FACTUUR_BLOKKEN.map((b) => (_jsxs("li", { className: `grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded-md border px-2 py-2 ${gekozen === b ? "border-primary bg-primary/10" : "border-border bg-card hover:bg-muted/50"}`, children: [_jsx("button", { type: "button", title: BLOK_LABEL[b], onClick: () => setGekozen(gekozen === b ? null : b), className: "min-w-0 truncate text-left text-sm font-medium text-foreground", children: BLOK_LABEL[b] }), isSlot(b) && _jsx("span", { className: "shrink-0 text-muted-foreground", title: "Dit onderdeel is verplicht", "aria-label": "Dit onderdeel is verplicht", children: _jsx(Lock, { className: "h-4 w-4" }) })] }, b))) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Een factuur heeft vaste onderdelen; toevoegen of weghalen kan niet." })] }), _jsxs("div", { className: "min-w-0", children: [hints.length > 0 && (_jsx("ul", { className: "mb-3 flex flex-col gap-1 text-sm text-muted-foreground", "aria-label": "Alleen in het voorbeeld", children: hints.map((h) => _jsx("li", { children: h }, h)) })), pdfUrl ? _jsx("iframe", { title: "Voorbeeld factuur", src: pdfUrl, className: "h-[85vh] w-full rounded-md border border-border" }) : _jsx(Loader2, { className: "h-5 w-5 animate-spin" })] }), bewerker?.instellingenVak ? createPortal(instellingen, bewerker.instellingenVak) : null] }));
|
|
136
|
+
}
|
|
137
|
+
return (_jsxs("div", { className: "space-y-6 p-6", children: [!ingebed && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { asChild: true, variant: "ghost", size: "sm", children: _jsxs(Link, { to: "/layouts-printers/documenten", children: [_jsx(ArrowLeft, { className: "mr-1 h-4 w-4" }), " Terug"] }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-xl font-semibold", children: layout.naam }), _jsxs("p", { className: "text-sm text-muted-foreground", children: ["Factuur, A4 \u00B7 versie ", String(layout.huidige_versie ?? 1)] })] })] }), _jsxs(Button, { onClick: opslaan, disabled: bezig, children: [bezig ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : _jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan"] })] })), _jsxs("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)]", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-base", children: "Opmaak" }), _jsx(CardDescription, { children: "Lettergrootte en kleur van titels en lijnen." })] }), _jsxs(CardContent, { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { children: [_jsx(Label, { htmlFor: "f-pt", children: "Lettergrootte (pt)" }), _jsx(Input, { id: "f-pt", inputMode: "decimal", value: String(cfg.stijl?.grootte_pt ?? 9), onChange: (e) => setCfg((c) => ({ ...c, stijl: { ...c.stijl, grootte_pt: Number(e.target.value) || 9 } })) })] }), _jsxs("div", { children: [_jsx(Label, { htmlFor: "f-kleur", children: "Accentkleur" }), _jsx(Input, { id: "f-kleur", type: "color", value: cfg.stijl?.accent ?? "#1F3A2E", onChange: (e) => setCfg((c) => ({ ...c, stijl: { ...c.stijl, accent: e.target.value } })) })] }), _jsxs("div", { className: "col-span-2", children: [_jsx(Label, { htmlFor: "f-voet", children: "Voettekst" }), _jsx(Input, { id: "f-voet", value: cfg.voettekst ?? "", onChange: (e) => setCfg((c) => ({ ...c, voettekst: e.target.value })) })] })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-base", children: "Onderdelen" }), _jsx(CardDescription, { children: "Verplaatsen en breedte aanpassen kan. Onderdelen met een slot zijn verplicht en kunnen niet weg." })] }), _jsx(CardContent, { className: "space-y-3", children: FACTUUR_BLOKKEN.map((b) => {
|
|
103
138
|
const p = (cfg.blokken?.[b] ?? {});
|
|
104
139
|
return (_jsxs("div", { className: "grid grid-cols-[1fr_auto_auto_auto] items-end gap-2", children: [_jsxs("div", { className: "flex items-center gap-1 text-sm", children: [(vergrendeld.has(`factuur.blokken.${b}`) || isVastVerplicht("factuur", b)) && _jsx(Lock, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-label": "Vergrendeld" }), BLOK_LABEL[b]] }), ["x_mm", "y_mm", "breedte_mm"].map((veld) => (_jsxs("div", { className: "w-20", children: [_jsx(Label, { className: "text-xs text-muted-foreground", children: veld === "x_mm" ? "links" : veld === "y_mm" ? "boven" : "breedte" }), _jsx(Input, { inputMode: "decimal", value: p[veld] == null ? "" : String(p[veld]), placeholder: veld === "y_mm" ? "volgt" : "", onChange: (e) => zetBlok(b, veld, e.target.value) })] }, veld)))] }, b));
|
|
105
140
|
}) })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-base", children: "Voorbeeld" }), _jsx(CardDescription, { children: "Met voorbeeldgegevens; het logo komt uit de bedrijfsgegevens." })] }), _jsx(CardContent, { children: pdfUrl ? _jsx("iframe", { title: "Voorbeeld factuur", src: pdfUrl, className: "h-[780px] w-full rounded-md border border-border" }) : _jsx(Loader2, { className: "h-5 w-5 animate-spin" }) })] })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PakbonBuilderPage.d.ts","sourceRoot":"","sources":["../../src/components/PakbonBuilderPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PakbonBuilderPage.d.ts","sourceRoot":"","sources":["../../src/components/PakbonBuilderPage.tsx"],"names":[],"mappings":"AA+BA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI7E,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAe,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAiB,+BA4OvK"}
|
|
@@ -6,6 +6,7 @@ import { Badge, Button, Card, CardContent, CardDescription, CardHeader, CardTitl
|
|
|
6
6
|
import { AlertTriangle, ArrowLeft, CheckCircle2, Loader2, Printer, Save } from "lucide-react";
|
|
7
7
|
import { PakbonSectiesPanel } from "./PakbonSectiesPanel.js";
|
|
8
8
|
import { PrintbestandVoorbeeld } from "./PrintbestandVoorbeeld.js";
|
|
9
|
+
import { NogGeenLogo } from "./layoutBewerker/NogGeenLogo.js";
|
|
9
10
|
import { FormaatOrientatieBar } from "./FormaatOrientatieBar.js";
|
|
10
11
|
import { leesPakbonConfig, pickMethode } from "../lib/pakbonBuilder.js";
|
|
11
12
|
import { renderPakbonDocument, voorbeeldPakbonOrder } from "../lib/pakbonHtml.js";
|
|
@@ -121,5 +122,5 @@ export function PakbonBuilderPage({ layoutId: layoutIdProp, ingebed = false, doe
|
|
|
121
122
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
122
123
|
if (!layout || !config)
|
|
123
124
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
124
|
-
return (_jsxs("main", { className: "space-y-4 p-6", children: [!ingebed && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: _jsxs(Link, { to: "/layouts-printers/documenten", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Layouts"] }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: layout.naam }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Pakbon opbouwen uit secties \u00B7 ", config.secties.length, " secties"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LayoutPrinterSelect, { layoutId: layoutId }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void voorbeeldPrinten(), disabled: printen || controle !== "gereed", children: [printen ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-4 w-4" })), "Voorbeeld printen"] }), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { to: "/layouts-printers/blokken/$layoutId", params: { layoutId }, children: "
|
|
125
|
+
return (_jsxs("main", { className: "space-y-4 p-6", children: [!ingebed && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Button, { variant: "ghost", size: "sm", asChild: true, children: _jsxs(Link, { to: "/layouts-printers/documenten", children: [_jsx(ArrowLeft, { className: "mr-2 h-4 w-4" }), " Layouts"] }) }), _jsxs("div", { children: [_jsx("h1", { className: "text-lg font-semibold", children: layout.naam }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Pakbon opbouwen uit secties \u00B7 ", config.secties.length, " secties"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LayoutPrinterSelect, { layoutId: layoutId }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => void voorbeeldPrinten(), disabled: printen || controle !== "gereed", children: [printen ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(Printer, { className: "mr-2 h-4 w-4" })), "Voorbeeld printen"] }), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { to: "/layouts-printers/blokken/$layoutId", params: { layoutId }, children: "Onderdelen ontwerpen" }) }), _jsxs(Button, { size: "sm", onClick: opslaan, disabled: bezig || Boolean(layout.systeem), children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan"] })] })] })), layout.systeem ? _jsx(SysteemLayoutMelding, { layoutId: layout.id, route: "pakbon" }) : null, !ingebed && _jsx(FormaatOrientatieBar, { layout: layout, onChange: (patch) => setLayout((l) => (l ? { ...l, ...patch } : l)), vergrendeld: Boolean(layout.systeem) }), _jsxs("div", { className: ingebed ? "grid items-start gap-4 lg:grid-cols-[15rem_minmax(0,1fr)]" : "grid items-start gap-4 lg:grid-cols-[400px_1fr]", children: [_jsxs(Card, { className: ingebed ? "flex flex-col lg:sticky lg:top-4" : "flex h-[calc(100vh-14rem)] min-h-[420px] flex-col overflow-hidden lg:sticky lg:top-4", children: [!ingebed && (_jsxs(CardHeader, { className: "pb-3", children: [_jsx(CardTitle, { className: "text-base", children: "Onderdelen" }), _jsx(CardDescription, { children: "Voeg onderdelen toe, wijzig de volgorde en stel elk onderdeel afzonderlijk in." })] })), _jsx(CardContent, { className: "min-h-0 flex-1 overflow-y-auto", children: _jsx(PakbonSectiesPanel, { config: config, onChange: setConfig, documenttype: "pakbon", uit: Boolean(layout.systeem), referentie: referentieConfig === undefined ? null : leesPakbonConfig(referentieConfig).secties }) })] }), _jsxs(Card, { className: ingebed ? "flex min-h-[75vh] flex-col border-0 bg-transparent shadow-none" : "flex h-[calc(100vh-14rem)] min-h-[420px] flex-col overflow-hidden", children: [!ingebed && (_jsxs(CardHeader, { className: "flex-row items-center justify-between space-y-0 pb-3", children: [_jsxs("div", { children: [_jsx(CardTitle, { className: "text-base", children: "Live voorbeeld" }), _jsx(CardDescription, { children: "Bekijk een volle kar of een deelkar met alleen de te verzamelen fusten." })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Select, { value: voorbeeldVariant, onValueChange: (value) => setVoorbeeldVariant(value), children: [_jsx(SelectTrigger, { className: "w-48", "aria-label": "Voorbeeldvariant", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "full_cart", children: "Volle kar" }), _jsx(SelectItem, { value: "partial_order", children: "Deelkar" })] })] }), _jsxs(Badge, { variant: controle === "afwijking" ? "destructive" : "secondary", children: [controle === "controleren" ? _jsx(Loader2, { className: "mr-1 h-3 w-3 animate-spin" }) : controle === "gereed" ? _jsx(CheckCircle2, { className: "mr-1 h-3 w-3" }) : _jsx(AlertTriangle, { className: "mr-1 h-3 w-3" }), controle === "controleren" ? "Controleren" : controle === "gereed" ? "Afdruk gereed" : "Afwijking gevonden"] })] })] })), _jsxs(CardContent, { className: ingebed ? "min-h-0 flex-1 overflow-hidden p-0" : "min-h-0 flex-1 overflow-hidden", children: [ingebed && (_jsx("div", { className: "mb-3 flex justify-center", children: _jsx("div", { role: "radiogroup", "aria-label": "Voorbeeld", className: "inline-flex rounded-md border border-border bg-muted p-0.5", children: [["full_cart", "Volle kar"], ["partial_order", "Deelkar"]].map(([w, t]) => (_jsx("button", { type: "button", role: "radio", "aria-checked": voorbeeldVariant === w, onClick: () => setVoorbeeldVariant(w), className: `rounded px-4 py-1.5 text-sm font-medium ${voorbeeldVariant === w ? "bg-card text-primary shadow-sm" : "text-muted-foreground"}`, children: t }, w))) }) })), ingebed && _jsx(NogGeenLogo, { config: config }), _jsx("div", { className: ingebed ? "h-full" : "h-full rounded-md border bg-muted/30 p-2", children: voorbeeldHtml ? (_jsx(PrintbestandVoorbeeld, { layoutId: layout?.id ?? layoutId, sleutel: "pakbon", indeling: config, onControle: (status, fout) => { setControle(status); setControleFout(fout ?? null); } })) : null })] })] })] })] }));
|
|
125
126
|
}
|
|
@@ -160,7 +160,7 @@ export function PakbonSectiePreview({ sectie, config, breedteMm, lettertype, let
|
|
|
160
160
|
...(breedteMm ? { width: `${breedteMm}mm`, boxSizing: "content-box" } : {}),
|
|
161
161
|
...(lettertype ? { fontFamily: lettertype } : {}),
|
|
162
162
|
...(lettergroottePt ? { fontSize: `${lettergroottePt}pt`, lineHeight: 1.35 } : {}),
|
|
163
|
-
}, children: segmenten ? (_jsxs("div", { className: "space-y-3", children: [segmenten.map((seg, i) => (_jsxs("div", { className: "space-y-1", children: [seg.breakBefore && (_jsx("div", { className: "border-t-2 border-dashed pt-1 text-center text-[8px] uppercase text-muted-foreground", children: "Nieuwe pagina" })), seg.node, i === segmenten.length - 1 && null] }, seg.key))), segmenten.length === 0 && (_jsx("p", { className: "text-muted-foreground", children: "
|
|
163
|
+
}, children: segmenten ? (_jsxs("div", { className: "space-y-3", children: [segmenten.map((seg, i) => (_jsxs("div", { className: "space-y-1", children: [seg.breakBefore && (_jsx("div", { className: "border-t-2 border-dashed pt-1 text-center text-[8px] uppercase text-muted-foreground", children: "Nieuwe pagina" })), seg.node, i === segmenten.length - 1 && null] }, seg.key))), segmenten.length === 0 && (_jsx("p", { className: "text-muted-foreground", children: "Dit onderdeel staat uit." }))] })) : (_jsx(BlokFrame, { sectie: sectie, children: _jsx(SectieView, { sectie: sectie, order: order, zoek: zoek }) })) }));
|
|
164
164
|
}
|
|
165
165
|
/** Kaderinstellingen (breedte, uitlijning, marges, achtergrond, rand) per blok. */
|
|
166
166
|
function BlokFrame({ sectie, children }) {
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { type PakbonConfig, type PakbonSectie, type PakbonSectieType, type PickMethode } from "../lib/pakbonBuilder.js";
|
|
2
|
-
/** Beheer van de
|
|
3
|
-
export declare function PakbonSectiesPanel({ config, onChange, beschikbareTypes, documenttype, referentie, }: {
|
|
2
|
+
/** Beheer van de onderdelen waaruit pakbon en afleverbrief zijn opgebouwd. */
|
|
3
|
+
export declare function PakbonSectiesPanel({ config, onChange, beschikbareTypes, documenttype, referentie, uit, }: {
|
|
4
4
|
config: PakbonConfig;
|
|
5
5
|
onChange: (c: PakbonConfig) => void;
|
|
6
|
-
/** Beperkt de keuzelijst
|
|
6
|
+
/** Beperkt de keuzelijst (bijvoorbeeld voor de afleverbrief). */
|
|
7
7
|
beschikbareTypes?: PakbonSectieType[];
|
|
8
|
-
/** Soort voor de verplichte
|
|
8
|
+
/** Soort voor de verplichte onderdelen (slotje). */
|
|
9
9
|
documenttype?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Onderdelen van de laatst actieve stand (groen bolletje). */
|
|
11
11
|
referentie?: PakbonSectie[] | null;
|
|
12
|
+
/** Vergrendelde versie: alles staat uit. */
|
|
13
|
+
uit?: boolean;
|
|
12
14
|
}): import("react").JSX.Element;
|
|
13
15
|
/** Volledige instellingen van één blok — herbruikt in de blokontwerper. */
|
|
14
|
-
export declare function PakbonSectieEditor({ sectie, onChange, methode, }: {
|
|
16
|
+
export declare function PakbonSectieEditor({ sectie, onChange, methode, verbergTitel, }: {
|
|
15
17
|
sectie: PakbonSectie;
|
|
16
18
|
onChange: (patch: Partial<PakbonSectie>) => void;
|
|
17
19
|
methode?: PickMethode;
|
|
20
|
+
verbergTitel?: boolean;
|
|
18
21
|
}): import("react").JSX.Element;
|
|
19
22
|
/** Kaderinstellingen (breedte, uitlijning, marges, opmaak) van één blok. */
|
|
20
23
|
export declare function PakbonBlokKaderEditor({ sectie, onChange, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PakbonSectiesPanel.d.ts","sourceRoot":"","sources":["../../src/components/PakbonSectiesPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PakbonSectiesPanel.d.ts","sourceRoot":"","sources":["../../src/components/PakbonSectiesPanel.tsx"],"names":[],"mappings":"AA+BA,OAAO,EASL,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,YAAuB,EACvB,UAAiB,EACjB,GAAW,GACZ,EAAE;IACD,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACpC,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACnC,4CAA4C;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,+BA0LA;AAkVD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,OAAe,EACf,YAAoB,GACrB,EAAE;IACD,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,+BAqHA;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;CAClD,+BA4FA"}
|
|
@@ -1,56 +1,90 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useBewerker } from "../lib/bewerkerContext.js";
|
|
5
|
+
import { onderdeelNaam, onderdeelUitleg, onzichtbaarInLijst, pastBij, toevoegbaar } from "../lib/onderdelenPerSoort.js";
|
|
6
|
+
import { InstellingenKop, OnderdelenLijst } from "./layoutBewerker/OnderdelenLijst.js";
|
|
7
|
+
import { Button, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Separator, Dialog, DialogContent, DialogHeader, DialogTitle, Switch, } from "@flowselections/core";
|
|
8
|
+
import { ChevronDown, ChevronUp, ImagePlus, Plus, Trash2 } from "lucide-react";
|
|
5
9
|
import { useEffect } from "react";
|
|
6
10
|
import { toast } from "sonner";
|
|
7
11
|
import { useLogos } from "../lib/logoLibrary.js";
|
|
8
12
|
import { LogoBibliotheekDialog } from "./LogoBibliotheekDialog.js";
|
|
9
13
|
import { LogoThumbnail, LogosPage } from "./LogosPage.js";
|
|
10
|
-
import { GewijzigdBolletje, VerplichtSlot } from "./BlokMarkering.js";
|
|
11
14
|
import { gewijzigdeBlokken, isVergrendeld } from "../lib/verplichteBlokken.js";
|
|
12
15
|
import { BESCHIKBARE_KOLOMMEN, CONDITIE_VELDEN, SECTIE_REGISTER, nieuweKolom, nieuweSectie, pickMethode, sectieDef, sectieOnderdrukt, } from "../lib/pakbonBuilder.js";
|
|
13
|
-
/** Beheer van de
|
|
14
|
-
export function PakbonSectiesPanel({ config, onChange, beschikbareTypes, documenttype = "pakbon", referentie = null, }) {
|
|
16
|
+
/** Beheer van de onderdelen waaruit pakbon en afleverbrief zijn opgebouwd. */
|
|
17
|
+
export function PakbonSectiesPanel({ config, onChange, beschikbareTypes, documenttype = "pakbon", referentie = null, uit = false, }) {
|
|
18
|
+
const bewerker = useBewerker();
|
|
15
19
|
const alleSecties = Array.isArray(config?.secties) ? config.secties : [];
|
|
16
20
|
const methode = pickMethode(alleSecties);
|
|
17
|
-
const toegestaan = (t) => !beschikbareTypes || beschikbareTypes.includes(t);
|
|
18
|
-
|
|
21
|
+
const toegestaan = (t) => (!beschikbareTypes || beschikbareTypes.includes(t)) && pastBij(documenttype, t);
|
|
22
|
+
// Onderdrukte onderdelen (per pickmethode) en onderdelen die onzichtbaar blijven werken
|
|
23
|
+
// (pickmethode, producten-onder-lagen) blijven bewaard, maar staan niet in de lijst.
|
|
24
|
+
const inLijst = (s) => !sectieOnderdrukt(s.type, methode) && !onzichtbaarInLijst(documenttype, s.type);
|
|
25
|
+
const secties = alleSecties.filter(inLijst);
|
|
26
|
+
const buiten = alleSecties.filter((s) => !inLijst(s));
|
|
19
27
|
const [open, setOpen] = useState(null);
|
|
20
|
-
const [sleep, setSleep] = useState(null);
|
|
21
|
-
const keuzes = SECTIE_REGISTER.filter((d) => !sectieOnderdrukt(d.type, methode) && toegestaan(d.type));
|
|
22
|
-
const [toevoegen, setToevoegen] = useState(keuzes.find((d) => d.type === "orderregels")?.type ?? keuzes[0]?.type ?? "tekstblok");
|
|
23
|
-
// Onderdrukte blokken blijven bewaard in de configuratie, ook al staan ze niet in de lijst.
|
|
24
|
-
const verborgen = alleSecties.filter((s) => sectieOnderdrukt(s.type, methode));
|
|
25
|
-
const zet = (nieuw) => onChange({ ...config, secties: [...nieuw, ...verborgen] });
|
|
26
|
-
const update = (id, patch) => zet(secties.map((s) => (s.id === id ? { ...s, ...patch } : s)));
|
|
27
28
|
const gewijzigd = gewijzigdeBlokken(secties, referentie);
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
void gewijzigd;
|
|
30
|
+
const zet = (nieuw) => onChange({ ...config, secties: [...nieuw, ...buiten] });
|
|
31
|
+
const zetAlles = (nieuw) => onChange({ ...config, secties: nieuw });
|
|
32
|
+
const update = (id, patch) => zetAlles(alleSecties.map((s) => (s.id === id ? { ...s, ...patch } : s)));
|
|
33
|
+
// "Lagen" is in de bewerker één onderdeel met "Producten op een laag"; de print leest beide.
|
|
34
|
+
const productenSectie = alleSecties.find((s) => s.type === "producten") ?? null;
|
|
35
|
+
const vergrendeld = (s) => {
|
|
36
|
+
if (isVergrendeld(documenttype, alleSecties, s))
|
|
37
|
+
return true;
|
|
38
|
+
return s.type === "lagen" && !!productenSectie && isVergrendeld(documenttype, alleSecties, productenSectie);
|
|
36
39
|
};
|
|
37
|
-
const
|
|
38
|
-
|
|
40
|
+
const verwijder = (id) => {
|
|
41
|
+
const weg = secties.find((x) => x.id === id);
|
|
42
|
+
if (!weg || vergrendeld(weg))
|
|
39
43
|
return;
|
|
44
|
+
const wegIds = new Set([weg.id]);
|
|
45
|
+
if (weg.type === "lagen")
|
|
46
|
+
for (const p of alleSecties)
|
|
47
|
+
if (p.type === "producten")
|
|
48
|
+
wegIds.add(p.id);
|
|
49
|
+
const voor = alleSecties;
|
|
50
|
+
zetAlles(alleSecties.filter((x) => !wegIds.has(x.id)));
|
|
51
|
+
if (open === id)
|
|
52
|
+
setOpen(null);
|
|
53
|
+
toast(`${onderdeelNaam(weg.type, weg.titel)} verwijderd`, { duration: 10000, action: { label: "Ongedaan maken", onClick: () => zetAlles(voor) } });
|
|
54
|
+
};
|
|
55
|
+
const verplaats = (van, naar) => {
|
|
40
56
|
const kopie = [...secties];
|
|
41
57
|
const [x] = kopie.splice(van, 1);
|
|
42
58
|
kopie.splice(naar, 0, x);
|
|
43
59
|
zet(kopie);
|
|
44
60
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
const herhaalbaar = new Set(["tekstblok", "qrcode", "barcode", "afbeelding"]);
|
|
62
|
+
const volgorde = toevoegbaar(documenttype);
|
|
63
|
+
const keuzes = SECTIE_REGISTER
|
|
64
|
+
.filter((d) => !sectieOnderdrukt(d.type, methode) && toegestaan(d.type) && !onzichtbaarInLijst(documenttype, d.type))
|
|
65
|
+
.sort((a, b) => (volgorde ? volgorde.indexOf(a.type) - volgorde.indexOf(b.type) : 0))
|
|
66
|
+
.map((d) => ({
|
|
67
|
+
type: d.type,
|
|
68
|
+
naam: onderdeelNaam(d.type, d.label),
|
|
69
|
+
uitleg: onderdeelUitleg(d.type, d.omschrijving),
|
|
70
|
+
alToegevoegd: !herhaalbaar.has(d.type) && secties.some((s) => s.type === d.type && s.zichtbaar),
|
|
71
|
+
}));
|
|
72
|
+
const toevoegen = (type) => {
|
|
73
|
+
const t = type;
|
|
74
|
+
const s = nieuweSectie(t);
|
|
75
|
+
const extra = [];
|
|
76
|
+
if (t === "lagen" && !alleSecties.some((x) => x.type === "producten"))
|
|
77
|
+
extra.push(nieuweSectie("producten"));
|
|
78
|
+
// Verborgen exemplaar van hetzelfde onderdeel: dat terugzetten in plaats van een tweede.
|
|
79
|
+
const verborgenZelfde = !herhaalbaar.has(t) ? secties.find((x) => x.type === t && !x.zichtbaar) : undefined;
|
|
80
|
+
if (verborgenZelfde) {
|
|
81
|
+
update(verborgenZelfde.id, { zichtbaar: true });
|
|
82
|
+
setOpen(verborgenZelfde.id);
|
|
48
83
|
return;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
}
|
|
85
|
+
onChange({ ...config, secties: [...secties, s, ...buiten, ...extra] });
|
|
86
|
+
setOpen(s.id);
|
|
52
87
|
};
|
|
53
|
-
const heeftLogoBlok = secties.some((s) => s.type === "logo");
|
|
54
88
|
const logoInstellingen = (_jsxs("div", { className: "space-y-2 ", children: [_jsx(LogoKiezer, { logoId: config.logo?.logoId ?? null, onKies: (logo) => onChange({
|
|
55
89
|
...config,
|
|
56
90
|
logo: {
|
|
@@ -70,34 +104,40 @@ export function PakbonSectiesPanel({ config, onChange, beschikbareTypes, documen
|
|
|
70
104
|
uitlijning: v,
|
|
71
105
|
},
|
|
72
106
|
}), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "left", children: "Links" }), _jsx(SelectItem, { value: "center", children: "Midden" }), _jsx(SelectItem, { value: "right", children: "Rechts" })] })] })] })] }))] }));
|
|
73
|
-
// Delete verwijdert het gekozen
|
|
107
|
+
// Delete verwijdert het gekozen onderdeel, met Ongedaan maken.
|
|
74
108
|
useEffect(() => {
|
|
75
109
|
const onKey = (e) => {
|
|
76
|
-
if (e.key !== "Delete" || !open ||
|
|
110
|
+
if (e.key !== "Delete" || !open || uit)
|
|
77
111
|
return;
|
|
78
112
|
const el = e.target;
|
|
79
113
|
if (el && (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.isContentEditable || el.getAttribute("role") === "combobox"))
|
|
80
114
|
return;
|
|
81
|
-
const weg = secties.find((x) => x.id === open);
|
|
82
|
-
if (!weg)
|
|
83
|
-
return;
|
|
84
115
|
e.preventDefault();
|
|
85
|
-
verwijder(
|
|
116
|
+
verwijder(open);
|
|
86
117
|
};
|
|
87
118
|
window.addEventListener("keydown", onKey);
|
|
88
119
|
return () => window.removeEventListener("keydown", onKey);
|
|
89
120
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
121
|
+
const zichtbareRijen = secties.filter((s) => s.zichtbaar);
|
|
122
|
+
const gekozen = secties.find((s) => s.id === open) ?? null;
|
|
123
|
+
const rij = (s) => ({ id: s.id, naam: onderdeelNaam(s.type, s.titel || sectieDef(s.type).label), verplicht: vergrendeld(s) });
|
|
124
|
+
const instellingen = gekozen ? (_jsxs("div", { className: uit ? "pointer-events-none opacity-60" : "", children: [_jsx(InstellingenKop, { naam: onderdeelNaam(gekozen.type, gekozen.titel || sectieDef(gekozen.type).label) }), gekozen.type === "logo" && !(typeof gekozen.opties?.logoId === "string" && gekozen.opties.logoId) && _jsx("div", { className: "mb-3", children: logoInstellingen }), _jsx(PakbonSectieEditor, { sectie: gekozen, methode: methode, onChange: (patch) => update(gekozen.id, patch) }), gekozen.type === "lagen" && productenSectie && (_jsxs("div", { className: "mt-4 border-t border-border pt-4", children: [_jsx("p", { className: "mb-2 text-sm font-medium text-foreground", children: "Producten op een laag" }), _jsx(PakbonSectieEditor, { sectie: productenSectie, methode: methode, verbergTitel: true, onChange: (patch) => update(productenSectie.id, patch) })] })), BEHEER_VAN[gekozen.type] && _jsx(BeheerRegel, { ...BEHEER_VAN[gekozen.type] })] })) : (_jsx("p", { className: "text-sm text-muted-foreground", children: "Kies links een onderdeel om het aan te passen." }));
|
|
125
|
+
return (_jsxs(_Fragment, { children: [_jsx(OnderdelenLijst, { uit: uit, rijen: zichtbareRijen.map(rij), verborgen: secties.filter((s) => !s.zichtbaar).map(rij), gekozen: open, onKies: setOpen, onVerplaats: (van, naar) => {
|
|
126
|
+
// Volgorde binnen de zichtbare rijen; verborgen blijven achteraan.
|
|
127
|
+
const zicht = [...zichtbareRijen];
|
|
128
|
+
const [x] = zicht.splice(van, 1);
|
|
129
|
+
zicht.splice(naar, 0, x);
|
|
130
|
+
zet([...zicht, ...secties.filter((s) => !s.zichtbaar)]);
|
|
131
|
+
}, onVerwijder: verwijder, onTerugzetten: (id) => update(id, { zichtbaar: true }), keuzes: keuzes, onToevoegen: toevoegen }), bewerker?.instellingenVak ? createPortal(instellingen, bewerker.instellingenVak) : _jsx("div", { className: "mt-4 border-t border-border pt-4", children: instellingen })] }));
|
|
132
|
+
}
|
|
133
|
+
/** Onderdelen waarvan de gegevens elders worden beheerd. Alleen het logo heeft een vaste plek (Logo's). */
|
|
134
|
+
const BEHEER_VAN = {
|
|
135
|
+
logo: { tekst: "Komt uit Logo's", logos: true },
|
|
136
|
+
bedrijfsgegevens: { tekst: "Komt uit je bedrijfsgegevens" },
|
|
137
|
+
};
|
|
138
|
+
function BeheerRegel({ tekst, logos }) {
|
|
139
|
+
const [open, setOpen] = useState(false);
|
|
140
|
+
return (_jsxs("p", { className: "mt-4 border-t border-border pt-3 text-sm text-muted-foreground", children: [tekst, logos && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx("button", { type: "button", className: "font-medium text-primary", onClick: () => setOpen(true), children: "Aanpassen \u2192" })] }), logos && (_jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "max-h-[85vh] max-w-4xl overflow-y-auto", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Logo's" }) }), _jsx(LogosPage, { ingebed: true })] }) }))] }));
|
|
101
141
|
}
|
|
102
142
|
function OptieVeld({ def, waarde, onChange, }) {
|
|
103
143
|
if (def.type === "schakelaar") {
|
|
@@ -135,7 +175,7 @@ function CondityEditor({ condities, onChange, }) {
|
|
|
135
175
|
return (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { className: "text-xs uppercase text-muted-foreground", children: "Alleen tonen wanneer" }), condities.map((c, i) => (_jsxs("div", { className: "grid grid-cols-[1fr_auto_1fr_auto] items-center gap-1", children: [_jsxs(Select, { value: c.veld, onValueChange: (v) => onChange(condities.map((x, idx) => (idx === i ? { ...x, veld: v } : x))), children: [_jsx(SelectTrigger, { className: "h-8", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: CONDITIE_VELDEN.map((v) => (_jsx(SelectItem, { value: v.value, children: v.label }, v.value))) })] }), _jsxs(Select, { value: c.operator, onValueChange: (v) => onChange(condities.map((x, idx) => idx === i ? { ...x, operator: v } : x)), children: [_jsx(SelectTrigger, { className: "h-8 w-20", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: ["=", "!=", ">", "<", "bevat", "leeg", "niet_leeg"].map((o) => (_jsx(SelectItem, { value: o, children: o }, o))) })] }), _jsx(Input, { className: "h-8", value: c.waarde, onChange: (e) => onChange(condities.map((x, idx) => (idx === i ? { ...x, waarde: e.target.value } : x))) }), _jsx(Button, { size: "icon", variant: "ghost", className: "h-7 w-7", onClick: () => onChange(condities.filter((_, idx) => idx !== i)), children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, i))), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => onChange([...condities, { veld: "aantal_karren", operator: ">", waarde: "1" }]), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Voorwaarde"] })] }));
|
|
136
176
|
}
|
|
137
177
|
/** Volledige instellingen van één blok — herbruikt in de blokontwerper. */
|
|
138
|
-
export function PakbonSectieEditor({ sectie, onChange, methode = "kar", }) {
|
|
178
|
+
export function PakbonSectieEditor({ sectie, onChange, methode = "kar", verbergTitel = false, }) {
|
|
139
179
|
const s = sectie;
|
|
140
180
|
const def = sectieDef(s.type);
|
|
141
181
|
const bundelAan = s.type === "karren" && (s.opties?.bundel_identiek ?? true);
|
|
@@ -144,6 +184,8 @@ export function PakbonSectieEditor({ sectie, onChange, methode = "kar", }) {
|
|
|
144
184
|
const verzamellijstUit = s.type === "pickmethode" && methode === "kar";
|
|
145
185
|
const aangepasteOpties = def.opties
|
|
146
186
|
.filter((o) => !(verzamellijstUit && o.key !== "methode"))
|
|
187
|
+
// Kleuren op het papier volgen de stijlgids; geen eigen kleurkeuze.
|
|
188
|
+
.filter((o) => o.type !== "kleur" && o.key !== "toon_paginanummer" && o.key !== "kleur")
|
|
147
189
|
.map((o) => {
|
|
148
190
|
if (s.type === "karren" && o.key === "velden" && bundelAan) {
|
|
149
191
|
return {
|
|
@@ -160,13 +202,13 @@ export function PakbonSectieEditor({ sectie, onChange, methode = "kar", }) {
|
|
|
160
202
|
}
|
|
161
203
|
return o;
|
|
162
204
|
});
|
|
163
|
-
return (_jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs", children: "
|
|
205
|
+
return (_jsxs("div", { className: "space-y-3", children: [!verbergTitel && (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-xs", children: "Kop op het papier" }), _jsx(Input, { value: s.titel, onChange: (e) => onChange({ titel: e.target.value }) })] })), s.type === "logo" && typeof s.opties?.logoId === "string" && !!s.opties.logoId && (_jsx(LogoKiezer, { logoId: s.opties.logoId, onKies: (logo) => onChange({
|
|
164
206
|
opties: {
|
|
165
207
|
...s.opties,
|
|
166
208
|
logoId: logo?.id ?? null,
|
|
167
209
|
logoNaam: logo?.naam ?? null,
|
|
168
210
|
},
|
|
169
|
-
}) })), s.type === "pickmethode" && methode === "beide" && (_jsxs("p", { className: "rounded border border-dashed px-3 py-2 text-xs text-muted-foreground", children: ["De Logistics Engine kiest per opdracht de variant: ", _jsx("span", { className: "font-medium", children: "volle kar" }), "toont de karrenindeling; ", _jsx("span", { className: "font-medium", children: "deelkar" }), " toont alleen de te verzamelen fusten. De barcode hieronder wordt alleen gevuld met de barcode uit die opdracht."] })), verzamellijstUit && (_jsxs("p", { className: "rounded border border-dashed px-3 py-2 text-xs text-muted-foreground", children: ["De instellingen voor de fustverzamellijst gelden bij picken per fusten of bij de gecombineerde methode. Bij picken per kar stel je de fustgegevens in bij het
|
|
211
|
+
}) })), s.type === "pickmethode" && methode === "beide" && (_jsxs("p", { className: "rounded border border-dashed px-3 py-2 text-xs text-muted-foreground", children: ["De Logistics Engine kiest per opdracht de variant: ", _jsx("span", { className: "font-medium", children: "volle kar" }), "toont de karrenindeling; ", _jsx("span", { className: "font-medium", children: "deelkar" }), " toont alleen de te verzamelen fusten. De barcode hieronder wordt alleen gevuld met de barcode uit die opdracht."] })), verzamellijstUit && (_jsxs("p", { className: "rounded border border-dashed px-3 py-2 text-xs text-muted-foreground", children: ["De instellingen voor de fustverzamellijst gelden bij picken per fusten of bij de gecombineerde methode. Bij picken per kar stel je de fustgegevens in bij het onderdeel", _jsx("span", { className: "font-medium", children: " Fusttotalen" }), "."] })), aangepasteOpties.map((o) => {
|
|
170
212
|
const isVelden = o.key === "velden";
|
|
171
213
|
const basisWaarde = s.opties?.[o.key] ?? o.standaard;
|
|
172
214
|
const waarde = isVelden && bundelAan
|
|
@@ -196,7 +238,7 @@ export function PakbonBlokKaderEditor({ sectie, onChange, }) {
|
|
|
196
238
|
const o = sectie.opties ?? {};
|
|
197
239
|
const zet = (key, waarde) => onChange({ opties: { ...o, [key]: waarde } });
|
|
198
240
|
const num = (key, fallback) => Number(o[key] ?? fallback);
|
|
199
|
-
return (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Breedte %" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_breedte", 100), onChange: (e) => zet("blok_breedte", Number(e.target.value)) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Uitlijning
|
|
241
|
+
return (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Breedte %" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_breedte", 100), onChange: (e) => zet("blok_breedte", Number(e.target.value)) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Uitlijning onderdeel" }), _jsxs(Select, { value: String(o.blok_uitlijning ?? "left"), onValueChange: (v) => zet("blok_uitlijning", v), children: [_jsx(SelectTrigger, { className: "h-8", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "left", children: "Links" }), _jsx(SelectItem, { value: "center", children: "Midden" }), _jsx(SelectItem, { value: "right", children: "Rechts" })] })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Marge boven/onder (mm)" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_marge", 0), onChange: (e) => zet("blok_marge", Number(e.target.value)) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Binnenruimte (mm)" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_padding", 0), onChange: (e) => zet("blok_padding", Number(e.target.value)) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Achtergrond" }), _jsx(Input, { className: "h-8", type: "color", value: String(o.blok_achtergrond ?? "#ffffff"), onChange: (e) => zet("blok_achtergrond", e.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Randkleur" }), _jsx(Input, { className: "h-8", type: "color", value: String(o.blok_randkleur ?? "#e5e7eb"), onChange: (e) => zet("blok_randkleur", e.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Hoekafronding (mm)" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_radius", 0), onChange: (e) => zet("blok_radius", Number(e.target.value)) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { className: "text-[10px]", children: "Tekstschaal %" }), _jsx(Input, { className: "h-8", type: "number", value: num("blok_tekstschaal", 100), onChange: (e) => zet("blok_tekstschaal", Number(e.target.value)) })] }), _jsxs("div", { className: "col-span-2 flex items-center justify-between rounded border px-3 py-2", children: [_jsx("span", { className: "text-sm", children: "Rand om onderdeel" }), _jsx(Switch, { checked: !!o.blok_rand, onCheckedChange: (v) => zet("blok_rand", v) })] })] }));
|
|
200
242
|
}
|
|
201
243
|
/** Kiest een logo uit de centrale Logo Bibliotheek voor een logo-sectie. */
|
|
202
244
|
function LogoKiezer({ logoId, onKies, }) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ProductiebonBlok, type ProductiebonConfig } from "../lib/productiebonBuilder.js";
|
|
2
|
-
/** Beheer van de
|
|
3
|
-
export declare function ProductiebonBlokkenPanel({ config, onChange, referentie, }: {
|
|
2
|
+
/** Beheer van de onderdelen waaruit de productiebon is opgebouwd. */
|
|
3
|
+
export declare function ProductiebonBlokkenPanel({ config, onChange, referentie, uit, }: {
|
|
4
4
|
config: ProductiebonConfig;
|
|
5
5
|
onChange: (c: ProductiebonConfig) => void;
|
|
6
|
-
/**
|
|
6
|
+
/** Onderdelen van de laatst actieve stand. */
|
|
7
7
|
referentie?: ProductiebonBlok[] | null;
|
|
8
|
+
uit?: boolean;
|
|
8
9
|
}): import("react").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=ProductiebonBlokkenPanel.d.ts.map
|