@flowselections/floriday-klanten-module 1.0.104 → 1.0.105
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/klanten/CustomerAssortmentTab.d.ts +3 -1
- package/dist-lib/components/klanten/CustomerAssortmentTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/CustomerAssortmentTab.js +37 -9
- package/dist-lib/components/klanten/CustomerStickerCell.d.ts +6 -1
- package/dist-lib/components/klanten/CustomerStickerCell.d.ts.map +1 -1
- package/dist-lib/components/klanten/CustomerStickerCell.js +4 -3
- package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetail.js +11 -1
- package/dist-lib/components/klanten/StickerSizeLine.d.ts +6 -1
- package/dist-lib/components/klanten/StickerSizeLine.d.ts.map +1 -1
- package/dist-lib/components/klanten/StickerSizeLine.js +9 -3
- package/dist-lib/integrations/supabase/types.d.ts +211 -1
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/customer-stickers.functions.d.ts +6 -0
- package/dist-lib/lib/customer-stickers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customer-stickers.functions.js +54 -0
- package/package.json +7 -1
- package/schema/klanten.sql +103 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export declare function CustomerAssortmentTab({ customerKey, organizationId, customerId, }: {
|
|
1
|
+
export declare function CustomerAssortmentTab({ customerKey, organizationId, customerId, focusProduct, }: {
|
|
2
2
|
customerKey: string;
|
|
3
3
|
organizationId?: string | null;
|
|
4
4
|
/** Optioneel: klant-id; nodig voor klantartikelcodes. */
|
|
5
5
|
customerId?: string | null;
|
|
6
|
+
/** Optioneel: artikel (product-id of Floriday-id) om direct te tonen, bv. vanuit Verkoop. */
|
|
7
|
+
focusProduct?: string | null;
|
|
6
8
|
}): import("react").JSX.Element;
|
|
7
9
|
//# sourceMappingURL=CustomerAssortmentTab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerAssortmentTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/CustomerAssortmentTab.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,EACd,UAAU,
|
|
1
|
+
{"version":3,"file":"CustomerAssortmentTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/CustomerAssortmentTab.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,cAAc,EACd,UAAU,EACV,YAAmB,GACpB,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,6FAA6F;IAC7F,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,+BA+bA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { formatDateTime } from "../../lib/format-date.js";
|
|
4
4
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { useServerFn } from "@tanstack/react-start";
|
|
@@ -24,7 +24,7 @@ function money(value, currency) {
|
|
|
24
24
|
return "—";
|
|
25
25
|
return formatMoney(value, currency);
|
|
26
26
|
}
|
|
27
|
-
export function CustomerAssortmentTab({ customerKey, organizationId, customerId, }) {
|
|
27
|
+
export function CustomerAssortmentTab({ customerKey, organizationId, customerId, focusProduct = null, }) {
|
|
28
28
|
const list = useServerFn(listCustomerAssortment);
|
|
29
29
|
const listStickers = useServerFn(listCustomerStickers);
|
|
30
30
|
const importStickers = useServerFn(importFloridayStickers);
|
|
@@ -70,6 +70,16 @@ export function CustomerAssortmentTab({ customerKey, organizationId, customerId,
|
|
|
70
70
|
return m;
|
|
71
71
|
}, [fustData]);
|
|
72
72
|
const fustFormat = fustData?.format ?? null;
|
|
73
|
+
// Stickers staan onder products.id; oude rijen nog onder het Floriday-id (regelsleutel).
|
|
74
|
+
const zoekSticker = (m, i) => {
|
|
75
|
+
for (const id of i.product_ids ?? []) {
|
|
76
|
+
const s = m.get(id);
|
|
77
|
+
if (s)
|
|
78
|
+
return s;
|
|
79
|
+
}
|
|
80
|
+
return m.get(i.key) ?? null;
|
|
81
|
+
};
|
|
82
|
+
const stickerSleutel = (i) => i.product_id ?? i.key;
|
|
73
83
|
const items = Array.isArray(data?.items) ? data.items : [];
|
|
74
84
|
const bronLabel = data?.bron === "voorraad" ? "Bron: voorraad" : "Bron: Floriday";
|
|
75
85
|
const ownCount = items.filter((i) => i.in_assortment).length;
|
|
@@ -91,6 +101,24 @@ export function CustomerAssortmentTab({ customerKey, organizationId, customerId,
|
|
|
91
101
|
},
|
|
92
102
|
onError: (e) => toast.error(friendlyError(e, "Ophalen uit Floriday mislukt")),
|
|
93
103
|
});
|
|
104
|
+
// Vanuit Verkoop ("Sticker toevoegen"): het gevraagde artikel zoeken, tonen en markeren.
|
|
105
|
+
const [focusKey, setFocusKey] = useState(null);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (!focusProduct || focusKey || items.length === 0)
|
|
108
|
+
return;
|
|
109
|
+
const hit = items.find((i) => i.key === focusProduct || (i.product_ids ?? []).includes(focusProduct));
|
|
110
|
+
if (!hit) {
|
|
111
|
+
toast.error("Dit artikel staat niet in het assortiment van deze klant.");
|
|
112
|
+
setFocusKey("-");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setGroup(hit.in_assortment ? "own" : "other");
|
|
116
|
+
setOnlyPriced(false);
|
|
117
|
+
setOnlyWithoutSticker(false);
|
|
118
|
+
setSearch(hit.name);
|
|
119
|
+
setFocusKey(hit.key);
|
|
120
|
+
requestAnimationFrame(() => document.getElementById(`assortiment-${hit.key}`)?.scrollIntoView({ block: "center" }));
|
|
121
|
+
}, [focusProduct, focusKey, items]);
|
|
94
122
|
const filtered = useMemo(() => {
|
|
95
123
|
const q = search.trim().toLowerCase();
|
|
96
124
|
return items.filter((i) => {
|
|
@@ -126,14 +154,14 @@ export function CustomerAssortmentTab({ customerKey, organizationId, customerId,
|
|
|
126
154
|
? ` (${pg.calc_type === "surcharge" ? "toeslag" : "korting"} ${pg.calc_value}${pg.calc_value_type === "percentage" ? "%" : ` ${currency}`})`
|
|
127
155
|
: ""] })) : (_jsx("span", { className: "text-warning-soft-foreground", children: "Geen prijsgroep ingesteld voor deze klant" })), data?.summary.last_synced_at && (_jsxs("span", { children: ["laatste sync: ", formatDateTime(data.summary.last_synced_at)] }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [_jsxs("span", { children: ["Formaat productsticker:", " ", _jsx("strong", { className: "text-foreground", children: defaultFormat
|
|
128
156
|
? `${defaultFormat.width_mm} × ${defaultFormat.height_mm} mm`
|
|
129
|
-
: "—" })] }), _jsx(CustomerStickerFormatDialog, { customerKey: customerKey, format: defaultFormat }), _jsxs("span", { children: ["Formaat fuststicker:", " ", _jsx("strong", { className: "text-foreground", children: fustFormat ? `${fustFormat.width_mm} × ${fustFormat.height_mm} mm` : "—" })] }), _jsx(CustomerStickerFormatDialog, { customerKey: customerKey, format: fustFormat, soort: "fust" }), _jsxs("span", { children: [_jsx("strong", { className: "text-foreground", children: stickerMap.size }), " artikelen met productsticker", " · ", _jsx("strong", { className: "text-foreground", children: fustMap.size }), " met fuststicker"] }), _jsx(BulkStickerUploadDialog, { customerKey: customerKey, products: items.map((i) => ({
|
|
130
|
-
key: i
|
|
157
|
+
: "—" })] }), _jsx(CustomerStickerFormatDialog, { customerKey: customerKey, format: defaultFormat, trigger: _jsx(Button, { type: "button", variant: "link", size: "sm", className: "h-auto p-0 text-xs", children: "wijzigen" }) }), _jsxs("span", { children: ["Formaat fuststicker:", " ", _jsx("strong", { className: "text-foreground", children: fustFormat ? `${fustFormat.width_mm} × ${fustFormat.height_mm} mm` : "—" })] }), _jsx(CustomerStickerFormatDialog, { customerKey: customerKey, format: fustFormat, soort: "fust", trigger: _jsx(Button, { type: "button", variant: "link", size: "sm", className: "h-auto p-0 text-xs", children: "wijzigen" }) }), _jsxs("span", { children: [_jsx("strong", { className: "text-foreground", children: stickerMap.size }), " artikelen met productsticker", " · ", _jsx("strong", { className: "text-foreground", children: fustMap.size }), " met fuststicker"] }), _jsx(BulkStickerUploadDialog, { customerKey: customerKey, products: items.map((i) => ({
|
|
158
|
+
key: stickerSleutel(i),
|
|
131
159
|
name: i.name,
|
|
132
160
|
code: i.supplier_article_code,
|
|
133
161
|
vbn: i.vbn_code,
|
|
134
162
|
botanical: i.botanical_name,
|
|
135
|
-
hasSticker: stickerMap
|
|
136
|
-
hasFustSticker: fustMap
|
|
163
|
+
hasSticker: !!zoekSticker(stickerMap, i),
|
|
164
|
+
hasFustSticker: !!zoekSticker(fustMap, i),
|
|
137
165
|
})), soortKiezen: true, onDone: () => qc.invalidateQueries({ queryKey: ["customer-stickers", customerKey] }) }), _jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: floridayImport.isPending, onClick: () => floridayImport.mutate(), children: [_jsx(RefreshCw, { className: "h-4 w-4 mr-1.5 " + (floridayImport.isPending ? "animate-spin" : "") }), "Stickers ophalen uit Floriday"] })] }), hasOwnAssortment && (_jsx("div", { className: "flex flex-wrap items-center gap-2", children: _jsx("div", { className: "inline-flex rounded-lg border p-0.5", children: [
|
|
138
166
|
["own", `Eigen assortiment (${ownCount})`],
|
|
139
167
|
["other", `Overige producten (${otherCount})`],
|
|
@@ -152,14 +180,14 @@ export function CustomerAssortmentTab({ customerKey, organizationId, customerId,
|
|
|
152
180
|
i.packages_per_layer != null ? `${i.packages_per_layer} per laag` : null,
|
|
153
181
|
i.layers_per_carrier != null ? `${i.layers_per_carrier} lagen` : null,
|
|
154
182
|
].filter(Boolean);
|
|
155
|
-
const sticker = stickerMap
|
|
183
|
+
const sticker = zoekSticker(stickerMap, i);
|
|
156
184
|
const fmt = sticker?.width_mm != null && sticker?.height_mm != null
|
|
157
185
|
? `${sticker.width_mm} × ${sticker.height_mm} mm`
|
|
158
186
|
: defaultFormat
|
|
159
187
|
? `${defaultFormat.width_mm} × ${defaultFormat.height_mm} mm`
|
|
160
188
|
: null;
|
|
161
189
|
const alias = kiesAlias(aliases ?? [], i.product_ids ?? []);
|
|
162
|
-
return (_jsxs(TableRow, { className: customerId && i.product_id ? "cursor-pointer" : undefined, title: customerId && !i.product_id ? "Dit artikel staat nog niet in de voorraad" : undefined, onClick: (e) => {
|
|
190
|
+
return (_jsxs(TableRow, { id: `assortiment-${i.key}`, "data-state": focusKey === i.key ? "selected" : undefined, className: customerId && i.product_id ? "cursor-pointer" : undefined, title: customerId && !i.product_id ? "Dit artikel staat nog niet in de voorraad" : undefined, onClick: (e) => {
|
|
163
191
|
if (!customerId || !i.product_id)
|
|
164
192
|
return;
|
|
165
193
|
if (e.target.closest("button, a, input, label, select, textarea, [role='dialog']"))
|
|
@@ -172,7 +200,7 @@ export function CustomerAssortmentTab({ customerKey, organizationId, customerId,
|
|
|
172
200
|
i.country_of_origin,
|
|
173
201
|
alias?.customer_article_code ? `Klantcode: ${alias.customer_article_code}` : null,
|
|
174
202
|
alias?.customer_article_name ? `Klantnaam: ${alias.customer_article_name}` : null,
|
|
175
|
-
].filter(Boolean).join(" · ") || "—" })] }), hasOwnAssortment && (_jsx(TableCell, { children: i.in_assortment ? (_jsx(Badge, { children: "Eigen assortiment" })) : (_jsx("span", { className: "text-xs text-muted-foreground", children: "Overig" })) })), _jsxs(TableCell, { className: "text-sm text-muted-foreground", children: [_jsx("div", { children: i.packaging ?? "—" }), packing.length > 0 && (_jsx("div", { className: "text-xs", children: packing.join(" · ") }))] }), _jsx(TableCell, { className: "text-right whitespace-nowrap tabular-nums text-muted-foreground", children: money(i.base_price, i.currency) }), _jsxs(TableCell, { className: "text-right whitespace-nowrap tabular-nums", children: [_jsx("div", { className: "font-medium", children: money(i.price, i.currency) }), i.base_price_source && (_jsx("div", { className: "text-[10px] text-muted-foreground", children: i.base_price_source }))] }), _jsx(TableCell, { children: _jsxs("div", { className: "space-y-1", children: [_jsx(CustomerStickerCell, { customerKey: customerKey, tradeItemKey: i
|
|
203
|
+
].filter(Boolean).join(" · ") || "—" })] }), hasOwnAssortment && (_jsx(TableCell, { children: i.in_assortment ? (_jsx(Badge, { children: "Eigen assortiment" })) : (_jsx("span", { className: "text-xs text-muted-foreground", children: "Overig" })) })), _jsxs(TableCell, { className: "text-sm text-muted-foreground", children: [_jsx("div", { children: i.packaging ?? "—" }), packing.length > 0 && (_jsx("div", { className: "text-xs", children: packing.join(" · ") }))] }), _jsx(TableCell, { className: "text-right whitespace-nowrap tabular-nums text-muted-foreground", children: money(i.base_price, i.currency) }), _jsxs(TableCell, { className: "text-right whitespace-nowrap tabular-nums", children: [_jsx("div", { className: "font-medium", children: money(i.price, i.currency) }), i.base_price_source && (_jsx("div", { className: "text-[10px] text-muted-foreground", children: i.base_price_source }))] }), _jsx(TableCell, { children: _jsxs("div", { className: "space-y-1", children: [_jsx(CustomerStickerCell, { customerKey: customerKey, tradeItemKey: stickerSleutel(i), sticker: sticker, standaard: defaultFormat }), sticker ? (_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [_jsx(Badge, { variant: sticker.source === "floriday" ? "default" : "secondary", children: sticker.source === "floriday" ? "Uit Floriday" : "Handmatig" }), fmt && _jsx("span", { children: fmt })] })) : _jsx("div", { className: "text-[10px] text-muted-foreground", children: "\u2014" })] }) }), _jsx(TableCell, { children: _jsx(CustomerStickerCell, { customerKey: customerKey, tradeItemKey: stickerSleutel(i), sticker: zoekSticker(fustMap, i), soort: "fust", standaard: fustFormat }) })] }, i.key));
|
|
176
204
|
}) })] }) }) }), customerId && (_jsx(CustomerArticleAliasDialog, { customerId: customerId, artikel: aliasArtikel, onOpenChange: (o) => { if (!o)
|
|
177
205
|
setAliasArtikel(null); } }))] }));
|
|
178
206
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type CustomerSticker } from "../../lib/customer-stickers.functions.js";
|
|
2
2
|
import { type StickerSoort } from "../../lib/sticker-soort.js";
|
|
3
|
-
export declare function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort, }: {
|
|
3
|
+
export declare function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort, standaard, }: {
|
|
4
|
+
/** Standaardformaat van de klant voor deze soort. */
|
|
5
|
+
standaard?: {
|
|
6
|
+
width_mm: number;
|
|
7
|
+
height_mm: number;
|
|
8
|
+
} | null;
|
|
4
9
|
customerKey: string;
|
|
5
10
|
tradeItemKey: string;
|
|
6
11
|
sticker: CustomerSticker | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerStickerCell.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/CustomerStickerCell.tsx"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAiBxE,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAiB,
|
|
1
|
+
{"version":3,"file":"CustomerStickerCell.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/CustomerStickerCell.tsx"],"names":[],"mappings":"AASA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAiBxE,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,YAAY,EACZ,OAAO,EACP,KAAiB,EACjB,SAAgB,GACjB,EAAE;IACD,qDAAqD;IACrD,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,4DAA4D;IAC5D,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,+BA+LA"}
|
|
@@ -20,7 +20,7 @@ function extOf(name) {
|
|
|
20
20
|
function safeKey(value) {
|
|
21
21
|
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
22
22
|
}
|
|
23
|
-
export function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort = "product", }) {
|
|
23
|
+
export function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort = "product", standaard = null, }) {
|
|
24
24
|
const qc = useQueryClient();
|
|
25
25
|
const confirm = useServerFn(confirmStickerUpload);
|
|
26
26
|
const remove = useServerFn(deleteCustomerSticker);
|
|
@@ -54,6 +54,7 @@ export function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort
|
|
|
54
54
|
data: {
|
|
55
55
|
customerKey,
|
|
56
56
|
tradeItemKey,
|
|
57
|
+
oudeSleutel: sticker && sticker.trade_item_key !== tradeItemKey ? sticker.trade_item_key : null,
|
|
57
58
|
filePath: path,
|
|
58
59
|
fileName: file.name,
|
|
59
60
|
mimeType: type,
|
|
@@ -76,7 +77,7 @@ export function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort
|
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
const del = useMutation({
|
|
79
|
-
mutationFn: () => remove({ data: { customerKey, tradeItemKey, soort } }),
|
|
80
|
+
mutationFn: () => remove({ data: { customerKey, tradeItemKey: sticker?.trade_item_key ?? tradeItemKey, soort } }),
|
|
80
81
|
onSuccess: () => {
|
|
81
82
|
invalidate();
|
|
82
83
|
toast.success("Sticker verwijderd");
|
|
@@ -94,5 +95,5 @@ export function CustomerStickerCell({ customerKey, tradeItemKey, sticker, soort
|
|
|
94
95
|
: "Formaat nog onbekend" })] })] })) : (_jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: busy, onClick: () => inputRef.current?.click(), children: [_jsx(Upload, { className: "h-4 w-4 mr-1.5" }), "Uploaden"] })), _jsx(Dialog, { open: open, onOpenChange: (o) => { setOpen(o); if (!o)
|
|
95
96
|
setLastDet(null); }, children: _jsxs(DialogContent, { className: "max-w-md", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Sticker" }) }), sticker && (_jsxs("div", { className: "space-y-3", children: [isImage && sticker.url ? (_jsx("img", { src: sticker.url, alt: sticker.file_name, className: "max-h-64 w-full rounded border object-contain bg-muted" })) : (_jsxs("div", { className: "rounded border bg-muted p-6 flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [_jsx(FileText, { className: "h-5 w-5" }), sticker.file_name] })), _jsxs("p", { className: "text-xs text-muted-foreground", children: [sticker.file_name, sticker.file_size != null
|
|
96
97
|
? ` · ${(sticker.file_size / 1024).toFixed(0)} kB`
|
|
97
|
-
: ""] }), _jsx(StickerSizeLine, { customerKey: customerKey, tradeItemKey:
|
|
98
|
+
: ""] }), _jsx(StickerSizeLine, { customerKey: customerKey, tradeItemKey: sticker.trade_item_key, soort: soort, widthMm: sticker.width_mm, heightMm: sticker.height_mm, initialDetection: lastDet, standaard: standaard, onSaved: invalidate }, sticker.file_path)] })), _jsxs(DialogFooter, { className: "gap-2 sm:justify-between", children: [_jsxs(Button, { type: "button", variant: "destructive", disabled: del.isPending || busy, onClick: () => del.mutate(), children: [_jsx(Trash2, { className: "h-4 w-4 mr-1.5" }), "Verwijderen"] }), _jsxs("div", { className: "flex gap-2", children: [sticker?.url && (_jsx(Button, { type: "button", variant: "outline", asChild: true, children: _jsxs("a", { href: sticker.url, target: "_blank", rel: "noreferrer", children: [_jsx(Eye, { className: "h-4 w-4 mr-1.5" }), "Bekijken"] }) })), _jsxs(Button, { type: "button", disabled: busy, onClick: () => inputRef.current?.click(), children: [_jsx(RefreshCw, { className: "h-4 w-4 mr-1.5" }), "Vervangen"] })] })] })] }) })] }));
|
|
98
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"AAqDA,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+
|
|
1
|
+
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"AAqDA,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+BAobjD"}
|
|
@@ -46,6 +46,16 @@ export function KlantDetail({ id }) {
|
|
|
46
46
|
const getNote = useServerFn(getCustomerNote);
|
|
47
47
|
const saveNote = useServerFn(upsertCustomerNote);
|
|
48
48
|
const [tab, setTab] = useState("overview");
|
|
49
|
+
// Diepe link (bv. Verkoop "Sticker toevoegen"): ?tab=assortiment&product=<product-id>.
|
|
50
|
+
const [focusProduct, setFocusProduct] = useState(null);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const q = new URLSearchParams(window.location.search);
|
|
53
|
+
if (q.get("tab") === "assortiment")
|
|
54
|
+
setTab("assortment");
|
|
55
|
+
const p = q.get("product");
|
|
56
|
+
if (p)
|
|
57
|
+
setFocusProduct(p);
|
|
58
|
+
}, [id]);
|
|
49
59
|
const [editOpen, setEditOpen] = useState(false);
|
|
50
60
|
const [confirm, setConfirm] = useState(null);
|
|
51
61
|
const [archiefVraag, setArchiefVraag] = useState(false);
|
|
@@ -156,5 +166,5 @@ export function KlantDetail({ id }) {
|
|
|
156
166
|
else
|
|
157
167
|
toggleActive.mutate(!c.is_active);
|
|
158
168
|
setConfirm(null);
|
|
159
|
-
}, children: confirm === "delete" ? "Verwijderen" : c.is_active ? "Op inactief zetten" : "Activeren" })] })] }) })] }) }), _jsxs("div", { className: "grid gap-6 lg:grid-cols-[340px_1fr]", children: [_jsx(ProfileCard, { profile: adaptLocalToProfile(c, data.contacts), notes: noteData?.note ?? null, onSaveNotes: (n) => noteMut.mutate(n), isSaving: noteMut.isPending || noteLoading }), _jsxs("div", { className: "space-y-4 min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [keyData?.customerKey ? (_jsx(CustomerPriceGroupSelect, { customerKey: keyData.customerKey })) : null, priceGroups.length > 0 && (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: "Floriday-prijscategorie:" }), _jsx(PriceGroupBadges, { groups: priceGroups, max: priceGroups.length })] }))] }), _jsx(CustomerKpis, { customerId: id, twinfieldCode: c.twinfield_code ?? null, onSelect: setTab }), _jsxs(Tabs, { value: tab, onValueChange: setTab, children: [_jsxs(TabsList, { className: "flex h-auto flex-wrap gap-2 bg-transparent p-0 mb-4 [&>button]:h-9 [&>button]:rounded-lg [&>button]:border [&>button]:border-border [&>button]:bg-card [&>button]:px-3 [&>button]:text-sm [&>button]:transition-colors [&>button]:duration-150 [&>button:hover]:bg-muted [&>button[data-state=active]]:border-primary/40 [&>button[data-state=active]]:bg-primary/10 [&>button[data-state=active]]:shadow-none [&>button[data-state=active]]:font-medium", children: [_jsx(TabsTrigger, { value: "overview", children: "Overzicht" }), _jsx(TabsTrigger, { value: "dashboard", children: "Analyses" }), _jsxs(TabsTrigger, { value: "contacts", children: ["Contacten (", data.contacts.length, ")"] }), _jsxs(TabsTrigger, { value: "locations", children: ["Locaties (", data.delivery_locations.length, ")"] }), _jsx(TabsTrigger, { value: "assortment", children: "Assortiment" }), c.floriday_organization_id && (_jsx(TabsTrigger, { value: "floriday-assortment", children: "Aanbod via Floriday" })), _jsxs(TabsTrigger, { value: "orders", children: ["Bestellingen (", ordersData?.orders.length ?? 0, ")"] }), _jsx(TabsTrigger, { value: "trade", children: "Handel" }), _jsx(TabsTrigger, { value: "discounts", children: "Kortingen & prijzen" }), _jsx(TabsTrigger, { value: "activity", children: "Activiteit" })] }), _jsxs(TabsContent, { value: "overview", className: "space-y-4", children: [c.bio && (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Bio" }) }), _jsx(CardContent, { className: "text-sm whitespace-pre-wrap", children: c.bio })] })), (c.segments?.length || c.trade_forms?.length || c.markets?.length || c.product_groups?.length) ? (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Profiel" }) }), _jsxs(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [_jsx(BadgeList, { label: "Segmenten", items: c.segments }), _jsx(BadgeList, { label: "Handelsvorm", items: c.trade_forms }), _jsx(BadgeList, { label: "Afzetmarkten", items: c.markets }), _jsx(BadgeList, { label: "Productgroepen", items: c.product_groups })] })] })) : null, (c.payment_methods?.length ?? 0) > 0 && (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Financi\u00EBle afhandeling" }) }), _jsx(CardContent, { children: _jsx(BadgeList, { label: "Betaalmethoden", items: c.payment_methods }) })] })), hasBillingInfo(c) && _jsx(FactureringKredietCard, { customer: c }), _jsx(CustomerCarrierCard, { customerId: id }), _jsx(CustomerLogisticsCard, { customerId: id }), !hasBillingInfo(c) && !c.bio && !(c.segments?.length || c.trade_forms?.length || c.markets?.length || c.product_groups?.length) && !(c.payment_methods?.length) && (_jsx(EmptyState, { message: "Geen extra profielinformatie beschikbaar voor deze klant." }))] }), _jsx(TabsContent, { value: "contacts", children: data.contacts.length === 0 ? (_jsx(EmptyState, { message: c.floriday_organization_id ? "Geen contactpersonen beschikbaar. Floriday levert geen contactpersonen via de koppeling." : "Geen contactpersonen beschikbaar." })) : (_jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: data.contacts.map((p) => (_jsx(Card, { children: _jsxs(CardContent, { className: "pt-6 space-y-2", children: [_jsx("div", { className: "font-semibold", children: p.full_name }), p.job_title && _jsx("div", { className: "text-sm text-muted-foreground", children: p.job_title }), p.phone && (_jsxs("a", { href: `tel:${p.phone}`, className: "text-sm flex items-center gap-2 hover:underline", children: [_jsx(Phone, { className: "h-3.5 w-3.5 text-muted-foreground" }), " ", p.phone] })), p.email && (_jsxs("a", { href: `mailto:${p.email}`, className: "text-sm flex items-center gap-2 hover:underline", children: [_jsx(Mail, { className: "h-3.5 w-3.5 text-muted-foreground" }), " ", p.email] })), p.is_active ? _jsx(Badge, { children: "Actief" }) : _jsx(Badge, { variant: "secondary", children: "Inactief" })] }) }, p.id))) })) }), _jsxs(TabsContent, { value: "trade", children: [_jsx(KlantExtraVeldenCard, { customerId: c.id }), c.floriday_organization_id ? (_jsx(FloridayTradeSettingsCard, { organizationId: c.floriday_organization_id })) : data.trade_settings.length === 0 ? (_jsx(EmptyState, { message: "Geen handelsinstellingen voor deze klant." })) : (_jsx(Card, { children: _jsx(CardContent, { className: "pt-6 space-y-2", children: data.trade_settings.map((s) => (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Badge, { variant: s.is_active ? "default" : "secondary", children: s.is_active ? "Actief" : "Niet actief" }), _jsx("span", { className: "text-sm", children: s.setting_label })] }, s.id))) }) }))] }), _jsx(TabsContent, { value: "locations", children: _jsxs("div", { className: "space-y-4", children: [_jsx(CustomerCarrierCard, { customerId: id }), _jsx(CustomerLogisticsCard, { customerId: id }), _jsx(DeliveryLocationsTab, { customerId: id })] }) }), _jsx(TabsContent, { value: "dashboard", children: _jsx(CustomerAnalyticsTab, { customerId: id }) }), _jsx(TabsContent, { value: "assortment", children: keyData?.customerKey ? (_jsx(CustomerAssortmentTab, { customerKey: keyData.customerKey, organizationId: c.floriday_organization_id ?? null, customerId: id })) : (_jsx(EmptyState, { message: "Assortiment is beschikbaar zodra deze klant gekoppeld is." })) }), c.floriday_organization_id && (_jsx(TabsContent, { value: "floriday-assortment", children: _jsx(FloridayAssortmentTab, { organizationId: c.floriday_organization_id }) })), _jsx(TabsContent, { value: "orders", children: _jsx(CustomerOrdersTab, { orders: ordersData?.orders ?? [], deletedCount: ordersData?.deletedCount ?? 0, loading: ordersLoading, showFloridayNotice: !!c.floriday_organization_id }) }), _jsx(TabsContent, { value: "activity", children: _jsx(Card, { children: _jsxs(CardContent, { className: "pt-6 space-y-2", children: [data.floriday_synced_at && (_jsxs("div", { className: "flex items-center justify-between text-sm border-l-2 border-primary pl-3 py-1", children: [_jsxs("span", { children: ["Gekoppeld met ", _jsx("strong", { children: "Floriday" })] }), _jsx("span", { className: "text-xs text-muted-foreground", children: formatDateTime(data.floriday_synced_at) })] })), data.audit.length === 0 && !data.floriday_synced_at ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen activiteit voor deze klant." })) : (data.audit.map((a) => _jsx(ActivityItem, { entry: a }, a.id)))] }) }) }), _jsx(TabsContent, { value: "discounts", children: _jsx(LocalDiscountsTab, { customerId: id }) })] })] })] }), _jsx(KlantBewerkenDialog, { open: editOpen, onOpenChange: setEditOpen, customerId: id, onSaved: () => qc.invalidateQueries({ queryKey: ["customer", id] }) })] }));
|
|
169
|
+
}, children: confirm === "delete" ? "Verwijderen" : c.is_active ? "Op inactief zetten" : "Activeren" })] })] }) })] }) }), _jsxs("div", { className: "grid gap-6 lg:grid-cols-[340px_1fr]", children: [_jsx(ProfileCard, { profile: adaptLocalToProfile(c, data.contacts), notes: noteData?.note ?? null, onSaveNotes: (n) => noteMut.mutate(n), isSaving: noteMut.isPending || noteLoading }), _jsxs("div", { className: "space-y-4 min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [keyData?.customerKey ? (_jsx(CustomerPriceGroupSelect, { customerKey: keyData.customerKey })) : null, priceGroups.length > 0 && (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: "Floriday-prijscategorie:" }), _jsx(PriceGroupBadges, { groups: priceGroups, max: priceGroups.length })] }))] }), _jsx(CustomerKpis, { customerId: id, twinfieldCode: c.twinfield_code ?? null, onSelect: setTab }), _jsxs(Tabs, { value: tab, onValueChange: setTab, children: [_jsxs(TabsList, { className: "flex h-auto flex-wrap gap-2 bg-transparent p-0 mb-4 [&>button]:h-9 [&>button]:rounded-lg [&>button]:border [&>button]:border-border [&>button]:bg-card [&>button]:px-3 [&>button]:text-sm [&>button]:transition-colors [&>button]:duration-150 [&>button:hover]:bg-muted [&>button[data-state=active]]:border-primary/40 [&>button[data-state=active]]:bg-primary/10 [&>button[data-state=active]]:shadow-none [&>button[data-state=active]]:font-medium", children: [_jsx(TabsTrigger, { value: "overview", children: "Overzicht" }), _jsx(TabsTrigger, { value: "dashboard", children: "Analyses" }), _jsxs(TabsTrigger, { value: "contacts", children: ["Contacten (", data.contacts.length, ")"] }), _jsxs(TabsTrigger, { value: "locations", children: ["Locaties (", data.delivery_locations.length, ")"] }), _jsx(TabsTrigger, { value: "assortment", children: "Assortiment" }), c.floriday_organization_id && (_jsx(TabsTrigger, { value: "floriday-assortment", children: "Aanbod via Floriday" })), _jsxs(TabsTrigger, { value: "orders", children: ["Bestellingen (", ordersData?.orders.length ?? 0, ")"] }), _jsx(TabsTrigger, { value: "trade", children: "Handel" }), _jsx(TabsTrigger, { value: "discounts", children: "Kortingen & prijzen" }), _jsx(TabsTrigger, { value: "activity", children: "Activiteit" })] }), _jsxs(TabsContent, { value: "overview", className: "space-y-4", children: [c.bio && (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Bio" }) }), _jsx(CardContent, { className: "text-sm whitespace-pre-wrap", children: c.bio })] })), (c.segments?.length || c.trade_forms?.length || c.markets?.length || c.product_groups?.length) ? (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Profiel" }) }), _jsxs(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [_jsx(BadgeList, { label: "Segmenten", items: c.segments }), _jsx(BadgeList, { label: "Handelsvorm", items: c.trade_forms }), _jsx(BadgeList, { label: "Afzetmarkten", items: c.markets }), _jsx(BadgeList, { label: "Productgroepen", items: c.product_groups })] })] })) : null, (c.payment_methods?.length ?? 0) > 0 && (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: "Financi\u00EBle afhandeling" }) }), _jsx(CardContent, { children: _jsx(BadgeList, { label: "Betaalmethoden", items: c.payment_methods }) })] })), hasBillingInfo(c) && _jsx(FactureringKredietCard, { customer: c }), _jsx(CustomerCarrierCard, { customerId: id }), _jsx(CustomerLogisticsCard, { customerId: id }), !hasBillingInfo(c) && !c.bio && !(c.segments?.length || c.trade_forms?.length || c.markets?.length || c.product_groups?.length) && !(c.payment_methods?.length) && (_jsx(EmptyState, { message: "Geen extra profielinformatie beschikbaar voor deze klant." }))] }), _jsx(TabsContent, { value: "contacts", children: data.contacts.length === 0 ? (_jsx(EmptyState, { message: c.floriday_organization_id ? "Geen contactpersonen beschikbaar. Floriday levert geen contactpersonen via de koppeling." : "Geen contactpersonen beschikbaar." })) : (_jsx("div", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3", children: data.contacts.map((p) => (_jsx(Card, { children: _jsxs(CardContent, { className: "pt-6 space-y-2", children: [_jsx("div", { className: "font-semibold", children: p.full_name }), p.job_title && _jsx("div", { className: "text-sm text-muted-foreground", children: p.job_title }), p.phone && (_jsxs("a", { href: `tel:${p.phone}`, className: "text-sm flex items-center gap-2 hover:underline", children: [_jsx(Phone, { className: "h-3.5 w-3.5 text-muted-foreground" }), " ", p.phone] })), p.email && (_jsxs("a", { href: `mailto:${p.email}`, className: "text-sm flex items-center gap-2 hover:underline", children: [_jsx(Mail, { className: "h-3.5 w-3.5 text-muted-foreground" }), " ", p.email] })), p.is_active ? _jsx(Badge, { children: "Actief" }) : _jsx(Badge, { variant: "secondary", children: "Inactief" })] }) }, p.id))) })) }), _jsxs(TabsContent, { value: "trade", children: [_jsx(KlantExtraVeldenCard, { customerId: c.id }), c.floriday_organization_id ? (_jsx(FloridayTradeSettingsCard, { organizationId: c.floriday_organization_id })) : data.trade_settings.length === 0 ? (_jsx(EmptyState, { message: "Geen handelsinstellingen voor deze klant." })) : (_jsx(Card, { children: _jsx(CardContent, { className: "pt-6 space-y-2", children: data.trade_settings.map((s) => (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(Badge, { variant: s.is_active ? "default" : "secondary", children: s.is_active ? "Actief" : "Niet actief" }), _jsx("span", { className: "text-sm", children: s.setting_label })] }, s.id))) }) }))] }), _jsx(TabsContent, { value: "locations", children: _jsxs("div", { className: "space-y-4", children: [_jsx(CustomerCarrierCard, { customerId: id }), _jsx(CustomerLogisticsCard, { customerId: id }), _jsx(DeliveryLocationsTab, { customerId: id })] }) }), _jsx(TabsContent, { value: "dashboard", children: _jsx(CustomerAnalyticsTab, { customerId: id }) }), _jsx(TabsContent, { value: "assortment", children: keyData?.customerKey ? (_jsx(CustomerAssortmentTab, { customerKey: keyData.customerKey, organizationId: c.floriday_organization_id ?? null, customerId: id, focusProduct: focusProduct })) : (_jsx(EmptyState, { message: "Assortiment is beschikbaar zodra deze klant gekoppeld is." })) }), c.floriday_organization_id && (_jsx(TabsContent, { value: "floriday-assortment", children: _jsx(FloridayAssortmentTab, { organizationId: c.floriday_organization_id }) })), _jsx(TabsContent, { value: "orders", children: _jsx(CustomerOrdersTab, { orders: ordersData?.orders ?? [], deletedCount: ordersData?.deletedCount ?? 0, loading: ordersLoading, showFloridayNotice: !!c.floriday_organization_id }) }), _jsx(TabsContent, { value: "activity", children: _jsx(Card, { children: _jsxs(CardContent, { className: "pt-6 space-y-2", children: [data.floriday_synced_at && (_jsxs("div", { className: "flex items-center justify-between text-sm border-l-2 border-primary pl-3 py-1", children: [_jsxs("span", { children: ["Gekoppeld met ", _jsx("strong", { children: "Floriday" })] }), _jsx("span", { className: "text-xs text-muted-foreground", children: formatDateTime(data.floriday_synced_at) })] })), data.audit.length === 0 && !data.floriday_synced_at ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen activiteit voor deze klant." })) : (data.audit.map((a) => _jsx(ActivityItem, { entry: a }, a.id)))] }) }) }), _jsx(TabsContent, { value: "discounts", children: _jsx(LocalDiscountsTab, { customerId: id }) })] })] })] }), _jsx(KlantBewerkenDialog, { open: editOpen, onOpenChange: setEditOpen, customerId: id, onSaved: () => qc.invalidateQueries({ queryKey: ["customer", id] }) })] }));
|
|
160
170
|
}
|
|
@@ -3,7 +3,12 @@ import { type StickerUploadSize } from "../../lib/customer-stickers.functions.js
|
|
|
3
3
|
* "Formaat: 48 × 48 mm (wijzigen)". Zonder maat: voorstel via geladen etiket
|
|
4
4
|
* (één klik bevestigen, alleen als het in de lijst staat) of kiezen uit de lijst.
|
|
5
5
|
*/
|
|
6
|
-
export declare function StickerSizeLine({ customerKey, tradeItemKey, soort, widthMm, heightMm, initialDetection, onSaved, }: {
|
|
6
|
+
export declare function StickerSizeLine({ customerKey, tradeItemKey, soort, widthMm, heightMm, initialDetection, onSaved, standaard, }: {
|
|
7
|
+
/** Standaardformaat van de klant: dan niets vragen, alleen tonen met "wijzigen". */
|
|
8
|
+
standaard?: {
|
|
9
|
+
width_mm: number;
|
|
10
|
+
height_mm: number;
|
|
11
|
+
} | null;
|
|
7
12
|
customerKey: string;
|
|
8
13
|
tradeItemKey: string;
|
|
9
14
|
/** Optioneel; standaard 'product'. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StickerSizeLine.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/StickerSizeLine.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,mCAAmC,CAAC;AAO3C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,KAAiB,EACjB,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,OAAO,
|
|
1
|
+
{"version":3,"file":"StickerSizeLine.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/StickerSizeLine.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,mCAAmC,CAAC;AAO3C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,KAAiB,EACjB,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,SAAgB,GACjB,EAAE;IACD,oFAAoF;IACpF,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gBAAgB,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,+BAoIA"}
|
|
@@ -12,7 +12,7 @@ const fmt = (v) => v.toLocaleString("nl-NL", { maximumFractionDigits: 1 });
|
|
|
12
12
|
* "Formaat: 48 × 48 mm (wijzigen)". Zonder maat: voorstel via geladen etiket
|
|
13
13
|
* (één klik bevestigen, alleen als het in de lijst staat) of kiezen uit de lijst.
|
|
14
14
|
*/
|
|
15
|
-
export function StickerSizeLine({ customerKey, tradeItemKey, soort = "product", widthMm, heightMm, initialDetection, onSaved, }) {
|
|
15
|
+
export function StickerSizeLine({ customerKey, tradeItemKey, soort = "product", widthMm, heightMm, initialDetection, onSaved, standaard = null, }) {
|
|
16
16
|
const save = useServerFn(setStickerSize);
|
|
17
17
|
const suggest = useServerFn(suggestStickerSize);
|
|
18
18
|
const known = widthMm != null && heightMm != null;
|
|
@@ -23,7 +23,7 @@ export function StickerSizeLine({ customerKey, tradeItemKey, soort = "product",
|
|
|
23
23
|
const { data: formatenData } = useStickerFormaten();
|
|
24
24
|
const formaten = formatenData?.formaten ?? [];
|
|
25
25
|
useEffect(() => {
|
|
26
|
-
if (known || det)
|
|
26
|
+
if (known || det || standaard)
|
|
27
27
|
return;
|
|
28
28
|
let alive = true;
|
|
29
29
|
suggest({ data: { customerKey, tradeItemKey, soort } })
|
|
@@ -32,7 +32,7 @@ export function StickerSizeLine({ customerKey, tradeItemKey, soort = "product",
|
|
|
32
32
|
return () => {
|
|
33
33
|
alive = false;
|
|
34
34
|
};
|
|
35
|
-
}, [known, det, customerKey, tradeItemKey, soort, suggest]);
|
|
35
|
+
}, [known, det, standaard, customerKey, tradeItemKey, soort, suggest]);
|
|
36
36
|
const store = async (wm, hm) => {
|
|
37
37
|
setBusy(true);
|
|
38
38
|
try {
|
|
@@ -64,6 +64,12 @@ export function StickerSizeLine({ customerKey, tradeItemKey, soort = "product",
|
|
|
64
64
|
}
|
|
65
65
|
if (editing)
|
|
66
66
|
return manual;
|
|
67
|
+
if (standaard) {
|
|
68
|
+
return (_jsxs("p", { className: "text-sm", children: ["Formaat: ", fmt(standaard.width_mm), " \u00D7 ", fmt(standaard.height_mm), " mm", " ", _jsx("span", { className: "text-xs text-muted-foreground", children: "(standaard van deze klant)" }), " ", _jsx("button", { type: "button", className: "text-xs text-primary underline-offset-2 hover:underline", onClick: () => {
|
|
69
|
+
setKeuze(null);
|
|
70
|
+
setEditing(true);
|
|
71
|
+
}, children: "wijzigen" })] }));
|
|
72
|
+
}
|
|
67
73
|
if (!det)
|
|
68
74
|
return _jsx("p", { className: "text-xs text-muted-foreground", children: "Formaat bepalen\u2026" });
|
|
69
75
|
// Voorstel alleen tonen als die maat in de lijst staat.
|