@flowselections/floriday-klanten-module 1.0.60 → 1.0.62

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.
@@ -1,3 +1,3 @@
1
- /** Alleen voor beheerders: schakelaars voor automatisch aanmaken van Floriday-klanten. */
1
+ /** Alleen voor beheerders: telling van het automatisch aanmaken van Floriday-klanten (geen schakelaars). */
2
2
  export declare function FloridayAutoPromoteCard(): import("react").JSX.Element | null;
3
3
  //# sourceMappingURL=FloridayAutoPromoteCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloridayAutoPromoteCard.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/FloridayAutoPromoteCard.tsx"],"names":[],"mappings":"AAeA,0FAA0F;AAC1F,wBAAgB,uBAAuB,uCAItC"}
1
+ {"version":3,"file":"FloridayAutoPromoteCard.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/FloridayAutoPromoteCard.tsx"],"names":[],"mappings":"AAQA,4GAA4G;AAC5G,wBAAgB,uBAAuB,uCAItC"}
@@ -1,13 +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 { useState } from "react";
3
- import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { useQuery } from "@tanstack/react-query";
4
4
  import { useServerFn } from "@tanstack/react-start";
5
- import { Card, CardContent, Switch, toast, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@flowselections/core";
6
5
  import { useCustomerDefaults } from "./useCustomerDefaults.js";
7
- import { getAutoPromoteStatus, setAutoPromote } from "../../lib/auto-promote.functions.js";
6
+ import { getAutoPromoteStatus } from "../../lib/auto-promote.functions.js";
8
7
  import { skipReasons, skippedTotal, roundSummary } from "../../lib/auto-promote.js";
9
8
  import { friendlyError } from "../../lib/errors.js";
10
- /** Alleen voor beheerders: schakelaars voor automatisch aanmaken van Floriday-klanten. */
9
+ /** Alleen voor beheerders: telling van het automatisch aanmaken van Floriday-klanten (geen schakelaars). */
11
10
  export function FloridayAutoPromoteCard() {
12
11
  const { isAdmin } = useCustomerDefaults();
13
12
  if (isAdmin !== true)
@@ -15,37 +14,18 @@ export function FloridayAutoPromoteCard() {
15
14
  return _jsx(Inner, {});
16
15
  }
17
16
  function Inner() {
18
- const qc = useQueryClient();
17
+ const [open, setOpen] = useState(false);
19
18
  const getStatus = useServerFn(getAutoPromoteStatus);
20
- const setFn = useServerFn(setAutoPromote);
21
- const q = useQuery({ queryKey: ["klanten-auto-promote"], queryFn: () => getStatus() });
22
- const [confirm, setConfirm] = useState(null);
23
- const [result, setResult] = useState(null);
24
- const [showDetails, setShowDetails] = useState(false);
25
- const m = useMutation({
26
- mutationFn: (v) => setFn({ data: v }),
27
- onSuccess: (r, v) => {
28
- if (v.on)
29
- setResult({ kind: v.kind, r });
30
- qc.invalidateQueries({ queryKey: ["klanten-auto-promote"] });
31
- qc.invalidateQueries({ queryKey: ["customers"] });
32
- },
33
- onError: (e) => toast.error(friendlyError(e)),
34
- });
19
+ const q = useQuery({ queryKey: ["klanten-auto-promote"], queryFn: () => getStatus(), enabled: open });
35
20
  const s = q.data;
36
21
  const rows = s
37
22
  ? [
38
- { kind: "relations", label: "Uit inkooprelaties", on: s.relaties_aan, c: s.inkooprelatie ?? {} },
39
- { kind: "orders", label: "Uit Floriday-orders", on: s.orders_aan, c: s.order ?? {} },
23
+ { label: "Uit inkooprelaties", c: s.inkooprelatie ?? {} },
24
+ { label: "Uit Floriday-orders", c: s.order ?? {} },
40
25
  ]
41
26
  : [];
42
- const pending = rows.find((r) => r.kind === confirm);
43
- return (_jsxs(Card, { children: [_jsxs(CardContent, { className: "p-4 space-y-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "font-semibold", children: "Floriday-klanten automatisch aanmaken" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Kopers uit Floriday worden klant. Er gaat niets naar Floriday of naar de boekhouding." })] }), q.isLoading && _jsx("p", { className: "text-sm text-muted-foreground", children: "Telling ophalen\u2026" }), q.error && _jsx("p", { className: "text-sm text-destructive", children: friendlyError(q.error) }), rows.map((r) => {
27
+ return (_jsxs("div", { className: "text-xs text-muted-foreground", children: [_jsx("button", { type: "button", className: "underline", onClick: () => setOpen((v) => !v), children: "Details voor beheer: Floriday-klanten" }), open && (_jsxs("div", { className: "mt-2 space-y-2 rounded border p-3", children: [_jsx("p", { children: "Kopers uit Floriday worden elke 5 minuten vanzelf klant. Ze gaan niet vanzelf naar de boekhouding." }), q.isLoading && _jsx("p", { children: "Telling ophalen\u2026" }), q.error && _jsx("p", { className: "text-destructive", children: friendlyError(q.error) }), s?.laatste_ronde && _jsxs("p", { children: ["Laatste ronde: ", roundSummary(s.laatste_ronde)] }), rows.map((r) => {
44
28
  const reasons = skipReasons(r.c);
45
- return (_jsxs("div", { className: "flex items-start justify-between gap-4 border-t pt-3", children: [_jsxs("div", { className: "min-w-0 text-sm", children: [_jsx("div", { className: "font-medium", children: r.label }), _jsxs("div", { className: "text-muted-foreground", children: [r.c.nieuw ?? 0, " nieuw \u00B7 ", r.c.koppelen_op_gln ?? 0, " koppelen op GLN \u00B7 ", skippedTotal(r.c), " overgeslagen"] }), reasons.length > 0 && _jsxs("div", { className: "text-muted-foreground", children: ["Overgeslagen: ", reasons.join("; ")] }), result?.kind === r.kind && _jsxs("div", { className: "mt-1", children: ["Laatste ronde: ", roundSummary(result.r)] })] }), _jsx(Switch, { checked: r.on, disabled: m.isPending, onCheckedChange: (v) => (v ? setConfirm(r.kind) : m.mutate({ kind: r.kind, on: false })), "aria-label": r.label })] }, r.kind));
46
- }), s && (_jsxs("div", { className: "border-t pt-3 text-xs text-muted-foreground", children: [_jsx("button", { type: "button", className: "underline", onClick: () => setShowDetails((v) => !v), children: "Details voor beheer" }), showDetails && (_jsxs("div", { className: "mt-2 space-y-1", children: [_jsxs("p", { children: ["Kopers met een order \u00E9n een inkooprelatie: ", s.order_ook_inkooprelatie] }), _jsxs("p", { children: ["Nog niet opgehaald maar wel in het netwerk: inkooprelaties", " ", s.inkooprelatie?.zonder_gegevens_wel_in_netwerk ?? 0, ", orders ", s.order?.zonder_gegevens_wel_in_netwerk ?? 0] }), _jsx("p", { children: "Steekproef van niet gevonden organisaties:" }), _jsx("pre", { className: "overflow-x-auto whitespace-pre-wrap break-all rounded bg-muted p-2", children: s.steekproef })] }))] }))] }), _jsx(AlertDialog, { open: !!pending, onOpenChange: (o) => !o && setConfirm(null), children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsxs(AlertDialogTitle, { children: [pending?.label, " aanzetten?"] }), _jsxs(AlertDialogDescription, { children: ["Er worden nu ", pending?.c.nieuw ?? 0, " klanten aangemaakt en ", pending?.c.koppelen_op_gln ?? 0, " bestaande klanten gekoppeld op GLN. Daarna gebeurt dit elke 5 minuten automatisch. Er gaat niets naar Floriday of naar de boekhouding, en de klanten krijgen geen eigen klantnummer."] })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), _jsx(AlertDialogAction, { onClick: () => {
47
- if (pending)
48
- m.mutate({ kind: pending.kind, on: true });
49
- setConfirm(null);
50
- }, children: "Aanzetten" })] })] }) })] }));
29
+ return (_jsxs("div", { children: [_jsxs("span", { className: "font-medium", children: [r.label, ":"] }), " nog ", r.c.nieuw ?? 0, " nieuw \u00B7", " ", r.c.koppelen_op_gln ?? 0, " koppelen op GLN \u00B7 ", skippedTotal(r.c), " overgeslagen", reasons.length > 0 && _jsxs("div", { children: ["Overgeslagen: ", reasons.join("; ")] })] }, r.label));
30
+ }), s && (_jsxs(_Fragment, { children: [_jsxs("p", { children: ["Kopers met een order \u00E9n een inkooprelatie: ", s.order_ook_inkooprelatie] }), _jsx("p", { children: "Steekproef van niet gevonden organisaties:" }), _jsx("pre", { className: "overflow-x-auto whitespace-pre-wrap break-all rounded bg-muted p-2", children: s.steekproef })] }))] }))] }));
51
31
  }
