@flowselections/floriday-klanten-module 1.0.28 → 1.0.30

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.
Files changed (86) hide show
  1. package/dist-lib/components/klanten/BewerkKlant.d.ts +6 -1
  2. package/dist-lib/components/klanten/BewerkKlant.d.ts.map +1 -1
  3. package/dist-lib/components/klanten/BewerkKlant.js +9 -5
  4. package/dist-lib/components/klanten/DeliveryLocationsTab.d.ts.map +1 -1
  5. package/dist-lib/components/klanten/DeliveryLocationsTab.js +2 -1
  6. package/dist-lib/components/klanten/GroupedKlantDetail.d.ts.map +1 -1
  7. package/dist-lib/components/klanten/GroupedKlantDetail.js +4 -2
  8. package/dist-lib/components/klanten/ImportKlanten.d.ts.map +1 -1
  9. package/dist-lib/components/klanten/ImportKlanten.js +2 -1
  10. package/dist-lib/components/klanten/KlantBewerkenDialog.d.ts +12 -0
  11. package/dist-lib/components/klanten/KlantBewerkenDialog.d.ts.map +1 -0
  12. package/dist-lib/components/klanten/KlantBewerkenDialog.js +27 -0
  13. package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
  14. package/dist-lib/components/klanten/KlantDetail.js +5 -3
  15. package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
  16. package/dist-lib/components/klanten/KlantenOverzicht.js +102 -16
  17. package/dist-lib/components/klanten/LocalDiscountFormDialog.d.ts.map +1 -1
  18. package/dist-lib/components/klanten/LocalDiscountFormDialog.js +2 -1
  19. package/dist-lib/components/klanten/LocalDiscountsTab.d.ts.map +1 -1
  20. package/dist-lib/components/klanten/LocalDiscountsTab.js +2 -1
  21. package/dist-lib/components/klanten/LogisticsStrategyCard.d.ts.map +1 -1
  22. package/dist-lib/components/klanten/LogisticsStrategyCard.js +2 -1
  23. package/dist-lib/components/klanten/NieuweKlant.d.ts.map +1 -1
  24. package/dist-lib/components/klanten/NieuweKlant.js +2 -1
  25. package/dist-lib/components/klanten/OvernemenTwinfieldKlant.d.ts +7 -1
  26. package/dist-lib/components/klanten/OvernemenTwinfieldKlant.d.ts.map +1 -1
  27. package/dist-lib/components/klanten/OvernemenTwinfieldKlant.js +16 -8
  28. package/dist-lib/components/klanten/RouteError.d.ts +6 -0
  29. package/dist-lib/components/klanten/RouteError.d.ts.map +1 -0
  30. package/dist-lib/components/klanten/RouteError.js +13 -0
  31. package/dist-lib/index.d.ts +1 -0
  32. package/dist-lib/index.d.ts.map +1 -1
  33. package/dist-lib/index.js +1 -0
  34. package/dist-lib/integrations/supabase/auth-middleware.d.ts +490 -0
  35. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  36. package/dist-lib/integrations/supabase/client.d.ts +490 -0
  37. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  38. package/dist-lib/integrations/supabase/client.server.d.ts +490 -0
  39. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  40. package/dist-lib/integrations/supabase/types.d.ts +490 -0
  41. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  42. package/dist-lib/lib/accounting/twinfield/worker.functions.d.ts +1470 -0
  43. package/dist-lib/lib/accounting/twinfield/worker.functions.d.ts.map +1 -1
  44. package/dist-lib/lib/accounting.functions.d.ts +1470 -0
  45. package/dist-lib/lib/accounting.functions.d.ts.map +1 -1
  46. package/dist-lib/lib/customer-analytics.functions.d.ts +490 -0
  47. package/dist-lib/lib/customer-analytics.functions.d.ts.map +1 -1
  48. package/dist-lib/lib/customer-notes.functions.d.ts +980 -0
  49. package/dist-lib/lib/customer-notes.functions.d.ts.map +1 -1
  50. package/dist-lib/lib/customer-revenue.functions.d.ts +20327 -0
  51. package/dist-lib/lib/customer-revenue.functions.d.ts.map +1 -0
  52. package/dist-lib/lib/customer-revenue.functions.js +124 -0
  53. package/dist-lib/lib/customers.functions.d.ts +4410 -0
  54. package/dist-lib/lib/customers.functions.d.ts.map +1 -1
  55. package/dist-lib/lib/customers.functions.js +39 -35
  56. package/dist-lib/lib/delivery-locations.functions.d.ts +1960 -0
  57. package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
  58. package/dist-lib/lib/errors.d.ts +7 -0
  59. package/dist-lib/lib/errors.d.ts.map +1 -0
  60. package/dist-lib/lib/errors.js +36 -0
  61. package/dist-lib/lib/external-customers.functions.d.ts +1961 -1
  62. package/dist-lib/lib/external-customers.functions.d.ts.map +1 -1
  63. package/dist-lib/lib/external-customers.functions.js +28 -12
  64. package/dist-lib/lib/floriday-assortment.functions.d.ts +490 -0
  65. package/dist-lib/lib/floriday-assortment.functions.d.ts.map +1 -1
  66. package/dist-lib/lib/floriday-discounts.functions.d.ts +980 -0
  67. package/dist-lib/lib/floriday-discounts.functions.d.ts.map +1 -1
  68. package/dist-lib/lib/floriday-trade-items.functions.d.ts +490 -0
  69. package/dist-lib/lib/floriday-trade-items.functions.d.ts.map +1 -1
  70. package/dist-lib/lib/local-discounts.functions.d.ts +3430 -0
  71. package/dist-lib/lib/local-discounts.functions.d.ts.map +1 -1
  72. package/dist-lib/lib/logistics-events.functions.d.ts +490 -0
  73. package/dist-lib/lib/logistics-events.functions.d.ts.map +1 -1
  74. package/dist-lib/lib/logistics-strategy.functions.d.ts +1960 -0
  75. package/dist-lib/lib/logistics-strategy.functions.d.ts.map +1 -1
  76. package/dist-lib/lib/overdue-invoices.functions.d.ts +490 -0
  77. package/dist-lib/lib/overdue-invoices.functions.d.ts.map +1 -1
  78. package/dist-lib/lib/price-groups-local.functions.d.ts +3430 -0
  79. package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
  80. package/dist-lib/lib/price-groups.functions.d.ts +490 -0
  81. package/dist-lib/lib/price-groups.functions.d.ts.map +1 -1
  82. package/dist-lib/lib/twinfield-adopt.functions.d.ts +980 -0
  83. package/dist-lib/lib/twinfield-adopt.functions.d.ts.map +1 -1
  84. package/dist-lib/lib/twinfield-ledger.functions.d.ts +490 -0
  85. package/dist-lib/lib/twinfield-ledger.functions.d.ts.map +1 -1
  86. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"LocalDiscountFormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocalDiscountFormDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,gBAAgB,EAEtB,MAAM,iCAAiC,CAAC;AAGzC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,KAAK,+BAiMzF"}
