@flowselections/layout-maker 1.20.1 → 1.22.0
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/README.md +139 -139
- package/dist-lib/components/PrinterSetupWizard.js +1 -1
- package/dist-lib/components/PrintersRedirectPage.d.ts +1 -1
- package/dist-lib/components/PrintersRedirectPage.js +14 -14
- package/dist-lib/components/PrintplekDetailPage.d.ts.map +1 -1
- package/dist-lib/components/PrintplekDetailPage.js +4 -2
- package/dist-lib/components/PrintplekkenPage.d.ts.map +1 -1
- package/dist-lib/components/PrintplekkenPage.js +4 -2
- package/dist-lib/components/TestprintDialog.d.ts +8 -0
- package/dist-lib/components/TestprintDialog.d.ts.map +1 -0
- package/dist-lib/components/TestprintDialog.js +93 -0
- package/dist-lib/index.d.ts +3 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +5 -3
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/lib/aiLayout.functions.d.ts.map +1 -1
- package/dist-lib/lib/aiLayout.server.js +9 -9
- package/dist-lib/lib/browserPrint.js +5 -5
- package/dist-lib/lib/layoutPreview.js +7 -7
- package/dist-lib/lib/pakbonHtml.js +50 -50
- package/dist-lib/lib/printService.functions.d.ts.map +1 -1
- package/dist-lib/lib/productiebonHtml.js +15 -15
- package/dist-lib/lib/profielHtml.js +18 -18
- package/dist-lib/lib/supabaseAdmin.server.d.ts +5 -5
- package/dist-lib/lib/supabaseAdmin.server.js +43 -43
- package/dist-lib/lib/testpagina.js +1 -1
- package/dist-lib/lib/testprint.d.ts +29 -0
- package/dist-lib/lib/testprint.d.ts.map +1 -0
- package/dist-lib/lib/testprint.js +89 -0
- package/package.json +139 -139
|
@@ -147,20 +147,20 @@ export function renderProductiebonDocument(config, gegevens, opties = {}) {
|
|
|
147
147
|
return inhoud ? `<div class="blok">${inhoud}</div>` : "";
|
|
148
148
|
})
|
|
149
149
|
.join("");
|
|
150
|
-
return `<!doctype html><html lang="nl"><head><meta charset="utf-8" />
|
|
151
|
-
<title>${esc(opties.titel ?? "Productiebon")}</title>
|
|
152
|
-
<style>
|
|
153
|
-
@page { size: ${b}mm ${h}mm; margin: ${marge}mm; }
|
|
154
|
-
* { box-sizing: border-box; }
|
|
155
|
-
html, body { margin: 0; padding: 0; }
|
|
156
|
-
body { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; color: #111827; line-height: 1.35; }
|
|
157
|
-
.blok { margin-bottom: 2.5mm; }
|
|
158
|
-
.sectitel { font-size: 90%; font-weight: 600; text-transform: uppercase; color: #6b7280; margin-bottom: 0.6mm; }
|
|
159
|
-
.vet { font-weight: 600; }
|
|
160
|
-
.kv { display: flex; justify-content: space-between; gap: 3mm; }
|
|
161
|
-
.kv .k { color: #6b7280; }
|
|
162
|
-
.tabel { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
163
|
-
.tabel th { text-align: left; font-weight: 600; }
|
|
164
|
-
.regel { padding: 0.4mm 0; }
|
|
150
|
+
return `<!doctype html><html lang="nl"><head><meta charset="utf-8" />
|
|
151
|
+
<title>${esc(opties.titel ?? "Productiebon")}</title>
|
|
152
|
+
<style>
|
|
153
|
+
@page { size: ${b}mm ${h}mm; margin: ${marge}mm; }
|
|
154
|
+
* { box-sizing: border-box; }
|
|
155
|
+
html, body { margin: 0; padding: 0; }
|
|
156
|
+
body { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; color: #111827; line-height: 1.35; }
|
|
157
|
+
.blok { margin-bottom: 2.5mm; }
|
|
158
|
+
.sectitel { font-size: 90%; font-weight: 600; text-transform: uppercase; color: #6b7280; margin-bottom: 0.6mm; }
|
|
159
|
+
.vet { font-weight: 600; }
|
|
160
|
+
.kv { display: flex; justify-content: space-between; gap: 3mm; }
|
|
161
|
+
.kv .k { color: #6b7280; }
|
|
162
|
+
.tabel { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
163
|
+
.tabel th { text-align: left; font-weight: 600; }
|
|
164
|
+
.regel { padding: 0.4mm 0; }
|
|
165
165
|
</style></head><body>${body}</body></html>`;
|
|
166
166
|
}
|
|
@@ -110,8 +110,8 @@ function regeltabel(regels) {
|
|
|
110
110
|
const eenheid = r["eenheid"] ?? "";
|
|
111
111
|
return `<tr><td>${esc(code)}</td><td>${esc(omschrijving)}</td><td style="text-align:right">${esc(aantal)}</td><td>${esc(eenheid)}</td></tr>`;
|
|
112
112
|
};
|
|
113
|
-
return `<table class="tabel"><colgroup><col style="width:20%" /><col style="width:52%" /><col style="width:16%" /><col style="width:12%" /></colgroup>
|
|
114
|
-
<thead><tr class="onder"><th>Code</th><th>Omschrijving</th><th style="text-align:right">Aantal</th><th>Eenheid</th></tr></thead>
|
|
113
|
+
return `<table class="tabel"><colgroup><col style="width:20%" /><col style="width:52%" /><col style="width:16%" /><col style="width:12%" /></colgroup>
|
|
114
|
+
<thead><tr class="onder"><th>Code</th><th>Omschrijving</th><th style="text-align:right">Aantal</th><th>Eenheid</th></tr></thead>
|
|
115
115
|
<tbody>${regels.map(rij).join("")}</tbody></table>`;
|
|
116
116
|
}
|
|
117
117
|
function totalenBlok(regels, velden) {
|
|
@@ -236,21 +236,21 @@ export function renderProfielDocument(documenttype, config, gegevens, opties = {
|
|
|
236
236
|
.map((groep) => groepHtml(groep, cfg, velden, data, opties))
|
|
237
237
|
.filter(Boolean)
|
|
238
238
|
.join("");
|
|
239
|
-
return `<!doctype html><html lang="nl"><head><meta charset="utf-8" />
|
|
240
|
-
<title>${esc(opties.titel ?? profiel.label)}</title>
|
|
241
|
-
<style>
|
|
242
|
-
@page { size: ${b}mm ${h}mm; margin: ${marge}mm; }
|
|
243
|
-
* { box-sizing: border-box; }
|
|
244
|
-
html, body { margin: 0; padding: 0; }
|
|
245
|
-
body { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; color: #111827; line-height: 1.35; }
|
|
246
|
-
.blok { margin-bottom: 2.5mm; }
|
|
247
|
-
.kop { border-bottom: 0.3mm solid #d1d5db; padding-bottom: 1mm; }
|
|
248
|
-
.sectitel { font-size: 90%; font-weight: 600; text-transform: uppercase; color: #6b7280; margin-bottom: 0.6mm; }
|
|
249
|
-
.vet { font-weight: 600; }
|
|
250
|
-
.klein { font-size: 85%; color: #6b7280; }
|
|
251
|
-
.kv { display: flex; justify-content: space-between; gap: 3mm; }
|
|
252
|
-
.kv .k { color: #6b7280; }
|
|
253
|
-
.tabel { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
254
|
-
.tabel th { text-align: left; font-weight: 600; }
|
|
239
|
+
return `<!doctype html><html lang="nl"><head><meta charset="utf-8" />
|
|
240
|
+
<title>${esc(opties.titel ?? profiel.label)}</title>
|
|
241
|
+
<style>
|
|
242
|
+
@page { size: ${b}mm ${h}mm; margin: ${marge}mm; }
|
|
243
|
+
* { box-sizing: border-box; }
|
|
244
|
+
html, body { margin: 0; padding: 0; }
|
|
245
|
+
body { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; color: #111827; line-height: 1.35; }
|
|
246
|
+
.blok { margin-bottom: 2.5mm; }
|
|
247
|
+
.kop { border-bottom: 0.3mm solid #d1d5db; padding-bottom: 1mm; }
|
|
248
|
+
.sectitel { font-size: 90%; font-weight: 600; text-transform: uppercase; color: #6b7280; margin-bottom: 0.6mm; }
|
|
249
|
+
.vet { font-weight: 600; }
|
|
250
|
+
.klein { font-size: 85%; color: #6b7280; }
|
|
251
|
+
.kv { display: flex; justify-content: space-between; gap: 3mm; }
|
|
252
|
+
.kv .k { color: #6b7280; }
|
|
253
|
+
.tabel { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
|
254
|
+
.tabel th { text-align: left; font-weight: 600; }
|
|
255
255
|
</style></head><body>${kop}${body}</body></html>`;
|
|
256
256
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
-
/** Uitleg voor de gebruiker als de serverinstellingen ontbreken. */
|
|
3
|
-
export declare function adminConfiguratieFout(): string | null;
|
|
4
|
-
/** Lazy adminclient: pas bij het eerste gebruik worden de instellingen gelezen. */
|
|
5
|
-
export declare const adminDb: SupabaseClient<any, any, any, any, any>;
|
|
1
|
+
import { type SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
/** Uitleg voor de gebruiker als de serverinstellingen ontbreken. */
|
|
3
|
+
export declare function adminConfiguratieFout(): string | null;
|
|
4
|
+
/** Lazy adminclient: pas bij het eerste gebruik worden de instellingen gelezen. */
|
|
5
|
+
export declare const adminDb: SupabaseClient<any, any, any, any, any>;
|
|
6
6
|
//# sourceMappingURL=supabaseAdmin.server.d.ts.map
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// src/lib/supabaseAdmin.server.ts — adminclient die in elke shell werkt.
|
|
3
|
-
// Leest de service-role sleutel uit meerdere mogelijke namen, zodat de module
|
|
4
|
-
// niet afhankelijk is van hoe een shell zijn omgeving heeft ingericht.
|
|
5
|
-
// ============================================================================
|
|
6
|
-
import { createClient } from "@supabase/supabase-js";
|
|
7
|
-
function lees(...namen) {
|
|
8
|
-
for (const naam of namen) {
|
|
9
|
-
const waarde = process.env[naam];
|
|
10
|
-
if (waarde && waarde.trim().length > 0)
|
|
11
|
-
return waarde.trim();
|
|
12
|
-
}
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
/** Uitleg voor de gebruiker als de serverinstellingen ontbreken. */
|
|
16
|
-
export function adminConfiguratieFout() {
|
|
17
|
-
const url = lees("SUPABASE_URL", "VITE_SUPABASE_URL");
|
|
18
|
-
const key = lees("SERVICE_ROLE_KEY", "SUPABASE_SERVICE_ROLE_KEY");
|
|
19
|
-
if (url && key)
|
|
20
|
-
return null;
|
|
21
|
-
const mist = [!url ? "SUPABASE_URL" : null, !key ? "SERVICE_ROLE_KEY" : null]
|
|
22
|
-
.filter(Boolean)
|
|
23
|
-
.join(" en ");
|
|
24
|
-
return `Achtergrondprinten is niet ingesteld: ${mist} ontbreekt in deze omgeving.`;
|
|
25
|
-
}
|
|
26
|
-
function maakClient() {
|
|
27
|
-
const url = lees("SUPABASE_URL", "VITE_SUPABASE_URL");
|
|
28
|
-
const key = lees("SERVICE_ROLE_KEY", "SUPABASE_SERVICE_ROLE_KEY");
|
|
29
|
-
if (!url || !key)
|
|
30
|
-
throw new Error(adminConfiguratieFout() ?? "Serverinstellingen ontbreken.");
|
|
31
|
-
return createClient(url, key, {
|
|
32
|
-
auth: { storage: undefined, persistSession: false, autoRefreshToken: false },
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
let _client;
|
|
36
|
-
/** Lazy adminclient: pas bij het eerste gebruik worden de instellingen gelezen. */
|
|
37
|
-
export const adminDb = new Proxy({}, {
|
|
38
|
-
get(_t, prop, receiver) {
|
|
39
|
-
if (!_client)
|
|
40
|
-
_client = maakClient();
|
|
41
|
-
return Reflect.get(_client, prop, receiver);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/supabaseAdmin.server.ts — adminclient die in elke shell werkt.
|
|
3
|
+
// Leest de service-role sleutel uit meerdere mogelijke namen, zodat de module
|
|
4
|
+
// niet afhankelijk is van hoe een shell zijn omgeving heeft ingericht.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
import { createClient } from "@supabase/supabase-js";
|
|
7
|
+
function lees(...namen) {
|
|
8
|
+
for (const naam of namen) {
|
|
9
|
+
const waarde = process.env[naam];
|
|
10
|
+
if (waarde && waarde.trim().length > 0)
|
|
11
|
+
return waarde.trim();
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Uitleg voor de gebruiker als de serverinstellingen ontbreken. */
|
|
16
|
+
export function adminConfiguratieFout() {
|
|
17
|
+
const url = lees("SUPABASE_URL", "VITE_SUPABASE_URL");
|
|
18
|
+
const key = lees("SERVICE_ROLE_KEY", "SUPABASE_SERVICE_ROLE_KEY");
|
|
19
|
+
if (url && key)
|
|
20
|
+
return null;
|
|
21
|
+
const mist = [!url ? "SUPABASE_URL" : null, !key ? "SERVICE_ROLE_KEY" : null]
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.join(" en ");
|
|
24
|
+
return `Achtergrondprinten is niet ingesteld: ${mist} ontbreekt in deze omgeving.`;
|
|
25
|
+
}
|
|
26
|
+
function maakClient() {
|
|
27
|
+
const url = lees("SUPABASE_URL", "VITE_SUPABASE_URL");
|
|
28
|
+
const key = lees("SERVICE_ROLE_KEY", "SUPABASE_SERVICE_ROLE_KEY");
|
|
29
|
+
if (!url || !key)
|
|
30
|
+
throw new Error(adminConfiguratieFout() ?? "Serverinstellingen ontbreken.");
|
|
31
|
+
return createClient(url, key, {
|
|
32
|
+
auth: { storage: undefined, persistSession: false, autoRefreshToken: false },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
let _client;
|
|
36
|
+
/** Lazy adminclient: pas bij het eerste gebruik worden de instellingen gelezen. */
|
|
37
|
+
export const adminDb = new Proxy({}, {
|
|
38
|
+
get(_t, prop, receiver) {
|
|
39
|
+
if (!_client)
|
|
40
|
+
_client = maakClient();
|
|
41
|
+
return Reflect.get(_client, prop, receiver);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { toast } from "@flowselections/core";
|
|
7
7
|
import { printDirect } from "./directPrint.js";
|
|
8
8
|
export async function drukTestpaginaAf(printerId, naam) {
|
|
9
|
-
const html = `<div style="padding:20mm;font-size:14pt"><h1 style="font-size:20pt">Testpagina</h1>
|
|
9
|
+
const html = `<div style="padding:20mm;font-size:14pt"><h1 style="font-size:20pt">Testpagina</h1>
|
|
10
10
|
<p>Deze pagina hoort uit: <strong>${naam}</strong></p></div>`;
|
|
11
11
|
const opdracht = {
|
|
12
12
|
documenttype: "pakbon",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface TestprintContext {
|
|
2
|
+
/** De printplek waarvandaan getest wordt. */
|
|
3
|
+
printplekId?: string | null;
|
|
4
|
+
/** Of de naam van de computer/werkplek. */
|
|
5
|
+
werkplek?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface TestprintRegel {
|
|
8
|
+
documenttype: string;
|
|
9
|
+
label: string;
|
|
10
|
+
printerId: string | null;
|
|
11
|
+
printerNaam: string | null;
|
|
12
|
+
/** Uitleg wanneer er geen printer gevonden is. */
|
|
13
|
+
reden: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Bepaalt voor elke documentsoort welke printer er volgens de instellingen
|
|
17
|
+
* gekozen wordt vanaf deze printplek of werkplek.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bepaalTestOverzicht(ctx: TestprintContext): Promise<TestprintRegel[]>;
|
|
20
|
+
export interface TestprintResultaat {
|
|
21
|
+
jobId: string;
|
|
22
|
+
printerId: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Verstuurt één testprint via de gewone printwachtrij, zodat exact dezelfde
|
|
26
|
+
* routering en PrintNode-afhandeling worden gebruikt als bij echte documenten.
|
|
27
|
+
*/
|
|
28
|
+
export declare function verstuurTestprint(documenttype: string, ctx: TestprintContext): Promise<TestprintResultaat>;
|
|
29
|
+
//# sourceMappingURL=testprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testprint.d.ts","sourceRoot":"","sources":["../../src/lib/testprint.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,kDAAkD;IAClD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA4B1F;AAiBD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAyC7B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/testprint.ts — controleren of élk document op de juiste printer
|
|
3
|
+
// uitkomt. Anders dan de gewone testpagina volgt een testprint de volledige
|
|
4
|
+
// beslisketen: printplek → werkplek → layout → papierformaat → PrintNode.
|
|
5
|
+
// ============================================================================
|
|
6
|
+
import { supabase } from "./supabaseClient.js";
|
|
7
|
+
import { DOCUMENT_TYPES, documentTypeLabel } from "./documentTypes.js";
|
|
8
|
+
import { printHtml, printerVoorDocumenttype } from "./printApi.js";
|
|
9
|
+
import { printplekNaam } from "./printplekken.js";
|
|
10
|
+
const arr = (v) => (Array.isArray(v) ? v : []);
|
|
11
|
+
/**
|
|
12
|
+
* Bepaalt voor elke documentsoort welke printer er volgens de instellingen
|
|
13
|
+
* gekozen wordt vanaf deze printplek of werkplek.
|
|
14
|
+
*/
|
|
15
|
+
export async function bepaalTestOverzicht(ctx) {
|
|
16
|
+
const printplekId = ctx.printplekId ?? undefined;
|
|
17
|
+
const werkplek = ctx.werkplek ?? undefined;
|
|
18
|
+
const { data } = await supabase.from("printers").select("id, naam").order("naam");
|
|
19
|
+
const namen = new Map(arr(data).map((p) => [p.id, p.naam]));
|
|
20
|
+
const regels = await Promise.all(DOCUMENT_TYPES.map(async (d) => {
|
|
21
|
+
let printerId = null;
|
|
22
|
+
try {
|
|
23
|
+
printerId = await printerVoorDocumenttype(d.value, undefined, werkplek, printplekId);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
printerId = null;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
documenttype: d.value,
|
|
30
|
+
label: d.label,
|
|
31
|
+
printerId,
|
|
32
|
+
printerNaam: printerId ? (namen.get(printerId) ?? "Printer") : null,
|
|
33
|
+
reden: printerId
|
|
34
|
+
? null
|
|
35
|
+
: "Nog geen printer ingesteld voor deze documentsoort op deze plek.",
|
|
36
|
+
};
|
|
37
|
+
}));
|
|
38
|
+
return regels;
|
|
39
|
+
}
|
|
40
|
+
/** De HTML van de testpagina: op papier zichtbaar waar hij vandaan komt. */
|
|
41
|
+
function testHtml(velden) {
|
|
42
|
+
const rijen = Object.entries(velden)
|
|
43
|
+
.map(([k, v]) => `<tr><td style="padding:2mm 6mm 2mm 0;color:#555">${k}</td><td style="padding:2mm 0;font-weight:600">${v}</td></tr>`)
|
|
44
|
+
.join("");
|
|
45
|
+
return `<div style="padding:15mm;font-family:Arial,Helvetica,sans-serif;font-size:12pt">
|
|
46
|
+
<h1 style="font-size:20pt;margin:0 0 6mm">Testprint</h1>
|
|
47
|
+
<p style="margin:0 0 6mm">Komt dit vel uit de bedoelde printer op de bedoelde plek? Dan zijn de instellingen goed.</p>
|
|
48
|
+
<table style="border-collapse:collapse;font-size:12pt">${rijen}</table>
|
|
49
|
+
</div>`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Verstuurt één testprint via de gewone printwachtrij, zodat exact dezelfde
|
|
53
|
+
* routering en PrintNode-afhandeling worden gebruikt als bij echte documenten.
|
|
54
|
+
*/
|
|
55
|
+
export async function verstuurTestprint(documenttype, ctx) {
|
|
56
|
+
const printplekId = ctx.printplekId ?? undefined;
|
|
57
|
+
const werkplek = ctx.werkplek ?? undefined;
|
|
58
|
+
const plekNaam = printplekId ? await printplekNaam(printplekId) : null;
|
|
59
|
+
const printerId = await printerVoorDocumenttype(documenttype, undefined, werkplek, printplekId);
|
|
60
|
+
if (!printerId) {
|
|
61
|
+
throw new Error(plekNaam
|
|
62
|
+
? `Geen printer voor ${documentTypeLabel(documenttype)} op ${plekNaam} — stel dit in bij deze printplek.`
|
|
63
|
+
: `Geen printer voor ${documentTypeLabel(documenttype)} — stel dit in bij Printen.`);
|
|
64
|
+
}
|
|
65
|
+
const { data } = await supabase
|
|
66
|
+
.from("printers")
|
|
67
|
+
.select("naam")
|
|
68
|
+
.eq("id", printerId)
|
|
69
|
+
.maybeSingle();
|
|
70
|
+
const printerNaam = data?.naam ?? "Printer";
|
|
71
|
+
const testId = `test-${documenttype}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
72
|
+
const html = testHtml({
|
|
73
|
+
Documentsoort: documentTypeLabel(documenttype),
|
|
74
|
+
Printplek: plekNaam ?? "—",
|
|
75
|
+
Werkplek: werkplek ?? "—",
|
|
76
|
+
Printer: printerNaam,
|
|
77
|
+
Tijdstip: new Date().toLocaleString("nl-NL"),
|
|
78
|
+
});
|
|
79
|
+
const { jobId } = await printHtml({
|
|
80
|
+
documenttype,
|
|
81
|
+
documentnaam: `Testprint ${documentTypeLabel(documenttype)}`,
|
|
82
|
+
html,
|
|
83
|
+
printerId,
|
|
84
|
+
...(printplekId ? { printplekId } : {}),
|
|
85
|
+
...(werkplek ? { werkplek } : {}),
|
|
86
|
+
payload: { test_id: testId, is_testprint: true },
|
|
87
|
+
});
|
|
88
|
+
return { jobId, printerId };
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@flowselections/layout-maker",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"flowselections": {
|
|
5
|
-
"moduleId": "layout-maker",
|
|
6
|
-
"pages": [
|
|
7
|
-
{
|
|
8
|
-
"export": "DocumentenPage",
|
|
9
|
-
"route": "layouts-printers",
|
|
10
|
-
"title": "Documenten"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"export": "WerkplekConfiguratiePage",
|
|
14
|
-
"route": "layouts-printers/printplekken/computers/$computerId",
|
|
15
|
-
"title": "Werkplek configureren"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"export": "PrintenPage",
|
|
19
|
-
"route": "layouts-printers/printplekken",
|
|
20
|
-
"title": "Printplekken"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"export": "PrintplekDetailPage",
|
|
24
|
-
"route": "layouts-printers/printplekken/$printplekId",
|
|
25
|
-
"title": "Printplek"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"export": "PrintQueuePage",
|
|
29
|
-
"route": "layouts-printers/wachtrij",
|
|
30
|
-
"title": "Printwachtrij"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"export": "PakbonBuilderPage",
|
|
34
|
-
"route": "layouts-printers/pakbon/$layoutId",
|
|
35
|
-
"title": "Pakbon opbouw"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"export": "BlokOntwerperPage",
|
|
39
|
-
"route": "layouts-printers/blokken/$layoutId",
|
|
40
|
-
"title": "Blokken ontwerpen"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"export": "ProductiebonBuilderPage",
|
|
44
|
-
"route": "layouts-printers/productiebon/$layoutId",
|
|
45
|
-
"title": "Productiebon opbouw"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"serverRoutes": [
|
|
49
|
-
{
|
|
50
|
-
"routePath": "/api/public/print/queue-tick",
|
|
51
|
-
"import": "@flowselections/layout-maker/print",
|
|
52
|
-
"handler": "behandelQueueTick",
|
|
53
|
-
"methods": [
|
|
54
|
-
"POST"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"private": false,
|
|
60
|
-
"sideEffects": false,
|
|
61
|
-
"type": "module",
|
|
62
|
-
"main": "./dist-lib/index.js",
|
|
63
|
-
"types": "./dist-lib/index.d.ts",
|
|
64
|
-
"exports": {
|
|
65
|
-
".": {
|
|
66
|
-
"types": "./dist-lib/index.d.ts",
|
|
67
|
-
"default": "./dist-lib/index.js"
|
|
68
|
-
},
|
|
69
|
-
"./print": {
|
|
70
|
-
"types": "./dist-lib/lib/queueTick.d.ts",
|
|
71
|
-
"default": "./dist-lib/lib/queueTick.js"
|
|
72
|
-
},
|
|
73
|
-
"./styles": "./dist-lib/styles.css"
|
|
74
|
-
},
|
|
75
|
-
"files": [
|
|
76
|
-
"dist-lib",
|
|
77
|
-
"public"
|
|
78
|
-
],
|
|
79
|
-
"publishConfig": {
|
|
80
|
-
"access": "public"
|
|
81
|
-
},
|
|
82
|
-
"scripts": {
|
|
83
|
-
"dev": "vite dev",
|
|
84
|
-
"build": "vite build",
|
|
85
|
-
"build:lib": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && node -e \"require('fs').writeFileSync('dist-lib/styles.css', '@source \\\"./\\\";\\n')\"",
|
|
86
|
-
"build:lib:watch": "tsc -p tsconfig.build.json --watch",
|
|
87
|
-
"build:dev": "vite build --mode development",
|
|
88
|
-
"preview": "vite preview",
|
|
89
|
-
"lint": "eslint ."
|
|
90
|
-
},
|
|
91
|
-
"peerDependencies": {
|
|
92
|
-
"@flowselections/core": "*",
|
|
93
|
-
"@tanstack/react-query": "^5.0.0",
|
|
94
|
-
"@tanstack/react-router": "^1.0.0",
|
|
95
|
-
"@tanstack/react-start": "^1.0.0",
|
|
96
|
-
"lucide-react": "^0.400.0",
|
|
97
|
-
"react": "^18 || ^19",
|
|
98
|
-
"react-dom": "^18 || ^19",
|
|
99
|
-
"sonner": "^2.0.0"
|
|
100
|
-
},
|
|
101
|
-
"dependencies": {
|
|
102
|
-
"@supabase/supabase-js": "^2.111.0",
|
|
103
|
-
"html2canvas": "^1.4.1",
|
|
104
|
-
"jspdf": "^4.2.1",
|
|
105
|
-
"pdf-lib": "^1.17.1"
|
|
106
|
-
},
|
|
107
|
-
"devDependencies": {
|
|
108
|
-
"@cloudflare/vite-plugin": "^1.25.5",
|
|
109
|
-
"@eslint/js": "^9.32.0",
|
|
110
|
-
"@flowselections/core": "1.0.18",
|
|
111
|
-
"@lovable.dev/vite-tanstack-config": "2.13.1",
|
|
112
|
-
"@rsbuild/core": "^1.0.0",
|
|
113
|
-
"@tailwindcss/vite": "^4.2.1",
|
|
114
|
-
"@tanstack/react-query": "^5.83.0",
|
|
115
|
-
"@tanstack/react-router": "^1.168.0",
|
|
116
|
-
"@tanstack/react-start": "^1.167.14",
|
|
117
|
-
"@tanstack/router-plugin": "^1.167.10",
|
|
118
|
-
"@types/node": "^22.16.5",
|
|
119
|
-
"@types/react": "^19.2.0",
|
|
120
|
-
"@types/react-dom": "^19.2.0",
|
|
121
|
-
"@vitejs/plugin-react": "^5.0.4",
|
|
122
|
-
"eslint": "^9.32.0",
|
|
123
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
124
|
-
"eslint-plugin-react-refresh": "^0.4.20",
|
|
125
|
-
"globals": "^15.15.0",
|
|
126
|
-
"lucide-react": "^0.575.0",
|
|
127
|
-
"react": "^19.2.0",
|
|
128
|
-
"react-dom": "^19.2.0",
|
|
129
|
-
"sonner": "^2.0.7",
|
|
130
|
-
"tailwindcss": "^4.2.1",
|
|
131
|
-
"tw-animate-css": "^1.3.4",
|
|
132
|
-
"typescript": "^5.8.3",
|
|
133
|
-
"tsc-alias": "^1.8.10",
|
|
134
|
-
"typescript-eslint": "^8.56.1",
|
|
135
|
-
"vite": "^7.3.1",
|
|
136
|
-
"vite-tsconfig-paths": "^6.0.2",
|
|
137
|
-
"nitro": "3.0.260603-beta"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowselections/layout-maker",
|
|
3
|
+
"version": "1.22.0",
|
|
4
|
+
"flowselections": {
|
|
5
|
+
"moduleId": "layout-maker",
|
|
6
|
+
"pages": [
|
|
7
|
+
{
|
|
8
|
+
"export": "DocumentenPage",
|
|
9
|
+
"route": "layouts-printers/documenten",
|
|
10
|
+
"title": "Documenten"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"export": "WerkplekConfiguratiePage",
|
|
14
|
+
"route": "layouts-printers/printplekken/computers/$computerId",
|
|
15
|
+
"title": "Werkplek configureren"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"export": "PrintenPage",
|
|
19
|
+
"route": "layouts-printers/printplekken",
|
|
20
|
+
"title": "Printplekken"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"export": "PrintplekDetailPage",
|
|
24
|
+
"route": "layouts-printers/printplekken/$printplekId",
|
|
25
|
+
"title": "Printplek"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"export": "PrintQueuePage",
|
|
29
|
+
"route": "layouts-printers/wachtrij",
|
|
30
|
+
"title": "Printwachtrij"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"export": "PakbonBuilderPage",
|
|
34
|
+
"route": "layouts-printers/pakbon/$layoutId",
|
|
35
|
+
"title": "Pakbon opbouw"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"export": "BlokOntwerperPage",
|
|
39
|
+
"route": "layouts-printers/blokken/$layoutId",
|
|
40
|
+
"title": "Blokken ontwerpen"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"export": "ProductiebonBuilderPage",
|
|
44
|
+
"route": "layouts-printers/productiebon/$layoutId",
|
|
45
|
+
"title": "Productiebon opbouw"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"serverRoutes": [
|
|
49
|
+
{
|
|
50
|
+
"routePath": "/api/public/print/queue-tick",
|
|
51
|
+
"import": "@flowselections/layout-maker/print",
|
|
52
|
+
"handler": "behandelQueueTick",
|
|
53
|
+
"methods": [
|
|
54
|
+
"POST"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"private": false,
|
|
60
|
+
"sideEffects": false,
|
|
61
|
+
"type": "module",
|
|
62
|
+
"main": "./dist-lib/index.js",
|
|
63
|
+
"types": "./dist-lib/index.d.ts",
|
|
64
|
+
"exports": {
|
|
65
|
+
".": {
|
|
66
|
+
"types": "./dist-lib/index.d.ts",
|
|
67
|
+
"default": "./dist-lib/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./print": {
|
|
70
|
+
"types": "./dist-lib/lib/queueTick.d.ts",
|
|
71
|
+
"default": "./dist-lib/lib/queueTick.js"
|
|
72
|
+
},
|
|
73
|
+
"./styles": "./dist-lib/styles.css"
|
|
74
|
+
},
|
|
75
|
+
"files": [
|
|
76
|
+
"dist-lib",
|
|
77
|
+
"public"
|
|
78
|
+
],
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public"
|
|
81
|
+
},
|
|
82
|
+
"scripts": {
|
|
83
|
+
"dev": "vite dev",
|
|
84
|
+
"build": "vite build",
|
|
85
|
+
"build:lib": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && node -e \"require('fs').writeFileSync('dist-lib/styles.css', '@source \\\"./\\\";\\n')\"",
|
|
86
|
+
"build:lib:watch": "tsc -p tsconfig.build.json --watch",
|
|
87
|
+
"build:dev": "vite build --mode development",
|
|
88
|
+
"preview": "vite preview",
|
|
89
|
+
"lint": "eslint ."
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"@flowselections/core": "*",
|
|
93
|
+
"@tanstack/react-query": "^5.0.0",
|
|
94
|
+
"@tanstack/react-router": "^1.0.0",
|
|
95
|
+
"@tanstack/react-start": "^1.0.0",
|
|
96
|
+
"lucide-react": "^0.400.0",
|
|
97
|
+
"react": "^18 || ^19",
|
|
98
|
+
"react-dom": "^18 || ^19",
|
|
99
|
+
"sonner": "^2.0.0"
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"@supabase/supabase-js": "^2.111.0",
|
|
103
|
+
"html2canvas": "^1.4.1",
|
|
104
|
+
"jspdf": "^4.2.1",
|
|
105
|
+
"pdf-lib": "^1.17.1"
|
|
106
|
+
},
|
|
107
|
+
"devDependencies": {
|
|
108
|
+
"@cloudflare/vite-plugin": "^1.25.5",
|
|
109
|
+
"@eslint/js": "^9.32.0",
|
|
110
|
+
"@flowselections/core": "1.0.18",
|
|
111
|
+
"@lovable.dev/vite-tanstack-config": "2.13.1",
|
|
112
|
+
"@rsbuild/core": "^1.0.0",
|
|
113
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
114
|
+
"@tanstack/react-query": "^5.83.0",
|
|
115
|
+
"@tanstack/react-router": "^1.168.0",
|
|
116
|
+
"@tanstack/react-start": "^1.167.14",
|
|
117
|
+
"@tanstack/router-plugin": "^1.167.10",
|
|
118
|
+
"@types/node": "^22.16.5",
|
|
119
|
+
"@types/react": "^19.2.0",
|
|
120
|
+
"@types/react-dom": "^19.2.0",
|
|
121
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
122
|
+
"eslint": "^9.32.0",
|
|
123
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
124
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
125
|
+
"globals": "^15.15.0",
|
|
126
|
+
"lucide-react": "^0.575.0",
|
|
127
|
+
"react": "^19.2.0",
|
|
128
|
+
"react-dom": "^19.2.0",
|
|
129
|
+
"sonner": "^2.0.7",
|
|
130
|
+
"tailwindcss": "^4.2.1",
|
|
131
|
+
"tw-animate-css": "^1.3.4",
|
|
132
|
+
"typescript": "^5.8.3",
|
|
133
|
+
"tsc-alias": "^1.8.10",
|
|
134
|
+
"typescript-eslint": "^8.56.1",
|
|
135
|
+
"vite": "^7.3.1",
|
|
136
|
+
"vite-tsconfig-paths": "^6.0.2",
|
|
137
|
+
"nitro": "3.0.260603-beta"
|
|
138
|
+
}
|
|
139
|
+
}
|