@flowselections/floriday-klanten-module 1.0.34 → 1.0.35

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 (90) hide show
  1. package/dist-lib/assets/floriday-logo.png.asset.json +11 -0
  2. package/dist-lib/components/klanten/CustomerAssortmentTab.d.ts +5 -0
  3. package/dist-lib/components/klanten/CustomerAssortmentTab.d.ts.map +1 -0
  4. package/dist-lib/components/klanten/CustomerAssortmentTab.js +74 -0
  5. package/dist-lib/components/klanten/FloridayPriceImportDialog.d.ts +5 -0
  6. package/dist-lib/components/klanten/FloridayPriceImportDialog.d.ts.map +1 -0
  7. package/dist-lib/components/klanten/FloridayPriceImportDialog.js +55 -0
  8. package/dist-lib/components/klanten/GroupedKlantDetail.d.ts.map +1 -1
  9. package/dist-lib/components/klanten/GroupedKlantDetail.js +4 -3
  10. package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
  11. package/dist-lib/components/klanten/KlantDetail.js +10 -2
  12. package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
  13. package/dist-lib/components/klanten/KlantenOverzicht.js +24 -3
  14. package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.d.ts +4 -0
  15. package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.d.ts.map +1 -0
  16. package/dist-lib/components/klanten/pricegroups/CustomerPriceGroupSelect.js +47 -0
  17. package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.d.ts.map +1 -1
  18. package/dist-lib/components/klanten/pricegroups/PriceGroupFormPage.js +2 -1
  19. package/dist-lib/components/klanten/pricegroups/PriceGroupItemPrices.d.ts +5 -0
  20. package/dist-lib/components/klanten/pricegroups/PriceGroupItemPrices.d.ts.map +1 -0
  21. package/dist-lib/components/klanten/pricegroups/PriceGroupItemPrices.js +83 -0
  22. package/dist-lib/index.d.ts +8 -0
  23. package/dist-lib/index.d.ts.map +1 -1
  24. package/dist-lib/index.js +8 -0
  25. package/dist-lib/integrations/supabase/auth-middleware.d.ts +595 -0
  26. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  27. package/dist-lib/integrations/supabase/client.d.ts +595 -0
  28. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  29. package/dist-lib/integrations/supabase/client.server.d.ts +595 -0
  30. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  31. package/dist-lib/integrations/supabase/types.d.ts +597 -0
  32. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  33. package/dist-lib/lib/accounting/twinfield/mapping.js +13 -13
  34. package/dist-lib/lib/accounting/twinfield/worker.functions.d.ts +1785 -0
  35. package/dist-lib/lib/accounting/twinfield/worker.functions.d.ts.map +1 -1
  36. package/dist-lib/lib/accounting.functions.d.ts +1785 -0
  37. package/dist-lib/lib/accounting.functions.d.ts.map +1 -1
  38. package/dist-lib/lib/customer-analytics.functions.d.ts +595 -0
  39. package/dist-lib/lib/customer-analytics.functions.d.ts.map +1 -1
  40. package/dist-lib/lib/customer-assortment.functions.d.ts +26666 -0
  41. package/dist-lib/lib/customer-assortment.functions.d.ts.map +1 -0
  42. package/dist-lib/lib/customer-assortment.functions.js +280 -0
  43. package/dist-lib/lib/customer-notes.functions.d.ts +1190 -0
  44. package/dist-lib/lib/customer-notes.functions.d.ts.map +1 -1
  45. package/dist-lib/lib/customer-revenue.functions.d.ts +595 -0
  46. package/dist-lib/lib/customer-revenue.functions.d.ts.map +1 -1
  47. package/dist-lib/lib/customers.functions.d.ts +5355 -0
  48. package/dist-lib/lib/customers.functions.d.ts.map +1 -1
  49. package/dist-lib/lib/delivery-locations.functions.d.ts +2975 -0
  50. package/dist-lib/lib/delivery-locations.functions.d.ts.map +1 -1
  51. package/dist-lib/lib/errors.d.ts +12 -0
  52. package/dist-lib/lib/errors.d.ts.map +1 -1
  53. package/dist-lib/lib/errors.js +24 -0
  54. package/dist-lib/lib/external-customers.functions.d.ts +2380 -0
  55. package/dist-lib/lib/external-customers.functions.d.ts.map +1 -1
  56. package/dist-lib/lib/floriday-assortment.functions.d.ts +595 -0
  57. package/dist-lib/lib/floriday-assortment.functions.d.ts.map +1 -1
  58. package/dist-lib/lib/floriday-catalog-prices.d.ts +33 -0
  59. package/dist-lib/lib/floriday-catalog-prices.d.ts.map +1 -0
  60. package/dist-lib/lib/floriday-catalog-prices.js +98 -0
  61. package/dist-lib/lib/floriday-discounts.functions.d.ts +1190 -0
  62. package/dist-lib/lib/floriday-discounts.functions.d.ts.map +1 -1
  63. package/dist-lib/lib/floriday-price-import.functions.d.ts +53265 -0
  64. package/dist-lib/lib/floriday-price-import.functions.d.ts.map +1 -0
  65. package/dist-lib/lib/floriday-price-import.functions.js +219 -0
  66. package/dist-lib/lib/floriday-trade-items.functions.d.ts +595 -0
  67. package/dist-lib/lib/floriday-trade-items.functions.d.ts.map +1 -1
  68. package/dist-lib/lib/floriday.server.d.ts +55 -0
  69. package/dist-lib/lib/floriday.server.d.ts.map +1 -0
  70. package/dist-lib/lib/floriday.server.js +765 -0
  71. package/dist-lib/lib/local-discounts.functions.d.ts +4165 -0
  72. package/dist-lib/lib/local-discounts.functions.d.ts.map +1 -1
  73. package/dist-lib/lib/logistics-events.functions.d.ts +595 -0
  74. package/dist-lib/lib/logistics-events.functions.d.ts.map +1 -1
  75. package/dist-lib/lib/logistics-strategy.functions.d.ts +2380 -0
  76. package/dist-lib/lib/logistics-strategy.functions.d.ts.map +1 -1
  77. package/dist-lib/lib/overdue-invoices.functions.d.ts +595 -0
  78. package/dist-lib/lib/overdue-invoices.functions.d.ts.map +1 -1
  79. package/dist-lib/lib/price-groups-local.functions.d.ts +137905 -27
  80. package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
  81. package/dist-lib/lib/price-groups-local.functions.js +145 -0
  82. package/dist-lib/lib/price-groups.functions.d.ts +601 -1
  83. package/dist-lib/lib/price-groups.functions.d.ts.map +1 -1
  84. package/dist-lib/lib/twinfield-adopt.functions.d.ts +1190 -0
  85. package/dist-lib/lib/twinfield-adopt.functions.d.ts.map +1 -1
  86. package/dist-lib/lib/twinfield-ledger.functions.d.ts +595 -0
  87. package/dist-lib/lib/twinfield-ledger.functions.d.ts.map +1 -1
  88. package/dist-lib/lib/twinfield-ledger.server.js +21 -21
  89. package/package.json +1 -1
  90. package/public/flowselections-assets/Klanten/twinfield-logo.svg +217 -217