1
+ {"version":3,"file":"LocalDiscountFormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocalDiscountFormDialog.tsx"],"names":[],"mappings":"AASA,OAAO,EAKL,KAAK,gBAAgB,EAEtB,MAAM,iCAAiC,CAAC;AAGzC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,KAAK,+BAiMzF"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { friendlyError } from "../../lib/errors";
2
3
  import { useEffect, useState } from "react";
3
4
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
5
  import { useServerFn } from "@tanstack/react-start";
@@ -101,7 +102,7 @@ export function LocalDiscountFormDialog({ open, onOpenChange, customerId, editin
101
102
  qc.invalidateQueries({ queryKey: ["local-discounts", customerId] });
102
103
  onOpenChange(false);
103
104
  },
104
- onError: (err) => toast.error(err.message),
105
+ onError: (err) => toast.error(friendlyError(err, "Opslaan mislukt")),
105
106
  });
106
107
  const canSave = (source === "agreement" ? !!netPrice : !!discountValue) && !save.isPending;
107
108
  return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: editing ? "Korting bewerken" : "Nieuwe korting" }) }), _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Bron" }), _jsxs(Select, { value: source, onValueChange: (v) => setSource(v), disabled: !!editing, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "agreement", children: "Contract (vaste nettoprijs)" }), _jsx(SelectItem, { value: "sales_strategy", children: "Kortingsregel (%/bedrag)" }), _jsx(SelectItem, { value: "price_group", children: "Staffelkorting (o.b.v. hoeveelheid)" })] })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Product" }), _jsxs(Select, { value: productId, onValueChange: setProductId, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Kies een product" }) }), _jsx(SelectContent, { children: products.map((p) => (_jsxs(SelectItem, { value: p.id, children: [p.product, p.sale_price != null ? ` — € ${Number(p.sale_price).toFixed(2)}` : ""] }, p.id))) })] })] }), source === "agreement" ? (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Basisprijs (optioneel)" }), _jsx(Input, { type: "number", step: "0.01", value: basePrice, onChange: (e) => setBasePrice(e.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Nettoprijs *" }), _jsx(Input, { type: "number", step: "0.01", value: netPrice, onChange: (e) => setNetPrice(e.target.value) })] })] })) : (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Type" }), _jsxs(Select, { value: discountType, onValueChange: (v) => setDiscountType(v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "percentage", children: "Percentage (%)" }), _jsx(SelectItem, { value: "amount", children: "Vast bedrag" })] })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Waarde *" }), _jsx(Input, { type: "number", step: "0.01", value: discountValue, onChange: (e) => setDiscountValue(e.target.value) })] })] })), _jsxs("div", { className: "grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Min. hoeveelheid" }), _jsx(Input, { type: "number", step: "1", value: minQuantity, onChange: (e) => setMinQuantity(e.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Geldig van" }), _jsx(Input, { type: "date", value: validFrom, onChange: (e) => setValidFrom(e.target.value) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Geldig tot" }), _jsx(Input, { type: "date", value: validUntil, onChange: (e) => setValidUntil(e.target.value) })] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Notities" }), _jsx(Input, { value: notes, onChange: (e) => setNotes(e.target.value) })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Annuleren" }), _jsx(Button, { disabled: !canSave, onClick: () => save.mutate(), children: save.isPending ? "Opslaan…" : "Opslaan" })] })] }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"LocalDiscountsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocalDiscountsTab.tsx"],"names":[],"mappings":"AAkDA,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,+BA2JvE"}
