@flowselections/layout-maker 1.69.41 → 1.69.44
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/NetwerkPrintersDialog.js +79 -79
- package/dist-lib/components/PrintplekDetailPage.d.ts.map +1 -1
- package/dist-lib/components/PrintplekDetailPage.js +21 -1
- package/dist-lib/integrations/supabase/client.server.js +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +4131 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/pakbonHtml.d.ts +5 -0
- package/dist-lib/lib/pakbonHtml.d.ts.map +1 -1
- package/dist-lib/lib/pakbonHtml.js +6 -0
- package/dist-lib/lib/printQueue.server.d.ts +5 -0
- package/dist-lib/lib/printQueue.server.d.ts.map +1 -1
- package/dist-lib/lib/printQueue.server.js +53 -1
- package/dist-lib/lib/printService.functions.d.ts +1 -1
- package/dist-lib/lib/printnodeWebhookBeheer.server.d.ts +1 -1
- package/dist-lib/lib/productiebonBuilder.d.ts +6 -0
- package/dist-lib/lib/productiebonBuilder.d.ts.map +1 -1
- package/dist-lib/lib/productiebonBuilder.js +13 -1
- package/dist-lib/lib/productiebonData.d.ts +43 -0
- package/dist-lib/lib/productiebonData.d.ts.map +1 -0
- package/dist-lib/lib/productiebonData.js +92 -0
- package/dist-lib/lib/productiebonData.server.d.ts +15 -0
- package/dist-lib/lib/productiebonData.server.d.ts.map +1 -0
- package/dist-lib/lib/productiebonData.server.js +53 -0
- package/dist-lib/lib/productiebonHtml.d.ts.map +1 -1
- package/dist-lib/lib/productiebonHtml.js +37 -1
- package/dist-lib/lib/productiebonPrinter.d.ts +11 -0
- package/dist-lib/lib/productiebonPrinter.d.ts.map +1 -0
- package/dist-lib/lib/productiebonPrinter.js +16 -0
- package/dist-lib/lib/standaardLayouts.server.d.ts.map +1 -1
- package/dist-lib/lib/standaardLayouts.server.js +25 -2
- package/dist-lib/lib/standaardenBron.d.ts.map +1 -1
- package/dist-lib/lib/standaardenBron.js +670 -3
- package/dist-lib/lib/versie.generated.d.ts +1 -1
- package/dist-lib/lib/versie.generated.js +1 -1
- package/package.json +8 -1
- package/sql/print-schema.sql +285 -2
- package/sql/print-schema.verslag.md +10 -2
|
@@ -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,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":"PrintplekDetailPage.d.ts","sourceRoot":"","sources":["../../src/components/PrintplekDetailPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PrintplekDetailPage.d.ts","sourceRoot":"","sources":["../../src/components/PrintplekDetailPage.tsx"],"names":[],"mappings":"AA4EA,wBAAgB,mBAAmB,gCAqwBlC"}
|
|
@@ -28,6 +28,7 @@ import { useRouteringOverzicht } from "../lib/printRoutering.js";
|
|
|
28
28
|
import { routeringMeldingTekst } from "../lib/waaromPrinter.js";
|
|
29
29
|
import { STATUS_ONBEKEND_TEKST, toestandVanComputer, zelfdeNaamTekst } from "../lib/computerKoppeling.js";
|
|
30
30
|
import { koppelComputerOpId } from "../lib/printService.functions.js";
|
|
31
|
+
import { productiebonStandaardTekst } from "../lib/productiebonPrinter.js";
|
|
31
32
|
const BRON_LABEL = {
|
|
32
33
|
werkplek_formaat: "Werkplek (papierformaat)",
|
|
33
34
|
werkplek_afwijking: "Werkplek (afwijking)",
|
|
@@ -161,6 +162,25 @@ export function PrintplekDetailPage() {
|
|
|
161
162
|
};
|
|
162
163
|
const computerId = (n) => computers.find((k) => k.naam === n)?.id ?? null;
|
|
163
164
|
const eigenRegel = (t) => regels.find((r) => r.print_plek_id === plekId && r.documenttype === t) ?? null;
|
|
165
|
+
// 1.69.44: productiebon zonder eigen printer → printer van deze plek met hetzelfde formaat.
|
|
166
|
+
const [pbKeuze, setPbKeuze] = useState(null);
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
let actief = true;
|
|
169
|
+
void (async () => {
|
|
170
|
+
const { data, error } = await supabase.rpc("printplek_productiebon_printer", { _plek: plekId });
|
|
171
|
+
if (!actief)
|
|
172
|
+
return;
|
|
173
|
+
if (error) {
|
|
174
|
+
console.error("[printplek] productiebon-printer bepalen mislukt", error.message);
|
|
175
|
+
setPbKeuze(null);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
setPbKeuze((data ?? null));
|
|
179
|
+
})();
|
|
180
|
+
return () => {
|
|
181
|
+
actief = false;
|
|
182
|
+
};
|
|
183
|
+
}, [plekId, regels, toegewezen]);
|
|
164
184
|
const vernieuw = async () => {
|
|
165
185
|
await reload(true);
|
|
166
186
|
await reloadRoutering();
|
|
@@ -301,7 +321,7 @@ export function PrintplekDetailPage() {
|
|
|
301
321
|
.filter((x) => x.u && (x.u.bron !== hoofd?.bron || x.u.printer_id !== hoofd?.printer_id));
|
|
302
322
|
const regel = eigenRegel(d.value);
|
|
303
323
|
return [
|
|
304
|
-
_jsxs("tr", { className: "border-b align-top", children: [_jsxs("td", { className: "py-2 pr-3 font-medium", children: [documentTypeLabel(d.value), pcNamen.length > 1 ? (_jsxs("div", { className: "text-muted-foreground text-xs font-normal", children: ["op ", rijen[0]] })) : null] }), _jsx(RouteringCellen, { u: hoofd }),
|
|
324
|
+
_jsxs("tr", { className: "border-b align-top", children: [_jsxs("td", { className: "py-2 pr-3 font-medium", children: [documentTypeLabel(d.value), pcNamen.length > 1 ? (_jsxs("div", { className: "text-muted-foreground text-xs font-normal", children: ["op ", rijen[0]] })) : null] }), _jsx(RouteringCellen, { u: hoofd }), _jsxs("td", { className: "py-2", children: [_jsxs("select", { className: selectKlasse, "aria-label": `Printer voor ${documentTypeLabel(d.value)}`, value: regel?.printer_id ?? "standaard", onChange: (e) => void zetRegel(d.value, e.target.value), children: [_jsx("option", { value: "standaard", children: "Standaard gebruiken" }), eigenPrinters.filter((p) => p.actief).map((p) => (_jsx("option", { value: p.id, children: p.naam }, p.id)))] }), d.value === "productiebon" && !regel ? (_jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: productiebonStandaardTekst(pbKeuze) })) : null] })] }, d.value),
|
|
305
325
|
...afwijkend.map((x) => (_jsxs("tr", { className: "border-b align-top", children: [_jsxs("td", { className: "text-muted-foreground py-2 pr-3 pl-4 text-xs", children: ["op ", x.pc] }), _jsx(RouteringCellen, { u: x.u }), _jsx("td", {})] }, `${d.value}-${x.pc}`))),
|
|
306
326
|
];
|
|
307
327
|
}) })] }) })) : null] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [_jsx(Link2, { className: "h-4 w-4" }), " Gekoppeld aan"] }), _jsx(CardDescription, { children: "Andere modules (bijvoorbeeld pickstations) kunnen zich aan deze printplek koppelen." })] }), _jsxs(CardContent, { className: "space-y-4", children: [bronnen.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: "Nog niets gekoppeld. Kies deze printplek in de andere module (bijvoorbeeld bij een pickstation); de koppeling verschijnt hier vanzelf." })) : (_jsx("div", { className: "space-y-2", children: bronnen.map((b) => (_jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border px-3 py-2 text-sm", children: [_jsx(Badge, { variant: "secondary", children: b.bron }), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [b.label ?? b.bron_id, _jsx("span", { className: "text-muted-foreground ml-2 text-xs", children: b.bron_id })] }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => void ontkoppel(b.bron, b.bron_id), children: [_jsx(X, { className: "mr-1 h-3.5 w-3.5" }), " Ontkoppelen"] })] }, b.id))) })), weeskoppelingen.length > 0 ? (_jsxs("div", { className: "space-y-2 rounded-lg border border-dashed p-3", children: [_jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-xs", children: [_jsx(AlertTriangle, { className: "h-3.5 w-3.5" }), " Koppelingen zonder bestaande printplek:"] }), weeskoppelingen.map((b) => (_jsxs("div", { className: "flex flex-wrap items-center gap-3 text-sm", children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: b.label ?? `${b.bron} ${b.bron_id}` }), _jsxs(Button, { variant: "ghost", size: "sm", onClick: () => void ontkoppel(b.bron, b.bron_id), children: [_jsx(Trash2, { className: "mr-1 h-3.5 w-3.5" }), " Opruimen"] })] }, b.id)))] })) : null] })] })] }));
|
|
@@ -20,7 +20,7 @@ function createSupabaseAdminClient() {
|
|
|
20
20
|
let _supabaseAdmin;
|
|
21
21
|
// Server-side Supabase client with service role - bypasses RLS
|
|
22
22
|
// SECURITY: Only use this for trusted server-side operations, never expose to client code
|
|
23
|
-
// Import like: import { supabaseAdmin } from "
|
|
23
|
+
// Import like: import { supabaseAdmin } from "./client.server.js";
|
|
24
24
|
export const supabaseAdmin = new Proxy({}, {
|
|
25
25
|
get(_, prop, receiver) {
|
|
26
26
|
if (!_supabaseAdmin)
|