@@ -0,0 +1,83 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
4
+ import { useServerFn } from "@tanstack/react-start";
5
+ import { Card, CardContent, Input } from "@flowselections/core";
6
+ import { Search } from "lucide-react";
7
+ import { toast } from "sonner";
8
+ import { listTradeItemsForPreview } from "../../../lib/floriday-trade-items.functions";
9
+ import { listPriceGroupItemPrices, setPriceGroupItemPrice, } from "../../../lib/price-groups-local.functions";
10
+ import { decodeDeep } from "../../../lib/decode-html";
11
+ import { friendlyError } from "../../../lib/errors";
12
+ function parseAmount(raw) {
13
+ const t = raw.trim().replace(",", ".");
14
+ if (!t)
15
+ return null;
16
+ const n = Number(t);
17
+ return Number.isFinite(n) && n >= 0 ? n : null;
18
+ }
19
+ export function PriceGroupItemPrices({ priceGroupId, currency = "EUR", }) {
20
+ const qc = useQueryClient();
21
+ const listItems = useServerFn(listTradeItemsForPreview);
22
+ const listPrices = useServerFn(listPriceGroupItemPrices);
23
+ const savePrice = useServerFn(setPriceGroupItemPrice);
24
+ const [search, setSearch] = useState("");
25
+ const [drafts, setDrafts] = useState({});
26
+ const [saving, setSaving] = useState(null);
27
+ const { data: itemsData, isLoading: loadingItems } = useQuery({
28
+ queryKey: ["trade-items-preview"],
29
+ queryFn: () => listItems().then(decodeDeep),
30
+ staleTime: 5 * 60000,
31
+ });
32
+ const { data: pricesData } = useQuery({
33
+ queryKey: ["price-group-item-prices", priceGroupId],
34
+ queryFn: () => listPrices({ data: { priceGroupId } }).then(decodeDeep),
35
+ enabled: !!priceGroupId,
36
+ });
37
+ const priceByKey = useMemo(() => {
38
+ const m = new Map();
39
+ for (const p of pricesData?.prices ?? [])
40
+ m.set(p.trade_item_key, p.price_per_piece);
41
+ return m;
42
+ }, [pricesData]);
43
+ const items = itemsData?.items ?? [];
44
+ const filtered = useMemo(() => {
45
+ const q = search.trim().toLowerCase();
46
+ if (!q)
47
+ return items;
48
+ return items.filter((i) => i.name.toLowerCase().includes(q) || (i.vbn_code ?? "").toLowerCase().includes(q));
49
+ }, [items, search]);
50
+ const commit = async (key, raw) => {
51
+ const current = priceByKey.get(key) ?? null;
52
+ const next = parseAmount(raw);
53
+ if ((current ?? null) === next) {
54
+ setDrafts((d) => {
55
+ const { [key]: _drop, ...rest } = d;
56
+ return rest;
57
+ });
58
+ return;
59
+ }
60
+ setSaving(key);
61
+ try {
62
+ await savePrice({ data: { priceGroupId, tradeItemKey: key, price: next, currency } });
63
+ await qc.invalidateQueries({ queryKey: ["price-group-item-prices", priceGroupId] });
64
+ qc.invalidateQueries({ queryKey: ["customer-assortment"] });
65
+ setDrafts((d) => {
66
+ const { [key]: _drop, ...rest } = d;
67
+ return rest;
68
+ });
69
+ toast.success(next == null ? "Prijs verwijderd" : "Prijs opgeslagen");
70
+ }
71
+ catch (e) {
72
+ toast.error(friendlyError(e));
73
+ }
74
+ finally {
75
+ setSaving(null);
76
+ }
77
+ };
78
+ return (_jsx(Card, { children: _jsxs(CardContent, { className: "p-4 space-y-3", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium", children: "Vaste prijzen per artikel" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Een ingevulde prijs geldt voor elke klant in deze prijsgroep en gaat v\u00F3\u00F3r de berekende prijs. Laat leeg om de berekening te gebruiken." })] }), _jsxs("div", { className: "relative max-w-sm", children: [_jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }), _jsx(Input, { placeholder: "Zoek artikel\u2026", value: search, onChange: (e) => setSearch(e.target.value), className: "pl-9" })] }), loadingItems ? (_jsx("p", { className: "text-sm text-muted-foreground py-4", children: "Artikelen laden\u2026" })) : filtered.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground py-4", children: "Geen artikelen gevonden." })) : (_jsx("div", { className: "max-h-[360px] overflow-y-auto border rounded-md divide-y", children: filtered.map((i) => {
79
+ const stored = priceByKey.get(i.id);
80
+ const value = drafts[i.id] ?? (stored != null ? String(stored) : "");
81
+ return (_jsxs("div", { className: "flex items-center gap-3 p-2.5", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "text-sm font-medium truncate", children: i.name }), _jsx("div", { className: "text-xs text-muted-foreground truncate", children: i.vbn_code ? `VBN ${i.vbn_code}` : "—" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs text-muted-foreground", children: currency }), _jsx(Input, { inputMode: "decimal", placeholder: "\u2014", className: "w-28 text-right tabular-nums", value: value, disabled: saving === i.id, onChange: (e) => setDrafts((d) => ({ ...d, [i.id]: e.target.value })), onBlur: (e) => void commit(i.id, e.target.value) })] })] }, i.id));
82
+ }) }))] }) }));
83
+ }
@@ -19,6 +19,14 @@ export { PriceGroupsRoute } from "./components/klanten/pricegroups/PriceGroupsRo
19
19
  export { PriceGroupFormPage } from "./components/klanten/pricegroups/PriceGroupFormPage";