1
+ {"version":3,"file":"LocalDiscountsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocalDiscountsTab.tsx"],"names":[],"mappings":"AAmDA,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,+BA2JvE"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { friendlyError } from "../../lib/errors";
2
3
  import { useMemo, useState } from "react";
3
4
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
5
  import { useServerFn } from "@tanstack/react-start";
@@ -71,7 +72,7 @@ export function LocalDiscountsTab({ customerId }) {
71
72
  toast.success("Korting verwijderd");
72
73
  qc.invalidateQueries({ queryKey: ["local-discounts", customerId] });
73
74
  },
74
- onError: (err) => toast.error(err.message),
75
+ onError: (err) => toast.error(friendlyError(err, "Actie mislukt")),
75
76
  });
76
77
  const filtered = useMemo(() => {
77
78
  const rows = data?.rows ?? [];
@@ -1 +1 @@
1
- {"version":3,"file":"LogisticsStrategyCard.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LogisticsStrategyCard.tsx"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,oCAAoC,CAAC;AAI5C,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,+BAuEA"}
1
+ {"version":3,"file":"LogisticsStrategyCard.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LogisticsStrategyCard.tsx"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,oCAAoC,CAAC;AAI5C,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,+BAuEA"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { friendlyError } from "../../lib/errors";
2
3
  import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
3
4
  import { useServerFn } from "@tanstack/react-start";
4
5
  import { Card, CardContent, CardHeader, CardTitle, Badge, toast, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
@@ -25,7 +26,7 @@ export function LogisticsStrategyCard({ scope, refKey, description, }) {
25
26
  toast.success("Logistieke strategie bijgewerkt");
26
27
  qc.invalidateQueries({ queryKey: ["logistics-strategy-binding", scope, refKey] });
27
28
  },
28
- onError: (e) => toast.error(e instanceof Error ? e.message : "Opslaan mislukt"),
29
+ onError: (e) => toast.error(friendlyError(e, "Opslaan mislukt")),
29
30
  });
30
31
  const strategies = strategiesData?.strategies ?? [];
31
32
  const current = bindingData?.binding?.strategy_id ?? null;
@@ -1 +1 @@
1
- {"version":3,"file":"NieuweKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NieuweKlant.tsx"],"names":[],"mappings":"AAcA,wBAAgB,WAAW,gCAgE1B"}
1
+ {"version":3,"file":"NieuweKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/NieuweKlant.tsx"],"names":[],"mappings":"AAeA,wBAAgB,WAAW,gCAgE1B"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { friendlyError } from "../../lib/errors";
2
3
  import { useNavigate } from "@tanstack/react-router";
3
4
  import { useState } from "react";
4
5
  import { useMutation, useQueryClient } from "@tanstack/react-query";
@@ -23,7 +24,7 @@ export function NieuweKlant() {
23
24
  qc.invalidateQueries({ queryKey: ["customers"] });
24
25
  navigate({ to: "/klanten/$id", params: { id: r.customer.id } });
25
26
  },
26
- onError: (e) => toast.error(e instanceof Error ? e.message : "Fout"),
27
+ onError: (e) => toast.error(friendlyError(e, "Klant aanmaken mislukt")),
27
28
  });
