@flowselections/floriday-klanten-module 1.0.91 → 1.0.93
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/GroupedKlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/GroupedKlantDetail.js +20 -1
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +19 -6
- package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.js +18 -6
- package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.js +26 -2
- package/dist-lib/components/settings/CustomerFieldsCard.d.ts.map +1 -1
- package/dist-lib/components/settings/CustomerFieldsCard.js +25 -6
- package/dist-lib/integrations/supabase/types.d.ts +721 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/carriers.functions.d.ts.map +1 -1
- package/dist-lib/lib/carriers.functions.js +5 -4
- package/dist-lib/lib/customer-assortment.functions.d.ts.map +1 -1
- package/dist-lib/lib/customer-assortment.functions.js +7 -6
- package/dist-lib/lib/customer-schemas.d.ts +13 -13
- package/dist-lib/lib/customers.functions.d.ts +37 -7
- package/dist-lib/lib/customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.js +74 -9
- package/dist-lib/lib/delivery-locations.functions.d.ts +3 -3
- package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
- package/dist-lib/lib/delivery-locations.functions.js +9 -8
- package/dist-lib/lib/fetch-all-paged.d.ts +16 -0
- package/dist-lib/lib/fetch-all-paged.d.ts.map +1 -0
- package/dist-lib/lib/fetch-all-paged.js +28 -0
- package/dist-lib/lib/floriday-assortment.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-assortment.functions.js +5 -4
- package/dist-lib/lib/klanten-bron.d.ts +12 -0
- package/dist-lib/lib/klanten-bron.d.ts.map +1 -0
- package/dist-lib/lib/klanten-bron.js +13 -0
- package/dist-lib/lib/logistics-strategy.functions.d.ts +2 -2
- package/dist-lib/lib/price-groups-local.functions.d.ts +43 -0
- package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
- package/dist-lib/lib/price-groups-local.functions.js +121 -20
- package/dist-lib/lib/price-groups.functions.d.ts.map +1 -1
- package/dist-lib/lib/price-groups.functions.js +5 -4
- package/dist-lib/lib/pricing.d.ts.map +1 -1
- package/dist-lib/lib/pricing.js +11 -4
- package/dist-lib/lib/twinfield-adopt.functions.d.ts +2 -2
- package/dist-lib/lib/twinfield-defaults.d.ts +2 -2
- package/package.json +7 -3
- package/schema/klanten.sql +247 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupedKlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/GroupedKlantDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupedKlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/GroupedKlantDetail.tsx"],"names":[],"mappings":"AA4CA,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,+BAgZpE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ensureKlantRijVoorFloriday } from "../../lib/price-groups-local.functions.js";
|
|
2
3
|
import { Navigate, useNavigate } from "@tanstack/react-router";
|
|
3
4
|
import { REFRESH_MS } from "../../lib/refresh-intervals.js";
|
|
4
5
|
import { formatDateTime } from "../../lib/format-date.js";
|
|
@@ -97,6 +98,9 @@ export function GroupedKlantDetail({ groupKey }) {
|
|
|
97
98
|
.subscribe();
|
|
98
99
|
return () => { supabase.removeChannel(channel); };
|
|
99
100
|
}, [groupKey, qc]);
|
|
101
|
+
const ensureKlantRij = useServerFn(ensureKlantRijVoorFloriday);
|
|
102
|
+
const [promoting, setPromoting] = useState(false);
|
|
103
|
+
const [promotedId, setPromotedId] = useState(null);
|
|
100
104
|
const localIdEarly = (data?.group?.sources ?? [])
|
|
101
105
|
.find((x) => x.provider === "local")?.external_id ?? null;
|
|
102
106
|
const localCustomer = useLocalCustomer(localIdEarly);
|
|
@@ -134,7 +138,22 @@ export function GroupedKlantDetail({ groupKey }) {
|
|
|
134
138
|
provider: providerMap.get(s.provider)?.label ?? s.provider,
|
|
135
139
|
}))
|
|
136
140
|
.sort((a, b) => +new Date(b.created_at) - +new Date(a.created_at));
|
|
137
|
-
return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 sm:p-6", children: [_jsx(BackLink, {}), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [localCustomerId ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] })) : twinfieldCode ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] })) :
|
|
141
|
+
return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 sm:p-6", children: [_jsx(BackLink, {}), _jsxs("div", { className: "flex items-center justify-end gap-2", children: [localCustomerId ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] })) : twinfieldCode ? (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] })) : floridayBuyerId ? (_jsxs(Button, { variant: "outline", size: "sm", disabled: promoting, onClick: async () => {
|
|
142
|
+
setPromoting(true);
|
|
143
|
+
try {
|
|
144
|
+
const res = await ensureKlantRij({ data: { organizationId: floridayBuyerId } });
|
|
145
|
+
setPromotedId(res.customerId);
|
|
146
|
+
await qc.invalidateQueries();
|
|
147
|
+
setEditOpen(true);
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
console.error("[klanten] bewerken Floriday-klant mislukt", e);
|
|
151
|
+
toast.error(e instanceof Error ? e.message : "Deze klant kan nu niet worden bewerkt. Probeer het opnieuw.");
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
setPromoting(false);
|
|
155
|
+
}
|
|
156
|
+
}, children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] })) : null, _jsx(FloridayDeeplinkButton, { organizationId: floridayBuyerId })] }), _jsx(KlantBewerkenDialog, { open: editOpen, onOpenChange: setEditOpen, customerId: localCustomerId ?? promotedId ?? null, twinfieldCode: localCustomerId || promotedId ? null : twinfieldCode, onSaved: () => qc.invalidateQueries() }), _jsxs("div", { className: "grid gap-6 lg:grid-cols-[340px_1fr]", children: [_jsx(ProfileCard, { profile: profile, 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: [_jsx(CustomerPriceGroupSelect, { customerKey: groupKey }), 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(KpiStrip, { counts: {
|
|
138
157
|
contacts: contacts.length,
|
|
139
158
|
locations: locations.length,
|
|
140
159
|
assortment: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlantenOverzicht.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantenOverzicht.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KlantenOverzicht.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantenOverzicht.tsx"],"names":[],"mappings":"AAyEA,wBAAgB,gBAAgB,gCAk3B/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { matchesBron, BRON_LABELS } from "../../lib/klanten-bron.js";
|
|
2
3
|
import { useNavigate } from "@tanstack/react-router";
|
|
3
4
|
import { REFRESH_MS, FULL_REFRESH_MS, OVERLAP_MS, STATUS_FAST_MS } from "../../lib/refresh-intervals.js";
|
|
4
5
|
import { formatDate } from "../../lib/format-date.js";
|
|
@@ -35,6 +36,7 @@ export function KlantenOverzicht() {
|
|
|
35
36
|
const [selectedCountries, setSelectedCountries] = usePersistedState("klanten:countries", []);
|
|
36
37
|
const [selectedChannels, setSelectedChannels] = usePersistedState("klanten:channels", []);
|
|
37
38
|
const [selectedPayments, setSelectedPayments] = usePersistedState("klanten:payments", []);
|
|
39
|
+
const [bron, setBron] = usePersistedState("klanten:bron", "all");
|
|
38
40
|
const [view, setView] = usePersistedState("klanten:view", "all");
|
|
39
41
|
const [sort, setSort] = usePersistedState("klanten:sort", { col: "company_name", dir: "asc" });
|
|
40
42
|
const [page, setPage] = usePersistedState("klanten:page", 1);
|
|
@@ -74,7 +76,7 @@ export function KlantenOverzicht() {
|
|
|
74
76
|
const { data: localData, isLoading: loadingLocal, error: localError } = useQuery({
|
|
75
77
|
queryKey: ["customers-local"],
|
|
76
78
|
queryFn: () => list({
|
|
77
|
-
data: { search: "", customer_class: "", country: "", is_active: "all", source: "
|
|
79
|
+
data: { search: "", customer_class: "", country: "", is_active: "all", source: "all" },
|
|
78
80
|
}).then(decodeDeep),
|
|
79
81
|
staleTime: 60000,
|
|
80
82
|
refetchInterval: FULL_REFRESH_MS,
|
|
@@ -140,7 +142,7 @@ export function KlantenOverzicht() {
|
|
|
140
142
|
: null;
|
|
141
143
|
if (sinceLocal) {
|
|
142
144
|
const res = decodeDeep(await list({
|
|
143
|
-
data: { search: "", customer_class: "", country: "", is_active: "all", source: "
|
|
145
|
+
data: { search: "", customer_class: "", country: "", is_active: "all", source: "all", since: sinceLocal },
|
|
144
146
|
}));
|
|
145
147
|
if (res?.server_now)
|
|
146
148
|
localWatermark.current = res.server_now;
|
|
@@ -275,7 +277,9 @@ export function KlantenOverzicht() {
|
|
|
275
277
|
id: c.id,
|
|
276
278
|
group_key: null,
|
|
277
279
|
source: "local",
|
|
278
|
-
|
|
280
|
+
// Floriday-klant zonder gekoppelde rij in de bronnenlijst: toon toch het Floriday-label.
|
|
281
|
+
providers: c.source === "floriday" || c.floriday_organization_id ? ["floriday"] : [],
|
|
282
|
+
floriday: c.source === "floriday" || !!c.floriday_organization_id,
|
|
279
283
|
missing_invoice: missingInvoiceAddressFields(c),
|
|
280
284
|
company_name: c.company_name,
|
|
281
285
|
commercial_name: c.commercial_name ?? null,
|
|
@@ -428,6 +432,8 @@ export function KlantenOverzicht() {
|
|
|
428
432
|
}
|
|
429
433
|
if (selectedPayments.length > 0)
|
|
430
434
|
rows = rows.filter((c) => c.payment_method?.label && selectedPayments.includes(c.payment_method.label));
|
|
435
|
+
if (hasFloriday && bron !== "all")
|
|
436
|
+
rows = rows.filter((c) => matchesBron(c, bron));
|
|
431
437
|
if (search) {
|
|
432
438
|
const s = search.toLowerCase();
|
|
433
439
|
rows = rows.filter((c) => [c.company_name, c.commercial_name, c.contact_person, c.email, c.city]
|
|
@@ -440,7 +446,7 @@ export function KlantenOverzicht() {
|
|
|
440
446
|
const cmp = av.localeCompare(bv);
|
|
441
447
|
return sort.dir === "asc" ? cmp : -cmp;
|
|
442
448
|
});
|
|
443
|
-
}, [allRows, view, selectedCountries, selectedChannels, selectedPayments, search, sort]);
|
|
449
|
+
}, [allRows, view, selectedCountries, selectedChannels, selectedPayments, search, sort, bron, hasFloriday]);
|
|
444
450
|
const total = customers.length;
|
|
445
451
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
446
452
|
const currentPage = Math.min(page, totalPages);
|
|
@@ -473,6 +479,12 @@ export function KlantenOverzicht() {
|
|
|
473
479
|
clear: () => { setSelectedChannels((prev) => prev.filter((v) => v !== ch)); resetPage(); },
|
|
474
480
|
});
|
|
475
481
|
});
|
|
482
|
+
if (hasFloriday && bron !== "all")
|
|
483
|
+
activeFilterChips.push({
|
|
484
|
+
key: "bron",
|
|
485
|
+
label: `Bron: ${BRON_LABELS[bron]}`,
|
|
486
|
+
clear: () => { setBron("all"); resetPage(); },
|
|
487
|
+
});
|
|
476
488
|
selectedPayments.forEach((pm) => {
|
|
477
489
|
activeFilterChips.push({
|
|
478
490
|
key: `pm-${pm}`,
|
|
@@ -510,8 +522,9 @@ export function KlantenOverzicht() {
|
|
|
510
522
|
}, [selectedIdx]);
|
|
511
523
|
useEffect(() => { setSelectedIdx(-1); }, [currentPage, view, search]);
|
|
512
524
|
const [filtersOpen, setFiltersOpen] = useState(false);
|
|
513
|
-
const extraFilterCount = selectedCountries.length + selectedChannels.length + selectedPayments.length;
|
|
525
|
+
const extraFilterCount = selectedCountries.length + selectedChannels.length + selectedPayments.length + (hasFloriday && bron !== "all" ? 1 : 0);
|
|
514
526
|
const clearAll = () => {
|
|
527
|
+
setBron("all");
|
|
515
528
|
setSearchInput("");
|
|
516
529
|
setSearch("");
|
|
517
530
|
setSelectedCountries([]);
|
|
@@ -549,7 +562,7 @@ export function KlantenOverzicht() {
|
|
|
549
562
|
{ value: "active", label: "Met omzet", icon: _jsx(UserCheck, {}), count: totals.active },
|
|
550
563
|
{ value: "inactive", label: "Zonder omzet", icon: _jsx(UserX, {}), count: totals.inactive },
|
|
551
564
|
{ value: "overdue", label: "Achterstallig", icon: _jsx(AlertCircle, {}), count: totals.overdue },
|
|
552
|
-
] }), _jsxs(Toolbar, { end: _jsx(ColumnsMenu, { columns: COL_DEFS.filter((c) => c.label).map((c) => ({ key: c.key, label: c.label, locked: c.locked })), hidden: hiddenCols, onChange: setHiddenCols }), chips: _jsx(FilterChips, { chips: activeFilterChips.filter((c) => c.key !== "s"), onClearAll: clearAll }), children: [_jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SearchInput, { ref: searchRef, label: "Zoek klanten", placeholder: "Zoek op bedrijf, contact of e-mail", value: searchInput, onChange: setSearchInput, onClear: () => { setSearchInput(""); setSearch(""); resetPage(); } }) }), _jsx(FiltersButton, { count: extraFilterCount, onClick: () => setFiltersOpen(true) })] }), _jsxs(FiltersPanel, { open: filtersOpen, onOpenChange: setFiltersOpen, onClearAll: extraFilterCount > 0 ? () => { setSelectedCountries([]); setSelectedChannels([]); setSelectedPayments([]); resetPage(); } : undefined, resultLabel: `Toon ${total} ${total === 1 ? "klant" : "klanten"}`, children: [_jsx(FilterField, { label: "Land", children: _jsx(MultiSearchableSelect, { values: selectedCountries, onValuesChange: (v) => { setSelectedCountries(v); resetPage(); }, options: countryOptions, placeholder: "Alle landen", triggerClassName: "w-full h-9 rounded-lg" }) }), channelOptions.length > 0 && (_jsx(FilterField, { label: "Kanaal", children: _jsx(MultiSearchableSelect, { values: selectedChannels, onValuesChange: (v) => { setSelectedChannels(v); resetPage(); }, options: channelSelectOptions, placeholder: "Alle kanalen", triggerClassName: "w-full h-9 rounded-lg" }) })), _jsx(FilterField, { label: "Betaalvorm", children: _jsx(MultiSearchableSelect, { values: selectedPayments, onValuesChange: (v) => { setSelectedPayments(v); resetPage(); }, options: paymentSelectOptions, placeholder: "Alle betaalvormen", triggerClassName: "w-full h-9 rounded-lg" }) })] }), !isLoading && pageRows.length === 0 ? (_jsx(EmptyState, { onAdd: () => goTo({ to: "/klanten/nieuw" }), filtered: activeFilterChips.length > 0 || view !== "all", onClearFilters: clearAll })) : (_jsx(DataTable, { cols: visibleCols, head: _jsxs("tr", { children: [_jsx(Th, { sort: sortState("company_name"), onSort: () => toggleSort("company_name"), children: "Bedrijf" }), show("contact") && _jsx(Th, { children: "Contact" }), show("pricegroup") && _jsx(Th, { children: "Prijscategorie" }), show("payment") && _jsx(Th, { children: "Betaalvorm" }), show("revenue") && _jsx(Th, { children: "Omzet 12 mnd" }), show("country") && _jsx(Th, { sort: sortState("country"), onSort: () => toggleSort("country"), children: "Land" }), show("carrier") && _jsx(Th, { children: "Vervoerder" }), _jsx(Th, { children: "Status" }), _jsx(Th, { children: _jsx("span", { className: "sr-only", children: "Acties" }) })] }), mobile: isLoading ? _jsx(TableSkeleton, { as: "div", rows: 6 }) : (_jsx("ul", { className: "divide-y divide-border", children: pageRows.map((c) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => openRow(c), className: "flex w-full min-w-0 items-center gap-3 px-4 py-3 text-left active:bg-muted", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: displayName(c).primary }), _jsx(ChannelIcons, { providers: c.providers })] }), _jsx("div", { className: "truncate text-xs text-muted-foreground", children: [c.city, formatCountry(c.country)].filter(Boolean).join(" · ") || c.email || "—" })] }), _jsxs("div", { className: "shrink-0 text-right", children: [_jsx("div", { className: "text-sm tabular-nums", children: c.revenue && c.revenue.count > 0 ? formatEuro(c.revenue.amount) : "—" }), _jsx("div", { className: "flex justify-end", children: _jsx(CustomerStatus, { c: c }) })] })] }) }, c.key))) })), children: isLoading ? (_jsx(TableSkeleton, { rows: 8, columns: visibleCols.length })) : pageRows.map((c, idx) => {
|
|
565
|
+
] }), _jsxs(Toolbar, { end: _jsx(ColumnsMenu, { columns: COL_DEFS.filter((c) => c.label).map((c) => ({ key: c.key, label: c.label, locked: c.locked })), hidden: hiddenCols, onChange: setHiddenCols }), chips: _jsx(FilterChips, { chips: activeFilterChips.filter((c) => c.key !== "s"), onClearAll: clearAll }), children: [_jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SearchInput, { ref: searchRef, label: "Zoek klanten", placeholder: "Zoek op bedrijf, contact of e-mail", value: searchInput, onChange: setSearchInput, onClear: () => { setSearchInput(""); setSearch(""); resetPage(); } }) }), _jsx(FiltersButton, { count: extraFilterCount, onClick: () => setFiltersOpen(true) })] }), _jsxs(FiltersPanel, { open: filtersOpen, onOpenChange: setFiltersOpen, onClearAll: extraFilterCount > 0 ? () => { setSelectedCountries([]); setSelectedChannels([]); setSelectedPayments([]); setBron("all"); resetPage(); } : undefined, resultLabel: `Toon ${total} ${total === 1 ? "klant" : "klanten"}`, children: [_jsx(FilterField, { label: "Land", children: _jsx(MultiSearchableSelect, { values: selectedCountries, onValuesChange: (v) => { setSelectedCountries(v); resetPage(); }, options: countryOptions, placeholder: "Alle landen", triggerClassName: "w-full h-9 rounded-lg" }) }), hasFloriday && (_jsx(FilterField, { label: "Bron", children: _jsx("div", { role: "radiogroup", "aria-label": "Bron", className: "flex flex-wrap gap-1.5", children: ["all", "floriday", "buiten"].map((b) => (_jsx(Button, { type: "button", role: "radio", "aria-checked": bron === b, size: "sm", variant: bron === b ? "default" : "outline", className: "h-9 rounded-lg", onClick: () => { setBron(b); resetPage(); }, children: BRON_LABELS[b] }, b))) }) })), channelOptions.length > 0 && (_jsx(FilterField, { label: "Kanaal", children: _jsx(MultiSearchableSelect, { values: selectedChannels, onValuesChange: (v) => { setSelectedChannels(v); resetPage(); }, options: channelSelectOptions, placeholder: "Alle kanalen", triggerClassName: "w-full h-9 rounded-lg" }) })), _jsx(FilterField, { label: "Betaalvorm", children: _jsx(MultiSearchableSelect, { values: selectedPayments, onValuesChange: (v) => { setSelectedPayments(v); resetPage(); }, options: paymentSelectOptions, placeholder: "Alle betaalvormen", triggerClassName: "w-full h-9 rounded-lg" }) })] }), !isLoading && pageRows.length === 0 ? (_jsx(EmptyState, { onAdd: () => goTo({ to: "/klanten/nieuw" }), filtered: activeFilterChips.length > 0 || view !== "all", onClearFilters: clearAll })) : (_jsx(DataTable, { cols: visibleCols, head: _jsxs("tr", { children: [_jsx(Th, { sort: sortState("company_name"), onSort: () => toggleSort("company_name"), children: "Bedrijf" }), show("contact") && _jsx(Th, { children: "Contact" }), show("pricegroup") && _jsx(Th, { children: "Prijscategorie" }), show("payment") && _jsx(Th, { children: "Betaalvorm" }), show("revenue") && _jsx(Th, { children: "Omzet 12 mnd" }), show("country") && _jsx(Th, { sort: sortState("country"), onSort: () => toggleSort("country"), children: "Land" }), show("carrier") && _jsx(Th, { children: "Vervoerder" }), _jsx(Th, { children: "Status" }), _jsx(Th, { children: _jsx("span", { className: "sr-only", children: "Acties" }) })] }), mobile: isLoading ? _jsx(TableSkeleton, { as: "div", rows: 6 }) : (_jsx("ul", { className: "divide-y divide-border", children: pageRows.map((c) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => openRow(c), className: "flex w-full min-w-0 items-center gap-3 px-4 py-3 text-left active:bg-muted", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: displayName(c).primary }), _jsx(ChannelIcons, { providers: c.providers })] }), _jsx("div", { className: "truncate text-xs text-muted-foreground", children: [c.city, formatCountry(c.country)].filter(Boolean).join(" · ") || c.email || "—" })] }), _jsxs("div", { className: "shrink-0 text-right", children: [_jsx("div", { className: "text-sm tabular-nums", children: c.revenue && c.revenue.count > 0 ? formatEuro(c.revenue.amount) : "—" }), _jsx("div", { className: "flex justify-end", children: _jsx(CustomerStatus, { c: c }) })] })] }) }, c.key))) })), children: isLoading ? (_jsx(TableSkeleton, { rows: 8, columns: visibleCols.length })) : pageRows.map((c, idx) => {
|
|
553
566
|
const { primary, secondary } = displayName(c);
|
|
554
567
|
const selected = idx === selectedIdx;
|
|
555
568
|
const groups = c.price_groups.map((g) => g.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerPriceGroupSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/klanten/pricegroups/CustomerPriceGroupSelect.tsx"],"names":[],"mappings":"AAcA,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,+
|
|
1
|
+
{"version":3,"file":"CustomerPriceGroupSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/klanten/pricegroups/CustomerPriceGroupSelect.tsx"],"names":[],"mappings":"AAcA,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,+BAgFhF"}
|
|
@@ -24,8 +24,9 @@ export function CustomerPriceGroupSelect({ customerKey }) {
|
|
|
24
24
|
});
|
|
25
25
|
const options = useMemo(() => [
|
|
26
26
|
{ value: NONE, label: "Geen prijsgroep" },
|
|
27
|
+
// Alleen eigen prijsgroepen kiezen; Floriday-groepen beheer je in Floriday.
|
|
27
28
|
...(groups ?? [])
|
|
28
|
-
.filter((g) => g.is_active !== false)
|
|
29
|
+
.filter((g) => g.is_active !== false && g.source !== "floriday")
|
|
29
30
|
.map((g) => ({ value: g.id, label: g.name })),
|
|
30
31
|
], [groups]);
|
|
31
32
|
const mutation = useMutation({
|
|
@@ -39,9 +40,20 @@ export function CustomerPriceGroupSelect({ customerKey }) {
|
|
|
39
40
|
onError: (err) => toast.error(friendlyError(err)),
|
|
40
41
|
onSettled: () => setPending(null),
|
|
41
42
|
});
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const memberOf = useMemo(() => {
|
|
44
|
+
const ids = new Set(current?.priceGroupIds ?? []);
|
|
45
|
+
return (groups ?? [])
|
|
46
|
+
.filter((g) => ids.has(g.id) && g.is_active !== false)
|
|
47
|
+
.sort((a, b) => Number(a.source === "floriday") - Number(b.source === "floriday") || a.sort_order - b.sort_order);
|
|
48
|
+
}, [groups, current]);
|
|
49
|
+
const ownCurrent = memberOf.find((g) => g.source !== "floriday");
|
|
50
|
+
const bepalend = memberOf[0];
|
|
51
|
+
const floridayGroups = memberOf.filter((g) => g.source === "floriday");
|
|
52
|
+
const value = pending ?? ownCurrent?.id ?? NONE;
|
|
53
|
+
return (_jsxs("div", { className: "flex flex-col gap-1 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Prijsgroep:" }), _jsx("div", { className: "w-[240px]", children: _jsx(SearchableSelect, { value: value, onValueChange: (v) => {
|
|
54
|
+
setPending(v);
|
|
55
|
+
mutation.mutate(v === NONE ? null : v);
|
|
56
|
+
}, options: options, placeholder: "Geen prijsgroep" }) })] }), bepalend ? (_jsxs("div", { className: "text-xs text-muted-foreground", children: ["Prijs komt uit: ", _jsx("span", { className: "text-foreground", children: bepalend.name }), bepalend.source === "floriday" ? " (Floriday)" : "", floridayGroups.length > 0 && bepalend.source !== "floriday"
|
|
57
|
+
? ` · gaat voor ${floridayGroups.map((g) => g.name).join(", ")} (Floriday)`
|
|
58
|
+
: ""] })) : null] }));
|
|
47
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceGroupFormPage.d.ts","sourceRoot":"","sources":["../../../../src/components/klanten/pricegroups/PriceGroupFormPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PriceGroupFormPage.d.ts","sourceRoot":"","sources":["../../../../src/components/klanten/pricegroups/PriceGroupFormPage.tsx"],"names":[],"mappings":"AA8MA,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,+BA4tB9E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { PageHeader, TableSkeleton } from "../../fs-ui/index.js";
|
|
2
|
+
import { PageHeader, TableSkeleton, InlineAlert } from "../../fs-ui/index.js";
|
|
3
3
|
import { useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { useServerFn } from "@tanstack/react-start";
|
|
@@ -7,7 +7,7 @@ import { useNavigate } from "@tanstack/react-router";
|
|
|
7
7
|
import { Button, Input, Label, Separator, Card, CardContent, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Checkbox, } from "@flowselections/core";
|
|
8
8
|
import { ArrowRight, Check, ChevronDown, PencilLine, Calculator, Users, Globe2, Circle, CheckCircle2, Info, ChevronLeft, ChevronRight, ImageIcon } from "lucide-react";
|
|
9
9
|
import { BackLink } from "../BackLink.js";
|
|
10
|
-
import { createCustomerPriceGroup, updateCustomerPriceGroup, getCustomerPriceGroup, setPriceGroupMembers, } from "../../../lib/price-groups-local.functions.js";
|
|
10
|
+
import { createCustomerPriceGroup, updateCustomerPriceGroup, getCustomerPriceGroup, setPriceGroupMembers, copyPriceGroupAsOwn, } from "../../../lib/price-groups-local.functions.js";
|
|
11
11
|
import { computePrice } from "../../../lib/pricing.js";
|
|
12
12
|
import { formatEur } from "../../../lib/format-currency.js";
|
|
13
13
|
import { listTradeItemsForPreview } from "../../../lib/floriday-trade-items.functions.js";
|
|
@@ -69,6 +69,15 @@ function StepSection({ index, title, subtitle, open, completed, disabled, onTogg
|
|
|
69
69
|
? "bg-primary text-primary-foreground"
|
|
70
70
|
: "bg-muted text-muted-foreground border"), children: completed && !open ? _jsx(Check, { className: "h-4 w-4" }) : index + 1 }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "text-base " + (open ? "font-semibold" : "font-medium"), children: title }), !open && subtitle && (_jsx("div", { className: "text-xs text-muted-foreground truncate mt-0.5", children: subtitle }))] }), !disabled && (_jsx(ChevronDown, { className: "h-4 w-4 text-muted-foreground transition-transform " + (open ? "rotate-180" : "") }))] }), open && (_jsx(CardContent, { className: "pt-0 pb-6 px-6 space-y-4 border-t", children: _jsx("div", { className: "pt-6", children: children }) }))] }));
|
|
71
71
|
}
|
|
72
|
+
function FloridayGroepAlleenLezen({ naam, leden, onCopy }) {
|
|
73
|
+
const [busy, setBusy] = useState(false);
|
|
74
|
+
return (_jsx("main", { className: "min-h-screen pb-28", children: _jsxs("div", { className: "max-w-6xl mx-auto flex flex-col gap-4 p-4 sm:p-6", children: [_jsx(BackLink, { to: "/klanten/prijsgroepen", label: "Terug naar prijsgroepen" }), _jsx(PageHeader, { title: naam, info: `${leden} ${leden === 1 ? "klant" : "klanten"} in deze prijsgroep.`, actions: _jsx(Button, { size: "sm", disabled: busy, onClick: async () => { setBusy(true); try {
|
|
75
|
+
await onCopy();
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
setBusy(false);
|
|
79
|
+
} }, children: "Kopie maken als eigen prijsgroep" }) }), _jsx(InlineAlert, { tone: "info", title: "Deze prijsgroep beheer je in Floriday.", children: "Wil je hier iets aanpassen? Maak een kopie als eigen prijsgroep. De kopie gaat voor bij klanten die in beide groepen zitten." })] }) }));
|
|
80
|
+
}
|
|
72
81
|
export function PriceGroupFormPage({ editingId }) {
|
|
73
82
|
const qc = useQueryClient();
|
|
74
83
|
const navigate = useNavigate();
|
|
@@ -76,6 +85,7 @@ export function PriceGroupFormPage({ editingId }) {
|
|
|
76
85
|
const updateFn = useServerFn(updateCustomerPriceGroup);
|
|
77
86
|
const getFn = useServerFn(getCustomerPriceGroup);
|
|
78
87
|
const setMembersFn = useServerFn(setPriceGroupMembers);
|
|
88
|
+
const copyFn = useServerFn(copyPriceGroupAsOwn);
|
|
79
89
|
const listCustomersFn = useServerFn(listExternalCustomers);
|
|
80
90
|
const [openStep, setOpenStep] = useState(0);
|
|
81
91
|
const [maxReached, setMaxReached] = useState(0);
|
|
@@ -250,6 +260,20 @@ export function PriceGroupFormPage({ editingId }) {
|
|
|
250
260
|
if (editingId && loadingExisting) {
|
|
251
261
|
return _jsx("main", { className: "flex flex-col gap-4 p-4 sm:p-6", children: _jsx(TableSkeleton, { as: "div", rows: 6 }) });
|
|
252
262
|
}
|
|
263
|
+
if (editingId && existing?.group?.source === "floriday") {
|
|
264
|
+
return (_jsx(FloridayGroepAlleenLezen, { naam: existing.group.name, leden: existing.customerKeys?.length ?? 0, onCopy: async () => {
|
|
265
|
+
try {
|
|
266
|
+
const res = await copyFn({ data: { id: editingId } });
|
|
267
|
+
qc.invalidateQueries({ queryKey: ["customer-price-groups"] });
|
|
268
|
+
toast.success("Kopie gemaakt als eigen prijsgroep");
|
|
269
|
+
navigate({ to: "/klanten/prijsgroepen/$id", params: { id: res.id } });
|
|
270
|
+
}
|
|
271
|
+
catch (e) {
|
|
272
|
+
console.error("[prijsgroepen] kopie maken mislukt", e);
|
|
273
|
+
toast.error("Kopie maken lukt niet. Probeer het opnieuw.");
|
|
274
|
+
}
|
|
275
|
+
} }));
|
|
276
|
+
}
|
|
253
277
|
return (_jsxs("main", { className: "min-h-screen pb-28", children: [_jsxs("div", { className: "max-w-6xl mx-auto flex flex-col gap-4 p-4 sm:p-6", children: [_jsx(BackLink, { to: "/klanten/prijsgroepen", label: "Terug naar prijsgroepen" }), _jsx(PageHeader, { title: editingId ? "Prijsgroep bewerken" : "Nieuwe prijsgroep", info: "Stel prijsafspraken en berekening in. Klanten koppel je op het overzicht." }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-[1fr_340px] items-start", children: [_jsxs("div", { className: "space-y-4 min-w-0", children: [_jsx(StepSection, { index: 0, title: STEP_TITLES[0], subtitle: summaries[0], open: openStep === 0, completed: maxReached > 0, disabled: false, onToggle: () => goToStep(0), children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { children: "Naam van de prijsgroep" }), _jsx("div", { className: "text-xs text-muted-foreground mb-1.5", children: "Alleen zichtbaar voor jou." }), _jsx(Input, { value: form.name, onChange: (e) => patch({ name: e.target.value }), placeholder: "Bijvoorbeeld: trouwe klanten" })] }), _jsxs("div", { className: "max-w-sm", children: [_jsx(Label, { children: "Valuta" }), _jsxs(Select, { value: form.currency, onValueChange: (v) => patch({ currency: v }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "EUR", children: "Euro" }), _jsx(SelectItem, { value: "USD", children: "Amerikaanse dollar" })] })] })] }), _jsxs("div", { children: [_jsx(Label, { children: "Prijsbepaling" }), _jsxs("div", { className: "grid sm:grid-cols-2 gap-3 mt-2", children: [_jsx(OptionCard, { selected: form.pricing_mode === "manual", onClick: () => patch({ pricing_mode: "manual" }), icon: _jsx(PencilLine, { className: "h-5 w-5" }), title: "Prijzen handmatig invoeren", description: "Geef per prijsgroep handmatig een prijs in bij het aanbieden van artikelen." }), _jsx(OptionCard, { selected: form.pricing_mode === "calculated", onClick: () => patch({ pricing_mode: "calculated" }), icon: _jsx(Calculator, { className: "h-5 w-5" }), title: "Prijzen berekenen", description: "Bereken prijzen automatisch op basis van een basisprijs met een door jou samen te stellen berekening." })] })] }), _jsxs("div", { children: [_jsx(Label, { children: "Type prijsgroep" }), _jsxs("div", { className: "grid sm:grid-cols-2 gap-3 mt-2", children: [_jsx(OptionCard, { selected: form.group_type === "general", onClick: () => patch({ group_type: "general" }), icon: _jsx(Globe2, { className: "h-5 w-5" }), title: "Algemene prijsgroep", description: "Zichtbaar voor alle klanten (alleen voor partijprijzen)." }), _jsx(OptionCard, { selected: form.group_type === "customer_specific", onClick: () => patch({ group_type: "customer_specific" }), icon: _jsx(Users, { className: "h-5 w-5" }), title: "Klantspecifieke prijsgroep", description: "Zichtbaar voor klanten die zijn ingedeeld in deze prijsgroep." })] })] }), _jsx("div", { className: "pt-2 flex justify-end", children: _jsxs(Button, { onClick: () => nextStep(0), disabled: !canProceed(0), children: ["Volgende stap ", _jsx(ArrowRight, { className: "h-4 w-4 ml-1" })] }) })] }) }), _jsx(StepSection, { index: 1, title: STEP_TITLES[1], subtitle: summaries[1], open: openStep === 1, completed: maxReached > 1, disabled: maxReached < 1, onToggle: () => goToStep(1), children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-3", children: [_jsx(RadioBanner, { selected: form.price_scope === "incl_delivery", onClick: () => patch({ price_scope: "incl_delivery" }), title: "Prijzen inclusief levering en transport" }), form.price_scope === "incl_delivery" && (_jsx(BulletList, { items: [
|
|
254
278
|
"Prijzen zichtbaar voor klanten die direct inkopen op Floriday",
|
|
255
279
|
"Prijzen zijn inclusief levering en transport, ongeacht het bestelvolume",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerFieldsCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/CustomerFieldsCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomerFieldsCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/CustomerFieldsCard.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,kBAAkB,gCAuGjC"}
|
|
@@ -2,16 +2,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button, Input, Label, supabase, toast, } from "@flowselections/core";
|
|
4
4
|
import { Plus, Trash2, Users } from "lucide-react";
|
|
5
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
6
|
+
import { ensureKlantenDefaults } from "../../lib/customers.functions.js";
|
|
7
|
+
const fout = (wat, error) => {
|
|
8
|
+
console.error(`[klantvelden] ${wat} mislukt`, error);
|
|
9
|
+
toast.error(`${wat} lukt niet. Probeer het opnieuw; blijft het misgaan, neem dan contact op met de beheerder.`);
|
|
10
|
+
};
|
|
5
11
|
export function CustomerFieldsCard() {
|
|
6
12
|
const [fields, setFields] = useState([]);
|
|
7
13
|
const [options, setOptions] = useState([]);
|
|
8
14
|
const [newOption, setNewOption] = useState("");
|
|
9
15
|
const [newField, setNewField] = useState("");
|
|
16
|
+
const ensureDefaults = useServerFn(ensureKlantenDefaults);
|
|
10
17
|
const load = async () => {
|
|
11
|
-
|
|
18
|
+
try {
|
|
19
|
+
await ensureDefaults();
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
fout("Standaardklantklassen klaarzetten", e);
|
|
23
|
+
}
|
|
24
|
+
const [{ data: f, error: fErr }, { data: o, error: oErr }] = await Promise.all([
|
|
12
25
|
supabase.from("customer_field_settings").select("*").order("sort_order"),
|
|
13
26
|
supabase.from("customer_field_options").select("*").order("sort_order"),
|
|
14
27
|
]);
|
|
28
|
+
if (fErr || oErr)
|
|
29
|
+
fout("Klantvelden laden", fErr ?? oErr);
|
|
15
30
|
setFields(f ?? []);
|
|
16
31
|
setOptions(o ?? []);
|
|
17
32
|
};
|
|
@@ -19,13 +34,17 @@ export function CustomerFieldsCard() {
|
|
|
19
34
|
const classField = fields.find((f) => f.field_key === "customer_class");
|
|
20
35
|
const classOptions = options.filter((o) => o.field_setting_id === classField?.id);
|
|
21
36
|
const addClass = async () => {
|
|
22
|
-
if (!
|
|
37
|
+
if (!newOption.trim())
|
|
23
38
|
return;
|
|
39
|
+
if (!classField) {
|
|
40
|
+
toast.error("Klantklassen zijn nog niet klaargezet. Vernieuw de pagina en probeer het opnieuw.");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
24
43
|
const { error } = await supabase.from("customer_field_options").insert({
|
|
25
44
|
field_setting_id: classField.id, label: newOption.trim(), sort_order: classOptions.length,
|
|
26
45
|
});
|
|
27
46
|
if (error)
|
|
28
|
-
return
|
|
47
|
+
return fout("Klantklasse opslaan", error);
|
|
29
48
|
setNewOption("");
|
|
30
49
|
toast.success("Klantklasse toegevoegd");
|
|
31
50
|
load();
|
|
@@ -33,7 +52,7 @@ export function CustomerFieldsCard() {
|
|
|
33
52
|
const delOption = async (id) => {
|
|
34
53
|
const { error } = await supabase.from("customer_field_options").delete().eq("id", id);
|
|
35
54
|
if (error)
|
|
36
|
-
return
|
|
55
|
+
return fout("Klantklasse verwijderen", error);
|
|
37
56
|
load();
|
|
38
57
|
};
|
|
39
58
|
const addField = async () => {
|
|
@@ -44,7 +63,7 @@ export function CustomerFieldsCard() {
|
|
|
44
63
|
field_key: key, field_label: newField.trim(), field_type: "text", is_custom: true, sort_order: fields.length,
|
|
45
64
|
});
|
|
46
65
|
if (error)
|
|
47
|
-
return
|
|
66
|
+
return fout("Veld opslaan", error);
|
|
48
67
|
setNewField("");
|
|
49
68
|
toast.success("Veld toegevoegd");
|
|
50
69
|
load();
|
|
@@ -52,7 +71,7 @@ export function CustomerFieldsCard() {
|
|
|
52
71
|
const delField = async (id) => {
|
|
53
72
|
const { error } = await supabase.from("customer_field_settings").delete().eq("id", id);
|
|
54
73
|
if (error)
|
|
55
|
-
return
|
|
74
|
+
return fout("Veld verwijderen", error);
|
|
56
75
|
load();
|
|
57
76
|
};
|
|
58
77
|
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Klantenmodule" })] }), _jsx(CardDescription, { children: "Beheer klantklassen en extra velden voor klanten" })] }), _jsxs(CardContent, { className: "space-y-6", children: [_jsxs("div", { children: [_jsx(Label, { className: "text-sm font-medium", children: "Klantklassen" }), _jsxs("div", { className: "space-y-2 mt-2", children: [classOptions.map((o) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { value: o.label, disabled: true, className: "flex-1" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => delOption(o.id), children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, o.id))), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { value: newOption, onChange: (e) => setNewOption(e.target.value), placeholder: "Nieuwe klantklasse (bv. D)" }), _jsx(Button, { onClick: addClass, size: "sm", children: _jsx(Plus, { className: "h-4 w-4" }) })] })] })] }), _jsxs("div", { children: [_jsx(Label, { className: "text-sm font-medium", children: "Extra (custom) velden" }), _jsxs("div", { className: "space-y-2 mt-2", children: [fields.filter((f) => f.is_custom).map((f) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { value: f.field_label, disabled: true, className: "flex-1" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => delField(f.id), children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, f.id))), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { value: newField, onChange: (e) => setNewField(e.target.value), placeholder: "Naam van nieuw veld" }), _jsx(Button, { onClick: addField, size: "sm", children: _jsx(Plus, { className: "h-4 w-4" }) })] })] })] })] })] }));
|