@flowselections/floriday-klanten-module 1.0.46 → 1.0.49
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/BewerkKlant.d.ts.map +1 -1
- package/dist-lib/components/klanten/BewerkKlant.js +1 -1
- package/dist-lib/components/klanten/CustomerAnalyticsTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/CustomerAnalyticsTab.js +2 -2
- package/dist-lib/components/klanten/FloridayNetworkStatus.d.ts +5 -0
- package/dist-lib/components/klanten/FloridayNetworkStatus.d.ts.map +1 -0
- package/dist-lib/components/klanten/FloridayNetworkStatus.js +18 -0
- package/dist-lib/components/klanten/KlantDetailLayout.d.ts +2 -0
- package/dist-lib/components/klanten/KlantDetailLayout.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetailLayout.js +6 -1
- package/dist-lib/components/klanten/KlantFormulier.d.ts +3 -1
- package/dist-lib/components/klanten/KlantFormulier.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantFormulier.js +16 -4
- package/dist-lib/components/klanten/NetwerkPagina.d.ts.map +1 -1
- package/dist-lib/components/klanten/NetwerkPagina.js +9 -5
- package/dist-lib/components/klanten/pricegroups/CustomerPickerDialog.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/CustomerPickerDialog.js +10 -2
- package/dist-lib/components/klanten/pricegroups/PriceGroupsPage.d.ts.map +1 -1
- package/dist-lib/components/klanten/pricegroups/PriceGroupsPage.js +4 -7
- package/dist-lib/components/klanten/pricegroups/UnknownFloridayMembers.d.ts +11 -0
- package/dist-lib/components/klanten/pricegroups/UnknownFloridayMembers.d.ts.map +1 -0
- package/dist-lib/components/klanten/pricegroups/UnknownFloridayMembers.js +43 -0
- package/dist-lib/index.js +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +464 -2
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +1 -0
- package/dist-lib/lib/customers.functions.d.ts +3 -0
- package/dist-lib/lib/customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.js +6 -2
- package/dist-lib/lib/floriday-network-status.functions.d.ts +18 -0
- package/dist-lib/lib/floriday-network-status.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday-network-status.functions.js +41 -0
- package/dist-lib/lib/price-groups-local.functions.d.ts +42 -0
- package/dist-lib/lib/price-groups-local.functions.d.ts.map +1 -1
- package/dist-lib/lib/price-groups-local.functions.js +120 -1
- package/dist-lib/lib/vat-format.d.ts +17 -0
- package/dist-lib/lib/vat-format.d.ts.map +1 -0
- package/dist-lib/lib/vat-format.js +64 -0
- package/package.json +4 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
5
|
+
import { Button, Badge } from "@flowselections/core";
|
|
6
|
+
import { toast } from "sonner";
|
|
7
|
+
import { addFloridayMemberToPriceGroup, } from "../../../lib/price-groups-local.functions";
|
|
8
|
+
import { friendlyError } from "../../../lib/errors";
|
|
9
|
+
/**
|
|
10
|
+
* Floriday-leden van een prijsgroep die nog geen ERP-klant zijn. Er wordt niets vastgelegd
|
|
11
|
+
* tot iemand op "Toevoegen" klikt; dan ontstaat een klant zonder Twinfield-debiteur.
|
|
12
|
+
*/
|
|
13
|
+
export function UnknownFloridayMembers({ members, priceGroupIdFor, }) {
|
|
14
|
+
const qc = useQueryClient();
|
|
15
|
+
const addFn = useServerFn(addFloridayMemberToPriceGroup);
|
|
16
|
+
const [done, setDone] = useState(new Set());
|
|
17
|
+
const addMut = useMutation({
|
|
18
|
+
mutationFn: async (m) => {
|
|
19
|
+
for (const g of m.groups) {
|
|
20
|
+
const id = priceGroupIdFor(g.external_id);
|
|
21
|
+
if (id)
|
|
22
|
+
await addFn({ data: { organizationId: m.organization_id, priceGroupId: id } });
|
|
23
|
+
}
|
|
24
|
+
return m;
|
|
25
|
+
},
|
|
26
|
+
onSuccess: (m) => {
|
|
27
|
+
setDone((prev) => new Set(prev).add(m.organization_id));
|
|
28
|
+
qc.invalidateQueries({ queryKey: ["customer-price-groups"] });
|
|
29
|
+
qc.invalidateQueries({ queryKey: ["unknown-floriday-members"] });
|
|
30
|
+
qc.invalidateQueries({ queryKey: ["customer-price-group"] });
|
|
31
|
+
qc.invalidateQueries({ queryKey: ["external-customers-picker"] });
|
|
32
|
+
toast.success(`${m.commercial_name ?? m.name} is toegevoegd als klant (zonder debiteur in Twinfield).`);
|
|
33
|
+
},
|
|
34
|
+
onError: (e) => toast.error(friendlyError(e)),
|
|
35
|
+
});
|
|
36
|
+
if (members.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("p", { className: "text-xs font-medium", children: ["Onbekend in ERP (", members.length, ")"] }), _jsx("div", { className: "max-h-56 overflow-y-auto rounded-md border divide-y", children: members.map((m) => {
|
|
39
|
+
const added = done.has(m.organization_id);
|
|
40
|
+
const canAdd = m.groups.some((g) => priceGroupIdFor(g.external_id));
|
|
41
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 px-3 py-2", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-sm font-medium truncate", children: m.commercial_name ?? m.name }), _jsxs("div", { className: "text-xs text-muted-foreground truncate", children: [m.commercial_name ? `${m.name} · ` : "", m.city ?? "—", " \u00B7 ", m.reason] }), m.groups.length > 0 && (_jsxs("div", { className: "text-xs text-muted-foreground truncate", children: ["In Floriday: ", m.groups.map((g) => g.name).join(", ")] }))] }), added ? (_jsx(Badge, { variant: "secondary", children: "Toegevoegd" })) : (_jsx(Button, { size: "sm", variant: "outline", disabled: !canAdd || addMut.isPending, title: canAdd ? undefined : "Importeer eerst de prijsgroep", onClick: () => addMut.mutate(m), children: "Toevoegen" }))] }, m.organization_id));
|
|
42
|
+
}) }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Toevoegen maakt een klant aan op organisatie-id, zonder debiteur in Twinfield, en deelt die in bij de prijsgroep." })] }));
|
|
43
|
+
}
|
package/dist-lib/index.js
CHANGED