@flowselections/layout-maker 1.69.62 → 1.69.63
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.d.ts.map +1 -1
- package/dist-lib/components/AfleverbriefBuilderPage.js +2 -1
- package/dist-lib/components/NetwerkPrintersDialog.js +79 -79
- package/dist-lib/components/PakbonBuilderPage.d.ts.map +1 -1
- package/dist-lib/components/PakbonBuilderPage.js +2 -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 +93 -51
- 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 +28 -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/client.server.js +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/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/pakbonHtml.d.ts +2 -0
- package/dist-lib/lib/pakbonHtml.d.ts.map +1 -1
- package/dist-lib/lib/pakbonHtml.js +21 -9
- package/dist-lib/lib/productiebonHtml.d.ts.map +1 -1
- package/dist-lib/lib/productiebonHtml.js +3 -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 +61 -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,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
|
+
}
|
|
@@ -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: "Blokken 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-[
|
|
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: "Blokken 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-[17rem_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: "Secties" }), _jsx(CardDescription, { children: "Voeg blokken toe, wijzig de volgorde en stel elk blok 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: "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
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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: "Blokken 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-[
|
|
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: "Blokken 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-[17rem_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: "Secties" }), _jsx(CardDescription, { children: "Voeg blokken toe, wijzig de volgorde en stel elk blok 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: "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: "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
|
}
|
|
@@ -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"}
|