28
29
  const onSubmit = (values) => {
29
30
  setPendingData(values);
@@ -2,7 +2,13 @@
2
2
  * Neemt een Twinfield-debiteur over naar een lokale, bewerkbare klant. Bestaat
3
3
  * de lokale klant al, dan sturen we meteen door naar het bewerkscherm.
4
4
  */
5
- export declare function OvernemenTwinfieldKlant({ code }: {
5
+ export declare function OvernemenTwinfieldKlant({ code, onExistingLocal, onDone, onCancel, hideBackLink, }: {
6
6
  code: string;
7
+ /** Bestaat er al een lokale klant, dan geeft dit het id door i.p.v. te navigeren. */
8
+ onExistingLocal?: (id: string) => void;
9
+ /** Na succesvol overnemen; navigeert dan zelf niet. */
10
+ onDone?: (customerId: string | null) => void;
11
+ onCancel?: () => void;
12
+ hideBackLink?: boolean;
7
13
  }): import("react").JSX.Element;
8
14
  //# sourceMappingURL=OvernemenTwinfieldKlant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OvernemenTwinfieldKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/OvernemenTwinfieldKlant.tsx"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,+BAkGjE"}
1
+ {"version":3,"file":"OvernemenTwinfieldKlant.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/OvernemenTwinfieldKlant.tsx"],"names":[],"mappings":"AAwBA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,eAAe,EACf,MAAM,EACN,QAAQ,EACR,YAAY,GACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,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,+BAsGA"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { friendlyError } from "../../lib/errors";
2
3
  import { useNavigate } from "@tanstack/react-router";
3
4
  import { useEffect } from "react";
4
5
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -20,7 +21,7 @@ function num(v) {
20
21
  * Neemt een Twinfield-debiteur over naar een lokale, bewerkbare klant. Bestaat
21
22
  * de lokale klant al, dan sturen we meteen door naar het bewerkscherm.
22
23
  */
23
- export function OvernemenTwinfieldKlant({ code }) {
24
+ export function OvernemenTwinfieldKlant({ code, onExistingLocal, onDone, onCancel, hideBackLink, }) {
24
25
  const navigate = useNavigate();
25
26
  const qc = useQueryClient();
26
27
  const prepare = useServerFn(prepareTwinfieldAdoption);
@@ -31,9 +32,13 @@ export function OvernemenTwinfieldKlant({ code }) {
31
32
  });
32
33
  const existingId = data?.localId ?? null;
33
34
  useEffect(() => {
34
- if (existingId)
35
+ if (!existingId)
36
+ return;
37
+ if (onExistingLocal)
38
+ onExistingLocal(existingId);
39
+ else
35
40
  navigate({ to: "/klanten/bewerken/$id", params: { id: existingId }, replace: true });
36
- }, [existingId, navigate]);
41
+ }, [existingId, navigate, onExistingLocal]);
37
42
  const mut = useMutation({
38
43
  mutationFn: (values) => adopt({ data: { code, values } }),
39
44
  onSuccess: (r) => {
@@ -43,18 +48,21 @@ export function OvernemenTwinfieldKlant({ code }) {
43
48
  }
44
49
  qc.invalidateQueries({ queryKey: ["customers-local"] });
45
50
  qc.invalidateQueries({ queryKey: ["customers-external"] });
46
- const id = r.customer?.id;
47
- if (id)
51
+ qc.invalidateQueries({ queryKey: ["customers"] });
52
+ const id = r.customer?.id ?? null;
53
+ if (onDone)
54
+ onDone(id);
55
+ else if (id)
48
56
  navigate({ to: "/klanten/$id", params: { id } });
49
57
  else
50
58
  navigate({ to: "/klanten" });
51
59
  },
52
- onError: (e) => toast.error(e instanceof Error ? e.message : "Overnemen mislukt"),
60
+ onError: (e) => toast.error(friendlyError(e, "Overnemen mislukt")),
53
61
  });
54
62
  if (isLoading || existingId)
55
63
  return _jsx("main", { className: "p-6", children: "Laden..." });
56
64
  if (error || !data?.prefill) {
57
- return (_jsxs("main", { className: "p-6 space-y-3", children: [_jsx(BackLink, {}), _jsx("p", { className: "text-sm text-destructive", children: error instanceof Error ? error.message : "Deze Twinfield-klant is niet gevonden." })] }));
65
+ return (_jsxs("main", { className: "p-6 space-y-3", children: [!hideBackLink && _jsx(BackLink, {}), _jsx("p", { className: "text-sm text-destructive", children: error instanceof Error ? error.message : "Deze Twinfield-klant is niet gevonden." })] }));
58
66
  }
59
67
  const p = data.prefill;
60
68
  const defaults = {
@@ -95,5 +103,5 @@ export function OvernemenTwinfieldKlant({ code }) {
95
103
  customer_number: code,
96
104
  force: true,
97
105
  };
98
- return (_jsx(KlantFormulier, { title: `${p.company_name || `Debiteur ${code}`} bewerken`, submitLabel: "Wijzigingen opslaan", submitting: mut.isPending, defaultValues: defaults, numberReadOnly: true, numberHint: `Twinfield-debiteurnummer ${code} — niet aanpasbaar`, onSubmit: (values) => mut.mutate(values), onCancel: () => navigate({ to: "/klanten" }) }));
106
+ return (_jsx(KlantFormulier, { title: `${p.company_name || `Debiteur ${code}`} bewerken`, submitLabel: "Wijzigingen opslaan", submitting: mut.isPending, defaultValues: defaults, numberReadOnly: true, numberHint: `Twinfield-debiteurnummer ${code} — niet aanpasbaar`, onSubmit: (values) => mut.mutate(values), onCancel: () => (onCancel ? onCancel() : navigate({ to: "/klanten" })) }));
99
107
  }
@@ -0,0 +1,6 @@
1
+ /** Nette foutweergave voor route-loaders en render-fouten binnen Klanten. */
2
+ export declare function RouteError({ error }: {
3
+ error: unknown;
4
+ }): import("react").JSX.Element;
5
+ export declare function RouteNotFound(): import("react").JSX.Element;
6
+ //# sourceMappingURL=RouteError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteError.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/RouteError.tsx"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,+BAoBvD;AAED,wBAAgB,aAAa,gCAU5B"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRouter } from "@tanstack/react-router";
3
+ import { Button, Card, CardContent } from "@flowselections/core";
4
+ import { AlertCircle, RefreshCw } from "lucide-react";
5
+ import { friendlyError } from "../../lib/errors";
6
+ /** Nette foutweergave voor route-loaders en render-fouten binnen Klanten. */
7
+ export function RouteError({ error }) {
8
+ const router = useRouter();
9
+ return (_jsx("div", { className: "p-6", children: _jsx(Card, { children: _jsxs(CardContent, { className: "flex flex-col items-center justify-center gap-3 py-12 text-center", children: [_jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: _jsx(AlertCircle, { className: "h-6 w-6 text-destructive" }) }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: "Deze pagina kon niet worden geladen" }), _jsx("div", { className: "mt-0.5 text-sm text-muted-foreground", children: friendlyError(error) })] }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => router.invalidate(), children: [_jsx(RefreshCw, { className: "mr-2 h-4 w-4" }), " Opnieuw proberen"] })] }) }) }));
10
+ }
11
+ export function RouteNotFound() {
12
+ return (_jsx("div", { className: "p-6", children: _jsx(Card, { children: _jsx(CardContent, { className: "py-12 text-center text-sm text-muted-foreground", children: "Deze pagina bestaat niet (meer)." }) }) }));
13
+ }
@@ -8,6 +8,7 @@ export { NieuweKlant } from "./components/klanten/NieuweKlant";
8
8
  export { KlantFormulier } from "./components/klanten/KlantFormulier";
