@flowselections/layout-maker 1.69.63 → 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/AfdrukKnop.js +64 -64
- package/dist-lib/components/AfleverbriefBuilderPage.js +1 -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/NetwerkPrintersDialog.js +79 -79
- package/dist-lib/components/PakbonBuilderPage.js +1 -1
- package/dist-lib/components/PakbonPreview.js +1 -1
- package/dist-lib/components/PakbonSectiesPanel.js +2 -2
- package/dist-lib/components/ProductiebonBuilderPage.js +1 -1
- package/dist-lib/components/VersieBewerkenPage.d.ts.map +1 -1
- package/dist-lib/components/VersieBewerkenPage.js +3 -2
- package/dist-lib/integrations/supabase/client.server.js +1 -1
- 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/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/onderdelenPerSoort.js +1 -1
- 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.map +1 -1
- package/dist-lib/lib/pakbonHtml.js +9 -4
- 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 +2 -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/vanzelfOpslaan.d.ts.map +1 -1
- package/dist-lib/lib/vanzelfOpslaan.js +9 -2
- package/dist-lib/lib/versie.generated.d.ts +1 -1
- package/dist-lib/lib/versie.generated.js +1 -1
- package/package.json +1 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// ============================================================================
|
|
3
|
-
// src/components/AfdrukKnop.tsx — afdrukken met automatisch ingesteld
|
|
4
|
-
// papierformaat, stand en de bedoelde printer. Waar mogelijk gaat het
|
|
5
|
-
// document direct naar de printer; anders opent het printvenster.
|
|
6
|
-
// ============================================================================
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { Button, toast } from "@flowselections/core";
|
|
9
|
-
import { Loader2, Printer } from "lucide-react";
|
|
10
|
-
import { drukAf } from "../lib/browserPrint.js";
|
|
11
|
-
import { printDirect } from "../lib/directPrint.js";
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated Verouderd — deze knop gebruikt het browser-printvenster als
|
|
14
|
-
* terugval. Gebruik `printHtml()` / `printPdf()` uit `printApi` zodat alles
|
|
15
|
-
* via PrintNode loopt.
|
|
16
|
-
*/
|
|
17
|
-
export function AfdrukKnop({ documenttype, formaatCode, orientatie, getHtml, css, documentnaam, label = "Afdrukken", layoutId, kopieen, }) {
|
|
18
|
-
const [bezig, setBezig] = useState(false);
|
|
19
|
-
const afdrukken = async () => {
|
|
20
|
-
setBezig(true);
|
|
21
|
-
try {
|
|
22
|
-
const html = getHtml();
|
|
23
|
-
const direct = await printDirect({
|
|
24
|
-
documenttype,
|
|
25
|
-
formaatCode,
|
|
26
|
-
orientatie,
|
|
27
|
-
html,
|
|
28
|
-
css,
|
|
29
|
-
documentnaam,
|
|
30
|
-
layoutId: layoutId ?? null,
|
|
31
|
-
kopieen,
|
|
32
|
-
});
|
|
33
|
-
if (direct.gelukt) {
|
|
34
|
-
toast.success(direct.printernaam
|
|
35
|
-
? `Verstuurd naar ${direct.printernaam}`
|
|
36
|
-
: "Het document is naar de printer verstuurd");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (direct.reden)
|
|
40
|
-
toast.error(direct.reden);
|
|
41
|
-
const { printer } = await drukAf({
|
|
42
|
-
documenttype,
|
|
43
|
-
formaatCode,
|
|
44
|
-
orientatie,
|
|
45
|
-
html,
|
|
46
|
-
css,
|
|
47
|
-
documentnaam,
|
|
48
|
-
});
|
|
49
|
-
if (printer) {
|
|
50
|
-
toast.info(`Kies in het printvenster: ${printer.systeemnaam ?? printer.naam}`);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
toast.info("Er is nog geen vaste printer ingesteld voor dit document.");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
toast.error("Afdrukken mislukt");
|
|
58
|
-
}
|
|
59
|
-
finally {
|
|
60
|
-
setBezig(false);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
return (_jsxs(Button, { variant: "outline", disabled: bezig, onClick: () => void afdrukken(), children: [bezig ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : _jsx(Printer, { className: "mr-2 h-4 w-4" }), label] }));
|
|
64
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// src/components/AfdrukKnop.tsx — afdrukken met automatisch ingesteld
|
|
4
|
+
// papierformaat, stand en de bedoelde printer. Waar mogelijk gaat het
|
|
5
|
+
// document direct naar de printer; anders opent het printvenster.
|
|
6
|
+
// ============================================================================
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Button, toast } from "@flowselections/core";
|
|
9
|
+
import { Loader2, Printer } from "lucide-react";
|
|
10
|
+
import { drukAf } from "../lib/browserPrint.js";
|
|
11
|
+
import { printDirect } from "../lib/directPrint.js";
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Verouderd — deze knop gebruikt het browser-printvenster als
|
|
14
|
+
* terugval. Gebruik `printHtml()` / `printPdf()` uit `printApi` zodat alles
|
|
15
|
+
* via PrintNode loopt.
|
|
16
|
+
*/
|
|
17
|
+
export function AfdrukKnop({ documenttype, formaatCode, orientatie, getHtml, css, documentnaam, label = "Afdrukken", layoutId, kopieen, }) {
|
|
18
|
+
const [bezig, setBezig] = useState(false);
|
|
19
|
+
const afdrukken = async () => {
|
|
20
|
+
setBezig(true);
|
|
21
|
+
try {
|
|
22
|
+
const html = getHtml();
|
|
23
|
+
const direct = await printDirect({
|
|
24
|
+
documenttype,
|
|
25
|
+
formaatCode,
|
|
26
|
+
orientatie,
|
|
27
|
+
html,
|
|
28
|
+
css,
|
|
29
|
+
documentnaam,
|
|
30
|
+
layoutId: layoutId ?? null,
|
|
31
|
+
kopieen,
|
|
32
|
+
});
|
|
33
|
+
if (direct.gelukt) {
|
|
34
|
+
toast.success(direct.printernaam
|
|
35
|
+
? `Verstuurd naar ${direct.printernaam}`
|
|
36
|
+
: "Het document is naar de printer verstuurd");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (direct.reden)
|
|
40
|
+
toast.error(direct.reden);
|
|
41
|
+
const { printer } = await drukAf({
|
|
42
|
+
documenttype,
|
|
43
|
+
formaatCode,
|
|
44
|
+
orientatie,
|
|
45
|
+
html,
|
|
46
|
+
css,
|
|
47
|
+
documentnaam,
|
|
48
|
+
});
|
|
49
|
+
if (printer) {
|
|
50
|
+
toast.info(`Kies in het printvenster: ${printer.systeemnaam ?? printer.naam}`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
toast.info("Er is nog geen vaste printer ingesteld voor dit document.");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
toast.error("Afdrukken mislukt");
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
setBezig(false);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return (_jsxs(Button, { variant: "outline", disabled: bezig, onClick: () => void afdrukken(), children: [bezig ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : _jsx(Printer, { className: "mr-2 h-4 w-4" }), label] }));
|
|
64
|
+
}
|
|
@@ -117,5 +117,5 @@ export function AfleverbriefBuilderPage({ layoutId: layoutIdProp, ingebed = fals
|
|
|
117
117
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
118
118
|
if (!layout || !config)
|
|
119
119
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
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: "
|
|
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 })] })] })] })] })] }));
|
|
121
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,79 +1,79 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// ============================================================================
|
|
3
|
-
// src/components/NetwerkPrintersDialog.tsx — printers uit het netwerk zoeken,
|
|
4
|
-
// toevoegen of koppelen aan een bestaande printer.
|
|
5
|
-
// ============================================================================
|
|
6
|
-
import { useCallback, useEffect, useState } from "react";
|
|
7
|
-
import { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, toast, } from "@flowselections/core";
|
|
8
|
-
import { Loader2, Printer, RefreshCw } from "lucide-react";
|
|
9
|
-
import { supabase } from "../lib/supabaseClient.js";
|
|
10
|
-
import { netwerkPrinters } from "../lib/printService.functions.js";
|
|
11
|
-
export function NetwerkPrintersDialog({ open, onOpenChange, huidigePrinterId, huidigePrinterNaam, onKlaar, }) {
|
|
12
|
-
const [bezig, setBezig] = useState(false);
|
|
13
|
-
const [fout, setFout] = useState(null);
|
|
14
|
-
const [lijst, setLijst] = useState([]);
|
|
15
|
-
const zoeken = useCallback(async () => {
|
|
16
|
-
setBezig(true);
|
|
17
|
-
setFout(null);
|
|
18
|
-
try {
|
|
19
|
-
const res = await netwerkPrinters({ data: undefined });
|
|
20
|
-
if (!res.ok) {
|
|
21
|
-
setFout(res.fout);
|
|
22
|
-
setLijst([]);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
setLijst(Array.isArray(res.printers) ? res.printers : []);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
setFout("Er kon niet in het netwerk worden gezocht. Probeer het zo opnieuw.");
|
|
30
|
-
}
|
|
31
|
-
finally {
|
|
32
|
-
setBezig(false);
|
|
33
|
-
}
|
|
34
|
-
}, []);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (open)
|
|
37
|
-
void zoeken();
|
|
38
|
-
}, [open, zoeken]);
|
|
39
|
-
const toevoegen = async (p) => {
|
|
40
|
-
try {
|
|
41
|
-
const { error } = await supabase.from("printers").insert({
|
|
42
|
-
naam: p.naam,
|
|
43
|
-
systeemnaam: p.naam,
|
|
44
|
-
locatie: p.computer,
|
|
45
|
-
omschrijving: p.omschrijving,
|
|
46
|
-
online: p.online,
|
|
47
|
-
actief: true,
|
|
48
|
-
extern_printer_id: p.id,
|
|
49
|
-
});
|
|
50
|
-
if (error)
|
|
51
|
-
throw error;
|
|
52
|
-
toast.success(`${p.naam} is toegevoegd`);
|
|
53
|
-
onKlaar?.();
|
|
54
|
-
onOpenChange(false);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
toast.error("Toevoegen mislukt");
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const koppelen = async (p) => {
|
|
61
|
-
if (!huidigePrinterId)
|
|
62
|
-
return;
|
|
63
|
-
try {
|
|
64
|
-
const { error } = await supabase
|
|
65
|
-
.from("printers")
|
|
66
|
-
.update({ extern_printer_id: p.id, systeemnaam: p.naam, locatie: p.computer })
|
|
67
|
-
.eq("id", huidigePrinterId);
|
|
68
|
-
if (error)
|
|
69
|
-
throw error;
|
|
70
|
-
toast.success("Printer gekoppeld");
|
|
71
|
-
onKlaar?.();
|
|
72
|
-
onOpenChange(false);
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
toast.error("Koppelen mislukt");
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Printers in het netwerk" }), _jsx(DialogDescription, { children: "Kies een printer om toe te voegen. Staat een printer er niet bij? Zet dan de computer aan waar de printer op is aangesloten." })] }), _jsxs("div", { className: "space-y-2", children: [bezig && (_jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Zoeken\u2026"] })), !bezig && fout && _jsx("p", { className: "text-destructive text-sm", children: fout }), !bezig && !fout && lijst.length === 0 && (_jsx("p", { className: "text-muted-foreground text-sm", children: "Er zijn geen printers gevonden." })), lijst.map((p) => (_jsxs("div", { className: "flex items-center gap-3 rounded-lg border p-3", children: [_jsx(Printer, { className: "text-muted-foreground h-5 w-5" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm font-medium", children: p.naam }), _jsxs("p", { className: "text-muted-foreground truncate text-xs", children: [p.computer || "Onbekende computer", " \u00B7 ", p.online ? "online" : "offline"] })] }), huidigePrinterId && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => void koppelen(p), children: ["Koppelen aan ", huidigePrinterNaam ?? "printer"] })), _jsx(Button, { size: "sm", onClick: () => void toevoegen(p), children: "Toevoegen" })] }, p.id)))] }), _jsx("div", { className: "flex justify-end", children: _jsxs(Button, { variant: "ghost", onClick: () => void zoeken(), disabled: bezig, children: [_jsx(RefreshCw, { className: "mr-2 h-4 w-4" }), " Opnieuw zoeken"] }) })] }) }));
|
|
79
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// src/components/NetwerkPrintersDialog.tsx — printers uit het netwerk zoeken,
|
|
4
|
+
// toevoegen of koppelen aan een bestaande printer.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
import { useCallback, useEffect, useState } from "react";
|
|
7
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, toast, } from "@flowselections/core";
|
|
8
|
+
import { Loader2, Printer, RefreshCw } from "lucide-react";
|
|
9
|
+
import { supabase } from "../lib/supabaseClient.js";
|
|
10
|
+
import { netwerkPrinters } from "../lib/printService.functions.js";
|
|
11
|
+
export function NetwerkPrintersDialog({ open, onOpenChange, huidigePrinterId, huidigePrinterNaam, onKlaar, }) {
|
|
12
|
+
const [bezig, setBezig] = useState(false);
|
|
13
|
+
const [fout, setFout] = useState(null);
|
|
14
|
+
const [lijst, setLijst] = useState([]);
|
|
15
|
+
const zoeken = useCallback(async () => {
|
|
16
|
+
setBezig(true);
|
|
17
|
+
setFout(null);
|
|
18
|
+
try {
|
|
19
|
+
const res = await netwerkPrinters({ data: undefined });
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
setFout(res.fout);
|
|
22
|
+
setLijst([]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
setLijst(Array.isArray(res.printers) ? res.printers : []);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
setFout("Er kon niet in het netwerk worden gezocht. Probeer het zo opnieuw.");
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
setBezig(false);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (open)
|
|
37
|
+
void zoeken();
|
|
38
|
+
}, [open, zoeken]);
|
|
39
|
+
const toevoegen = async (p) => {
|
|
40
|
+
try {
|
|
41
|
+
const { error } = await supabase.from("printers").insert({
|
|
42
|
+
naam: p.naam,
|
|
43
|
+
systeemnaam: p.naam,
|
|
44
|
+
locatie: p.computer,
|
|
45
|
+
omschrijving: p.omschrijving,
|
|
46
|
+
online: p.online,
|
|
47
|
+
actief: true,
|
|
48
|
+
extern_printer_id: p.id,
|
|
49
|
+
});
|
|
50
|
+
if (error)
|
|
51
|
+
throw error;
|
|
52
|
+
toast.success(`${p.naam} is toegevoegd`);
|
|
53
|
+
onKlaar?.();
|
|
54
|
+
onOpenChange(false);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
toast.error("Toevoegen mislukt");
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const koppelen = async (p) => {
|
|
61
|
+
if (!huidigePrinterId)
|
|
62
|
+
return;
|
|
63
|
+
try {
|
|
64
|
+
const { error } = await supabase
|
|
65
|
+
.from("printers")
|
|
66
|
+
.update({ extern_printer_id: p.id, systeemnaam: p.naam, locatie: p.computer })
|
|
67
|
+
.eq("id", huidigePrinterId);
|
|
68
|
+
if (error)
|
|
69
|
+
throw error;
|
|
70
|
+
toast.success("Printer gekoppeld");
|
|
71
|
+
onKlaar?.();
|
|
72
|
+
onOpenChange(false);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
toast.error("Koppelen mislukt");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Printers in het netwerk" }), _jsx(DialogDescription, { children: "Kies een printer om toe te voegen. Staat een printer er niet bij? Zet dan de computer aan waar de printer op is aangesloten." })] }), _jsxs("div", { className: "space-y-2", children: [bezig && (_jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Zoeken\u2026"] })), !bezig && fout && _jsx("p", { className: "text-destructive text-sm", children: fout }), !bezig && !fout && lijst.length === 0 && (_jsx("p", { className: "text-muted-foreground text-sm", children: "Er zijn geen printers gevonden." })), lijst.map((p) => (_jsxs("div", { className: "flex items-center gap-3 rounded-lg border p-3", children: [_jsx(Printer, { className: "text-muted-foreground h-5 w-5" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm font-medium", children: p.naam }), _jsxs("p", { className: "text-muted-foreground truncate text-xs", children: [p.computer || "Onbekende computer", " \u00B7 ", p.online ? "online" : "offline"] })] }), huidigePrinterId && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => void koppelen(p), children: ["Koppelen aan ", huidigePrinterNaam ?? "printer"] })), _jsx(Button, { size: "sm", onClick: () => void toevoegen(p), children: "Toevoegen" })] }, p.id)))] }), _jsx("div", { className: "flex justify-end", children: _jsxs(Button, { variant: "ghost", onClick: () => void zoeken(), disabled: bezig, children: [_jsx(RefreshCw, { className: "mr-2 h-4 w-4" }), " Opnieuw zoeken"] }) })] }) }));
|
|
79
|
+
}
|
|
@@ -122,5 +122,5 @@ export function PakbonBuilderPage({ layoutId: layoutIdProp, ingebed = false, doe
|
|
|
122
122
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
123
123
|
if (!layout || !config)
|
|
124
124
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
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: "
|
|
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 })] })] })] })] }));
|
|
126
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 }) {
|
|
@@ -208,7 +208,7 @@ export function PakbonSectieEditor({ sectie, onChange, methode = "kar", verbergT
|
|
|
208
208
|
logoId: logo?.id ?? null,
|
|
209
209
|
logoNaam: logo?.naam ?? null,
|
|
210
210
|
},
|
|
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
|
|
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) => {
|
|
212
212
|
const isVelden = o.key === "velden";
|
|
213
213
|
const basisWaarde = s.opties?.[o.key] ?? o.standaard;
|
|
214
214
|
const waarde = isVelden && bundelAan
|
|
@@ -238,7 +238,7 @@ export function PakbonBlokKaderEditor({ sectie, onChange, }) {
|
|
|
238
238
|
const o = sectie.opties ?? {};
|
|
239
239
|
const zet = (key, waarde) => onChange({ opties: { ...o, [key]: waarde } });
|
|
240
240
|
const num = (key, fallback) => Number(o[key] ?? fallback);
|
|
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
|
|
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) })] })] }));
|
|
242
242
|
}
|
|
243
243
|
/** Kiest een logo uit de centrale Logo Bibliotheek voor een logo-sectie. */
|
|
244
244
|
function LogoKiezer({ logoId, onKies, }) {
|
|
@@ -92,5 +92,5 @@ export function ProductiebonBuilderPage({ layoutId: layoutIdProp, ingebed = fals
|
|
|
92
92
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout laden\u2026" });
|
|
93
93
|
if (!layout || !config)
|
|
94
94
|
return _jsx("main", { className: "p-6 text-sm text-muted-foreground", children: "Layout niet gevonden." });
|
|
95
|
-
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: ["Productiebon opbouwen uit blokken \u00B7 ", config.blokken.length, " blokken"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [layoutId ? _jsx(LayoutPrinterSelect, { layoutId: layoutId }) : null, _jsxs(Button, { size: "sm", variant: "outline", onClick: 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"] }), _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: "productiebon" }) : 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-[
|
|
95
|
+
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: ["Productiebon opbouwen uit blokken \u00B7 ", config.blokken.length, " blokken"] })] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [layoutId ? _jsx(LayoutPrinterSelect, { layoutId: layoutId }) : null, _jsxs(Button, { size: "sm", variant: "outline", onClick: 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"] }), _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: "productiebon" }) : 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(ProductiebonBlokkenPanel, { config: config, onChange: setConfig, uit: Boolean(layout.systeem), referentie: referentieConfig === undefined ? null : leesProductiebonConfig(referentieConfig).blokken }) })] }), _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: "Voorbeeldproductieorder met samenstelling en belading." })] }), _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"] })] })), _jsx(CardContent, { className: ingebed ? "min-h-0 flex-1 overflow-hidden p-0" : "min-h-0 flex-1 overflow-hidden", children: _jsx("div", { className: "h-full overflow-hidden rounded-md border bg-muted/30 p-2", children: voorbeeldHtml ? _jsx(PrintbestandVoorbeeld, { layoutId: layout?.id ?? layoutId, sleutel: "productiebon", indeling: config, onControle: (status, fout) => { setControle(status); setControleFout(fout ?? null); } }) : null }) })] })] })] }));
|
|
96
96
|
}
|