20
20
  export { PriceGroupNewRoute } from "./components/klanten/pricegroups/PriceGroupNewRoute";
21
21
  export { PriceGroupEditRoute } from "./components/klanten/pricegroups/PriceGroupEditRoute";
22
+ export { CustomerPriceGroupSelect } from "./components/klanten/pricegroups/CustomerPriceGroupSelect";
23
+ export { CustomerAssortmentTab } from "./components/klanten/CustomerAssortmentTab";
24
+ export { listCustomerAssortment } from "./lib/customer-assortment.functions";
25
+ export { loadFloridayCatalogPrices, type CatalogPrice } from "./lib/floriday-catalog-prices";
26
+ export { FloridayPriceImportDialog } from "./components/klanten/FloridayPriceImportDialog";
27
+ export { previewFloridayPriceImport, applyFloridayPriceImport, } from "./lib/floriday-price-import.functions";
28
+ export { getPriceGroupsForCustomer, setPriceGroupForCustomer, resolveCustomerKeyForLocalCustomer, listPriceGroupItemPrices, setPriceGroupItemPrice, } from "./lib/price-groups-local.functions";
29
+ export { PriceGroupItemPrices } from "./components/klanten/pricegroups/PriceGroupItemPrices";
22
30
  export { listLogisticsStrategies, getLogisticsStrategyBinding, setLogisticsStrategyBinding, resolveLogisticsStrategy, } from "./lib/logistics-strategy.functions";