9
9
  export { BewerkKlant } from "./components/klanten/BewerkKlant";
10
10
  export { BewerkKlantRoute } from "./components/klanten/BewerkKlantRoute";
11
+ export { KlantBewerkenDialog } from "./components/klanten/KlantBewerkenDialog";
11
12
  export { OvernemenTwinfieldKlant } from "./components/klanten/OvernemenTwinfieldKlant";
12
13
  export { OvernemenTwinfieldKlantRoute } from "./components/klanten/OvernemenTwinfieldKlantRoute";
13
14
  export { ImportKlanten } from "./components/klanten/ImportKlanten";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,EAAE,UAgBnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,eAAO,MAAM,qBAAqB,EAAE,UAgBnC,CAAC"}
package/dist-lib/index.js CHANGED
@@ -24,6 +24,7 @@ export { NieuweKlant } from "./components/klanten/NieuweKlant";
24
24
  export { KlantFormulier } from "./components/klanten/KlantFormulier";
25
25
  export { BewerkKlant } from "./components/klanten/BewerkKlant";
26
26
  export { BewerkKlantRoute } from "./components/klanten/BewerkKlantRoute";
27
+ export { KlantBewerkenDialog } from "./components/klanten/KlantBewerkenDialog";
27
28
  export { OvernemenTwinfieldKlant } from "./components/klanten/OvernemenTwinfieldKlant";
28
29
  export { OvernemenTwinfieldKlantRoute } from "./components/klanten/OvernemenTwinfieldKlantRoute";
29
30
  export { ImportKlanten } from "./components/klanten/ImportKlanten";