@flowselections/floriday-klanten-module 1.0.88 → 1.0.90
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/fs-ui/ColumnsMenu.d.ts +14 -0
- package/dist-lib/components/fs-ui/ColumnsMenu.d.ts.map +1 -0
- package/dist-lib/components/fs-ui/ColumnsMenu.js +31 -0
- package/dist-lib/components/fs-ui/DataTable.d.ts +32 -5
- package/dist-lib/components/fs-ui/DataTable.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/DataTable.js +22 -6
- package/dist-lib/components/fs-ui/FilterChips.d.ts +10 -1
- package/dist-lib/components/fs-ui/FilterChips.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/FilterChips.js +7 -3
- package/dist-lib/components/fs-ui/FiltersPanel.d.ts +14 -0
- package/dist-lib/components/fs-ui/FiltersPanel.d.ts.map +1 -0
- package/dist-lib/components/fs-ui/FiltersPanel.js +9 -0
- package/dist-lib/components/fs-ui/InlineAlert.d.ts +3 -4
- package/dist-lib/components/fs-ui/InlineAlert.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/InlineAlert.js +10 -16
- package/dist-lib/components/fs-ui/KpiRow.d.ts +1 -1
- package/dist-lib/components/fs-ui/KpiRow.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/KpiRow.js +2 -2
- package/dist-lib/components/fs-ui/NoticeBar.d.ts +18 -0
- package/dist-lib/components/fs-ui/NoticeBar.d.ts.map +1 -0
- package/dist-lib/components/fs-ui/NoticeBar.js +37 -0
- package/dist-lib/components/fs-ui/PageHeader.d.ts +13 -3
- package/dist-lib/components/fs-ui/PageHeader.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/PageHeader.js +9 -3
- package/dist-lib/components/fs-ui/PillTabs.d.ts +5 -3
- package/dist-lib/components/fs-ui/PillTabs.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/PillTabs.js +26 -9
- package/dist-lib/components/fs-ui/RowMenu.d.ts +13 -0
- package/dist-lib/components/fs-ui/RowMenu.d.ts.map +1 -0
- package/dist-lib/components/fs-ui/RowMenu.js +9 -0
- package/dist-lib/components/fs-ui/SearchInput.d.ts +2 -2
- package/dist-lib/components/fs-ui/SearchInput.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/SearchInput.js +11 -7
- package/dist-lib/components/fs-ui/Toolbar.d.ts +11 -2
- package/dist-lib/components/fs-ui/Toolbar.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/Toolbar.js +12 -3
- package/dist-lib/components/fs-ui/UpdatedAt.d.ts +5 -2
- package/dist-lib/components/fs-ui/UpdatedAt.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/UpdatedAt.js +7 -3
- package/dist-lib/components/fs-ui/index.d.ts +7 -3
- package/dist-lib/components/fs-ui/index.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/index.js +7 -3
- package/dist-lib/components/fs-ui/shortcuts.d.ts.map +1 -1
- package/dist-lib/components/fs-ui/shortcuts.js +7 -8
- package/dist-lib/components/klanten/BackLink.js +1 -1
- package/dist-lib/components/klanten/BewerkKlant.d.ts.map +1 -1
- package/dist-lib/components/klanten/BewerkKlant.js +3 -2
- package/dist-lib/components/klanten/ExternalCacheBanner.d.ts.map +1 -1
- package/dist-lib/components/klanten/ExternalCacheBanner.js +2 -2
- package/dist-lib/components/klanten/GroupedKlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/GroupedKlantDetail.js +5 -4
- package/dist-lib/components/klanten/ImportKlanten.d.ts.map +1 -1
- package/dist-lib/components/klanten/ImportKlanten.js +6 -2
- package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetail.js +16 -4
- package/dist-lib/components/klanten/KlantDetailLayout.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetailLayout.js +5 -2
- package/dist-lib/components/klanten/KlantFormulier.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantFormulier.js +48 -40
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +103 -96
- package/dist-lib/components/klanten/NetwerkPagina.d.ts.map +1 -1
- package/dist-lib/components/klanten/NetwerkPagina.js +5 -4
- package/dist-lib/components/klanten/NieuweKlant.d.ts.map +1 -1
- package/dist-lib/components/klanten/NieuweKlant.js +2 -1
- package/dist-lib/components/klanten/OvernemenTwinfieldKlant.d.ts.map +1 -1
- package/dist-lib/components/klanten/OvernemenTwinfieldKlant.js +3 -2
- package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.js +4 -3
- package/dist-lib/components/klanten/pricegroups/PriceGroupsPage.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupsPage.js +8 -3
- package/dist-lib/lib/format-date.d.ts +2 -2
- package/dist-lib/lib/format-date.d.ts.map +1 -1
- package/dist-lib/lib/format-date.js +15 -7
- package/dist-lib/lib/labels.d.ts +36 -0
- package/dist-lib/lib/labels.d.ts.map +1 -0
- package/dist-lib/lib/labels.js +49 -0
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
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 { Children, createContext, useContext, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { useForm } from "react-hook-form";
|
|
4
4
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
5
|
import { useQuery } from "@tanstack/react-query";
|
|
6
6
|
import { useServerFn } from "@tanstack/react-start";
|
|
7
7
|
import { Button, Card, CardContent, Input, Label, Textarea, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
|
|
8
|
-
import {
|
|
8
|
+
import { MapPin, Landmark, ReceiptText, ChevronDown, Check, AlertCircle, Users, BookOpen, } from "lucide-react";
|
|
9
|
+
import { PageHeader, NoticeBar } from "../fs-ui/index.js";
|
|
9
10
|
import { BackLink } from "./BackLink.js";
|
|
10
11
|
import { listCustomerClasses } from "../../lib/customers.functions.js";
|
|
11
12
|
import { listTwinfieldLedgerAccounts } from "../../lib/twinfield-ledger.functions.js";
|
|
@@ -209,44 +210,51 @@ export function KlantFormulier({ title, description, submitLabel, submitting, de
|
|
|
209
210
|
const t = v.trim();
|
|
210
211
|
return t && !/^https?:\/\//i.test(t) ? `https://${t}` : t;
|
|
211
212
|
};
|
|
212
|
-
return (_jsxs("main", { className: "min-h-screen
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
213
|
+
return (_jsxs("main", { className: "min-h-screen", children: [_jsxs("div", { className: "mx-auto flex max-w-6xl flex-col gap-4 p-4 sm:p-6", children: [_jsx(BackLink, {}), _jsx(PageHeader, { title: title, info: description }), _jsx(NoticeBar, { items: [
|
|
214
|
+
errorCount > 0 && {
|
|
215
|
+
tone: "destructive",
|
|
216
|
+
text: _jsxs(_Fragment, { children: [_jsxs("span", { className: "font-medium", children: ["Controleer ", errorCount, " ", errorCount === 1 ? "veld" : "velden", "."] }), " ", _jsx("span", { className: "text-muted-foreground", children: "Ga naar het eerste veld dat nog niet klopt." })] }),
|
|
217
|
+
action: _jsx(Button, { type: "button", variant: "outline", size: "sm", className: "h-8", onClick: focusFirstError, children: "Naar veld" }),
|
|
218
|
+
},
|
|
219
|
+
notice ? { tone: "info", text: notice } : null,
|
|
220
|
+
] })] }), _jsx("div", { className: "mx-auto max-w-6xl px-4 sm:px-6", children: _jsx(ExternalHintsContext.Provider, { value: externalHints, children: _jsx(FormValuesContext.Provider, { value: values, children: _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4",
|
|
221
|
+
// Twinfield-maxima: invoer stopt bij de grens (naam uitgezonderd, die wordt in Twinfield ingekort).
|
|
222
|
+
onFocusCapture: (e) => {
|
|
223
|
+
const t = e.target;
|
|
224
|
+
const max = t?.name && t.name !== "company_name" ? TWINFIELD_FIELD_MAX[t.name] : undefined;
|
|
225
|
+
if (max && (t.tagName === "INPUT" || t.tagName === "TEXTAREA"))
|
|
226
|
+
t.maxLength = max;
|
|
227
|
+
}, children: [_jsx(Section, { k: "algemeen", title: "Algemeen", icon: _jsx(Users, { className: "h-5 w-5" }), open: open.algemeen, onToggle: toggle, hasError: sectionHasError([
|
|
228
|
+
"customer_number", "company_name", "language", "website", "vat_number",
|
|
229
|
+
"coc_number", "contact_person", "attention_to", "email", "billing_email",
|
|
230
|
+
"phone", "fax",
|
|
231
|
+
]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [_jsx(Field, { label: "Nummer", error: fieldErr("customer_number"), hint: numberHint ?? (numberValue ? undefined : "Wordt toegekend door de boekhouding"), children: _jsx(Input, { readOnly: true, className: "bg-muted", value: numberValue ?? (numberReadOnly ? values.customer_number ?? "" : ""), placeholder: "Nog niet in de boekhouding" }) }), _jsx(Field, { label: "Bedrijfsnaam", required: true, error: fieldErr("company_name"), success: isValid("company_name"), hint: lengthWarning(values.company_name, 40, "de bedrijfsnaam"), children: _jsx(Input, { "aria-invalid": !!errors.company_name, ...form.register("company_name") }) }), _jsx(Field, { label: "Taal", error: fieldErr("language"), children: _jsxs(Select, { value: form.watch("language") || undefined, onValueChange: (v) => form.setValue("language", v, { shouldValidate: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Geen standaard" }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "nl", children: "nl" }), _jsx(SelectItem, { value: "en", children: "en" }), _jsx(SelectItem, { value: "de", children: "de" }), _jsx(SelectItem, { value: "fr", children: "fr" })] })] }) }), _jsx(Field, { label: "Website", error: fieldErr("website"), success: isValid("website"), children: _jsx(Input, { placeholder: "https://", ...normalizeOnBlur("website", normUrl) }) }), _jsxs(Field, { label: "BTW-nummer", required: vatRequired, error: fieldErr("vat_number"), success: isValid("vat_number"), children: [_jsx(Input, { "aria-invalid": !!errors.vat_number, ...normalizeOnBlur("vat_number", normVat) }), (() => {
|
|
232
|
+
const chk = checkVatFormat(values.vat_number, toIsoCountry(values.country));
|
|
233
|
+
const tfErr = isTwinfieldVatError(syncError) ? syncError : null;
|
|
234
|
+
if (chk.status !== "invalid" && !tfErr)
|
|
235
|
+
return null;
|
|
236
|
+
return (_jsxs("div", { className: "mt-1.5 rounded-md border border-warning/40 bg-warning/10 px-2.5 py-2 text-xs space-y-1.5", children: [_jsx("p", { className: "font-medium", children: chk.status === "invalid" ? chk.message : "De boekhouding weigerde het btw-nummer" }), tfErr && _jsxs("p", { className: "text-muted-foreground", children: ["Melding van de boekhouding: ", tfErr] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: () => { setVatOverride(false); form.setFocus("vat_number"); }, children: "Corrigeren" }), chk.status === "invalid" && (_jsx(Button, { type: "button", size: "sm", variant: vatOverride ? "secondary" : "ghost", onClick: () => setVatOverride(true), children: vatOverride ? "Wordt toch verstuurd" : "Toch versturen" }))] })] }));
|
|
237
|
+
})()] }), _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-mailadres voor facturen", 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 de boekhouding 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([
|
|
238
|
+
"address_type", "icp_country_code", "address_line1", "address_line2",
|
|
239
|
+
"street", "house_number", "postal_code", "city", "country",
|
|
240
|
+
]), 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]) => ({
|
|
241
|
+
value: code,
|
|
242
|
+
label: `${countryNameToFlag(code) ?? ""} ${name}`.trim(),
|
|
243
|
+
search: `${name} ${code}`,
|
|
244
|
+
})), 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") ??
|
|
245
|
+
"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") ??
|
|
246
|
+
"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
|
|
247
|
+
? "BIC wordt alleen samen met een passend IBAN naar de boekhouding gestuurd."
|
|
248
|
+
: undefined, children: _jsx(Input, { ...form.register("bank_bic") }) }), _jsx(Field, { label: "Bank - Nationale bankcode", children: _jsx(Input, { ...form.register("bank_national_code") }) }), _jsx(Field, { label: "Bank - Adresregel 1", children: _jsx(Input, { ...form.register("bank_address_line1") }) }), _jsx(Field, { label: "Bank - Adresregel 2", children: _jsx(Input, { ...form.register("bank_address_line2") }) }), _jsx(Field, { label: "Bank - Huisnummer", children: _jsx(Input, { ...form.register("bank_house_number") }) }), _jsx(Field, { label: "Bank - Postcode", error: fieldErr("bank_postal_code"), children: _jsx(Input, { ...normalizeOnBlur("bank_postal_code", normPostal) }) }), _jsx(Field, { label: "Bank - Plaats", children: _jsx(Input, { ...form.register("bank_city") }) }), _jsx(Field, { label: "Bank - Staat", children: _jsx(Input, { ...form.register("bank_state") }) }), _jsx("div", { className: "md:col-span-2", children: _jsx(Field, { label: "Bank - Land", children: _jsx(Input, { ...form.register("bank_country") }) }) })] }) }), _jsx(Section, { k: "facturering", title: "Facturering & betaling", icon: _jsx(ReceiptText, { className: "h-5 w-5" }), open: open.facturering, onToggle: toggle, summary: `${values.payment_term_days ?? "—"} vervaldagen · ${values.vat_display || TWINFIELD_DEFAULTS.vat_display}`, hasError: sectionHasError([
|
|
249
|
+
"discount_percentage", "discount_days", "payment_term_days", "vat_display",
|
|
250
|
+
"discount_surcharge", "payment_spec_method", "invoice_send_as", "notes",
|
|
251
|
+
]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Kortingspercentage (%)", error: fieldErr("discount_percentage"), hint: "Alleen voor dit systeem; de boekhouding accepteert dit niet.", children: _jsx(Input, { type: "number", step: "0.01", min: 0, max: 100, ...numberField("discount_percentage") }) }), _jsx(Field, { label: "Aantal kortingsdagen", error: fieldErr("discount_days"), hint: "Alleen voor dit systeem; gaat niet mee naar de boekhouding.", children: _jsx(Input, { type: "number", min: 0, max: 365, ...numberField("discount_days") }) }), _jsx(Field, { label: "Aantal vervaldagen", error: fieldErr("payment_term_days"), children: _jsx(Input, { type: "number", min: 0, max: 365, ...numberField("payment_term_days") }) }), _jsx(Field, { label: "Btw-weergave op factuur", error: fieldErr("vat_display"), children: _jsxs(Select, { value: form.watch("vat_display") || TWINFIELD_DEFAULTS.vat_display, onValueChange: (v) => form.setValue("vat_display", v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: VAT_DISPLAY_OPTIONS.map((o) => (_jsx(SelectItem, { value: o.value, children: o.label }, o.value))) })] }) }), _jsx(Field, { label: "Korting / opslag", error: fieldErr("discount_surcharge"), children: _jsxs(Select, { value: form.watch("discount_surcharge") || TWINFIELD_DEFAULTS.discount_surcharge, onValueChange: (v) => form.setValue("discount_surcharge", v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: DISCOUNT_SURCHARGE_OPTIONS.map((o) => (_jsx(SelectItem, { value: o.value, children: o.label }, o.value))) })] }) }), _jsx(Field, { label: "Verstuurmethode betaalspecificatie", error: fieldErr("payment_spec_method"), children: _jsxs(Select, { value: form.watch("payment_spec_method") || TWINFIELD_DEFAULTS.payment_spec_method, onValueChange: (v) => form.setValue("payment_spec_method", v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PAYMENT_SPEC_METHOD_OPTIONS.map((o) => (_jsx(SelectItem, { value: o.value, children: o.label }, o.value))) })] }) }), _jsx(Field, { label: "Elektronisch factureren", error: fieldErr("e_invoicing"), children: _jsxs(Select, { value: form.watch("e_invoicing") ? "ja" : "nee", onValueChange: (v) => form.setValue("e_invoicing", v === "ja"), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "nee", children: "Nee" }), _jsx(SelectItem, { value: "ja", children: "Ja" })] })] }) }), _jsx(Field, { label: "Factuur versturen als", error: fieldErr("invoice_send_as"), children: _jsxs(Select, { value: form.watch("invoice_send_as") || TWINFIELD_DEFAULTS.invoice_send_as, onValueChange: (v) => form.setValue("invoice_send_as", v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: INVOICE_SEND_AS_OPTIONS.map((o) => (_jsx(SelectItem, { value: o.value, children: o.label }, o.value))) })] }) }), _jsxs("div", { className: "md:col-span-2 space-y-1.5", children: [_jsx(Label, { children: "Notities" }), _jsx(Textarea, { rows: 4, ...form.register("notes") }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Interne notitie; wordt niet naar de boekhouding gestuurd." })] })] }) }), _jsx(Section, { k: "boekhouding", title: "Boekhouding (krediet en grootboek)", icon: _jsx(BookOpen, { className: "h-5 w-5" }), open: open.boekhouding, onToggle: toggle, summary: filled(values.ledger_account)
|
|
252
|
+
? `Grootboek ${values.ledger_account}`
|
|
253
|
+
: "Grootboekrekening nog niet gekozen", hasError: sectionHasError(["credit_limit", "send_reminder", "ledger_account"]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Kredietlimiet (\u20AC)", error: fieldErr("credit_limit"), hint: TWINFIELD_READONLY_HINT, children: _jsx(Input, { type: "number", step: "0.01", min: 0, readOnly: true, className: "bg-muted", ...numberField("credit_limit") }) }), _jsx(Field, { label: "Aanmanen", error: fieldErr("send_reminder"), hint: TWINFIELD_READONLY_HINT, children: _jsxs(Select, { disabled: true, value: form.watch("send_reminder") || TWINFIELD_DEFAULTS.send_reminder, onValueChange: (v) => form.setValue("send_reminder", v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: SEND_REMINDER_OPTIONS.map((o) => (_jsx(SelectItem, { value: o.value, children: o.label }, o.value))) })] }) }), _jsx(Field, { label: "Kredietbeheerder", hint: TWINFIELD_READONLY_HINT, children: _jsx(Input, { readOnly: true, className: "bg-muted", value: creditManagerDisplay(creditInfo ?? {}), placeholder: "\u2014" }) }), _jsx(Field, { label: "E-mail voor aanmaningen", hint: TWINFIELD_READONLY_HINT, children: _jsx(Input, { readOnly: true, className: "bg-muted", value: creditInfo?.reminder_email ?? "", placeholder: "\u2014" }) }), _jsx(Field, { label: "Geblokkeerd", error: fieldErr("blocked"), hint: TWINFIELD_READONLY_HINT, children: _jsxs(Select, { disabled: true, value: form.watch("blocked") ? "ja" : "nee", onValueChange: (v) => form.setValue("blocked", v === "ja"), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "nee", children: "Nee" }), _jsx(SelectItem, { value: "ja", children: "Ja" })] })] }) }), _jsx(Field, { label: "Grootboekrekening", error: fieldErr("ledger_account"), success: isValid("ledger_account"), hint: ledgerLoading
|
|
254
|
+
? "Rekeningschema wordt geladen uit de boekhouding…"
|
|
255
|
+
: ledger?.error
|
|
256
|
+
? `${ledger.error} Vul de rekening handmatig in.`
|
|
257
|
+
: "Verzamelrekening debiteuren; kan per administratie verschillen.", children: ledgerLoading ? (_jsx(Input, { disabled: true, placeholder: "Laden\u2026" })) : (ledger?.accounts?.length ?? 0) > 0 ? (_jsxs(Select, { value: form.watch("ledger_account") || "", onValueChange: (v) => form.setValue("ledger_account", v, { shouldValidate: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Kies grootboekrekening..." }) }), _jsx(SelectContent, { children: (ledger?.accounts ?? []).map((a) => (_jsxs(SelectItem, { value: a.code, children: [a.code, a.name ? ` - ${a.name}` : ""] }, a.code))) })] })) : (_jsx(Input, { placeholder: "bv. 1300", "aria-invalid": !!errors.ledger_account, ...form.register("ledger_account") })) })] }) }), extraSections] }) }) }) }), _jsx("div", { className: "sticky bottom-0 left-0 right-0 border-t bg-background z-20", children: _jsxs("div", { className: "max-w-6xl mx-auto px-6 py-3 flex justify-end gap-2", children: [_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, children: "Annuleren" }), _jsxs(Button, { type: "button", onClick: handleSubmit, disabled: submitting || !isDirty, children: [_jsx(Check, { className: "h-4 w-4 mr-2" }), submitting ? "Opslaan..." : submitLabel] })] }) }), extra] }));
|
|
250
258
|
}
|
|
251
259
|
function Section({ k, title, icon, open, onToggle, children, summary, hasError, }) {
|
|
252
260
|
return (_jsxs(Card, { className: "rounded-2xl border shadow-sm overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => onToggle(k), className: "w-full flex items-center justify-between px-6 py-4 hover:bg-muted/40 transition-colors", children: [_jsxs("div", { className: "flex items-center gap-3 min-w-0", children: [_jsx("span", { className: "text-primary", children: icon }), _jsx("span", { className: "text-base font-semibold", children: title }), hasError && (_jsx("span", { className: "h-2 w-2 rounded-full bg-destructive", "aria-label": "Deze sectie bevat een fout" })), !open && summary && (_jsx("span", { className: "truncate text-xs text-muted-foreground", children: summary }))] }), _jsx(ChevronDown, { className: `h-5 w-5 text-muted-foreground transition-transform ${open ? "" : "-rotate-90"}` })] }), open && (_jsx(CardContent, { className: "px-6 pb-6 pt-0", children: children }))] }));
|
|
@@ -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":"AAuEA,wBAAgB,gBAAgB,gCAo1B/B"}
|
|
@@ -7,9 +7,10 @@ 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,
|
|
11
|
-
import { Plus, Users, UserCheck, UserX, AlertCircle,
|
|
12
|
-
import { PageHeader,
|
|
10
|
+
import { Button, } from "@flowselections/core";
|
|
11
|
+
import { Plus, Users, UserCheck, UserX, AlertCircle, AlertTriangle, X, MapPin, Upload, List, CheckCircle2, MinusCircle, XCircle, Link2, } from "lucide-react";
|
|
12
|
+
import { PageHeader, KpiTile, KpiRow, PillTabs, Toolbar, FiltersButton, FiltersPanel, FilterField, SearchInput, FilterChips, InlineAlert, ColumnsMenu, useHiddenColumns, TableSkeleton, EmptyState as FsEmptyState, MobilePrimaryAction, useListShortcuts, ShortcutHelp, useShortcutHelp, DataTable, Th, Td, Pagination, CELL_X, RowMenu, StatusIcon, HoverTip, } from "../fs-ui/index.js";
|
|
13
|
+
import { label } from "../../lib/labels.js";
|
|
13
14
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@flowselections/core";
|
|
14
15
|
import { ChevronDown, Network } from "lucide-react";
|
|
15
16
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
@@ -21,12 +22,10 @@ import { supabase } from "../../integrations/supabase/client.js";
|
|
|
21
22
|
import { decodeDeep } from "../../lib/decode-html.js";
|
|
22
23
|
import { friendlyError, isBackendUnavailable, retryOnTransient, retryBackoff } from "../../lib/errors.js";
|
|
23
24
|
import { CustomerAvatar } from "../CustomerAvatar.js";
|
|
24
|
-
import { PriceGroupBadges } from "./PriceGroupBadges.js";
|
|
25
25
|
import { KlantBewerkenDialog } from "./KlantBewerkenDialog.js";
|
|
26
|
-
import { ChannelBadges } from "./ChannelBadges.js";
|
|
27
26
|
import { missingInvoiceAddressFields } from "../../lib/invoice-address.js";
|
|
28
27
|
import { ProposalLine, useCarrierProposals } from "./CarrierPicker.js";
|
|
29
|
-
import { derivePaymentMethod
|
|
28
|
+
import { derivePaymentMethod } from "../../lib/payment-method.js";
|
|
30
29
|
import { formatCountry, getCountryFlagAndName, countryNameToFlag } from "../../lib/countries.js";
|
|
31
30
|
import { MultiSearchableSelect } from "./MultiSearchableSelect.js";
|
|
32
31
|
export function KlantenOverzicht() {
|
|
@@ -510,106 +509,114 @@ export function KlantenOverzicht() {
|
|
|
510
509
|
document.querySelector(`[data-row-idx="${selectedIdx}"]`)?.scrollIntoView({ block: "nearest" });
|
|
511
510
|
}, [selectedIdx]);
|
|
512
511
|
useEffect(() => { setSelectedIdx(-1); }, [currentPage, view, search]);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
512
|
+
const [filtersOpen, setFiltersOpen] = useState(false);
|
|
513
|
+
const extraFilterCount = selectedCountries.length + selectedChannels.length + selectedPayments.length;
|
|
514
|
+
const clearAll = () => {
|
|
515
|
+
setSearchInput("");
|
|
516
|
+
setSearch("");
|
|
517
|
+
setSelectedCountries([]);
|
|
518
|
+
setSelectedChannels([]);
|
|
519
|
+
setSelectedPayments([]);
|
|
520
|
+
setView("all");
|
|
521
|
+
setPage(1);
|
|
522
|
+
};
|
|
523
|
+
const reload = () => {
|
|
524
|
+
queryClient.invalidateQueries({ queryKey: ["customers-local"] });
|
|
525
|
+
queryClient.invalidateQueries({ queryKey: ["customers-external"] });
|
|
526
|
+
queryClient.invalidateQueries({ queryKey: ["overdue-balances"] });
|
|
527
|
+
queryClient.invalidateQueries({ queryKey: ["customer-revenue-12m"] });
|
|
528
|
+
};
|
|
529
|
+
const rowMenuItems = (c) => {
|
|
530
|
+
const items = [{ label: "Openen", onSelect: () => openRow(c) }];
|
|
531
|
+
if (c.id)
|
|
532
|
+
items.push({ label: "Bewerken", onSelect: () => setEditTarget({ customerId: c.id }) });
|
|
533
|
+
else if (c.twinfield_code)
|
|
534
|
+
items.push({
|
|
535
|
+
label: "Overnemen en bewerken",
|
|
536
|
+
title: "Klant uit de boekhouding overnemen en bewerken",
|
|
537
|
+
onSelect: () => setEditTarget({ twinfieldCode: c.twinfield_code, twinfieldConnectionId: c.twinfield_connection_id }),
|
|
538
|
+
});
|
|
539
|
+
return items;
|
|
540
|
+
};
|
|
541
|
+
const [hiddenCols, setHiddenCols] = useHiddenColumns("klanten.overzicht.kolommen");
|
|
542
|
+
const show = (k) => !hiddenCols.includes(k);
|
|
543
|
+
const visibleCols = COL_DEFS.filter((c) => show(c.key)).map((c) => c.width);
|
|
544
|
+
const sortState = (col) => (sort.col === col ? sort.dir : null);
|
|
545
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-[calc(7rem+env(safe-area-inset-bottom))] sm:p-6 sm:pb-24", children: [_jsx(PageHeader, { title: "Klanten", updatedAt: updatedAt, actions: _jsxs(_Fragment, { children: [_jsxs("div", { className: "inline-flex", children: [_jsxs(Button, { variant: "outline", size: "sm", "aria-label": "Importeren", className: `h-10 w-10 p-0 sm:h-9 sm:w-auto sm:px-3 ${hasFloriday ? "rounded-r-none" : ""}`, onClick: () => goTo({ to: "/klanten/import" }), children: [_jsx(Upload, { className: "h-4 w-4 sm:mr-2" }), " ", _jsx("span", { className: "hidden sm:inline", children: "Importeren" })] }), hasFloriday && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "sm", className: "h-10 rounded-l-none border-l-0 px-2 sm:h-9", "aria-label": "Meer importmogelijkheden", children: _jsx(ChevronDown, { className: "h-4 w-4" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: _jsxs(DropdownMenuItem, { onSelect: () => goTo({ to: "/klanten/netwerk" }), children: [_jsx(Network, { className: "h-4 w-4 mr-2" }), " Klanten via Floriday"] }) })] }))] }), _jsxs(Button, { size: "sm", className: "hidden sm:inline-flex", onClick: () => goTo({ to: "/klanten/nieuw" }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Nieuwe klant", _jsx("kbd", { "aria-hidden": true, className: "ml-2 hidden rounded border border-primary-foreground/30 bg-primary-foreground/15 px-1.5 font-mono text-[10px] leading-4 text-primary-foreground sm:inline-block", children: "N" })] })] }) }), loadError && (_jsx(InlineAlert, { tone: "destructive", title: isBackendUnavailable(loadError) ? "Klanten zijn even niet bereikbaar" : "Klanten laden lukt niet", action: _jsx(Button, { size: "sm", variant: "outline", className: "ml-auto", onClick: reload, children: "Opnieuw proberen" }), children: isBackendUnavailable(loadError)
|
|
519
546
|
? "Je bent niet uitgelogd. Probeer het over een paar minuten opnieuw."
|
|
520
|
-
: friendlyError(loadError) })), _jsxs(KpiRow, { children: [_jsx(KpiTile, { icon: _jsx(Users, {}), title: "Alle klanten", value: totals.all, sub: "Al je klanten", active:
|
|
521
|
-
{ value: "all", label: "Alle", icon: _jsx(List, {
|
|
522
|
-
{ value: "active", label: "Met omzet", icon: _jsx(UserCheck, {
|
|
523
|
-
{ value: "inactive", label: "Zonder omzet", icon: _jsx(UserX, {
|
|
524
|
-
{ value: "overdue", label: "Achterstallig", icon: _jsx(AlertCircle, {
|
|
525
|
-
] }), _jsxs(Toolbar, { chips: _jsx(FilterChips, { chips: activeFilterChips, onClearAll: () => {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
setView("all");
|
|
532
|
-
setPage(1);
|
|
533
|
-
} }), children: [_jsx(SearchInput, { ref: searchRef, label: "Zoek klanten", placeholder: "Zoek op bedrijf, contact of e-mail", value: searchInput, onChange: setSearchInput, onClear: () => { setSearchInput(""); setSearch(""); resetPage(); } }), _jsx(MultiSearchableSelect, { values: selectedCountries, onValuesChange: (v) => { setSelectedCountries(v); resetPage(); }, options: countryOptions, placeholder: "Alle landen", triggerClassName: "w-36 h-9 rounded-lg" }), channelOptions.length > 0 && _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" })] }), _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 ? (_jsx(TableSkeleton, { rows: 8, columns: 9 })) : pageRows.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 9, children: _jsx(EmptyState, { onAdd: () => goTo({ to: "/klanten/nieuw" }), filtered: activeFilterChips.length > 0, onClearFilters: () => {
|
|
534
|
-
setSearchInput("");
|
|
535
|
-
setSearch("");
|
|
536
|
-
setSelectedCountries([]);
|
|
537
|
-
setSelectedChannels([]);
|
|
538
|
-
setSelectedPayments([]);
|
|
539
|
-
setView("all");
|
|
540
|
-
setPage(1);
|
|
541
|
-
} }) }) })) : pageRows.map((c, idx) => {
|
|
542
|
-
// Handelsnaam voorop (zoals Floriday en de verzendbrief); officiële naam klein eronder.
|
|
543
|
-
const hasTrade = !!c.commercial_name && c.commercial_name !== c.company_name;
|
|
544
|
-
const primaryName = hasTrade ? c.commercial_name : c.company_name;
|
|
545
|
-
const secondary = hasTrade ? c.company_name : c.city ?? c.email ?? null;
|
|
546
|
-
const selected = idx === selectedIdx;
|
|
547
|
-
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) => {
|
|
548
|
-
e.stopPropagation();
|
|
549
|
-
setEditTarget({ customerId: c.id });
|
|
550
|
-
}, 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: "Klant uit de boekhouding overnemen en bewerken", onClick: (e) => {
|
|
551
|
-
e.stopPropagation();
|
|
552
|
-
setEditTarget({
|
|
553
|
-
twinfieldCode: c.twinfield_code,
|
|
554
|
-
twinfieldConnectionId: c.twinfield_connection_id,
|
|
555
|
-
});
|
|
556
|
-
}, children: [_jsx(Pencil, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Bewerken" })] })) : null] }) })] }, c.key));
|
|
557
|
-
}) })] }) }) }), _jsxs("div", { className: "flex items-center justify-between gap-3 px-4 py-3 border-t text-sm flex-wrap", children: [_jsx("span", { className: "text-muted-foreground", children: isLoading ? "Laden…" : total === 0 ? "0 klanten" : `${startIdx + 1}–${endIdx} van ${total}` }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Per pagina" }), _jsxs(Select, { value: String(pageSize), onValueChange: (v) => { setPageSize(Number(v)); setPage(1); }, children: [_jsx(SelectTrigger, { className: "w-20 h-8", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "25", children: "25" }), _jsx(SelectItem, { value: "50", children: "50" }), _jsx(SelectItem, { value: "100", children: "100" })] })] })] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setPage((p) => Math.max(1, p - 1)), disabled: currentPage <= 1, children: [_jsx(ChevronLeft, { className: "h-4 w-4 mr-1" }), " Vorige"] }), _jsxs("span", { className: "text-muted-foreground", children: [currentPage, " / ", totalPages] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setPage((p) => Math.min(totalPages, p + 1)), disabled: currentPage >= totalPages, children: ["Volgende ", _jsx(ChevronRight, { className: "h-4 w-4 ml-1" })] })] })] })] }), _jsx(KlantBewerkenDialog, { open: editTarget !== null, onOpenChange: (open) => { if (!open)
|
|
547
|
+
: friendlyError(loadError) })), _jsxs(KpiRow, { children: [_jsx(KpiTile, { icon: _jsx(Users, {}), title: "Alle klanten", value: totals.all, sub: "Al je klanten", active: false, onClick: () => { setView("all"); resetPage(); } }), _jsx(KpiTile, { icon: _jsx(UserCheck, {}), title: "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, {}), title: "Zonder omzet", value: totals.inactive ?? "–", sub: "Afgelopen 12 maanden", active: view === "inactive", onClick: () => { setView("inactive"); resetPage(); } }), _jsx(KpiTile, { icon: _jsx(AlertCircle, {}), tone: "warning", title: "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, { label: "Klanten", value: view, onChange: (v) => { setView(v); resetPage(); }, items: [
|
|
548
|
+
{ value: "all", label: "Alle", icon: _jsx(List, {}), count: totals.all },
|
|
549
|
+
{ value: "active", label: "Met omzet", icon: _jsx(UserCheck, {}), count: totals.active },
|
|
550
|
+
{ value: "inactive", label: "Zonder omzet", icon: _jsx(UserX, {}), count: totals.inactive },
|
|
551
|
+
{ value: "overdue", label: "Achterstallig", icon: _jsx(AlertCircle, {}), count: totals.overdue },
|
|
552
|
+
] }), _jsxs(Toolbar, { end: _jsx(ColumnsMenu, { columns: COL_DEFS.filter((c) => c.label).map((c) => ({ key: c.key, label: c.label, locked: c.locked })), hidden: hiddenCols, onChange: setHiddenCols }), chips: _jsx(FilterChips, { chips: activeFilterChips.filter((c) => c.key !== "s"), onClearAll: clearAll }), children: [_jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SearchInput, { ref: searchRef, label: "Zoek klanten", placeholder: "Zoek op bedrijf, contact of e-mail", value: searchInput, onChange: setSearchInput, onClear: () => { setSearchInput(""); setSearch(""); resetPage(); } }) }), _jsx(FiltersButton, { count: extraFilterCount, onClick: () => setFiltersOpen(true) })] }), _jsxs(FiltersPanel, { open: filtersOpen, onOpenChange: setFiltersOpen, onClearAll: extraFilterCount > 0 ? () => { setSelectedCountries([]); setSelectedChannels([]); setSelectedPayments([]); resetPage(); } : undefined, resultLabel: `Toon ${total} ${total === 1 ? "klant" : "klanten"}`, children: [_jsx(FilterField, { label: "Land", children: _jsx(MultiSearchableSelect, { values: selectedCountries, onValuesChange: (v) => { setSelectedCountries(v); resetPage(); }, options: countryOptions, placeholder: "Alle landen", triggerClassName: "w-full h-9 rounded-lg" }) }), channelOptions.length > 0 && (_jsx(FilterField, { label: "Kanaal", children: _jsx(MultiSearchableSelect, { values: selectedChannels, onValuesChange: (v) => { setSelectedChannels(v); resetPage(); }, options: channelSelectOptions, placeholder: "Alle kanalen", triggerClassName: "w-full h-9 rounded-lg" }) })), _jsx(FilterField, { label: "Betaalvorm", children: _jsx(MultiSearchableSelect, { values: selectedPayments, onValuesChange: (v) => { setSelectedPayments(v); resetPage(); }, options: paymentSelectOptions, placeholder: "Alle betaalvormen", triggerClassName: "w-full h-9 rounded-lg" }) })] }), !isLoading && pageRows.length === 0 ? (_jsx(EmptyState, { onAdd: () => goTo({ to: "/klanten/nieuw" }), filtered: activeFilterChips.length > 0 || view !== "all", onClearFilters: clearAll })) : (_jsx(DataTable, { cols: visibleCols, head: _jsxs("tr", { children: [_jsx(Th, { sort: sortState("company_name"), onSort: () => toggleSort("company_name"), children: "Bedrijf" }), show("contact") && _jsx(Th, { children: "Contact" }), show("pricegroup") && _jsx(Th, { children: "Prijscategorie" }), show("payment") && _jsx(Th, { children: "Betaalvorm" }), show("revenue") && _jsx(Th, { children: "Omzet 12 mnd" }), show("country") && _jsx(Th, { sort: sortState("country"), onSort: () => toggleSort("country"), children: "Land" }), show("carrier") && _jsx(Th, { children: "Vervoerder" }), _jsx(Th, { children: "Status" }), _jsx(Th, { children: _jsx("span", { className: "sr-only", children: "Acties" }) })] }), mobile: isLoading ? _jsx(TableSkeleton, { as: "div", rows: 6 }) : (_jsx("ul", { className: "divide-y divide-border", children: pageRows.map((c) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => openRow(c), className: "flex w-full min-w-0 items-center gap-3 px-4 py-3 text-left active:bg-muted", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: displayName(c).primary }), _jsx(ChannelIcons, { providers: c.providers })] }), _jsx("div", { className: "truncate text-xs text-muted-foreground", children: [c.city, formatCountry(c.country)].filter(Boolean).join(" · ") || c.email || "—" })] }), _jsxs("div", { className: "shrink-0 text-right", children: [_jsx("div", { className: "text-sm tabular-nums", children: c.revenue && c.revenue.count > 0 ? formatEuro(c.revenue.amount) : "—" }), _jsx("div", { className: "flex justify-end", children: _jsx(CustomerStatus, { c: c }) })] })] }) }, c.key))) })), children: isLoading ? (_jsx(TableSkeleton, { rows: 8, columns: visibleCols.length })) : pageRows.map((c, idx) => {
|
|
553
|
+
const { primary, secondary } = displayName(c);
|
|
554
|
+
const selected = idx === selectedIdx;
|
|
555
|
+
const groups = c.price_groups.map((g) => g.name);
|
|
556
|
+
return (_jsxs("tr", { "data-row-idx": idx, "data-state": selected ? "selected" : undefined, className: `group cursor-pointer border-b border-border hover:bg-muted/50 ${selected ? "bg-muted/60" : ""}`, style: { height: 60 }, onClick: () => openRow(c), children: [_jsxs("td", { className: `relative ${CELL_X} py-0 align-middle`, children: [selected && _jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 w-[3px] bg-primary" }), _jsxs("div", { className: "flex min-w-0 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: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", title: primary, children: primary }), _jsx(ChannelIcons, { providers: c.providers })] }), secondary && _jsx("div", { className: "truncate text-xs text-muted-foreground", title: secondary, children: secondary })] })] })] }), show("contact") && _jsx(Td, { line1: c.contact_person || (c.email ? undefined : null) || (c.email ?? undefined), line2: c.contact_person && c.email ? (_jsx("a", { href: `mailto:${c.email}`, onClick: (e) => e.stopPropagation(), className: "hover:underline", title: c.email, children: c.email })) : undefined }), show("pricegroup") && _jsx(Td, { line1: groups[0] ?? undefined, line2: groups.length > 1 ? `+ ${groups.length - 1} meer` : undefined }), show("payment") && _jsx(Td, { line1: c.payment_method.label }), show("revenue") && _jsx(Td, { line1: c.revenue && c.revenue.count > 0 ? _jsx("span", { className: "tabular-nums", children: formatEuro(c.revenue.amount) }) : _jsx("span", { className: "text-muted-foreground", children: "Geen omzet" }), line2: c.revenue && c.revenue.count > 0 ? `laatst ${formatDate(c.revenue.last_date)}` : undefined }), show("country") && _jsx(Td, { line1: c.country ? (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [_jsx("span", { "aria-hidden": "true", children: countryNameToFlag(c.country) ?? "🌐" }), _jsx("span", { className: "truncate", children: formatCountry(c.country) })] })) : undefined }), show("carrier") && _jsx("td", { className: `${CELL_X} py-0 align-middle`, children: _jsx("div", { className: "min-w-0 truncate text-sm", 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("td", { className: `${CELL_X} py-0 align-middle`, children: _jsx(CustomerStatus, { c: c }) }), _jsx("td", { className: "py-0 pr-2 align-middle", onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { label: `Acties voor ${primary}`, items: rowMenuItems(c) }) })] }, c.key));
|
|
557
|
+
}) })), _jsx(Pagination, { page: currentPage, pageSize: pageSize, total: total, loading: isLoading, onPage: setPage, onPageSize: (n) => { setPageSize(n); setPage(1); } }), _jsx(KlantBewerkenDialog, { open: editTarget !== null, onOpenChange: (open) => { if (!open)
|
|
558
558
|
setEditTarget(null); }, customerId: editTarget?.customerId ?? null, twinfieldCode: editTarget?.twinfieldCode ?? null, twinfieldConnectionId: editTarget?.twinfieldConnectionId ?? null, onSaved: () => queryClient.invalidateQueries() }), _jsxs(MobilePrimaryAction, { onClick: () => goTo({ to: "/klanten/nieuw" }), children: [_jsx(Plus, { className: "h-4 w-4" }), " Nieuwe klant"] }), _jsx(ShortcutHelp, { open: help.open, onOpenChange: help.setOpen, canCreate: true })] }) }));
|
|
559
559
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
560
|
+
const COL_DEFS = [
|
|
561
|
+
{ key: "company", width: 208, label: "Bedrijf", locked: true },
|
|
562
|
+
{ key: "contact", width: 150, label: "Contact" },
|
|
563
|
+
{ key: "pricegroup", width: 104, label: "Prijscategorie" },
|
|
564
|
+
{ key: "payment", width: 80, label: "Betaalvorm" },
|
|
565
|
+
{ key: "revenue", width: 104, label: "Omzet 12 mnd" },
|
|
566
|
+
{ key: "country", width: 92, label: "Land" },
|
|
567
|
+
{ key: "carrier", width: 98, label: "Vervoerder" },
|
|
568
|
+
{ key: "status", width: 32, label: "Status", locked: true },
|
|
569
|
+
{ key: "actions", width: 32 },
|
|
570
|
+
];
|
|
571
|
+
function displayName(c) {
|
|
572
|
+
// Handelsnaam voorop (zoals Floriday en de verzendbrief); officiële naam klein eronder.
|
|
573
|
+
const hasTrade = !!c.commercial_name && c.commercial_name !== c.company_name;
|
|
574
|
+
return {
|
|
575
|
+
primary: hasTrade ? c.commercial_name : c.company_name,
|
|
576
|
+
secondary: hasTrade ? c.company_name : c.city ?? c.email ?? null,
|
|
577
|
+
};
|
|
572
578
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
579
|
+
const CHANNEL_LOGOS = {
|
|
580
|
+
floriday: "/flowselections-assets/Klanten/floriday-logo.png",
|
|
581
|
+
twinfield: "/flowselections-assets/Klanten/twinfield-logo.svg",
|
|
582
|
+
};
|
|
583
|
+
/** Koppelingen als klein icoon met infoballon, nooit als badge. */
|
|
584
|
+
function ChannelIcons({ providers }) {
|
|
585
|
+
const list = (providers ?? []).filter((p) => p && p !== "local");
|
|
586
|
+
if (list.length === 0)
|
|
587
|
+
return null;
|
|
588
|
+
return (_jsx("span", { className: "inline-flex shrink-0 items-center gap-1", children: list.map((p) => {
|
|
589
|
+
const text = label("providerLinked", p);
|
|
590
|
+
const logo = CHANNEL_LOGOS[p];
|
|
591
|
+
return (_jsx(HoverTip, { label: text, content: text, className: "h-4 w-4", children: logo ? _jsx("img", { src: logo, alt: "", "aria-hidden": "true", className: "h-3.5 w-3.5 object-contain opacity-80" }) : _jsx(Link2, { className: "h-3.5 w-3.5 text-muted-foreground" }) }, p));
|
|
592
|
+
}) }));
|
|
576
593
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
594
|
+
/** Status als klein icoon met infoballon; achterstallig rood met het bedrag. */
|
|
595
|
+
function CustomerStatus({ c }) {
|
|
596
|
+
const lines = [];
|
|
597
|
+
if (c.overdue && c.overdue.count > 0) {
|
|
598
|
+
lines.push(`${formatEuro(c.overdue.total)} achterstallig · ${c.overdue.count} openstaande factu${c.overdue.count === 1 ? "ur" : "ren"} · oudste vervallen op ${formatDate(c.overdue.oldest_due)}`);
|
|
599
|
+
}
|
|
600
|
+
if (c.missing)
|
|
601
|
+
lines.push("Deze klant staat niet meer in de boekhouding.");
|
|
602
|
+
if ((c.missing_invoice?.length ?? 0) > 0)
|
|
603
|
+
lines.push(`Factuuradres onvolledig: ${c.missing_invoice.join(", ")} ontbreekt.`);
|
|
604
|
+
const tip = lines.length ? (_jsx("ul", { className: "space-y-1", children: lines.map((l) => _jsx("li", { children: l }, l)) })) : undefined;
|
|
605
|
+
if (c.overdue && c.overdue.count > 0) {
|
|
606
|
+
return _jsx(StatusIcon, { icon: _jsx(AlertCircle, {}), tone: "error", label: label("customerStatus", "overdue"), tip: tip });
|
|
607
|
+
}
|
|
608
|
+
if (c.missing)
|
|
609
|
+
return _jsx(StatusIcon, { icon: _jsx(XCircle, {}), tone: "error", label: label("customerStatus", "missing"), tip: tip });
|
|
610
|
+
if ((c.missing_invoice?.length ?? 0) > 0) {
|
|
611
|
+
return _jsx(StatusIcon, { icon: _jsx(AlertTriangle, {}), tone: "busy", label: label("customerStatus", "invoice_incomplete"), tip: tip });
|
|
580
612
|
}
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
|
|
613
|
+
return c.is_active
|
|
614
|
+
? _jsx(StatusIcon, { icon: _jsx(CheckCircle2, {}), tone: "done", label: label("customerStatus", "active") })
|
|
615
|
+
: _jsx(StatusIcon, { icon: _jsx(MinusCircle, {}), tone: "open", label: label("customerStatus", "inactive") });
|
|
584
616
|
}
|
|
585
617
|
function EmptyState({ onAdd, filtered = false, onClearFilters, }) {
|
|
586
618
|
return (_jsx(FsEmptyState, { icon: _jsx(Users, { className: "h-6 w-6" }), title: filtered ? "Geen klanten binnen deze filters" : "Nog geen klanten", text: filtered ? "Verruim of wis je filters om meer klanten te zien." : "Voeg je eerste klant toe of importeer een bestand.", action: filtered && onClearFilters ? (_jsxs(Button, { size: "sm", variant: "outline", onClick: onClearFilters, children: [_jsx(X, { className: "h-4 w-4 mr-2" }), " Filters wissen"] })) : (_jsxs(Button, { size: "sm", onClick: onAdd, children: [_jsx(Plus, { className: "h-4 w-4 mr-2" }), " Nieuwe klant"] })) }));
|
|
587
619
|
}
|
|
588
|
-
function relativeTime(iso) {
|
|
589
|
-
if (!iso)
|
|
590
|
-
return "";
|
|
591
|
-
const d = new Date(iso);
|
|
592
|
-
const diff = Date.now() - d.getTime();
|
|
593
|
-
const sec = Math.floor(diff / 1000);
|
|
594
|
-
if (sec < 60)
|
|
595
|
-
return "zojuist";
|
|
596
|
-
const min = Math.floor(sec / 60);
|
|
597
|
-
if (min < 60)
|
|
598
|
-
return `${min} min geleden`;
|
|
599
|
-
const hr = Math.floor(min / 60);
|
|
600
|
-
if (hr < 24)
|
|
601
|
-
return `${hr} uur geleden`;
|
|
602
|
-
const day = Math.floor(hr / 24);
|
|
603
|
-
if (day < 7)
|
|
604
|
-
return `${day} dag${day === 1 ? "" : "en"} geleden`;
|
|
605
|
-
return formatDate(d);
|
|
606
|
-
}
|
|
607
|
-
function formatDateNl(iso) {
|
|
608
|
-
const d = new Date(`${iso}T00:00:00`);
|
|
609
|
-
if (Number.isNaN(d.getTime()))
|
|
610
|
-
return iso;
|
|
611
|
-
return formatDate(d);
|
|
612
|
-
}
|
|
613
620
|
function formatEuro(n) {
|
|
614
621
|
return formatEur(n);
|
|
615
622
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetwerkPagina.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NetwerkPagina.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NetwerkPagina.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NetwerkPagina.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,aAAa,gCA+P5B"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { PageHeader, SearchInput } from "../fs-ui/index.js";
|
|
2
3
|
import { formatDate } from "../../lib/format-date.js";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
4
5
|
import { useServerFn } from "@tanstack/react-start";
|
|
5
6
|
import { useState } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { Button, Card, CardContent, Badge, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Switch, Label, } from "@flowselections/core";
|
|
8
|
+
import { MapPin, Globe } from "lucide-react";
|
|
8
9
|
import { BackLink } from "./BackLink.js";
|
|
9
10
|
import { countryNameToFlag } from "../../lib/countries.js";
|
|
10
11
|
import { listFloridayNetwork } from "../../lib/customers.functions.js";
|
|
@@ -43,9 +44,9 @@ export function NetwerkPagina() {
|
|
|
43
44
|
setTypes((prev) => prev.includes(value) ? prev.filter((t) => t !== value) : [...prev, value]);
|
|
44
45
|
setPage(0);
|
|
45
46
|
};
|
|
46
|
-
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "
|
|
47
|
+
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 200, children: _jsxs("main", { className: "flex w-full min-w-0 max-w-full flex-col gap-4 overflow-x-clip p-4 sm:p-6", children: [_jsx(BackLink, {}), _jsx(PageHeader, { title: "Klanten toevoegen uit netwerk", info: "Doorzoek alle organisaties die via Floriday beschikbaar zijn en voeg ze toe als klant." }), _jsx("div", { className: "flex flex-wrap items-center gap-2", children: _jsx("div", { className: "min-w-0 flex-1 sm:flex-none", children: _jsx(SearchInput, { label: "Zoek organisaties", placeholder: "Zoek op organisatienaam of GLN", value: search, onChange: (v) => { setSearch(v); setPage(0); }, onClear: () => { setSearch(""); setPage(0); } }) }) }), _jsx("div", { className: "flex items-center gap-2 flex-wrap", children: TYPE_OPTIONS.map((opt) => {
|
|
47
48
|
const active = types.includes(opt.value);
|
|
48
|
-
return (_jsx("button", { type: "button", onClick: () => toggleType(opt.value), className: "inline-flex items-center gap-1.5 rounded-full border px-3
|
|
49
|
+
return (_jsx("button", { type: "button", onClick: () => toggleType(opt.value), "aria-pressed": active, className: "inline-flex h-8 items-center gap-1.5 rounded-full border px-3 text-xs font-medium transition-colors duration-150 " +
|
|
49
50
|
(active
|
|
50
51
|
? "bg-primary text-primary-foreground border-primary"
|
|
51
52
|
: "bg-card text-muted-foreground border-border hover:bg-muted"), children: opt.label }, opt.value));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NieuweKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NieuweKlant.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NieuweKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NieuweKlant.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,WAAW,gCAgJ1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TableSkeleton } from "../fs-ui/index.js";
|
|
2
3
|
import { friendlyError } from "../../lib/errors.js";
|
|
3
4
|
import { useNavigate } from "@tanstack/react-router";
|
|
4
5
|
import { useState } from "react";
|
|
@@ -76,7 +77,7 @@ export function NieuweKlant() {
|
|
|
76
77
|
mut.mutate({ ...pendingData, force: true });
|
|
77
78
|
};
|
|
78
79
|
if (cd.isLoading)
|
|
79
|
-
return _jsx("main", { className: "p-6", children: "
|
|
80
|
+
return _jsx("main", { className: "flex flex-col gap-4 p-4 sm:p-6", children: _jsx(TableSkeleton, { as: "div", rows: 6 }) });
|
|
80
81
|
const d = cd.defaults;
|
|
81
82
|
const LABELS = { ledger_account: "grootboek", country: "land", language: "taal", payment_term_days: "betaaltermijn" };
|
|
82
83
|
const defaultValues = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OvernemenTwinfieldKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/OvernemenTwinfieldKlant.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OvernemenTwinfieldKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/OvernemenTwinfieldKlant.tsx"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,MAAM,EACN,QAAQ,EACR,YAAY,GACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qFAAqF;IACrF,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,+BA4GA"}
|