23
31
  export { emitLogisticsEvent } from "./lib/logistics-events.functions";
24
32
  export declare const floridayKlantenModule: FlowModule;
@@ -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,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,EA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export { PriceGroupFormPage } from "./components/klanten/pricegroups/PriceGroupFormPage";
36
36
  export { PriceGroupNewRoute } from "./components/klanten/pricegroups/PriceGroupNewRoute";
37
37
  export { PriceGroupEditRoute } from "./components/klanten/pricegroups/PriceGroupEditRoute";
38
+ export { CustomerPriceGroupSelect } from "./components/klanten/pricegroups/CustomerPriceGroupSelect";
39
+ export { CustomerAssortmentTab } from "./components/klanten/CustomerAssortmentTab";
40
+ export { listCustomerAssortment } from "./lib/customer-assortment.functions";
41
+ export { loadFloridayCatalogPrices } from "./lib/floriday-catalog-prices";
42
+ export { FloridayPriceImportDialog } from "./components/klanten/FloridayPriceImportDialog";
43
+ export { previewFloridayPriceImport, applyFloridayPriceImport, } from "./lib/floriday-price-import.functions";
44
+ export { getPriceGroupsForCustomer, setPriceGroupForCustomer, resolveCustomerKeyForLocalCustomer, listPriceGroupItemPrices, setPriceGroupItemPrice, } from "./lib/price-groups-local.functions";
45
+ export { PriceGroupItemPrices } from "./components/klanten/pricegroups/PriceGroupItemPrices";
38
46
  export { listLogisticsStrategies, getLogisticsStrategyBinding, setLogisticsStrategyBinding, resolveLogisticsStrategy, } from "./lib/logistics-strategy.functions";
39
47
  export { emitLogisticsEvent } from "./lib/logistics-events.functions";
40
48
  export const floridayKlantenModule = {