@flowselections/floriday-klanten-module 1.0.62 → 1.0.67
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/BulkStickerUploadDialog.d.ts.map +1 -1
- package/dist-lib/components/klanten/BulkStickerUploadDialog.js +4 -0
- package/dist-lib/components/klanten/CarrierAdminCard.d.ts +3 -0
- package/dist-lib/components/klanten/CarrierAdminCard.d.ts.map +1 -0
- package/dist-lib/components/klanten/CarrierAdminCard.js +23 -0
- package/dist-lib/components/klanten/CarrierPicker.d.ts +221 -0
- package/dist-lib/components/klanten/CarrierPicker.d.ts.map +1 -0
- package/dist-lib/components/klanten/CarrierPicker.js +74 -0
- package/dist-lib/components/klanten/CustomerCarrierCard.d.ts +5 -0
- package/dist-lib/components/klanten/CustomerCarrierCard.d.ts.map +1 -0
- package/dist-lib/components/klanten/CustomerCarrierCard.js +36 -0
- package/dist-lib/components/klanten/CustomerStickerCell.d.ts.map +1 -1
- package/dist-lib/components/klanten/CustomerStickerCell.js +11 -5
- package/dist-lib/components/klanten/DeliveryLocationsTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/DeliveryLocationsTab.js +38 -45
- package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetail.js +2 -1
- package/dist-lib/components/klanten/KlantFormulier.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantFormulier.js +8 -12
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +8 -3
- package/dist-lib/components/klanten/StickerSizeLine.d.ts +14 -0
- package/dist-lib/components/klanten/StickerSizeLine.d.ts.map +1 -0
- package/dist-lib/components/klanten/StickerSizeLine.js +74 -0
- package/dist-lib/components/klanten/StickerSizePreviewCard.d.ts +3 -0
- package/dist-lib/components/klanten/StickerSizePreviewCard.d.ts.map +1 -0
- package/dist-lib/components/klanten/StickerSizePreviewCard.js +27 -0
- package/dist-lib/integrations/supabase/types.d.ts +1357 -28
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/carrier-choice.d.ts +60 -0
- package/dist-lib/lib/carrier-choice.d.ts.map +1 -0
- package/dist-lib/lib/carrier-choice.js +68 -0
- package/dist-lib/lib/carriers.functions.d.ts +82 -0
- package/dist-lib/lib/carriers.functions.d.ts.map +1 -0
- package/dist-lib/lib/carriers.functions.js +180 -0
- package/dist-lib/lib/countries.d.ts +2 -0
- package/dist-lib/lib/countries.d.ts.map +1 -1
- package/dist-lib/lib/countries.js +2 -0
- package/dist-lib/lib/customer-schemas.d.ts +108 -2
- package/dist-lib/lib/customer-schemas.d.ts.map +1 -1
- package/dist-lib/lib/customer-schemas.js +15 -1
- package/dist-lib/lib/customer-stickers.functions.d.ts +55 -0
- package/dist-lib/lib/customer-stickers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customer-stickers.functions.js +137 -5
- package/dist-lib/lib/customers.functions.d.ts +4 -1
- package/dist-lib/lib/customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.js +7 -0
- package/dist-lib/lib/delivery-locations.functions.d.ts +2 -2
- package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
- package/dist-lib/lib/delivery-locations.functions.js +31 -38
- package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
- package/dist-lib/lib/price-groups-local.functions.js +4 -1
- package/dist-lib/lib/sticker-size.d.ts +59 -0
- package/dist-lib/lib/sticker-size.d.ts.map +1 -0
- package/dist-lib/lib/sticker-size.js +233 -0
- package/dist-lib/lib/twinfield-adopt.functions.d.ts +2 -1
- package/dist-lib/lib/twinfield-adopt.functions.d.ts.map +1 -1
- package/dist-lib/lib/twinfield-adopt.functions.js +2 -2
- package/dist-lib/lib/twinfield-customer-defaults.server.js +2 -2
- package/package.json +11 -3
- package/schema/klanten.sql +514 -48
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { friendlyError } from "../../lib/errors.js";
|
|
3
3
|
import { useCustomerDefaults } from "./useCustomerDefaults.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useMemo, useRef, useState } from "react";
|
|
5
5
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { useServerFn } from "@tanstack/react-start";
|
|
7
7
|
import { Button, Card, CardContent, Badge, toast, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@flowselections/core";
|
|
8
8
|
import { MapPin, Plus, Pencil, Trash2, Truck, Sparkles, PackageCheck, Download } from "lucide-react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { listDeliveryLocations, upsertDeliveryLocation, deleteDeliveryLocation, importFloridayDeliveryLocations, setPrimaryDeliveryLocation, } from "../../lib/delivery-locations.functions.js";
|
|
10
|
+
import { CarrierPicker, ProposalLine, useCarrierOptions, useCarrierProposals } from "./CarrierPicker.js";
|
|
11
|
+
import { SearchableSelect } from "./SearchableSelect.js";
|
|
12
|
+
import { choiceFromLocation, locationCarrierFields, proposalText, ENGINE_MISSING_TEXT, } from "../../lib/carrier-choice.js";
|
|
13
|
+
import { findCountry } from "../../lib/eu-regions.js";
|
|
11
14
|
import { decodeDeep } from "../../lib/decode-html.js";
|
|
12
|
-
import { countryNameToFlag } from "../../lib/countries.js";
|
|
15
|
+
import { countryNameToFlag, COUNTRY_NAMES, countryNameFromIso, toIsoCountry } from "../../lib/countries.js";
|
|
13
16
|
const EMPTY = {
|
|
14
17
|
name: "", street: "", house_number: "", postal_code: "",
|
|
15
18
|
city: "", province: "", country: "",
|
|
@@ -34,7 +37,6 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
34
37
|
};
|
|
35
38
|
const ownerKey = `${groupKey ?? ""}|${customerId ?? ""}|${externalProvider ?? ""}:${externalKey ?? ""}`;
|
|
36
39
|
const listFn = useServerFn(listDeliveryLocations);
|
|
37
|
-
const carriersFn = useServerFn(listCarriers);
|
|
38
40
|
const upsertFn = useServerFn(upsertDeliveryLocation);
|
|
39
41
|
const deleteFn = useServerFn(deleteDeliveryLocation);
|
|
40
42
|
const primaryFn = useServerFn(setPrimaryDeliveryLocation);
|
|
@@ -43,11 +45,8 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
43
45
|
queryFn: () => listFn({ data: owner }).then(decodeDeep),
|
|
44
46
|
enabled: !!(customerId || groupKey || (externalProvider && externalKey)),
|
|
45
47
|
});
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
queryFn: () => carriersFn().then(decodeDeep),
|
|
49
|
-
});
|
|
50
|
-
const carriers = carriersResp?.carriers ?? [];
|
|
48
|
+
const carrierOpts = useCarrierOptions();
|
|
49
|
+
const carriers = carrierOpts.ordered;
|
|
51
50
|
const locations = (list?.locations ?? []).filter((loc) => loc.external_provider !== "floriday" || loc.raw?.isDeleted !== true);
|
|
52
51
|
const [open, setOpen] = useState(false);
|
|
53
52
|
const [form, setForm] = useState(EMPTY);
|
|
@@ -110,19 +109,25 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
110
109
|
const showError = (field) => (submitted || touched[field]) && errors[field] ? errors[field] : undefined;
|
|
111
110
|
const markTouched = (field) => setTouched((t) => ({ ...t, [field]: true }));
|
|
112
111
|
const req = !form.self_pickup;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
// Live voorstel van de Logistieke Engine (nooit opgeslagen).
|
|
113
|
+
const proposals = useCarrierProposals(locations.map((l) => ({ key: l.id, location_id: l.id, customer_id: customerId ?? null })));
|
|
114
|
+
const formKey = form.id ?? `new:${customerId ?? ownerKey}`;
|
|
115
|
+
const formProposal = useCarrierProposals(open ? [{ key: formKey, location_id: form.id ?? null, customer_id: customerId ?? null }] : [], open);
|
|
116
|
+
const formProposalResult = formProposal.data ? formProposal.data[formKey] : undefined;
|
|
117
|
+
const autoLabel = formProposal.error
|
|
118
|
+
? "Automatisch (voorstel ophalen mislukt)"
|
|
119
|
+
: !formProposalResult
|
|
120
|
+
? "Automatisch (voorstel ophalen…)"
|
|
121
|
+
: formProposalResult.status === "engine_missing"
|
|
122
|
+
? `Automatisch (${ENGINE_MISSING_TEXT.toLowerCase()})`
|
|
123
|
+
: `Automatisch (voorstel: ${proposalText(formProposalResult.proposal)})`;
|
|
123
124
|
const carrierName = (id) => carriers.find((c) => c.id === id)?.name ?? "—";
|
|
124
125
|
const resetValidation = () => { setTouched({}); setSubmitted(false); };
|
|
125
|
-
const startNew = () => {
|
|
126
|
+
const startNew = () => {
|
|
127
|
+
setForm({ ...EMPTY, country: toIsoCountry(cd.defaults?.country ?? "") ?? "" });
|
|
128
|
+
resetValidation();
|
|
129
|
+
setOpen(true);
|
|
130
|
+
};
|
|
126
131
|
const startEdit = (loc) => {
|
|
127
132
|
resetValidation();
|
|
128
133
|
setForm({
|
|
@@ -133,7 +138,9 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
133
138
|
postal_code: loc.postal_code ?? "",
|
|
134
139
|
city: loc.city ?? "",
|
|
135
140
|
province: loc.province ?? "",
|
|
136
|
-
|
|
141
|
+
// Oude namen ("Nederland") worden als ISO-code getoond; een onbekend land blijft staan,
|
|
142
|
+
// zodat opslaan het weigert in plaats van te raden.
|
|
143
|
+
country: toIsoCountry(loc.country) ?? (loc.country ?? ""),
|
|
137
144
|
carrier_id: loc.carrier_id,
|
|
138
145
|
carrier_assignment_source: (loc.carrier_assignment_source ?? "auto"),
|
|
139
146
|
is_primary: loc.is_primary,
|
|
@@ -180,36 +187,22 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
180
187
|
}
|
|
181
188
|
saveMut.mutate();
|
|
182
189
|
};
|
|
183
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-sm text-muted-foreground", children: "Afleverlocaties staan volledig los van de boekhoudlocatie uit Twinfield en worden alleen gebruikt voor orderverwerking, planning, picking en levering. De vervoerder wordt
|
|
190
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-sm text-muted-foreground", children: "Afleverlocaties staan volledig los van de boekhoudlocatie uit Twinfield en worden alleen gebruikt voor orderverwerking, planning, picking en levering. De vervoerder wordt bepaald door de Logistieke Engine, tenzij je bij een locatie zelf een vervoerder kiest." }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { size: "sm", variant: "outline", onClick: () => previewMut.mutate(), disabled: previewMut.isPending, children: [_jsx(Download, { className: "h-4 w-4 mr-2" }), previewMut.isPending ? "Laden…" : "Importeren uit Floriday"] }), _jsxs(Button, { size: "sm", onClick: startNew, children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), " Locatie toevoegen"] })] })] }), locations.length === 0 ? (_jsx(Card, { children: _jsx(CardContent, { className: "py-10 text-center text-sm text-muted-foreground", children: "Nog geen afleverlocaties." }) })) : (_jsx("div", { className: "grid gap-3 md:grid-cols-2", children: locations.map((loc) => {
|
|
184
191
|
const street = [loc.street, loc.house_number].filter(Boolean).join(" ") || loc.raw?.address?.addressLine || loc.address_line || "";
|
|
185
|
-
return (_jsx(Card, { children: _jsxs(CardContent, { className: "pt-5 space-y-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-semibold flex items-center gap-2", children: [_jsx(MapPin, { className: "h-4 w-4 text-muted-foreground" }), loc.name || street || "Afleverlocatie"] }), _jsxs("div", { className: "text-sm text-muted-foreground mt-0.5", children: [loc.name ? street : "", loc.name && street && (loc.postal_code || loc.city) ? ", " : "", [loc.postal_code, loc.city].filter(Boolean).join(" "), loc.province ? ` · ${loc.province}` : "", loc.country ? (_jsxs("span", { className: "inline-flex items-center gap-1 ml-1", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(loc.country) ?? "🌐" }), _jsx("span", { children: loc.country })] })) : null] })] }), _jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => startEdit(loc), children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", children: _jsx(Trash2, { className: "h-4 w-4" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Locatie verwijderen?" }), _jsx(AlertDialogDescription, { children: "Deze actie kan niet ongedaan worden gemaakt." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), _jsx(AlertDialogAction, { onClick: () => delMut.mutate(loc.id), children: "Verwijderen" })] })] })] })] })] }), _jsxs("div", { className: "flex items-center gap-2 flex-wrap text-sm", children: [loc.self_pickup ? (_jsxs(_Fragment, { children: [_jsx(PackageCheck, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "font-medium", children: "
|
|
192
|
+
return (_jsx(Card, { children: _jsxs(CardContent, { className: "pt-5 space-y-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-semibold flex items-center gap-2", children: [_jsx(MapPin, { className: "h-4 w-4 text-muted-foreground" }), loc.name || street || "Afleverlocatie"] }), _jsxs("div", { className: "text-sm text-muted-foreground mt-0.5", children: [loc.name ? street : "", loc.name && street && (loc.postal_code || loc.city) ? ", " : "", [loc.postal_code, loc.city].filter(Boolean).join(" "), loc.province ? ` · ${loc.province}` : "", loc.country ? (_jsxs("span", { className: "inline-flex items-center gap-1 ml-1", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(loc.country) ?? "🌐" }), _jsx("span", { children: toIsoCountry(loc.country) ? countryNameFromIso(toIsoCountry(loc.country)) : loc.country })] })) : null] })] }), _jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => startEdit(loc), children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", children: _jsx(Trash2, { className: "h-4 w-4" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Locatie verwijderen?" }), _jsx(AlertDialogDescription, { children: "Deze actie kan niet ongedaan worden gemaakt." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), _jsx(AlertDialogAction, { onClick: () => delMut.mutate(loc.id), children: "Verwijderen" })] })] })] })] })] }), _jsxs("div", { className: "flex items-center gap-2 flex-wrap text-sm", children: [loc.self_pickup ? (_jsxs(_Fragment, { children: [_jsx(PackageCheck, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "font-medium", children: "Klant haalt zelf op" })] })) : loc.carrier_assignment_source === "manual" && loc.carrier_id ? (_jsxs(_Fragment, { children: [_jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "font-medium", children: carrierName(loc.carrier_id) }), _jsx(Badge, { variant: "outline", children: "Gekozen bij deze locatie" })] })) : (_jsxs("span", { className: "inline-flex items-center gap-2 flex-wrap", children: [_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(Sparkles, { className: "h-3 w-3" }), "Automatisch"] }), _jsx(ProposalLine, { result: proposals.data?.[loc.id], loading: proposals.isLoading, error: proposals.error, onRetry: () => proposals.refetch() })] })), loc.external_provider === "floriday" && (_jsx(Badge, { variant: "outline", className: "text-success-soft-foreground border-success", children: "Floriday" })), loc.gln && _jsxs(Badge, { variant: "secondary", children: ["GLN ", loc.gln] }), loc.is_primary && _jsx(Badge, { children: "Vaste afleverlocatie" }), loc.external_provider === "floriday" && loc.raw?.isDefault === true && (_jsx(Badge, { variant: "outline", children: "Standaard in Floriday" })), !loc.is_primary && (_jsx(Button, { size: "sm", variant: "outline", className: "h-7", disabled: primaryMut.isPending, onClick: () => primaryMut.mutate(loc.id), title: loc.external_provider === "floriday"
|
|
186
193
|
? "Dit verandert niets in Floriday; de koper kiest daar zelf zijn standaard."
|
|
187
194
|
: undefined, children: "Maak vaste afleverlocatie" }))] })] }) }, loc.id));
|
|
188
|
-
}) })), _jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: form.id ? "Locatie bewerken" : "Nieuwe locatie" }), _jsx(DialogDescription, { children: "
|
|
195
|
+
}) })), _jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: form.id ? "Locatie bewerken" : "Nieuwe locatie" }), _jsx(DialogDescription, { children: "Kies \"Automatisch\" om de vervoerder steeds door de Logistieke Engine te laten bepalen." })] }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2", children: [_jsx(Label, { children: "Locatienaam (optioneel)" }), _jsx(Input, { value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }) })] }), _jsxs("div", { className: "md:col-span-2 grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "col-span-2", children: [_jsxs(Label, { children: ["Straat ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.street, value: form.street, onChange: (e) => setForm({ ...form, street: e.target.value }), onBlur: () => markTouched("street"), "aria-invalid": !!showError("street"), className: showError("street") ? "border-destructive" : undefined }), showError("street") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("street") })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Huisnummer ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.house_number, value: form.house_number, onChange: (e) => setForm({ ...form, house_number: e.target.value }), onBlur: () => markTouched("house_number"), "aria-invalid": !!showError("house_number"), className: showError("house_number") ? "border-destructive" : undefined }), showError("house_number") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("house_number") })] })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Postcode ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.postal_code, value: form.postal_code, onChange: (e) => setForm({ ...form, postal_code: e.target.value }), onBlur: () => {
|
|
189
196
|
markTouched("postal_code");
|
|
190
197
|
setForm((f) => ({ ...f, postal_code: normalizePostalCode(f.postal_code, f.country) }));
|
|
191
|
-
}, "aria-invalid": !!showError("postal_code"), className: showError("postal_code") ? "border-destructive" : undefined }), showError("postal_code") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("postal_code") })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Plaats ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.city, value: form.city, onChange: (e) => setForm({ ...form, city: e.target.value }), onBlur: () => markTouched("city"), "aria-invalid": !!showError("city"), className: showError("city") ? "border-destructive" : undefined }), showError("city") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("city") })] }), _jsxs("div", { ref: fieldRefs.country, tabIndex: -1, children: [_jsxs(Label, { children: ["Land ", req && _jsx("span", { className: "text-destructive", children: "*" })] }),
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const flag = countryNameToFlag(c.code);
|
|
197
|
-
return (_jsx(SelectItem, { value: c.name, children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [flag ? _jsx("span", { className: "text-base", "aria-hidden": "true", children: flag }) : _jsx("span", { className: "w-4" }), _jsx("span", { children: c.name })] }) }, c.code));
|
|
198
|
-
}) })] }), showError("country") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("country") })] }), _jsxs("div", { ref: fieldRefs.province, tabIndex: -1, children: [_jsxs(Label, { children: ["Provincie ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), (() => {
|
|
198
|
+
}, "aria-invalid": !!showError("postal_code"), className: showError("postal_code") ? "border-destructive" : undefined }), showError("postal_code") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("postal_code") })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Plaats ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.city, value: form.city, onChange: (e) => setForm({ ...form, city: e.target.value }), onBlur: () => markTouched("city"), "aria-invalid": !!showError("city"), className: showError("city") ? "border-destructive" : undefined }), showError("city") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("city") })] }), _jsxs("div", { ref: fieldRefs.country, tabIndex: -1, children: [_jsxs(Label, { children: ["Land ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: form.country, onValueChange: (v) => { markTouched("country"); setForm({ ...form, country: v, province: "" }); }, options: Object.entries(COUNTRY_NAMES).map(([code, name]) => ({
|
|
199
|
+
value: code,
|
|
200
|
+
label: `${countryNameToFlag(code) ?? ""} ${name}`.trim(),
|
|
201
|
+
search: `${name} ${code}`,
|
|
202
|
+
})), placeholder: form.country && !COUNTRY_NAMES[form.country] ? `Onbekend land: ${form.country}` : "Kies een land", triggerClassName: `w-full ${showError("country") ? "border-destructive" : ""}` }), showError("country") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("country") })] }), _jsxs("div", { ref: fieldRefs.province, tabIndex: -1, children: [_jsxs(Label, { children: ["Provincie ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), (() => {
|
|
199
203
|
const provinces = findCountry(form.country)?.provinces ?? [];
|
|
200
204
|
return provinces.length > 0 ? (_jsxs(Select, { value: form.province || "", onValueChange: (v) => { markTouched("province"); setForm({ ...form, province: v }); }, children: [_jsx(SelectTrigger, { className: showError("province") ? "border-destructive" : undefined, children: _jsx(SelectValue, { placeholder: "Kies een provincie" }) }), _jsx(SelectContent, { children: provinces.map((p) => (_jsx(SelectItem, { value: p, children: p }, p))) })] })) : (_jsx(Input, { value: form.province, onChange: (e) => setForm({ ...form, province: e.target.value }), onBlur: () => markTouched("province"), placeholder: "Kies eerst een land", disabled: !form.country, "aria-invalid": !!showError("province"), className: showError("province") ? "border-destructive" : undefined }));
|
|
201
|
-
})(), showError("province") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("province") })] }), _jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { children: "Vervoerder" }),
|
|
202
|
-
if (v === "__self__") {
|
|
203
|
-
setForm({ ...form, self_pickup: true, carrier_id: null, carrier_assignment_source: "manual" });
|
|
204
|
-
}
|
|
205
|
-
else if (v === "__none__") {
|
|
206
|
-
setForm({ ...form, self_pickup: false, carrier_id: null, carrier_assignment_source: "manual" });
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
setForm({ ...form, self_pickup: false, carrier_id: v, carrier_assignment_source: "manual" });
|
|
210
|
-
}
|
|
211
|
-
}, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Kies een vervoerder" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "__self__", children: "Eigen vervoer (klant haalt zelf op)" }), _jsx(SelectItem, { value: "__none__", children: "\u2014 Geen vervoerder \u2014" }), carriers.map((c) => (_jsx(SelectItem, { value: c.id, children: c.name }, c.id)))] })] }), form.self_pickup ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "De klant komt zelf de karren ophalen \u2014 er wordt geen vervoerder gekoppeld." })) : form.carrier_assignment_source === "manual" ? (_jsxs("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [_jsx("span", { children: "Handmatig overschreven." }), _jsx(Button, { variant: "link", size: "sm", className: "h-auto p-0", onClick: () => setForm({ ...form, carrier_assignment_source: "auto" }), children: "Terug naar automatisch" })] })) : autoSuggested?.carrier_id ? (_jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [_jsx(Sparkles, { className: "h-3 w-3" }), "Automatisch geselecteerd op basis van ", autoSuggested.matched_on === "city"
|
|
212
|
-
? "plaats" : autoSuggested.matched_on === "province" ? "provincie" : "land", "."] })) : (_jsx("div", { className: "text-xs text-warning-soft-foreground", children: "Geen vervoerder gevonden voor dit bedieningsgebied \u2014 selecteer er handmatig \u00E9\u00E9n." }))] }), _jsxs("label", { className: "md:col-span-2 flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", className: "mt-1", checked: form.is_primary, onChange: (e) => setForm({ ...form, is_primary: e.target.checked }) }), _jsxs("span", { children: ["Vaste afleverlocatie", _jsx("span", { className: "block text-xs text-muted-foreground", children: "Wordt bij nieuwe orders vooraf gekozen. Een eventuele andere vaste locatie van deze klant vervalt." })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: "Annuleren" }), _jsx(Button, { onClick: handleSubmit, disabled: saveMut.isPending, children: form.id ? "Opslaan" : "Toevoegen" })] })] }) }), _jsx(Dialog, { open: importOpen, onOpenChange: setImportOpen, children: _jsxs(DialogContent, { className: "max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Afleverlocaties importeren uit Floriday" }), _jsx(DialogDescription, { children: "Controleer de locaties voordat je importeert. Adres, plaats, land en GLN-code komen uit Floriday. De vervoerder wordt automatisch gekoppeld op basis van het bedieningsgebied." })] }), _jsx("div", { className: "max-h-[50vh] overflow-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Locatie" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Klant" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Adres" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "GLN" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Actie" })] }) }), _jsxs("tbody", { children: [(importPreview?.items ?? []).map((it) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "px-3 py-2", children: it.name }), _jsx("td", { className: "px-3 py-2", children: it.customer_name ?? "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.address || "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.gln ?? "—" }), _jsxs("td", { className: "px-3 py-2", children: [it.action === "create" && _jsx(Badge, { children: "Nieuw" }), it.action === "update" && _jsx(Badge, { variant: "secondary", children: "Bijwerken" }), it.action === "no_customer" && (_jsx(Badge, { variant: "outline", className: "text-warning-soft-foreground border-warning bg-warning-soft", children: "Geen klant gevonden" }))] })] }, it.floriday_id))), (importPreview?.items ?? []).length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: 5, className: "px-3 py-6 text-center text-muted-foreground", children: "Geen locaties gevonden in Floriday." }) }))] })] }) }), _jsxs("div", { className: "text-sm text-muted-foreground", children: [importPreview?.created ?? 0, " nieuw \u00B7 ", importPreview?.updated ?? 0, " bijwerken", (importPreview?.skipped ?? 0) > 0
|
|
205
|
+
})(), showError("province") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("province") })] }), _jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { children: "Vervoerder" }), _jsx(CarrierPicker, { variant: "location", value: choiceFromLocation(form), onChange: (choice) => setForm({ ...form, ...locationCarrierFields(choice) }), autoLabel: autoLabel }), formProposal.error && (_jsx(ProposalLine, { result: undefined, error: formProposal.error, onRetry: () => formProposal.refetch() })), form.self_pickup ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "De klant komt zelf de karren ophalen. Er wordt geen vervoerder gekoppeld." })) : choiceFromLocation(form).kind === "auto" ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "Er wordt geen vervoerder vastgelegd; het voorstel wordt steeds opnieuw bepaald." })) : null] }), _jsxs("label", { className: "md:col-span-2 flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", className: "mt-1", checked: form.is_primary, onChange: (e) => setForm({ ...form, is_primary: e.target.checked }) }), _jsxs("span", { children: ["Vaste afleverlocatie", _jsx("span", { className: "block text-xs text-muted-foreground", children: "Wordt bij nieuwe orders vooraf gekozen. Een eventuele andere vaste locatie van deze klant vervalt." })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: "Annuleren" }), _jsx(Button, { onClick: handleSubmit, disabled: saveMut.isPending, children: form.id ? "Opslaan" : "Toevoegen" })] })] }) }), _jsx(Dialog, { open: importOpen, onOpenChange: setImportOpen, children: _jsxs(DialogContent, { className: "max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Afleverlocaties importeren uit Floriday" }), _jsx(DialogDescription, { children: "Controleer de locaties voordat je importeert. Adres, plaats, land en GLN-code komen uit Floriday. Nieuwe locaties krijgen de vervoerder \"Automatisch\"; bestaande keuzes blijven staan." })] }), _jsx("div", { className: "max-h-[50vh] overflow-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Locatie" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Klant" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Adres" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "GLN" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Actie" })] }) }), _jsxs("tbody", { children: [(importPreview?.items ?? []).map((it) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "px-3 py-2", children: it.name }), _jsx("td", { className: "px-3 py-2", children: it.customer_name ?? "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.address || "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.gln ?? "—" }), _jsxs("td", { className: "px-3 py-2", children: [it.action === "create" && _jsx(Badge, { children: "Nieuw" }), it.action === "update" && _jsx(Badge, { variant: "secondary", children: "Bijwerken" }), it.action === "no_customer" && (_jsx(Badge, { variant: "outline", className: "text-warning-soft-foreground border-warning bg-warning-soft", children: "Geen klant gevonden" }))] })] }, it.floriday_id))), (importPreview?.items ?? []).length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: 5, className: "px-3 py-6 text-center text-muted-foreground", children: "Geen locaties gevonden in Floriday." }) }))] })] }) }), _jsxs("div", { className: "text-sm text-muted-foreground", children: [importPreview?.created ?? 0, " nieuw \u00B7 ", importPreview?.updated ?? 0, " bijwerken", (importPreview?.skipped ?? 0) > 0
|
|
213
206
|
? ` · ${importPreview?.skipped} overgeslagen omdat de Floriday-organisatie niet aan een klant gekoppeld is`
|
|
214
207
|
: ""] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setImportOpen(false), children: "Afbreken" }), _jsx(Button, { onClick: () => importMut.mutate(), disabled: importMut.isPending || ((importPreview?.created ?? 0) + (importPreview?.updated ?? 0)) === 0, children: importMut.isPending ? "Importeren…" : "Importeren" })] })] }) })] }));
|
|
215
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"AA8CA,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+BA2XjD"}
|
|
@@ -9,6 +9,7 @@ import { Trash2, Mail, Phone, Power, Pencil, MoreHorizontal, } from "lucide-reac
|
|
|
9
9
|
import { getCustomer, deleteCustomer, updateCustomer } from "../../lib/customers.functions.js";
|
|
10
10
|
import { ProfileCard, KpiStrip, BadgeList, EmptyState, ActivityItem, adaptLocalToProfile, } from "./KlantDetailLayout.js";
|
|
11
11
|
import { DeliveryLocationsTab } from "./DeliveryLocationsTab.js";
|
|
12
|
+
import { CustomerCarrierCard } from "./CustomerCarrierCard.js";
|
|
12
13
|
import { BackLink } from "./BackLink.js";
|
|
13
14
|
import { CustomerAnalyticsTab } from "./CustomerAnalyticsTab.js";
|
|
14
15
|
import { LocalDiscountsTab } from "./LocalDiscountsTab.js";
|
|
@@ -122,5 +123,5 @@ export function KlantDetail({ id }) {
|
|
|
122
123
|
locations: data.delivery_locations.length,
|
|
123
124
|
assortment: null,
|
|
124
125
|
orders: ordersData?.orders.length ?? 0,
|
|
125
|
-
}, onSelect: setTab }), _jsxs(Tabs, { value: tab, onValueChange: setTab, children: [_jsxs(TabsList, { className: "flex flex-wrap h-auto gap-1 mb-4", 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: "Floriday-aanbod" })), _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 }), !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))) })) }), _jsx(TabsContent, { value: "trade", children: 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: _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 })) : (_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: ["Gesynchroniseerd via ", _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] }) })] }));
|
|
126
|
+
}, onSelect: setTab }), _jsxs(Tabs, { value: tab, onValueChange: setTab, children: [_jsxs(TabsList, { className: "flex flex-wrap h-auto gap-1 mb-4", 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: "Floriday-aanbod" })), _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 }), !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))) })) }), _jsx(TabsContent, { value: "trade", children: 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(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 })) : (_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: ["Gesynchroniseerd via ", _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] }) })] }));
|
|
126
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlantFormulier.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantFormulier.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"KlantFormulier.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantFormulier.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAwBxF,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAuBf,CAAC;AAErB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,aAAa,EACb,MAAM,EACN,cAAc,EACd,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qGAAqG;IACrG,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,iEAAiE;IACjE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,6EAA6E;IAC7E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kDAAkD;IAClD,UAAU,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACrH,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,+BAirBA"}
|
|
@@ -12,7 +12,8 @@ import { listTwinfieldLedgerAccounts } from "../../lib/twinfield-ledger.function
|
|
|
12
12
|
import { customerCreateSchema } from "../../lib/customer-schemas.js";
|
|
13
13
|
import { requiresVatNumber } from "../../lib/twinfield-required-fields.js";
|
|
14
14
|
import { TWINFIELD_FIELD_MAX, TWINFIELD_READONLY_FIELDS, TWINFIELD_READONLY_HINT } from "../../lib/twinfield-limits.js";
|
|
15
|
-
import { countryNameToFlag,
|
|
15
|
+
import { countryNameToFlag, COUNTRY_NAMES, toIsoCountry } from "../../lib/countries.js";
|
|
16
|
+
import { SearchableSelect } from "./SearchableSelect.js";
|
|
16
17
|
import { checkVatFormat, isTwinfieldVatError } from "../../lib/vat-format.js";
|
|
17
18
|
import { creditManagerDisplay } from "../../lib/credit-management.js";
|
|
18
19
|
import { TWINFIELD_DEFAULTS, VAT_DISPLAY_OPTIONS, PAYMENT_SPEC_METHOD_OPTIONS, INVOICE_SEND_AS_OPTIONS, SEND_REMINDER_OPTIONS, DISCOUNT_SURCHARGE_OPTIONS, } from "../../lib/twinfield-defaults.js";
|
|
@@ -124,7 +125,7 @@ export function KlantFormulier({ title, description, submitLabel, submitting, de
|
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
const merged = { ...values };
|
|
127
|
-
for (const k of Object.keys(customerCreateSchema.shape)) {
|
|
128
|
+
for (const k of Object.keys(customerCreateSchema.in.shape)) {
|
|
128
129
|
if (!form.getFieldState(k).isDirty && k in baseRef.current) {
|
|
129
130
|
merged[k] = baseRef.current[k];
|
|
130
131
|
}
|
|
@@ -228,16 +229,11 @@ export function KlantFormulier({ title, description, submitLabel, submitting, de
|
|
|
228
229
|
})()] }), _jsx(Field, { label: "KvK-nummer", error: fieldErr("coc_number"), success: isValid("coc_number"), children: _jsx(Input, { ...form.register("coc_number") }) }), _jsx(Field, { label: "Contactpersoon", error: fieldErr("contact_person"), success: isValid("contact_person"), children: _jsx(Input, { ...form.register("contact_person") }) }), _jsx(Field, { label: "T.a.v.", error: fieldErr("attention_to"), children: _jsx(Input, { ...form.register("attention_to") }) }), _jsx(Field, { label: "E-mail", error: fieldErr("email"), success: isValid("email"), children: _jsx(Input, { type: "email", "aria-invalid": !!errors.email, placeholder: "naam@bedrijf.nl", ...form.register("email") }) }), _jsx(Field, { label: "E-mail voor facturering", error: fieldErr("billing_email"), success: isValid("billing_email"), children: _jsx(Input, { type: "email", placeholder: "facturen@bedrijf.nl", ...form.register("billing_email") }) }), _jsx(Field, { label: "Telefoon", error: fieldErr("phone"), success: isValid("phone"), children: _jsx(Input, { ...form.register("phone") }) }), _jsx(Field, { label: "Faxnummer", error: fieldErr("fax"), children: _jsx(Input, { ...form.register("fax") }) }), _jsx(Field, { label: "Klantklasse", children: _jsxs(Select, { value: form.watch("customer_class") || "__none__", onValueChange: (v) => form.setValue("customer_class", v === "__none__" ? "" : v, { shouldDirty: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Kies klasse..." }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "__none__", children: "Geen klasse" }), (classData?.classes ?? []).map((c) => _jsx(SelectItem, { value: c, children: c }, c))] })] }) }), _jsx(Field, { label: "Status", hint: "Een inactieve klant wordt in Twinfield verborgen.", children: _jsxs(Select, { value: form.watch("is_active") === false ? "inactief" : "actief", onValueChange: (v) => form.setValue("is_active", v === "actief", { shouldDirty: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "actief", children: "Actief" }), _jsx(SelectItem, { value: "inactief", children: "Inactief" })] })] }) })] }) }), _jsx(Section, { k: "adres", title: "Adres", icon: _jsx(MapPin, { className: "h-5 w-5" }), open: open.adres, onToggle: toggle, hasError: sectionHasError([
|
|
229
230
|
"address_type", "icp_country_code", "address_line1", "address_line2",
|
|
230
231
|
"street", "house_number", "postal_code", "city", "country",
|
|
231
|
-
]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Straat", error: fieldErr("street"), success: isValid("street"), children: _jsx(Input, { "aria-invalid": !!errors.street, ...form.register("street") }) }), _jsx(Field, { label: "Huisnummer", error: fieldErr("house_number"), success: isValid("house_number"), children: _jsx(Input, { "aria-invalid": !!errors.house_number, ...form.register("house_number") }) }), _jsx(Field, { label: "Postcode", error: fieldErr("postal_code"), success: isValid("postal_code"), children: _jsx(Input, { "aria-invalid": !!errors.postal_code, ...normalizeOnBlur("postal_code", normPostal) }) }), _jsx(Field, { label: "Plaats", error: fieldErr("city"), success: isValid("city"), children: _jsx(Input, { "aria-invalid": !!errors.city, ...form.register("city") }) }), _jsx(Field, { label: "Land", error: fieldErr("country"), success: isValid("country"), children:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [flag ? _jsx("span", { className: "text-base", "aria-hidden": "true", children: flag }) : _jsx("span", { className: "w-4" }), _jsx("span", { children: selectedCountry })] }));
|
|
237
|
-
})() }) }), _jsx(SelectContent, { children: COMMON_COUNTRY_NAMES.map((name) => {
|
|
238
|
-
const flag = countryNameToFlag(name);
|
|
239
|
-
return (_jsx(SelectItem, { value: name, children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [flag ? _jsx("span", { className: "text-base", "aria-hidden": "true", children: flag }) : _jsx("span", { className: "w-4" }), _jsx("span", { children: name })] }) }, name));
|
|
240
|
-
}) })] }) }), _jsx(Field, { label: "Adres type", error: fieldErr("address_type"), children: _jsxs(Select, { value: form.watch("address_type") || TWINFIELD_DEFAULTS.address_type, onValueChange: (v) => form.setValue("address_type", v, { shouldValidate: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "invoice", children: "Factuur" }), _jsx(SelectItem, { value: "postal", children: "Post" })] })] }) }), _jsx(Field, { label: "ICP landcode", error: fieldErr("icp_country_code"), children: _jsx(Input, { placeholder: "bv. NL", ...form.register("icp_country_code") }) }), _jsx(Field, { label: "Adresregel 1", error: fieldErr("address_line1"), hint: lengthWarning(values.address_line1, 60, "adresregel 1") ??
|
|
232
|
+
]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Straat", error: fieldErr("street"), success: isValid("street"), children: _jsx(Input, { "aria-invalid": !!errors.street, ...form.register("street") }) }), _jsx(Field, { label: "Huisnummer", error: fieldErr("house_number"), success: isValid("house_number"), children: _jsx(Input, { "aria-invalid": !!errors.house_number, ...form.register("house_number") }) }), _jsx(Field, { label: "Postcode", error: fieldErr("postal_code"), success: isValid("postal_code"), children: _jsx(Input, { "aria-invalid": !!errors.postal_code, ...normalizeOnBlur("postal_code", normPostal) }) }), _jsx(Field, { label: "Plaats", error: fieldErr("city"), success: isValid("city"), children: _jsx(Input, { "aria-invalid": !!errors.city, ...form.register("city") }) }), _jsx(Field, { label: "Land", error: fieldErr("country"), success: isValid("country"), children: _jsx(SearchableSelect, { value: toIsoCountry(form.watch("country")) ?? (form.watch("country") || ""), onValueChange: (v) => form.setValue("country", v, { shouldValidate: true, shouldDirty: true }), options: Object.entries(COUNTRY_NAMES).map(([code, name]) => ({
|
|
233
|
+
value: code,
|
|
234
|
+
label: `${countryNameToFlag(code) ?? ""} ${name}`.trim(),
|
|
235
|
+
search: `${name} ${code}`,
|
|
236
|
+
})), placeholder: form.watch("country") ? `Onbekend land: ${form.watch("country")}` : "Kies een land", triggerClassName: "w-full" }) }), _jsx(Field, { label: "Adres type", error: fieldErr("address_type"), children: _jsxs(Select, { value: form.watch("address_type") || TWINFIELD_DEFAULTS.address_type, onValueChange: (v) => form.setValue("address_type", v, { shouldValidate: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "invoice", children: "Factuur" }), _jsx(SelectItem, { value: "postal", children: "Post" })] })] }) }), _jsx(Field, { label: "ICP landcode", error: fieldErr("icp_country_code"), children: _jsx(Input, { placeholder: "bv. NL", ...form.register("icp_country_code") }) }), _jsx(Field, { label: "Adresregel 1", error: fieldErr("address_line1"), hint: lengthWarning(values.address_line1, 60, "adresregel 1") ??
|
|
241
237
|
"Wordt automatisch gevuld uit straat en huisnummer; alleen aanpassen bij een afwijkend adres.", children: _jsx(Input, { ...form.register("address_line1") }) }), _jsx(Field, { label: "Adresregel 2", error: fieldErr("address_line2"), hint: lengthWarning(values.address_line2, 60, "adresregel 2") ??
|
|
242
238
|
"Optioneel, bijvoorbeeld een postbus of gebouwnaam.", children: _jsx(Input, { ...form.register("address_line2") }) })] }) }), _jsx(Section, { k: "bank", title: "Bankgegevens", icon: _jsx(Landmark, { className: "h-5 w-5" }), open: open.bank, onToggle: toggle, summary: filled(values.bank_iban) ? `IBAN ${values.bank_iban}` : "Nog leeg", hasError: sectionHasError(["bank_iban", "bank_bic", "bank_postal_code"]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Bank - Naam", children: _jsx(Input, { ...form.register("bank_name") }) }), _jsx(Field, { label: "Bank - Rekeninghouder", children: _jsx(Input, { ...form.register("bank_account_holder") }) }), _jsx(Field, { label: "Bank - Rekeningnummer", children: _jsx(Input, { ...form.register("bank_account_number") }) }), _jsx(Field, { label: "Bank - IBAN", error: fieldErr("bank_iban"), success: isValid("bank_iban"), children: _jsx(Input, { placeholder: "NL00 BANK 0000 0000 00", ...normalizeOnBlur("bank_iban", normIban) }) }), _jsx(Field, { label: "Bank - BIC", error: fieldErr("bank_bic"), success: isValid("bank_bic"), hint: form.formState.dirtyFields.bank_bic && !form.formState.dirtyFields.bank_iban
|
|
243
239
|
? "BIC wordt alleen samen met een passend IBAN naar Twinfield gestuurd."
|
|
@@ -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":"AAoEA,wBAAgB,gBAAgB,gCA43B/B"}
|
|
@@ -22,6 +22,9 @@ import { PriceGroupBadges } from "./PriceGroupBadges.js";
|
|
|
22
22
|
import { KlantBewerkenDialog } from "./KlantBewerkenDialog.js";
|
|
23
23
|
import { ChannelBadges } from "./ChannelBadges.js";
|
|
24
24
|
import { FloridayAutoPromoteCard } from "./FloridayAutoPromoteCard.js";
|
|
25
|
+
import { CarrierAdminCard } from "./CarrierAdminCard.js";
|
|
26
|
+
import { ProposalLine, useCarrierProposals } from "./CarrierPicker.js";
|
|
27
|
+
import { StickerSizePreviewCard } from "./StickerSizePreviewCard.js";
|
|
25
28
|
import { derivePaymentMethod, paymentToneClasses } from "../../lib/payment-method.js";
|
|
26
29
|
import { formatCountry, getCountryFlagAndName, countryNameToFlag } from "../../lib/countries.js";
|
|
27
30
|
import { MultiSearchableSelect } from "./MultiSearchableSelect.js";
|
|
@@ -440,6 +443,8 @@ export function KlantenOverzicht() {
|
|
|
440
443
|
const startIdx = total === 0 ? 0 : (currentPage - 1) * pageSize;
|
|
441
444
|
const endIdx = Math.min(startIdx + pageSize, total);
|
|
442
445
|
const pageRows = customers.slice(startIdx, endIdx);
|
|
446
|
+
// Vervoerder per klant: live voorstel van de Logistieke Engine, één aanvraag per pagina.
|
|
447
|
+
const carrierProposals = useCarrierProposals(pageRows.filter((c) => !!c.id).map((c) => ({ key: c.id, location_id: null, customer_id: c.id })));
|
|
443
448
|
const resetPage = () => setPage(1);
|
|
444
449
|
const activeFilterChips = [];
|
|
445
450
|
if (search)
|
|
@@ -473,7 +478,7 @@ export function KlantenOverzicht() {
|
|
|
473
478
|
});
|
|
474
479
|
const toggleSort = (col) => setSort((s) => (s.col === col ? { col, dir: s.dir === "asc" ? "desc" : "asc" } : { col, dir: "asc" }));
|
|
475
480
|
const lastUpdated = externalData?.last_fetched_at ?? null;
|
|
476
|
-
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "p-4 sm:p-6 space-y-5 min-w-0 max-w-full overflow-x-hidden", children: [_jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: "Klanten" }), _jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Beheer en doorzoek al je klanten." })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => goTo({ to: "/klanten/import" }), children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), " Importeren"] }), _jsxs(Button, { onClick: () => goTo({ to: "/klanten/nieuw" }), children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), " Nieuwe klant"] })] })] }), _jsx(FloridayAutoPromoteCard, {}), loadError && (_jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3", children: [_jsx(AlertCircle, { className: "h-5 w-5 text-destructive shrink-0" }), _jsxs("div", { className: "text-sm", children: [_jsx("div", { className: "font-medium", children: isBackendUnavailable(loadError)
|
|
481
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "p-4 sm:p-6 space-y-5 min-w-0 max-w-full overflow-x-hidden", children: [_jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: "Klanten" }), _jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Beheer en doorzoek al je klanten." })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => goTo({ to: "/klanten/import" }), children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), " Importeren"] }), _jsxs(Button, { onClick: () => goTo({ to: "/klanten/nieuw" }), children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), " Nieuwe klant"] })] })] }), _jsx(FloridayAutoPromoteCard, {}), _jsx(CarrierAdminCard, {}), _jsx(StickerSizePreviewCard, {}), loadError && (_jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3", children: [_jsx(AlertCircle, { className: "h-5 w-5 text-destructive shrink-0" }), _jsxs("div", { className: "text-sm", children: [_jsx("div", { className: "font-medium", children: isBackendUnavailable(loadError)
|
|
477
482
|
? "De database is tijdelijk niet bereikbaar"
|
|
478
483
|
: "De klanten konden niet geladen worden" }), _jsx("div", { className: "text-muted-foreground", children: isBackendUnavailable(loadError)
|
|
479
484
|
? "Je bent niet uitgelogd. Probeer het over een paar minuten opnieuw."
|
|
@@ -496,7 +501,7 @@ export function KlantenOverzicht() {
|
|
|
496
501
|
setSelectedPayments([]);
|
|
497
502
|
setView("all");
|
|
498
503
|
setPage(1);
|
|
499
|
-
}, className: "text-xs text-muted-foreground hover:text-foreground underline", children: "Alles wissen" })] })), _jsx(CardContent, { className: "p-0", children: _jsx("div", { className: "max-h-[60vh] overflow-y-auto overflow-x-auto overscroll-contain [-webkit-overflow-scrolling:touch]", children: _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 z-10 bg-background", children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: _jsx(SortHeader, { label: "Bedrijf", col: "company_name", sort: sort, onClick: toggleSort }) }), _jsx(TableHead, { children: "Contact" }), _jsx(TableHead, { children: "Prijscategorie" }), _jsx(TableHead, { children: "Kanaal" }), _jsx(TableHead, { children: "Betaalvorm" }), _jsx(TableHead, { children: "Omzet 12 mnd" }), _jsx(TableHead, { children: _jsx(SortHeader, { label: "Land", col: "country", sort: sort, onClick: toggleSort }) }), _jsx(TableHead, { children: "Status" })] }) }), _jsx(TableBody, { children: isLoading ? (Array.from({ length: 6 }).map((_, i) => (_jsx(TableRow, { children: Array.from({ length:
|
|
504
|
+
}, className: "text-xs text-muted-foreground hover:text-foreground underline", children: "Alles wissen" })] })), _jsx(CardContent, { className: "p-0", children: _jsx("div", { className: "max-h-[60vh] overflow-y-auto overflow-x-auto overscroll-contain [-webkit-overflow-scrolling:touch]", children: _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 z-10 bg-background", children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: _jsx(SortHeader, { label: "Bedrijf", col: "company_name", sort: sort, onClick: toggleSort }) }), _jsx(TableHead, { children: "Contact" }), _jsx(TableHead, { children: "Prijscategorie" }), _jsx(TableHead, { children: "Kanaal" }), _jsx(TableHead, { children: "Betaalvorm" }), _jsx(TableHead, { children: "Omzet 12 mnd" }), _jsx(TableHead, { children: _jsx(SortHeader, { label: "Land", col: "country", sort: sort, onClick: toggleSort }) }), _jsx(TableHead, { children: "Vervoerder" }), _jsx(TableHead, { children: "Status" })] }) }), _jsx(TableBody, { children: isLoading ? (Array.from({ length: 6 }).map((_, i) => (_jsx(TableRow, { children: Array.from({ length: 9 }).map((__, j) => (_jsx(TableCell, { className: "py-4", children: _jsx(Skeleton, { className: "h-4 w-full max-w-[160px]" }) }, j))) }, i)))) : pageRows.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 9, children: _jsx(EmptyState, { onAdd: () => goTo({ to: "/klanten/nieuw" }), filtered: activeFilterChips.length > 0, onClearFilters: () => {
|
|
500
505
|
setSearchInput("");
|
|
501
506
|
setSearch("");
|
|
502
507
|
setSelectedCountries([]);
|
|
@@ -514,7 +519,7 @@ export function KlantenOverzicht() {
|
|
|
514
519
|
: goTo({
|
|
515
520
|
to: "/klanten/groep/$groupKey",
|
|
516
521
|
params: { groupKey: c.group_key },
|
|
517
|
-
}), children: [_jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-medium truncate flex items-center gap-2", children: [_jsx("span", { className: "truncate", children: primaryName }), c.overdue && c.overdue.count > 0 && (_jsxs("span", { title: `${c.overdue.count} openstaande factu${c.overdue.count === 1 ? "ur" : "ren"} · oudste vervallen op ${c.overdue.oldest_due}`, className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 text-destructive px-2 py-0.5 text-[11px] font-medium shrink-0", children: [_jsx(AlertCircle, { className: "h-3 w-3" }), " ", formatEuro(c.overdue.total), " achterstallig"] }))] }), secondary && _jsx("div", { className: "text-xs text-muted-foreground truncate", children: secondary })] })] }) }), _jsx(TableCell, { className: "py-3", children: c.contact_person || c.email ? (_jsxs("div", { className: "min-w-0", children: [c.contact_person && _jsx("div", { className: "text-sm truncate", children: c.contact_person }), c.email && (_jsxs("a", { href: `mailto:${c.email}`, onClick: (e) => e.stopPropagation(), className: "text-xs text-muted-foreground inline-flex items-center gap-1 hover:underline truncate", children: [_jsx(Mail, { className: "h-3 w-3" }), " ", c.email] }))] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(PriceGroupBadges, { groups: c.price_groups }) }), _jsx(TableCell, { className: "py-3", children: _jsx(ChannelBadges, { providers: c.providers }) }), _jsx(TableCell, { className: "py-3", children: _jsx("span", { className: `inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${paymentToneClasses(c.payment_method.tone)}`, children: c.payment_method.label }) }), _jsx(TableCell, { className: "py-3 text-sm whitespace-nowrap", children: c.revenue && c.revenue.count > 0 ? (_jsxs("span", { title: `${c.revenue.count} transactie${c.revenue.count === 1 ? "" : "s"} · laatste op ${formatDateNl(c.revenue.last_date)}`, children: [_jsx("span", { className: "font-medium", children: formatEuro(c.revenue.amount) }), _jsxs("span", { className: "block text-xs text-muted-foreground", children: ["laatst ", formatDateNl(c.revenue.last_date)] })] })) : (_jsx("span", { className: "text-muted-foreground", children: "Geen omzet" })) }), _jsx(TableCell, { className: "py-3 text-sm", children: c.country ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(c.country) ?? "🌐" }), _jsx("span", { children: formatCountry(c.country) })] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx(StatusPill, { active: c.is_active, missing: c.missing }), c.id ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", title: "Klant bewerken", onClick: (e) => {
|
|
522
|
+
}), children: [_jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-medium truncate flex items-center gap-2", children: [_jsx("span", { className: "truncate", children: primaryName }), c.overdue && c.overdue.count > 0 && (_jsxs("span", { title: `${c.overdue.count} openstaande factu${c.overdue.count === 1 ? "ur" : "ren"} · oudste vervallen op ${c.overdue.oldest_due}`, className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 text-destructive px-2 py-0.5 text-[11px] font-medium shrink-0", children: [_jsx(AlertCircle, { className: "h-3 w-3" }), " ", formatEuro(c.overdue.total), " achterstallig"] }))] }), secondary && _jsx("div", { className: "text-xs text-muted-foreground truncate", children: secondary })] })] }) }), _jsx(TableCell, { className: "py-3", children: c.contact_person || c.email ? (_jsxs("div", { className: "min-w-0", children: [c.contact_person && _jsx("div", { className: "text-sm truncate", children: c.contact_person }), c.email && (_jsxs("a", { href: `mailto:${c.email}`, onClick: (e) => e.stopPropagation(), className: "text-xs text-muted-foreground inline-flex items-center gap-1 hover:underline truncate", children: [_jsx(Mail, { className: "h-3 w-3" }), " ", c.email] }))] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(PriceGroupBadges, { groups: c.price_groups }) }), _jsx(TableCell, { className: "py-3", children: _jsx(ChannelBadges, { providers: c.providers }) }), _jsx(TableCell, { className: "py-3", children: _jsx("span", { className: `inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${paymentToneClasses(c.payment_method.tone)}`, children: c.payment_method.label }) }), _jsx(TableCell, { className: "py-3 text-sm whitespace-nowrap", children: c.revenue && c.revenue.count > 0 ? (_jsxs("span", { title: `${c.revenue.count} transactie${c.revenue.count === 1 ? "" : "s"} · laatste op ${formatDateNl(c.revenue.last_date)}`, children: [_jsx("span", { className: "font-medium", children: formatEuro(c.revenue.amount) }), _jsxs("span", { className: "block text-xs text-muted-foreground", children: ["laatst ", formatDateNl(c.revenue.last_date)] })] })) : (_jsx("span", { className: "text-muted-foreground", children: "Geen omzet" })) }), _jsx(TableCell, { className: "py-3 text-sm", children: c.country ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(c.country) ?? "🌐" }), _jsx("span", { children: formatCountry(c.country) })] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3 max-w-[260px]", children: c.id ? (_jsx(ProposalLine, { compact: true, result: carrierProposals.data?.[c.id], loading: carrierProposals.isLoading, error: carrierProposals.error, onRetry: () => carrierProposals.refetch() })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx(StatusPill, { active: c.is_active, missing: c.missing }), c.id ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", title: "Klant bewerken", onClick: (e) => {
|
|
518
523
|
e.stopPropagation();
|
|
519
524
|
setEditTarget({ customerId: c.id });
|
|
520
525
|
}, children: [_jsx(Pencil, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Bewerken" })] })) : c.twinfield_code ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", title: "Twinfield-klant overnemen en bewerken", onClick: (e) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type StickerUploadSize } from "../../lib/customer-stickers.functions.js";
|
|
2
|
+
/**
|
|
3
|
+
* "Formaat: 48 × 48 mm (wijzigen)". Zonder maat: voorstel via geladen etiket
|
|
4
|
+
* (één klik bevestigen) of pas dan om breedte en hoogte vragen.
|
|
5
|
+
*/
|
|
6
|
+
export declare function StickerSizeLine({ customerKey, tradeItemKey, widthMm, heightMm, initialDetection, onSaved, }: {
|
|
7
|
+
customerKey: string;
|
|
8
|
+
tradeItemKey: string;
|
|
9
|
+
widthMm: number | null;
|
|
10
|
+
heightMm: number | null;
|
|
11
|
+
initialDetection?: StickerUploadSize | null;
|
|
12
|
+
onSaved: () => void;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=StickerSizeLine.d.ts.map
|
|
@@ -0,0 +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;AAK3C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,OAAO,GACR,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,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,+BA4GA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
4
|
+
import { Button, Input } from "@flowselections/core";
|
|
5
|
+
import { toast } from "sonner";
|
|
6
|
+
import { setStickerSize, suggestStickerSize, } from "../../lib/customer-stickers.functions.js";
|
|
7
|
+
import { friendlyError } from "../../lib/errors.js";
|
|
8
|
+
const fmt = (v) => v.toLocaleString("nl-NL", { maximumFractionDigits: 1 });
|
|
9
|
+
/**
|
|
10
|
+
* "Formaat: 48 × 48 mm (wijzigen)". Zonder maat: voorstel via geladen etiket
|
|
11
|
+
* (één klik bevestigen) of pas dan om breedte en hoogte vragen.
|
|
12
|
+
*/
|
|
13
|
+
export function StickerSizeLine({ customerKey, tradeItemKey, widthMm, heightMm, initialDetection, onSaved, }) {
|
|
14
|
+
const save = useServerFn(setStickerSize);
|
|
15
|
+
const suggest = useServerFn(suggestStickerSize);
|
|
16
|
+
const known = widthMm != null && heightMm != null;
|
|
17
|
+
const [editing, setEditing] = useState(false);
|
|
18
|
+
const [det, setDet] = useState(initialDetection ?? null);
|
|
19
|
+
const [w, setW] = useState("");
|
|
20
|
+
const [h, setH] = useState("");
|
|
21
|
+
const [busy, setBusy] = useState(false);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (known || det)
|
|
24
|
+
return;
|
|
25
|
+
let alive = true;
|
|
26
|
+
suggest({ data: { customerKey, tradeItemKey } })
|
|
27
|
+
.then((r) => alive && setDet(r))
|
|
28
|
+
.catch(() => alive && setDet({ method: "onbekend", size: null, suggestion: null }));
|
|
29
|
+
return () => {
|
|
30
|
+
alive = false;
|
|
31
|
+
};
|
|
32
|
+
}, [known, det, customerKey, tradeItemKey, suggest]);
|
|
33
|
+
const store = async (wm, hm) => {
|
|
34
|
+
setBusy(true);
|
|
35
|
+
try {
|
|
36
|
+
await save({ data: { customerKey, tradeItemKey, widthMm: wm, heightMm: hm } });
|
|
37
|
+
setEditing(false);
|
|
38
|
+
onSaved();
|
|
39
|
+
toast.success("Formaat opgeslagen");
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
toast.error(friendlyError(e, "Opslaan mislukt"));
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
setBusy(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const parse = (v) => Number(v.replace(",", "."));
|
|
49
|
+
const manual = (_jsxs("form", { className: "flex items-center gap-2", onSubmit: (e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
const wm = parse(w), hm = parse(h);
|
|
52
|
+
if (!(wm > 0 && hm > 0)) {
|
|
53
|
+
toast.error("Vul een breedte en hoogte in millimeters in.");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
void store(wm, hm);
|
|
57
|
+
}, children: [_jsx(Input, { "aria-label": "Breedte in mm", inputMode: "decimal", placeholder: "Breedte", value: w, onChange: (e) => setW(e.target.value), className: "h-8 w-20" }), _jsx("span", { className: "text-xs text-muted-foreground", children: "\u00D7" }), _jsx(Input, { "aria-label": "Hoogte in mm", inputMode: "decimal", placeholder: "Hoogte", value: h, onChange: (e) => setH(e.target.value), className: "h-8 w-20" }), _jsx("span", { className: "text-xs text-muted-foreground", children: "mm" }), _jsx(Button, { type: "submit", size: "sm", disabled: busy, children: "Opslaan" }), known && (_jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => setEditing(false), children: "Annuleren" }))] }));
|
|
58
|
+
if (known && !editing) {
|
|
59
|
+
return (_jsxs("p", { className: "text-sm", children: ["Formaat: ", fmt(widthMm), " \u00D7 ", fmt(heightMm), " mm", " ", _jsx("button", { type: "button", className: "text-xs text-primary underline-offset-2 hover:underline", onClick: () => {
|
|
60
|
+
setW(fmt(widthMm));
|
|
61
|
+
setH(fmt(heightMm));
|
|
62
|
+
setEditing(true);
|
|
63
|
+
}, children: "wijzigen" })] }));
|
|
64
|
+
}
|
|
65
|
+
if (editing)
|
|
66
|
+
return manual;
|
|
67
|
+
if (!det)
|
|
68
|
+
return _jsx("p", { className: "text-xs text-muted-foreground", children: "Formaat bepalen\u2026" });
|
|
69
|
+
if (det.suggestion) {
|
|
70
|
+
const s = det.suggestion;
|
|
71
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { className: "text-sm", children: ["Lijkt op ", fmt(s.width_mm), " \u00D7 ", fmt(s.height_mm), " mm", s.printer ? ` – etiket in ${s.printer}` : s.label ? ` – etiket ${s.label}` : ""] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { type: "button", size: "sm", disabled: busy, onClick: () => void store(s.width_mm, s.height_mm), children: "Klopt" }), _jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => setDet({ ...det, suggestion: null }), children: "Andere maat" })] })] }));
|
|
72
|
+
}
|
|
73
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm", children: "We konden het formaat niet uit het bestand halen. Hoe groot is deze sticker?" }), manual] }));
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickerSizePreviewCard.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/StickerSizePreviewCard.tsx"],"names":[],"mappings":"AAeA,iGAAiG;AACjG,wBAAgB,sBAAsB,uCAIrC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
5
|
+
import { useCustomerDefaults } from "./useCustomerDefaults.js";
|
|
6
|
+
import { previewStickerSizes } from "../../lib/customer-stickers.functions.js";
|
|
7
|
+
import { friendlyError } from "../../lib/errors.js";
|
|
8
|
+
const METHOD = {
|
|
9
|
+
pdf: "uit de PDF",
|
|
10
|
+
dpi: "uit de resolutie",
|
|
11
|
+
svg: "uit het bestand",
|
|
12
|
+
verhouding: "voorstel via etiket",
|
|
13
|
+
onbekend: "niet te bepalen",
|
|
14
|
+
};
|
|
15
|
+
/** Alleen beheerders, alleen lezen: welke maat bestaande stickers zonder maat zouden krijgen. */
|
|
16
|
+
export function StickerSizePreviewCard() {
|
|
17
|
+
const { isAdmin } = useCustomerDefaults();
|
|
18
|
+
if (isAdmin !== true)
|
|
19
|
+
return null;
|
|
20
|
+
return _jsx(Inner, {});
|
|
21
|
+
}
|
|
22
|
+
function Inner() {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const run = useServerFn(previewStickerSizes);
|
|
25
|
+
const q = useQuery({ queryKey: ["sticker-size-preview"], queryFn: () => run(), enabled: open });
|
|
26
|
+
return (_jsxs("div", { className: "text-xs text-muted-foreground", children: [_jsx("button", { type: "button", className: "underline", onClick: () => setOpen((v) => !v), children: "Details voor beheer: stickers zonder formaat" }), open && (_jsxs("div", { className: "mt-2 rounded border p-3 space-y-2", children: [_jsx("p", { children: "Overzicht, er wordt nog niets opgeslagen." }), q.isLoading && _jsx("p", { children: "Bestanden bekijken\u2026" }), q.error && _jsx("p", { className: "text-destructive", children: friendlyError(q.error) }), q.data && q.data.length === 0 && _jsx("p", { children: "Alle stickers hebben een formaat." }), q.data && q.data.length > 0 && (_jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-left", children: [_jsx("th", { children: "Klant" }), _jsx("th", { children: "Artikel" }), _jsx("th", { children: "Bestand" }), _jsx("th", { children: "Formaat" }), _jsx("th", { children: "Hoe" })] }) }), _jsx("tbody", { children: q.data.map((r) => (_jsxs("tr", { children: [_jsx("td", { children: r.customer_key }), _jsx("td", { children: r.trade_item_key }), _jsx("td", { className: "max-w-[160px] truncate", children: r.file_name }), _jsx("td", { children: r.width_mm != null ? `${r.width_mm} × ${r.height_mm} mm` : "–" }), _jsxs("td", { children: [METHOD[r.method] ?? r.method, r.printer ? ` (${r.printer})` : ""] })] }, `${r.customer_key}|${r.trade_item_key}`))) })] }))] }))] }));
|
|
27
|
+
}
|