@flowselections/floriday-klanten-module 1.0.72 → 1.0.75
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/FactureringKredietCard.js +1 -1
- package/dist-lib/components/klanten/ImportKlanten.js +2 -2
- package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetail.js +3 -1
- package/dist-lib/components/klanten/KlantFormulier.js +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +3 -1
- package/dist-lib/lib/customer-schemas.js +2 -2
- package/dist-lib/lib/invoice-address.d.ts +3 -0
- package/dist-lib/lib/invoice-address.d.ts.map +1 -0
- package/dist-lib/lib/invoice-address.js +14 -0
- package/package.json +2 -2
|
@@ -32,7 +32,7 @@ export function FactureringKredietCard({ customer }) {
|
|
|
32
32
|
const korting = [s(c.discount_percentage) && `${s(c.discount_percentage)}%`, s(c.discount_days) && `binnen ${s(c.discount_days)} dagen`]
|
|
33
33
|
.filter(Boolean).join(" ");
|
|
34
34
|
const limit = Number(c.credit_limit ?? 0);
|
|
35
|
-
return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between gap-2 space-y-0", children: [_jsx(CardTitle, { children: "Facturering en krediet" }), _jsx(BlockedBadge, { blocked: c.blocked })] }), _jsxs(CardContent, { className: "grid gap-x-8 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx(Row, { label: "Betaaltermijn", value: s(c.payment_term_days) && `${s(c.payment_term_days)} dagen` }), _jsx(Row, { label: "Korting", value: korting }), _jsx(Row, { label: "E-factureren", value: c.e_invoicing === true ? "Ja" : "Nee" }), _jsx(Row, { label: "
|
|
35
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between gap-2 space-y-0", children: [_jsx(CardTitle, { children: "Facturering en krediet" }), _jsx(BlockedBadge, { blocked: c.blocked })] }), _jsxs(CardContent, { className: "grid gap-x-8 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx(Row, { label: "Betaaltermijn", value: s(c.payment_term_days) && `${s(c.payment_term_days)} dagen` }), _jsx(Row, { label: "Korting", value: korting }), _jsx(Row, { label: "E-factureren", value: c.e_invoicing === true ? "Ja" : "Nee" }), _jsx(Row, { label: "E-mailadres voor facturen", value: s(c.billing_email) || (s(c.email) ? `Leeg – facturen gaan naar ${s(c.email)}` : "Geen e-mailadres voor facturen") }), _jsx(Row, { label: "Grootboek", value: s(c.ledger_account) }), _jsx(Row, { label: "IBAN", value: s(c.bank_iban) }), _jsx(Row, { label: "Banknaam", value: s(c.bank_name) }), _jsx(Row, { label: "Tenaamstelling", value: s(c.bank_account_holder) })] }), _jsxs("div", { children: [_jsx(Row, { label: "Kredietlimiet", value: limit > 0 ? `€ ${limit.toLocaleString("nl-NL", { minimumFractionDigits: 2 })}` : "" }), _jsx(Row, { label: "Kredietbeheerder", value: creditManagerDisplay(c) }), _jsx(Row, { label: "Aanmanen", value: reminder }), _jsx(Row, { label: "E-mail voor aanmaningen", value: c.send_reminder === "file_email" ? s(c.reminder_email) : "" }), _jsx(Row, { label: "Geblokkeerd", value: c.blocked === true ? "Ja" : "Nee" }), _jsx("p", { className: "text-xs text-muted-foreground pt-2", children: "Kredietgegevens worden beheerd in Twinfield." })] })] })] }));
|
|
36
36
|
}
|
|
37
37
|
/** Lokale klant ophalen voor de samengevoegde klantpagina (zelfde cache als de klantpagina). */
|
|
38
38
|
export function useLocalCustomer(customerId) {
|
|
@@ -31,7 +31,7 @@ const TARGET_FIELDS = [
|
|
|
31
31
|
{ key: "country", label: "Land", required: true },
|
|
32
32
|
{ key: "language", label: "Taal" },
|
|
33
33
|
{ key: "website", label: "Website" },
|
|
34
|
-
{ key: "billing_email", label: "E-mailadres voor
|
|
34
|
+
{ key: "billing_email", label: "E-mailadres voor facturen" },
|
|
35
35
|
{ key: "address_type", label: "Adrestype" },
|
|
36
36
|
{ key: "address_line1", label: "Adresregel 1" },
|
|
37
37
|
{ key: "address_line2", label: "Adresregel 2" },
|
|
@@ -72,7 +72,7 @@ const HEADER_ALIASES = {
|
|
|
72
72
|
"naam": "company_name", "bedrijfsnaam": "company_name", "company_name": "company_name",
|
|
73
73
|
"taal": "language", "language": "language",
|
|
74
74
|
"website": "website",
|
|
75
|
-
"e-mailadres voor facturering": "billing_email", "billing_email": "billing_email",
|
|
75
|
+
"e-mailadres voor facturering": "billing_email", "e-mailadres voor facturen": "billing_email", "billing_email": "billing_email",
|
|
76
76
|
"e-mailadres": "email", "email": "email", "e-mail": "email",
|
|
77
77
|
"adrestype": "address_type", "address_type": "address_type",
|
|
78
78
|
"adresregel 1": "address_line1", "adresregel1": "address_line1", "address_line1": "address_line1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KlantDetail.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/KlantDetail.tsx"],"names":[],"mappings":"AA+CA,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+BAuYjD"}
|
|
@@ -22,6 +22,7 @@ import { CustomerAssortmentTab } from "./CustomerAssortmentTab.js";
|
|
|
22
22
|
import { SyncStatusChip } from "./SyncStatusChip.js";
|
|
23
23
|
import { decodeDeep } from "../../lib/decode-html.js";
|
|
24
24
|
import { getMissingTwinfieldFields } from "../../lib/twinfield-required-fields.js";
|
|
25
|
+
import { missingInvoiceAddressFields } from "../../lib/invoice-address.js";
|
|
25
26
|
import { FactureringKredietCard, hasBillingInfo, BlockedBadge } from "./FactureringKredietCard.js";
|
|
26
27
|
import { getCustomerNote, upsertCustomerNote } from "../../lib/customer-notes.functions.js";
|
|
27
28
|
import { supabase } from "../../integrations/supabase/client.js";
|
|
@@ -107,8 +108,9 @@ export function KlantDetail({ id }) {
|
|
|
107
108
|
const c = data.customer;
|
|
108
109
|
const linkedToTwinfield = !!(c.twinfield_code ?? c.twinfield_debtor_code);
|
|
109
110
|
const missingTwinfield = getMissingTwinfieldFields(c);
|
|
111
|
+
const missingInvoice = missingInvoiceAddressFields(c);
|
|
110
112
|
const priceGroups = data.price_groups ?? c.price_groups ?? [];
|
|
111
|
-
return (_jsxs("main", { className: "p-6 space-y-4", children: [_jsx(BackLink, {}), missingTwinfield.length > 0 && (_jsxs("div", { className: "rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 text-sm", children: [_jsx("p", { className: "font-medium", children: "Onvolledig voor Twinfield" }), _jsxs("p", { className: "text-muted-foreground mt-0.5", children: ["Deze klant kan pas naar Twinfield worden gestuurd zodra de volgende gegevens zijn aangevuld: ", missingTwinfield.map((f) => f.label).join(", "), "."] })] })), _jsx("div", { className: "flex items-center justify-end", children: _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(BlockedBadge, { blocked: c.blocked }), _jsx(SyncStatusChip, { customerId: id }), _jsx(FloridayDeeplinkButton, { organizationId: c.floriday_organization_id }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(MoreHorizontal, { className: "h-4 w-4 mr-2" }), " Meer"] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onSelect: () => setConfirm("active"), children: [_jsx(Power, { className: "h-4 w-4 mr-2" }), c.is_active ? "Op inactief zetten" : "Activeren"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "text-destructive", onSelect: () => setConfirm("delete"), children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), " Verwijderen"] })] })] }), _jsx(AlertDialog, { open: confirm !== null, onOpenChange: (o) => !o && setConfirm(null), children: _jsxs(AlertDialogContent, { children: [confirm === "delete" ? (_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Klant verwijderen?" }), _jsxs(AlertDialogDescription, { children: [_jsx("strong", { children: c.company_name }), " wordt alleen hier verwijderd. In de boekhouding (Twinfield) blijft de klant bestaan, en in Floriday verandert niets. Dit kun je niet ongedaan maken."] })] })) : c.is_active ? (_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Klant op inactief zetten?" }), _jsxs(AlertDialogDescription, { children: [_jsx("strong", { children: c.company_name }), " wordt hier inactief.", " ", linkedToTwinfield
|
|
113
|
+
return (_jsxs("main", { className: "p-6 space-y-4", children: [_jsx(BackLink, {}), missingTwinfield.length > 0 && (_jsxs("div", { className: "rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 text-sm", children: [_jsx("p", { className: "font-medium", children: "Onvolledig voor Twinfield" }), _jsxs("p", { className: "text-muted-foreground mt-0.5", children: ["Deze klant kan pas naar Twinfield worden gestuurd zodra de volgende gegevens zijn aangevuld: ", missingTwinfield.map((f) => f.label).join(", "), "."] })] })), missingInvoice.length > 0 && (_jsxs("div", { className: "rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 text-sm flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: "Factuuradres onvolledig" }), _jsxs("p", { className: "text-muted-foreground mt-0.5", children: ["Er kan geen volledige factuur voor deze klant worden gemaakt. Ontbreekt: ", missingInvoice.join(", "), "."] })] }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: "Aanvullen" })] })), _jsx("div", { className: "flex items-center justify-end", children: _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(BlockedBadge, { blocked: c.blocked }), _jsx(SyncStatusChip, { customerId: id }), _jsx(FloridayDeeplinkButton, { organizationId: c.floriday_organization_id }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setEditOpen(true), children: [_jsx(Pencil, { className: "h-4 w-4 mr-2" }), " Bewerken"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(MoreHorizontal, { className: "h-4 w-4 mr-2" }), " Meer"] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onSelect: () => setConfirm("active"), children: [_jsx(Power, { className: "h-4 w-4 mr-2" }), c.is_active ? "Op inactief zetten" : "Activeren"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "text-destructive", onSelect: () => setConfirm("delete"), children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), " Verwijderen"] })] })] }), _jsx(AlertDialog, { open: confirm !== null, onOpenChange: (o) => !o && setConfirm(null), children: _jsxs(AlertDialogContent, { children: [confirm === "delete" ? (_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Klant verwijderen?" }), _jsxs(AlertDialogDescription, { children: [_jsx("strong", { children: c.company_name }), " wordt alleen hier verwijderd. In de boekhouding (Twinfield) blijft de klant bestaan, en in Floriday verandert niets. Dit kun je niet ongedaan maken."] })] })) : c.is_active ? (_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Klant op inactief zetten?" }), _jsxs(AlertDialogDescription, { children: [_jsx("strong", { children: c.company_name }), " wordt hier inactief.", " ", linkedToTwinfield
|
|
112
114
|
? "In de boekhouding (Twinfield) wordt de klant verborgen; de gegevens blijven daar bewaard."
|
|
113
115
|
: "Deze klant staat niet in de boekhouding, dus daar verandert niets.", " ", "In Floriday verandert niets. Je kunt de klant later weer activeren."] })] })) : (_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Klant activeren?" }), _jsxs(AlertDialogDescription, { children: [_jsx("strong", { children: c.company_name }), " wordt hier weer actief.", " ", linkedToTwinfield
|
|
114
116
|
? "In de boekhouding (Twinfield) wordt de klant weer zichtbaar."
|
|
@@ -226,7 +226,7 @@ export function KlantFormulier({ title, description, submitLabel, submitting, de
|
|
|
226
226
|
if (chk.status !== "invalid" && !tfErr)
|
|
227
227
|
return null;
|
|
228
228
|
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 : "Twinfield weigerde het btw-nummer" }), tfErr && _jsxs("p", { className: "text-muted-foreground", children: ["Melding van Twinfield: ", 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" }))] })] }));
|
|
229
|
-
})()] }), _jsx(Field, { label: "KvK-nummer", error: fieldErr("coc_number"), success: isValid("coc_number"), children: _jsx(Input, { ...form.register("coc_number") }) }), _jsx(Field, { label: "Contactpersoon", error: fieldErr("contact_person"), success: isValid("contact_person"), children: _jsx(Input, { ...form.register("contact_person") }) }), _jsx(Field, { label: "T.a.v.", error: fieldErr("attention_to"), children: _jsx(Input, { ...form.register("attention_to") }) }), _jsx(Field, { label: "E-mail", error: fieldErr("email"), success: isValid("email"), children: _jsx(Input, { type: "email", "aria-invalid": !!errors.email, placeholder: "naam@bedrijf.nl", ...form.register("email") }) }), _jsx(Field, { label: "E-
|
|
229
|
+
})()] }), _jsx(Field, { label: "KvK-nummer", error: fieldErr("coc_number"), success: isValid("coc_number"), children: _jsx(Input, { ...form.register("coc_number") }) }), _jsx(Field, { label: "Contactpersoon", error: fieldErr("contact_person"), success: isValid("contact_person"), children: _jsx(Input, { ...form.register("contact_person") }) }), _jsx(Field, { label: "T.a.v.", error: fieldErr("attention_to"), children: _jsx(Input, { ...form.register("attention_to") }) }), _jsx(Field, { label: "E-mail", error: fieldErr("email"), success: isValid("email"), children: _jsx(Input, { type: "email", "aria-invalid": !!errors.email, placeholder: "naam@bedrijf.nl", ...form.register("email") }) }), _jsx(Field, { label: "E-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 Twinfield verborgen.", children: _jsxs(Select, { value: form.watch("is_active") === false ? "inactief" : "actief", onValueChange: (v) => form.setValue("is_active", v === "actief", { shouldDirty: true }), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "actief", children: "Actief" }), _jsx(SelectItem, { value: "inactief", children: "Inactief" })] })] }) })] }) }), _jsx(Section, { k: "adres", title: "Adres", icon: _jsx(MapPin, { className: "h-5 w-5" }), open: open.adres, onToggle: toggle, hasError: sectionHasError([
|
|
230
230
|
"address_type", "icp_country_code", "address_line1", "address_line2",
|
|
231
231
|
"street", "house_number", "postal_code", "city", "country",
|
|
232
232
|
]), children: _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(Field, { label: "Straat", error: fieldErr("street"), success: isValid("street"), children: _jsx(Input, { "aria-invalid": !!errors.street, ...form.register("street") }) }), _jsx(Field, { label: "Huisnummer", error: fieldErr("house_number"), success: isValid("house_number"), children: _jsx(Input, { "aria-invalid": !!errors.house_number, ...form.register("house_number") }) }), _jsx(Field, { label: "Postcode", error: fieldErr("postal_code"), success: isValid("postal_code"), children: _jsx(Input, { "aria-invalid": !!errors.postal_code, ...normalizeOnBlur("postal_code", normPostal) }) }), _jsx(Field, { label: "Plaats", error: fieldErr("city"), success: isValid("city"), children: _jsx(Input, { "aria-invalid": !!errors.city, ...form.register("city") }) }), _jsx(Field, { label: "Land", error: fieldErr("country"), success: isValid("country"), children: _jsx(SearchableSelect, { value: toIsoCountry(form.watch("country")) ?? (form.watch("country") || ""), onValueChange: (v) => form.setValue("country", v, { shouldValidate: true, shouldDirty: true }), options: Object.entries(COUNTRY_NAMES).map(([code, name]) => ({
|
|
@@ -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":"AAwEA,wBAAgB,gBAAgB,gCAm4B/B"}
|
|
@@ -21,6 +21,7 @@ import { CustomerAvatar } from "../CustomerAvatar.js";
|
|
|
21
21
|
import { PriceGroupBadges } from "./PriceGroupBadges.js";
|
|
22
22
|
import { KlantBewerkenDialog } from "./KlantBewerkenDialog.js";
|
|
23
23
|
import { ChannelBadges } from "./ChannelBadges.js";
|
|
24
|
+
import { missingInvoiceAddressFields } from "../../lib/invoice-address.js";
|
|
24
25
|
import { FloridayAutoPromoteCard } from "./FloridayAutoPromoteCard.js";
|
|
25
26
|
import { CarrierAdminCard } from "./CarrierAdminCard.js";
|
|
26
27
|
import { TwinfieldQueueAdminCard } from "./TwinfieldQueueAdminCard.js";
|
|
@@ -274,6 +275,7 @@ export function KlantenOverzicht() {
|
|
|
274
275
|
group_key: null,
|
|
275
276
|
source: "local",
|
|
276
277
|
providers: [],
|
|
278
|
+
missing_invoice: missingInvoiceAddressFields(c),
|
|
277
279
|
company_name: c.company_name,
|
|
278
280
|
commercial_name: c.commercial_name ?? null,
|
|
279
281
|
contact_person: c.contact_person ?? null,
|
|
@@ -520,7 +522,7 @@ export function KlantenOverzicht() {
|
|
|
520
522
|
: goTo({
|
|
521
523
|
to: "/klanten/groep/$groupKey",
|
|
522
524
|
params: { groupKey: c.group_key },
|
|
523
|
-
}), children: [_jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(CustomerAvatar, { logoUrl: c.logo_url, name: c.company_name, size: "sm" }), _jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-medium truncate flex items-center gap-2", children: [_jsx("span", { className: "truncate", children: primaryName }), c.overdue && c.overdue.count > 0 && (_jsxs("span", { title: `${c.overdue.count} openstaande factu${c.overdue.count === 1 ? "ur" : "ren"} · oudste vervallen op ${c.overdue.oldest_due}`, className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 text-destructive px-2 py-0.5 text-[11px] font-medium shrink-0", children: [_jsx(AlertCircle, { className: "h-3 w-3" }), " ", formatEuro(c.overdue.total), " achterstallig"] }))] }), secondary && _jsx("div", { className: "text-xs text-muted-foreground truncate", children: secondary })] })] }) }), _jsx(TableCell, { className: "py-3", children: c.contact_person || c.email ? (_jsxs("div", { className: "min-w-0", children: [c.contact_person && _jsx("div", { className: "text-sm truncate", children: c.contact_person }), c.email && (_jsxs("a", { href: `mailto:${c.email}`, onClick: (e) => e.stopPropagation(), className: "text-xs text-muted-foreground inline-flex items-center gap-1 hover:underline truncate", children: [_jsx(Mail, { className: "h-3 w-3" }), " ", c.email] }))] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsx(PriceGroupBadges, { groups: c.price_groups }) }), _jsx(TableCell, { className: "py-3", children: _jsx(ChannelBadges, { providers: c.providers }) }), _jsx(TableCell, { className: "py-3", children: _jsx("span", { className: `inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium ${paymentToneClasses(c.payment_method.tone)}`, children: c.payment_method.label }) }), _jsx(TableCell, { className: "py-3 text-sm whitespace-nowrap", children: c.revenue && c.revenue.count > 0 ? (_jsxs("span", { title: `${c.revenue.count} transactie${c.revenue.count === 1 ? "" : "s"} · laatste op ${formatDateNl(c.revenue.last_date)}`, children: [_jsx("span", { className: "font-medium", children: formatEuro(c.revenue.amount) }), _jsxs("span", { className: "block text-xs text-muted-foreground", children: ["laatst ", formatDateNl(c.revenue.last_date)] })] })) : (_jsx("span", { className: "text-muted-foreground", children: "Geen omzet" })) }), _jsx(TableCell, { className: "py-3 text-sm", children: c.country ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(c.country) ?? "🌐" }), _jsx("span", { children: formatCountry(c.country) })] })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3 max-w-[260px]", children: c.id ? (_jsx(ProposalLine, { compact: true, result: carrierProposals.data?.[c.id], loading: carrierProposals.isLoading, error: carrierProposals.error, onRetry: () => carrierProposals.refetch() })) : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) }), _jsx(TableCell, { className: "py-3", children: _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx(StatusPill, { active: c.is_active, missing: c.missing }), c.id ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", title: "Klant bewerken", onClick: (e) => {
|
|
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) => {
|
|
524
526
|
e.stopPropagation();
|
|
525
527
|
setEditTarget({ customerId: c.id });
|
|
526
528
|
}, 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) => {
|
|
@@ -195,7 +195,7 @@ const customerCreateBaseSchema = z.object({
|
|
|
195
195
|
customer_number: fmtStr(16, NUMBER_RE, "Alleen letters, cijfers, - en _ (maximaal 16 tekens)"),
|
|
196
196
|
language: fmtStr(16, /^(nl|en|de|fr)$/i, "Kies een van de beschikbare talen"),
|
|
197
197
|
website: optWebsite(),
|
|
198
|
-
billing_email: optEmail("
|
|
198
|
+
billing_email: optEmail("Vul een geldig e-mailadres voor facturen in"),
|
|
199
199
|
address_type: optStr(64),
|
|
200
200
|
address_line1: optStr(128),
|
|
201
201
|
address_line2: optStr(128),
|
|
@@ -286,7 +286,7 @@ const customerImportRowBaseSchema = z
|
|
|
286
286
|
customer_number: fmtStr(16, NUMBER_RE, "Alleen letters, cijfers, - en _ (maximaal 16 tekens)"),
|
|
287
287
|
language: fmtStr(16, /^(nl|en|de|fr)$/i, "Kies een van de beschikbare talen"),
|
|
288
288
|
website: optWebsite(),
|
|
289
|
-
billing_email: optEmail("
|
|
289
|
+
billing_email: optEmail("Vul een geldig e-mailadres voor facturen in"),
|
|
290
290
|
address_type: optStr(64),
|
|
291
291
|
address_line1: optStr(128),
|
|
292
292
|
address_line2: optStr(128),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-address.d.ts","sourceRoot":"","sources":["../../src/lib/invoice-address.ts"],"names":[],"mappings":"AAUA,oFAAoF;AACpF,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAGnG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Velden die Facturatie nodig heeft voor het factuuradres (huisnummer telt niet mee: staat vaak in de straat). */
|
|
2
|
+
const FIELDS = [
|
|
3
|
+
{ key: "street", label: "straat" },
|
|
4
|
+
{ key: "postal_code", label: "postcode" },
|
|
5
|
+
{ key: "city", label: "plaats" },
|
|
6
|
+
{ key: "country", label: "land" },
|
|
7
|
+
];
|
|
8
|
+
const filled = (v) => v !== null && v !== undefined && String(v).trim() !== "";
|
|
9
|
+
/** Geeft de ontbrekende onderdelen van het factuuradres terug (leeg = volledig). */
|
|
10
|
+
export function missingInvoiceAddressFields(c) {
|
|
11
|
+
if (!c)
|
|
12
|
+
return FIELDS.map((f) => f.label);
|
|
13
|
+
return FIELDS.filter((f) => !filled(c[f.key])).map((f) => f.label);
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowselections/floriday-klanten-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@cloudflare/vite-plugin": "^1.25.5",
|
|
137
137
|
"@electric-sql/pglite": "^0.5.11",
|
|
138
138
|
"@eslint/js": "^9.32.0",
|
|
139
|
-
"@flowselections/core": "1.0.
|
|
139
|
+
"@flowselections/core": "1.0.34",
|
|
140
140
|
"@lovable.dev/vite-tanstack-config": "2.26.5",
|
|
141
141
|
"@rsbuild/core": "^1.0.0",
|
|
142
142
|
"@tailwindcss/vite": "^4.2.1",
|