package/dist-lib/index.js CHANGED
@@ -52,7 +52,7 @@ export { emitLogisticsEvent } from "./lib/logistics-events.functions.js";
52
52
  export const floridayKlantenModule = {
53
53
  id: "customers",
54
54
  name: "Klanten",
55
- version: "1.0.59",
55
+ version: "1.0.61",
56
56
  nav: {
57
57
  label: "Klanten",
58
58
  href: "/klanten",
@@ -14188,6 +14188,7 @@ export type Database = {
14188
14188
  bron_id: string;
14189
14189
  cart_id: string | null;
14190
14190
  created_at: string;
14191
+ eigen_sticker_id: string | null;
14191
14192
  fulfillment_order_id: string | null;
14192
14193
  handled_at: string | null;
14193
14194
  handled_error: string | null;
@@ -14214,6 +14215,7 @@ export type Database = {
14214
14215
  bron_id: string;
14215
14216
  cart_id?: string | null;
14216
14217
  created_at?: string;
14218
+ eigen_sticker_id?: string | null;
14217
14219
  fulfillment_order_id?: string | null;
14218
14220
  handled_at?: string | null;
14219
14221
  handled_error?: string | null;
@@ -14240,6 +14242,7 @@ export type Database = {
14240
14242
  bron_id?: string;
14241
14243
  cart_id?: string | null;
14242
14244
  created_at?: string;
14245
+ eigen_sticker_id?: string | null;
14243
14246
  fulfillment_order_id?: string | null;
14244
14247
  handled_at?: string | null;
14245
14248
  handled_error?: string | null;
@@ -31910,6 +31913,10 @@ export type Database = {
31910
31913
  Args: never;
31911
31914
  Returns: Json;
31912
31915
  };
31916
+ klanten_refresh_grouped_if_stale: {
31917
+ Args: never;
31918
+ Returns: boolean;
31919
+ };
31913
31920
  klanten_set_auto_promote: {
31914
31921
  Args: {
31915
31922
  p_kind: string;
@@ -33062,6 +33069,13 @@ export type Database = {
33062
33069
  };
33063
33070
  Returns: Json;
33064
33071
  };
33072
+ logistics_document_for_order: {
33073
+ Args: {
33074
+ p_documenttype: string;
33075
+ p_order_id: string;
33076
+ };
33077
+ Returns: Json;
33078
+ };
33065
33079
  logistics_document_layout: {
33066
33080
  Args: {
33067
33081
  _document_code: string;
@@ -33075,6 +33089,10 @@ export type Database = {
33075
33089
  };
33076
33090
  Returns: Json;
33077
33091
  };
33092
+ logistics_document_selection_status: {
33093
+ Args: never;
33094
+ Returns: Json;
33095
+ };
33078
33096
  logistics_document_station: {
33079
33097
  Args: {
33080
33098
  _document_code: string;
@@ -33893,6 +33911,12 @@ export type Database = {
33893
33911
  Args: never;
33894
33912
  Returns: Json;
33895
33913
  };
33914
+ logistics_own_sticker_sync: {
33915
+ Args: {
33916
+ p_limit?: number;
33917
+ };
33918
+ Returns: Json;
33919
+ };
33896
33920
  logistics_own_transport_departure: {
33897
33921
  Args: {
33898
33922
  p_delivery_date: string;
@@ -38602,6 +38626,15 @@ export type Database = {
38602
38626
  };
38603
38627
  Returns: Json;
38604
38628
  };
38629
+ voorraad_alert_floriday_not_updated: {
38630
+ Args: {
38631
+ p_key: string;
38632
+ p_order_id: string;
38633
+ p_order_item_id: string;
38634
+ p_qty: number;
38635
+ };
38636
+ Returns: undefined;
38637
+ };
38605
38638
  voorraad_can_write: {
38606
38639
  Args: never;
38607
38640
  Returns: boolean;
@@ -38624,6 +38657,12 @@ export type Database = {
38624
38657
  };
38625
38658
  Returns: string[];
38626
38659
  };
38660
+ voorraad_floriday_leads_key: {
38661
+ Args: {
38662
+ p_key: string;
38663
+ };
38664
+ Returns: boolean;
38665
+ };
38627
38666
  voorraad_hook_base_url: {
38628
38667
  Args: never;
38629
38668
  Returns: string;
@@ -38641,6 +38680,12 @@ export type Database = {
38641
38680
  };
38642
38681
  Returns: undefined;
38643
38682
  };
38683
+ voorraad_mark_floriday_sold_before_switch: {
38684
+ Args: {
38685
+ p_product_id: string;
38686
+ };
38687
+ Returns: number;
38688
+ };
38644
38689
  voorraad_production_enabled: {
38645
38690
  Args: never;
38646
38691
  Returns: boolean;