@flowselections/floriday-klanten-module 1.0.75 → 1.0.79
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/DeliveryLocationsTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/DeliveryLocationsTab.js +34 -5
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +51 -32
- package/dist-lib/components/klanten/LocationGlns.d.ts +20 -0
- package/dist-lib/components/klanten/LocationGlns.d.ts.map +1 -0
- package/dist-lib/components/klanten/LocationGlns.js +84 -0
- package/dist-lib/components/klanten/ui/styleguide.d.ts +58 -0
- package/dist-lib/components/klanten/ui/styleguide.d.ts.map +1 -0
- package/dist-lib/components/klanten/ui/styleguide.js +88 -0
- package/dist-lib/components/settings/ChannelsCard.d.ts +2 -0
- package/dist-lib/components/settings/ChannelsCard.d.ts.map +1 -0
- package/dist-lib/components/settings/ChannelsCard.js +35 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +2 -0
- package/dist-lib/integrations/supabase/types.d.ts +2840 -122
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +1 -0
- package/dist-lib/lib/channel-providers.d.ts +8 -0
- package/dist-lib/lib/channel-providers.d.ts.map +1 -0
- package/dist-lib/lib/channel-providers.js +23 -0
- package/dist-lib/lib/customer-schemas.d.ts +1 -1
- package/dist-lib/lib/customers.functions.d.ts +1 -1
- package/dist-lib/lib/delivery-gln.d.ts +58 -0
- package/dist-lib/lib/delivery-gln.d.ts.map +1 -0
- package/dist-lib/lib/delivery-gln.js +81 -0
- package/dist-lib/lib/delivery-locations.functions.d.ts +115 -1
- package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
- package/dist-lib/lib/delivery-locations.functions.js +124 -4
- package/dist-lib/lib/external-customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/external-customers.functions.js +18 -15
- package/package.json +1 -1
- package/schema/klanten.sql +467 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeliveryLocationsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/DeliveryLocationsTab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DeliveryLocationsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/DeliveryLocationsTab.tsx"],"names":[],"mappings":"AAgFA,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,WAAW,GACZ,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,+BA8jBA"}
|
|
@@ -4,11 +4,14 @@ import { useCustomerDefaults } from "./useCustomerDefaults.js";
|
|
|
4
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
|
-
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,
|
|
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, } from "@flowselections/core";
|
|
8
8
|
import { MapPin, Plus, Pencil, Trash2, Truck, Sparkles, PackageCheck, Download } from "lucide-react";
|
|
9
9
|
import { listDeliveryLocations, upsertDeliveryLocation, deleteDeliveryLocation, importFloridayDeliveryLocations, setPrimaryDeliveryLocation, } from "../../lib/delivery-locations.functions.js";
|
|
10
10
|
import { CarrierPicker, ProposalLine, useCarrierOptions, useCarrierProposals } from "./CarrierPicker.js";
|
|
11
11
|
import { SearchableSelect } from "./SearchableSelect.js";
|
|
12
|
+
import { LocationGlnList, DuplicateNotice, useLocationGlns } from "./LocationGlns.js";
|
|
13
|
+
import { duplicateGroups } from "../../lib/delivery-gln.js";
|
|
14
|
+
import { locationShipmentCount } from "../../lib/delivery-locations.functions.js";
|
|
12
15
|
import { choiceFromLocation, locationCarrierFields, proposalText, ENGINE_MISSING_TEXT, } from "../../lib/carrier-choice.js";
|
|
13
16
|
import { findCountry } from "../../lib/eu-regions.js";
|
|
14
17
|
import { decodeDeep } from "../../lib/decode-html.js";
|
|
@@ -48,6 +51,25 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
48
51
|
const carrierOpts = useCarrierOptions();
|
|
49
52
|
const carriers = carrierOpts.ordered;
|
|
50
53
|
const locations = (list?.locations ?? []).filter((loc) => loc.external_provider !== "floriday" || loc.raw?.isDeleted !== true);
|
|
54
|
+
const glnQuery = useLocationGlns(customerId ? locations.map((l) => l.id) : []);
|
|
55
|
+
const glnsByLoc = useMemo(() => {
|
|
56
|
+
const m = new Map();
|
|
57
|
+
for (const g of glnQuery.data?.glns ?? [])
|
|
58
|
+
m.set(g.location_id, [...(m.get(g.location_id) ?? []), g]);
|
|
59
|
+
return m;
|
|
60
|
+
}, [glnQuery.data]);
|
|
61
|
+
const dupGroups = useMemo(() => (customerId ? duplicateGroups(locations) : []), [customerId, locations]);
|
|
62
|
+
const refreshAll = () => {
|
|
63
|
+
qc.invalidateQueries({ queryKey: ["delivery-locations"] });
|
|
64
|
+
qc.invalidateQueries({ queryKey: ["location-glns"] });
|
|
65
|
+
};
|
|
66
|
+
const shipmentFn = useServerFn(locationShipmentCount);
|
|
67
|
+
const [delInfo, setDelInfo] = useState(null);
|
|
68
|
+
const askDelete = (id) => {
|
|
69
|
+
setDelInfo({ id, shipments: null });
|
|
70
|
+
shipmentFn({ data: { id } }).then((r) => setDelInfo((d) => (d?.id === id ? { id, shipments: r.shipments } : d)))
|
|
71
|
+
.catch(() => setDelInfo((d) => (d?.id === id ? { id, shipments: 0 } : d)));
|
|
72
|
+
};
|
|
51
73
|
const [open, setOpen] = useState(false);
|
|
52
74
|
const [form, setForm] = useState(EMPTY);
|
|
53
75
|
const cd = useCustomerDefaults();
|
|
@@ -162,9 +184,11 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
162
184
|
mutationFn: (id) => deleteFn({ data: { id } }),
|
|
163
185
|
onSuccess: () => {
|
|
164
186
|
toast.success("Locatie verwijderd");
|
|
187
|
+
setDelInfo(null);
|
|
165
188
|
qc.invalidateQueries({ queryKey: ["delivery-locations", ownerKey] });
|
|
166
189
|
qc.invalidateQueries({ queryKey: ["customer", ownerKey] });
|
|
167
190
|
},
|
|
191
|
+
onError: (e) => toast.error(friendlyError(e, "Verwijderen mislukt")),
|
|
168
192
|
});
|
|
169
193
|
const primaryMut = useMutation({
|
|
170
194
|
mutationFn: (id) => primaryFn({ data: { id } }),
|
|
@@ -187,11 +211,16 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
187
211
|
}
|
|
188
212
|
saveMut.mutate();
|
|
189
213
|
};
|
|
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"] })] })] }),
|
|
214
|
+
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"] })] })] }), dupGroups.map((g) => (_jsx(DuplicateNotice, { group: g, label: (l) => l.name || [l.street, l.house_number].filter(Boolean).join(" ") || "Afleverlocatie", mergeEnabled: glnQuery.data?.mergeEnabled === true, onMerged: refreshAll }, g.map((l) => l.id).join("|")))), _jsx(AlertDialog, { open: !!delInfo, onOpenChange: (o) => { if (!o)
|
|
215
|
+
setDelInfo(null); }, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Locatie verwijderen?" }), _jsx(AlertDialogDescription, { children: delInfo?.shipments == null
|
|
216
|
+
? "Zendingen controleren…"
|
|
217
|
+
: delInfo.shipments > 0
|
|
218
|
+
? `Deze locatie heeft ${delInfo.shipments} zendingen en kan daarom niet worden verwijderd. Voeg haar samen met een andere locatie.`
|
|
219
|
+
: "Deze actie kan niet ongedaan worden gemaakt. Een Floriday-import zet haar niet terug." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), delInfo?.shipments === 0 && (_jsx(AlertDialogAction, { onClick: () => delMut.mutate(delInfo.id), children: "Verwijderen" }))] })] }) }), 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) => {
|
|
191
220
|
const street = [loc.street, loc.house_number].filter(Boolean).join(" ") || loc.raw?.address?.addressLine || loc.address_line || "";
|
|
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" }) }),
|
|
221
|
+
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" }) }), _jsx(Button, { variant: "ghost", size: "icon", title: "Locatie verwijderen", onClick: () => askDelete(loc.id), children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), _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" })), !customerId && 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"
|
|
193
222
|
? "Dit verandert niets in Floriday; de koper kiest daar zelf zijn standaard."
|
|
194
|
-
: undefined, children: "Maak vaste afleverlocatie" }))] })] }) }, loc.id));
|
|
223
|
+
: undefined, children: "Maak vaste afleverlocatie" }))] }), customerId && (_jsx(LocationGlnList, { locationId: loc.id, glns: glnsByLoc.get(loc.id) ?? [], onChanged: refreshAll }))] }) }, loc.id));
|
|
195
224
|
}) })), _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: () => {
|
|
196
225
|
markTouched("postal_code");
|
|
197
226
|
setForm((f) => ({ ...f, postal_code: normalizePostalCode(f.postal_code, f.country) }));
|
|
@@ -202,7 +231,7 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
|
|
|
202
231
|
})), 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: "*" })] }), (() => {
|
|
203
232
|
const provinces = findCountry(form.country)?.provinces ?? [];
|
|
204
233
|
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 }));
|
|
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
|
|
234
|
+
})(), 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 === "known" && _jsx(Badge, { variant: "outline", children: "Al bekend" }), 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
|
|
206
235
|
? ` · ${importPreview?.skipped} overgeslagen omdat de Floriday-organisatie niet aan een klant gekoppeld is`
|
|
207
236
|
: ""] }), _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" })] })] }) })] }));
|
|
208
237
|
}
|
|
@@ -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":"AAqEA,wBAAgB,gBAAgB,gCAs5B/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useNavigate } from "@tanstack/react-router";
|
|
3
3
|
import { REFRESH_MS, FULL_REFRESH_MS, OVERLAP_MS, STATUS_FAST_MS } from "../../lib/refresh-intervals.js";
|
|
4
4
|
import { formatDate } from "../../lib/format-date.js";
|
|
@@ -7,8 +7,9 @@ import { useServerFn } from "@tanstack/react-start";
|
|
|
7
7
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { usePersistedState, markReturnToList, consumeReturnToList } from "../../lib/persisted-state.js";
|
|
9
9
|
import { formatEur } from "../../lib/format-currency.js";
|
|
10
|
-
import { Button, Input, Card, CardContent, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
|
|
11
|
-
import { Plus, Search, Users, UserCheck, UserX, AlertCircle, X, ArrowUpDown, Mail, MapPin, Upload, ChevronLeft, ChevronRight, Pencil, } from "lucide-react";
|
|
10
|
+
import { Button, Input, Card, CardContent, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Skeleton, } from "@flowselections/core";
|
|
11
|
+
import { Plus, Search, Users, UserCheck, UserX, AlertCircle, X, ArrowUpDown, Mail, MapPin, Upload, ChevronLeft, ChevronRight, Pencil, List, } from "lucide-react";
|
|
12
|
+
import { PageHeader, Kbd, KpiTile, PillTabs, useListShortcuts } from "./ui/styleguide.js";
|
|
12
13
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
13
14
|
import { listCustomers } from "../../lib/customers.functions.js";
|
|
14
15
|
import { listExternalCustomers } from "../../lib/external-customers.functions.js";
|
|
@@ -22,11 +23,7 @@ import { PriceGroupBadges } from "./PriceGroupBadges.js";
|
|
|
22
23
|
import { KlantBewerkenDialog } from "./KlantBewerkenDialog.js";
|
|
23
24
|
import { ChannelBadges } from "./ChannelBadges.js";
|
|
24
25
|
import { missingInvoiceAddressFields } from "../../lib/invoice-address.js";
|
|
25
|
-
import { FloridayAutoPromoteCard } from "./FloridayAutoPromoteCard.js";
|
|
26
|
-
import { CarrierAdminCard } from "./CarrierAdminCard.js";
|
|
27
|
-
import { TwinfieldQueueAdminCard } from "./TwinfieldQueueAdminCard.js";
|
|
28
26
|
import { ProposalLine, useCarrierProposals } from "./CarrierPicker.js";
|
|
29
|
-
import { StickerSizePreviewCard } from "./StickerSizePreviewCard.js";
|
|
30
27
|
import { derivePaymentMethod, paymentToneClasses } from "../../lib/payment-method.js";
|
|
31
28
|
import { formatCountry, getCountryFlagAndName, countryNameToFlag } from "../../lib/countries.js";
|
|
32
29
|
import { MultiSearchableSelect } from "./MultiSearchableSelect.js";
|
|
@@ -42,6 +39,8 @@ export function KlantenOverzicht() {
|
|
|
42
39
|
const [page, setPage] = usePersistedState("klanten:page", 1);
|
|
43
40
|
const [editTarget, setEditTarget] = useState(null);
|
|
44
41
|
const [pageSize, setPageSize] = usePersistedState("klanten:pageSize", 25, "local");
|
|
42
|
+
const [selectedIdx, setSelectedIdx] = useState(-1);
|
|
43
|
+
const searchRef = useRef(null);
|
|
45
44
|
// Zoekveld: de invoer reageert direct, het filteren pas na een korte pauze,
|
|
46
45
|
// zodat typen soepel blijft ook bij een volledig klantenbestand.
|
|
47
46
|
const [searchInput, setSearchInput] = useState(search);
|
|
@@ -399,10 +398,10 @@ export function KlantenOverzicht() {
|
|
|
399
398
|
const channelSelectOptions = useMemo(() => [
|
|
400
399
|
...channelOptions.map((p) => ({
|
|
401
400
|
value: p,
|
|
402
|
-
label: p.charAt(0).toUpperCase() + p.slice(1),
|
|
401
|
+
label: providers.find((x) => x.provider === p)?.label ?? p.charAt(0).toUpperCase() + p.slice(1),
|
|
403
402
|
})),
|
|
404
403
|
{ value: "__none__", label: "Geen kanaal" },
|
|
405
|
-
], [channelOptions]);
|
|
404
|
+
], [channelOptions, providers]);
|
|
406
405
|
const paymentSelectOptions = useMemo(() => paymentOptions.map((p) => ({ value: p, label: p })), [paymentOptions]);
|
|
407
406
|
const customers = useMemo(() => {
|
|
408
407
|
let rows = allRows;
|
|
@@ -481,7 +480,25 @@ export function KlantenOverzicht() {
|
|
|
481
480
|
});
|
|
482
481
|
const toggleSort = (col) => setSort((s) => (s.col === col ? { col, dir: s.dir === "asc" ? "desc" : "asc" } : { col, dir: "asc" }));
|
|
483
482
|
const lastUpdated = externalData?.last_fetched_at ?? null;
|
|
484
|
-
|
|
483
|
+
const updatedAt = localData ? new Date() : null;
|
|
484
|
+
const openRow = (c) => c.id
|
|
485
|
+
? goTo({ to: "/klanten/$id", params: { id: c.id } })
|
|
486
|
+
: goTo({ to: "/klanten/groep/$groupKey", params: { groupKey: c.group_key } });
|
|
487
|
+
useListShortcuts({
|
|
488
|
+
onNew: () => goTo({ to: "/klanten/nieuw" }),
|
|
489
|
+
onSearch: () => searchRef.current?.focus(),
|
|
490
|
+
onNext: () => setSelectedIdx((i) => Math.min(pageRows.length - 1, i + 1)),
|
|
491
|
+
onPrev: () => setSelectedIdx((i) => Math.max(0, i - 1)),
|
|
492
|
+
onOpen: () => { const r = pageRows[selectedIdx]; if (r)
|
|
493
|
+
openRow(r); },
|
|
494
|
+
});
|
|
495
|
+
useEffect(() => {
|
|
496
|
+
if (selectedIdx < 0)
|
|
497
|
+
return;
|
|
498
|
+
document.querySelector(`[data-row-idx="${selectedIdx}"]`)?.scrollIntoView({ block: "nearest" });
|
|
499
|
+
}, [selectedIdx]);
|
|
500
|
+
useEffect(() => { setSelectedIdx(-1); }, [currentPage, view, search]);
|
|
501
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "flex min-w-0 max-w-full flex-col gap-4 overflow-x-hidden p-4 pb-24 sm:p-6 sm:pb-24", children: [_jsx(PageHeader, { title: "Klanten", updatedAt: updatedAt, actions: _jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", className: "h-9 rounded-lg", onClick: () => goTo({ to: "/klanten/import" }), children: [_jsx(Upload, { className: "h-4 w-4 mr-2" }), " Importeren"] }), _jsxs(Button, { className: "h-9 rounded-lg", onClick: () => goTo({ to: "/klanten/nieuw" }), children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), " Nieuwe klant ", _jsx(Kbd, { onPrimary: true, children: "N" })] })] }) }), 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)
|
|
485
502
|
? "De database is tijdelijk niet bereikbaar"
|
|
486
503
|
: "De klanten konden niet geladen worden" }), _jsx("div", { className: "text-muted-foreground", children: isBackendUnavailable(loadError)
|
|
487
504
|
? "Je bent niet uitgelogd. Probeer het over een paar minuten opnieuw."
|
|
@@ -490,21 +507,27 @@ export function KlantenOverzicht() {
|
|
|
490
507
|
queryClient.invalidateQueries({ queryKey: ["customers-external"] });
|
|
491
508
|
queryClient.invalidateQueries({ queryKey: ["overdue-balances"] });
|
|
492
509
|
queryClient.invalidateQueries({ queryKey: ["customer-revenue-12m"] });
|
|
493
|
-
}, children: "Opnieuw proberen" })] })), _jsxs("div", { className: "grid grid-cols-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
510
|
+
}, children: "Opnieuw proberen" })] })), _jsxs("div", { className: "grid grid-cols-2 gap-3 lg:grid-cols-4", children: [_jsx(KpiTile, { icon: _jsx(Users, { className: "h-6 w-6" }), label: "Alle klanten", value: totals.all, sub: "Lokaal en gekoppelde bronnen", active: view === "all", onClick: () => { setView("all"); resetPage(); } }), _jsx(KpiTile, { icon: _jsx(UserCheck, { className: "h-6 w-6" }), label: "Met omzet", value: totals.active ?? "–", sub: revenueData ? `${formatEuro(revenueData.totals.amount)} · afgelopen 12 mnd` : "Afgelopen 12 maanden", active: view === "active", onClick: () => { setView("active"); resetPage(); } }), _jsx(KpiTile, { icon: _jsx(UserX, { className: "h-6 w-6" }), tone: "muted", label: "Zonder omzet", value: totals.inactive ?? "–", sub: "Afgelopen 12 maanden", active: view === "inactive", onClick: () => { setView("inactive"); resetPage(); } }), _jsx(KpiTile, { icon: _jsx(AlertCircle, { className: "h-6 w-6" }), tone: "warning", label: "Achterstallig", value: totals.overdue, sub: overdueData?.totals && totals.overdue ? (_jsxs("span", { className: "text-destructive", children: [formatEuro(overdueData.totals.amount), " openstaand \u00B7 ", overdueData.totals.invoices, " facturen"] })) : "Vervallen facturen", active: view === "overdue", onClick: () => { setView("overdue"); resetPage(); } })] }), _jsx(PillTabs, { value: view, onChange: (v) => { setView(v); resetPage(); }, items: [
|
|
511
|
+
{ value: "all", label: "Alle", icon: _jsx(List, { className: "h-4 w-4" }), count: totals.all },
|
|
512
|
+
{ value: "active", label: "Met omzet", icon: _jsx(UserCheck, { className: "h-4 w-4" }), count: totals.active },
|
|
513
|
+
{ value: "inactive", label: "Zonder omzet", icon: _jsx(UserX, { className: "h-4 w-4" }), count: totals.inactive },
|
|
514
|
+
{ value: "overdue", label: "Achterstallig", icon: _jsx(AlertCircle, { className: "h-4 w-4" }), count: totals.overdue },
|
|
515
|
+
] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "relative w-full sm:w-80", children: [_jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }), _jsx(Input, { ref: searchRef, "aria-label": "Zoek klanten", placeholder: "Zoek op bedrijf, contact of e-mail", value: searchInput, onChange: (e) => setSearchInput(e.target.value), onKeyDown: (e) => {
|
|
516
|
+
if (e.key === "Escape") {
|
|
517
|
+
setSearchInput("");
|
|
518
|
+
setSearch("");
|
|
519
|
+
resetPage();
|
|
520
|
+
e.target.blur();
|
|
521
|
+
}
|
|
522
|
+
}, className: "h-9 rounded-lg pl-9 pr-9" }), searchInput ? (_jsx("button", { type: "button", "aria-label": "Zoekopdracht wissen", onClick: () => { setSearchInput(""); setSearch(""); resetPage(); }, className: "absolute right-2 top-1/2 grid h-6 w-6 -translate-y-1/2 place-items-center rounded-sm text-muted-foreground hover:text-foreground", children: _jsx(X, { className: "h-4 w-4" }) })) : (_jsx("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2", children: _jsx(Kbd, { children: "/" }) }))] }), _jsx(MultiSearchableSelect, { values: selectedCountries, onValuesChange: (v) => { setSelectedCountries(v); resetPage(); }, options: countryOptions, placeholder: "Alle landen", triggerClassName: "w-36 h-9 rounded-lg" }), _jsx(MultiSearchableSelect, { values: selectedChannels, onValuesChange: (v) => { setSelectedChannels(v); resetPage(); }, options: channelSelectOptions, placeholder: "Alle kanalen", triggerClassName: "w-40 h-9 rounded-lg" }), _jsx(MultiSearchableSelect, { values: selectedPayments, onValuesChange: (v) => { setSelectedPayments(v); resetPage(); }, options: paymentSelectOptions, placeholder: "Alle betaalvormen", triggerClassName: "w-40 h-9 rounded-lg" })] }), activeFilterChips.length > 0 && (_jsxs("div", { className: "-mt-2 flex flex-wrap items-center gap-2", children: [activeFilterChips.map((chip) => (_jsxs("button", { type: "button", onClick: chip.clear, className: "inline-flex h-8 items-center gap-1.5 rounded-full border border-border bg-card px-3 text-xs transition-colors duration-150 hover:bg-muted", children: [chip.label, " ", _jsx(X, { className: "h-3 w-3" })] }, chip.key))), _jsx("button", { type: "button", onClick: () => {
|
|
523
|
+
setSearchInput("");
|
|
524
|
+
setSearch("");
|
|
525
|
+
setSelectedCountries([]);
|
|
526
|
+
setSelectedChannels([]);
|
|
527
|
+
setSelectedPayments([]);
|
|
528
|
+
setView("all");
|
|
529
|
+
setPage(1);
|
|
530
|
+
}, className: "text-xs text-muted-foreground underline hover:text-foreground", children: "Alles wissen" })] })), _jsxs(Card, { className: "overflow-hidden rounded-xl border-border shadow-sm", children: [_jsx(CardContent, { className: "p-0", children: _jsx("div", { className: "max-h-[65vh] overflow-y-auto overflow-x-auto overscroll-contain [-webkit-overflow-scrolling:touch]", children: _jsxs(Table, { className: "min-w-[900px]", children: [_jsx(TableHeader, { className: "sticky top-0 z-10 bg-card [&_th]:h-10 [&_th]:text-[11px] [&_th]:font-bold [&_th]:uppercase [&_th]:tracking-wider [&_th]:text-muted-foreground", children: _jsxs(TableRow, { className: "hover:bg-transparent", 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: () => {
|
|
508
531
|
setSearchInput("");
|
|
509
532
|
setSearch("");
|
|
510
533
|
setSelectedCountries([]);
|
|
@@ -512,17 +535,13 @@ export function KlantenOverzicht() {
|
|
|
512
535
|
setSelectedPayments([]);
|
|
513
536
|
setView("all");
|
|
514
537
|
setPage(1);
|
|
515
|
-
} }) }) })) : pageRows.map((c) => {
|
|
538
|
+
} }) }) })) : pageRows.map((c, idx) => {
|
|
516
539
|
// Handelsnaam voorop (zoals Floriday en de verzendbrief); officiële naam klein eronder.
|
|
517
540
|
const hasTrade = !!c.commercial_name && c.commercial_name !== c.company_name;
|
|
518
541
|
const primaryName = hasTrade ? c.commercial_name : c.company_name;
|
|
519
542
|
const secondary = hasTrade ? c.company_name : c.city ?? c.email ?? null;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
: goTo({
|
|
523
|
-
to: "/klanten/groep/$groupKey",
|
|
524
|
-
params: { groupKey: c.group_key },
|
|
525
|
-
}), 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.missing_invoice?.length ?? 0) > 0 && (_jsx("span", { title: `Factuuradres onvolledig: ${c.missing_invoice.join(", ")} ontbreekt`, className: "text-warning shrink-0", children: _jsx(AlertCircle, { className: "h-3.5 w-3.5", "aria-label": "Factuuradres onvolledig" }) })), 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) => {
|
|
543
|
+
const selected = idx === selectedIdx;
|
|
544
|
+
return (_jsxs(TableRow, { "data-row-idx": idx, "data-state": selected ? "selected" : undefined, className: `h-[60px] cursor-pointer transition-colors duration-150 hover:bg-muted/50 ${selected ? "bg-primary/5 shadow-[inset_3px_0_0_var(--color-primary)]" : ""}`, onClick: () => openRow(c), 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.missing_invoice?.length ?? 0) > 0 && (_jsx("span", { title: `Factuuradres onvolledig: ${c.missing_invoice.join(", ")} ontbreekt`, className: "text-warning shrink-0", children: _jsx(AlertCircle, { className: "h-3.5 w-3.5", "aria-label": "Factuuradres onvolledig" }) })), 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) => {
|
|
526
545
|
e.stopPropagation();
|
|
527
546
|
setEditTarget({ customerId: c.id });
|
|
528
547
|
}, 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,20 @@
|
|
|
1
|
+
import { type LocationGln } from "../../lib/delivery-locations.functions.js";
|
|
2
|
+
import { type DupLocation } from "../../lib/delivery-gln.js";
|
|
3
|
+
export declare function useLocationGlns(locationIds: string[]): import("@tanstack/react-query").UseQueryResult<{
|
|
4
|
+
glns: LocationGln[];
|
|
5
|
+
mergeEnabled: boolean;
|
|
6
|
+
}, Error>;
|
|
7
|
+
/** GLN-badges bij één locatie: toevoegen, verwijderen en primair maken. */
|
|
8
|
+
export declare function LocationGlnList({ locationId, glns, onChanged }: {
|
|
9
|
+
locationId: string;
|
|
10
|
+
glns: LocationGln[];
|
|
11
|
+
onChanged: () => void;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** Melding + samenvoegen voor locaties met hetzelfde adres en dezelfde (of een lege) naam. */
|
|
14
|
+
export declare function DuplicateNotice<T extends DupLocation>({ group, label, mergeEnabled, onMerged }: {
|
|
15
|
+
group: T[];
|
|
16
|
+
label: (l: T) => string;
|
|
17
|
+
mergeEnabled: boolean;
|
|
18
|
+
onMerged: () => void;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=LocationGlns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocationGlns.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocationGlns.tsx"],"names":[],"mappings":"AASA,OAAO,EAEiC,KAAK,WAAW,EACvD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAElF,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE;;;UAOpD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC/D,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,CAAC;CAChE,+BAuEA;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAC/F,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAClF,+BA+DA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { friendlyError } from "../../lib/errors.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
5
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
6
|
+
import { Button, Input, toast, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@flowselections/core";
|
|
7
|
+
import { Plus, Star, X, Merge, AlertTriangle } from "lucide-react";
|
|
8
|
+
import { addLocationGln, removeLocationGln, setPrimaryLocationGln, listLocationGlns, previewLocationMerge, mergeLocations, } from "../../lib/delivery-locations.functions.js";
|
|
9
|
+
import { glnError, mergeSummary } from "../../lib/delivery-gln.js";
|
|
10
|
+
export function useLocationGlns(locationIds) {
|
|
11
|
+
const fn = useServerFn(listLocationGlns);
|
|
12
|
+
return useQuery({
|
|
13
|
+
queryKey: ["location-glns", [...locationIds].sort().join(",")],
|
|
14
|
+
queryFn: () => fn({ data: { location_ids: locationIds } }),
|
|
15
|
+
enabled: locationIds.length > 0,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** GLN-badges bij één locatie: toevoegen, verwijderen en primair maken. */
|
|
19
|
+
export function LocationGlnList({ locationId, glns, onChanged }) {
|
|
20
|
+
const [adding, setAdding] = useState(false);
|
|
21
|
+
const [value, setValue] = useState("");
|
|
22
|
+
const [err, setErr] = useState(null);
|
|
23
|
+
const addFn = useServerFn(addLocationGln);
|
|
24
|
+
const removeFn = useServerFn(removeLocationGln);
|
|
25
|
+
const primaryFn = useServerFn(setPrimaryLocationGln);
|
|
26
|
+
const addMut = useMutation({
|
|
27
|
+
mutationFn: (gln) => addFn({ data: { location_id: locationId, gln } }),
|
|
28
|
+
onSuccess: (res) => {
|
|
29
|
+
if ("conflict" in res) {
|
|
30
|
+
setErr(res.message);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
toast.success("GLN toegevoegd");
|
|
34
|
+
setValue("");
|
|
35
|
+
setAdding(false);
|
|
36
|
+
setErr(null);
|
|
37
|
+
onChanged();
|
|
38
|
+
},
|
|
39
|
+
onError: (e) => setErr(friendlyError(e, "Toevoegen mislukt")),
|
|
40
|
+
});
|
|
41
|
+
const removeMut = useMutation({
|
|
42
|
+
mutationFn: (id) => removeFn({ data: { id } }),
|
|
43
|
+
onSuccess: () => { toast.success("GLN verwijderd. Een import zet hem niet terug."); onChanged(); },
|
|
44
|
+
onError: (e) => toast.error(friendlyError(e, "Verwijderen mislukt")),
|
|
45
|
+
});
|
|
46
|
+
const primaryMut = useMutation({
|
|
47
|
+
mutationFn: (id) => primaryFn({ data: { id } }),
|
|
48
|
+
onSuccess: () => { toast.success("Dit is nu de hoofd-GLN"); onChanged(); },
|
|
49
|
+
onError: (e) => toast.error(friendlyError(e, "Wijzigen mislukt")),
|
|
50
|
+
});
|
|
51
|
+
const submit = () => {
|
|
52
|
+
const e = glnError(value);
|
|
53
|
+
if (e) {
|
|
54
|
+
setErr(e);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
addMut.mutate(value.trim().replace(/\s/g, ""));
|
|
58
|
+
};
|
|
59
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [glns.map((g) => (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs tabular-nums", children: [g.is_primary ? (_jsx(Star, { className: "h-3 w-3 text-primary", "aria-label": "Hoofd-GLN" })) : (_jsx("button", { type: "button", title: "Maak hoofd-GLN", className: "text-muted-foreground transition-colors duration-150 hover:text-primary", disabled: primaryMut.isPending, onClick: () => primaryMut.mutate(g.id), children: _jsx(Star, { className: "h-3 w-3" }) })), "GLN ", g.gln, g.source === "floriday" && _jsx("span", { className: "text-muted-foreground", children: "\u00B7 Floriday" }), _jsx("button", { type: "button", title: "GLN verwijderen", className: "text-muted-foreground transition-colors duration-150 hover:text-destructive", disabled: removeMut.isPending, onClick: () => removeMut.mutate(g.id), children: _jsx(X, { className: "h-3 w-3" }) })] }, g.id))), adding ? (_jsxs("span", { className: "inline-flex flex-col gap-1", children: [_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Input, { autoFocus: true, value: value, inputMode: "numeric", placeholder: "13 cijfers", className: "h-8 w-40 tabular-nums", onChange: (e) => { setValue(e.target.value); setErr(null); }, onKeyDown: (e) => { if (e.key === "Enter")
|
|
60
|
+
submit(); if (e.key === "Escape") {
|
|
61
|
+
setAdding(false);
|
|
62
|
+
setErr(null);
|
|
63
|
+
} } }), _jsx(Button, { size: "sm", className: "h-8", disabled: addMut.isPending, onClick: submit, children: "Toevoegen" })] }), err && _jsx("span", { className: "text-xs text-destructive", children: err })] })) : (_jsxs(Button, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAdding(true), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " GLN"] }))] }));
|
|
64
|
+
}
|
|
65
|
+
/** Melding + samenvoegen voor locaties met hetzelfde adres en dezelfde (of een lege) naam. */
|
|
66
|
+
export function DuplicateNotice({ group, label, mergeEnabled, onMerged }) {
|
|
67
|
+
const [open, setOpen] = useState(false);
|
|
68
|
+
const [sourceId, setSourceId] = useState(group[1]?.id ?? "");
|
|
69
|
+
const targetId = group.find((l) => l.id !== sourceId)?.id ?? "";
|
|
70
|
+
const previewFn = useServerFn(previewLocationMerge);
|
|
71
|
+
const mergeFn = useServerFn(mergeLocations);
|
|
72
|
+
const preview = useQuery({
|
|
73
|
+
queryKey: ["merge-preview", sourceId, targetId],
|
|
74
|
+
queryFn: () => previewFn({ data: { source_id: sourceId, target_id: targetId } }),
|
|
75
|
+
enabled: open && !!sourceId && !!targetId,
|
|
76
|
+
});
|
|
77
|
+
const mergeMut = useMutation({
|
|
78
|
+
mutationFn: () => mergeFn({ data: { source_id: sourceId, target_id: targetId } }),
|
|
79
|
+
onSuccess: (r) => { toast.success(`Samengevoegd · ${r.shipmentsMoved} zendingen omgezet`); setOpen(false); onMerged(); },
|
|
80
|
+
onError: (e) => toast.error(friendlyError(e, "Samenvoegen mislukt")),
|
|
81
|
+
});
|
|
82
|
+
const summary = preview.data ? mergeSummary(preview.data) : null;
|
|
83
|
+
return (_jsxs("div", { className: "flex items-start justify-between gap-3 rounded-lg border border-warning bg-warning-soft p-3 text-sm text-warning-soft-foreground", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("span", { children: ["Mogelijk dubbel: ", group.map(label).join(" en "), " hebben hetzelfde adres."] })] }), mergeEnabled && group.length === 2 && (_jsxs(Button, { size: "sm", variant: "outline", className: "h-8 shrink-0", onClick: () => setOpen(true), children: [_jsx(Merge, { className: "mr-1 h-4 w-4" }), " Samenvoegen"] })), _jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Locaties samenvoegen" }), _jsx(DialogDescription, { children: "Kies welke locatie blijft. De andere wordt opgeheven." })] }), _jsx("div", { className: "grid gap-2", children: group.map((l) => (_jsxs("label", { className: "flex cursor-pointer items-center gap-2 rounded-lg border border-border p-3 transition-colors duration-150 hover:border-ring/50", children: [_jsx("input", { type: "radio", name: "keep", checked: targetId === l.id, onChange: () => setSourceId(group.find((x) => x.id !== l.id).id) }), _jsxs("span", { children: ["Behoud ", _jsx("span", { className: "font-medium", children: label(l) })] })] }, l.id))) }), preview.isLoading && _jsx("p", { className: "text-sm text-muted-foreground", children: "Overzicht laden\u2026" }), preview.error && _jsx("p", { className: "text-sm text-destructive", children: friendlyError(preview.error, "Overzicht laden mislukt") }), summary && (_jsxs("div", { className: "space-y-2 text-sm", children: [_jsx("ul", { className: "list-disc space-y-1 pl-5", children: summary.lines.map((l) => _jsx("li", { children: l }, l)) }), summary.warnings.map((w) => (_jsx("p", { className: "rounded-lg bg-warning-soft p-2 text-warning-soft-foreground", children: w }, w)))] })), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: "Annuleren" }), _jsx(Button, { disabled: !summary || mergeMut.isPending, onClick: () => mergeMut.mutate(), children: mergeMut.isPending ? "Samenvoegen…" : "Samenvoegen" })] })] }) })] }));
|
|
84
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Paginakop volgens de stijlgids: titel 24 px vet + "Bijgewerkt hh:mm", acties rechts. */
|
|
3
|
+
export declare function PageHeader({ title, updatedAt, subtitle, actions, }: {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
updatedAt?: Date | string | null;
|
|
6
|
+
subtitle?: ReactNode;
|
|
7
|
+
actions?: ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
/** Kleine sneltoets-hint; verborgen op mobiel. */
|
|
10
|
+
export declare function Kbd({ children, onPrimary }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
onPrimary?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** KPI-tegel: 48 px icoonvlak, label in kapitalen, waarde 24 px semibold. */
|
|
15
|
+
export declare function KpiTile({ icon, label, value, sub, tone, active, onClick, }: {
|
|
16
|
+
icon: ReactNode;
|
|
17
|
+
label: string;
|
|
18
|
+
value: ReactNode;
|
|
19
|
+
sub?: ReactNode;
|
|
20
|
+
tone?: "primary" | "warning" | "destructive" | "muted";
|
|
21
|
+
active?: boolean;
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/** Tabbladen als pillen met icoon, label en teller. */
|
|
25
|
+
export declare function PillTabs<T extends string>({ value, onChange, items, }: {
|
|
26
|
+
value: T;
|
|
27
|
+
onChange: (v: T) => void;
|
|
28
|
+
items: {
|
|
29
|
+
value: T;
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
count?: number | null;
|
|
33
|
+
}[];
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
/** Lege staat: groot zacht icoon, korte titel, één zin, één actie. */
|
|
36
|
+
export declare function EmptyBlock({ icon, title, text, action, }: {
|
|
37
|
+
icon: ReactNode;
|
|
38
|
+
title: string;
|
|
39
|
+
text?: string;
|
|
40
|
+
action?: ReactNode;
|
|
41
|
+
}): import("react").JSX.Element;
|
|
42
|
+
/** Melding: zacht rood of oker vlak, icoon links, actie rechts. */
|
|
43
|
+
export declare function Notice({ tone, icon, title, children, action, }: {
|
|
44
|
+
tone?: "warning" | "destructive";
|
|
45
|
+
icon: ReactNode;
|
|
46
|
+
title: ReactNode;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
action?: ReactNode;
|
|
49
|
+
}): import("react").JSX.Element;
|
|
50
|
+
/** Sneltoetsen voor lijstpagina's: N, /, J/K, Enter. Geen effect tijdens typen of in dialogen. */
|
|
51
|
+
export declare function useListShortcuts(handlers: {
|
|
52
|
+
onNew?: () => void;
|
|
53
|
+
onSearch?: () => void;
|
|
54
|
+
onNext?: () => void;
|
|
55
|
+
onPrev?: () => void;
|
|
56
|
+
onOpen?: () => void;
|
|
57
|
+
}): void;
|
|
58
|
+
//# sourceMappingURL=styleguide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleguide.d.ts","sourceRoot":"","sources":["../../../../src/components/klanten/ui/styleguide.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlD,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,+BAmBA;AAED,kDAAkD;AAClD,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAiB,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,+BAYhG;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,GAAG,EACH,IAAgB,EAChB,MAAc,EACd,OAAO,GACR,EAAE;IACD,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,CAAC;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,+BA6BA;AAED,uDAAuD;AACvD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,EACzC,KAAK,EACL,QAAQ,EACR,KAAK,GACN,EAAE;IACD,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CAC/E,+BAmCA;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,GACP,EAAE;IACD,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,+BASA;AAED,mEAAmE;AACnE,wBAAgB,MAAM,CAAC,EACrB,IAAgB,EAChB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,GACP,EAAE;IACD,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,+BAeA;AAQD,kGAAkG;AAClG,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE;IACzC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,QAgBA"}
|