@flowselections/floriday-voorraad 1.0.87 → 1.0.90

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 (32) hide show
  1. package/dist-lib/components/voorraad/FloridayTakeoverPanel.d.ts.map +1 -1
  2. package/dist-lib/components/voorraad/FloridayTakeoverPanel.js +21 -8
  3. package/dist-lib/components/voorraad/InventoryStatusBadge.d.ts.map +1 -1
  4. package/dist-lib/components/voorraad/InventoryStatusBadge.js +7 -0
  5. package/dist-lib/hooks/useInventorySettings.d.ts +3 -0
  6. package/dist-lib/hooks/useInventorySettings.d.ts.map +1 -1
  7. package/dist-lib/hooks/useInventorySettings.js +1 -1
  8. package/dist-lib/hooks-entry.d.ts +1 -0
  9. package/dist-lib/hooks-entry.d.ts.map +1 -1
  10. package/dist-lib/hooks-entry.js +1 -0
  11. package/dist-lib/integrations/supabase/types.d.ts +214 -0
  12. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  13. package/dist-lib/lib/__tests__/floriday-customer-offers.test.d.ts +2 -0
  14. package/dist-lib/lib/__tests__/floriday-customer-offers.test.d.ts.map +1 -0
  15. package/dist-lib/lib/__tests__/floriday-customer-offers.test.js +36 -0
  16. package/dist-lib/lib/floriday-customer-offers.d.ts +25 -0
  17. package/dist-lib/lib/floriday-customer-offers.d.ts.map +1 -0
  18. package/dist-lib/lib/floriday-customer-offers.js +49 -0
  19. package/dist-lib/lib/floriday-takeover-core.d.ts +71 -0
  20. package/dist-lib/lib/floriday-takeover-core.d.ts.map +1 -0
  21. package/dist-lib/lib/floriday-takeover-core.js +196 -0
  22. package/dist-lib/lib/floriday-takeover.functions.d.ts +5 -49
  23. package/dist-lib/lib/floriday-takeover.functions.d.ts.map +1 -1
  24. package/dist-lib/lib/floriday-takeover.functions.js +3 -219
  25. package/dist-lib/server-hooks/floriday-follow.d.ts +3 -0
  26. package/dist-lib/server-hooks/floriday-follow.d.ts.map +1 -0
  27. package/dist-lib/server-hooks/floriday-follow.js +46 -0
  28. package/dist-lib/server-hooks/guard.d.ts.map +1 -1
  29. package/dist-lib/server-hooks/guard.js +6 -1
  30. package/package.json +16 -2
  31. package/sql/AGENTS.md +3 -0
  32. package/sql/floriday-voorraad-schema.sql +8188 -0
@@ -1 +1 @@
1
- {"version":3,"file":"FloridayTakeoverPanel.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/FloridayTakeoverPanel.tsx"],"names":[],"mappings":"AA4CA,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,EAAE;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAoCvF;AAED,wBAAgB,qBAAqB,CAAC,EAAE,YAAY,EAAE,EAAE;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCA2QtF"}
1
+ {"version":3,"file":"FloridayTakeoverPanel.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/FloridayTakeoverPanel.tsx"],"names":[],"mappings":"AA4CA,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,EAAE;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAoCvF;AAED,wBAAgB,qBAAqB,CAAC,EAAE,YAAY,EAAE,EAAE;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,sCAoStF"}
@@ -11,14 +11,14 @@ import { useCallback, useEffect, useMemo, useState } from "react";
11
11
  import { useServerFn } from "@tanstack/react-start";
12
12
  import { toast } from "sonner";
13
13
  import * as XLSX from "xlsx";
14
- import { Button } from "@flowselections/core";
14
+ import { Button, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@flowselections/core";
15
15
  import { supabase } from "../../integrations/supabase/client.js";
16
16
  import { getFloridayTakeoverPreview } from "../../lib/floriday-takeover.functions.js";
17
17
  const sb = supabase;
18
18
  const eur = (v) => v == null ? "—" : `€ ${Number(v).toLocaleString("nl-NL", { minimumFractionDigits: 2, maximumFractionDigits: 4 })}`;
19
19
  const num = (v) => (v == null ? "—" : Number(v).toLocaleString("nl-NL"));
20
20
  function offersText(o) {
21
- return o.map((x) => [x.customer ?? "Klant onbekend", x.price != null ? eur(x.price) : null, x.pieces != null ? `${num(x.pieces)} st.` : null,
21
+ return o.map((x) => [x.customer ?? "Klant onbekend", x.title ? `“${x.title}”` : null, x.price != null ? eur(x.price) : null, x.pieces != null ? `${num(x.pieces)} st.` : null,
22
22
  x.from || x.to ? `${(x.from ?? "").slice(0, 10)} – ${(x.to ?? "").slice(0, 10)}` : null].filter(Boolean).join(" ")).join("; ");
23
23
  }
24
24
  function formsText(f) {
@@ -63,6 +63,7 @@ export function FloridayTakeoverPanel({ connectionId }) {
63
63
  const itemsBlocked = fetchStatus != null && fetchStatus.tradeItems !== "compleet";
64
64
  const [selected, setSelected] = useState(new Set());
65
65
  const [busy, setBusy] = useState(false);
66
+ const [ask, setAsk] = useState(null);
66
67
  const [runs, setRuns] = useState([]);
67
68
  const [leadRows, setLeadRows] = useState([]);
68
69
  const [leadSel, setLeadSel] = useState(new Set());
@@ -124,8 +125,15 @@ export function FloridayTakeoverPanel({ connectionId }) {
124
125
  if (!connectionId || chosen.length === 0 || itemsBlocked)
125
126
  return;
126
127
  const created = chosen.filter((r) => r.action === "aanmaken").length;
127
- if (!window.confirm(`${chosen.length} artikelen overnemen uit Floriday${created ? `, waarvan ${created} nieuw aanmaken` : ""}? ` +
128
- "Voorraad en prijs worden overgenomen. Er gaat niets naar Floriday; deze artikelen blijven Floriday-leidend."))
128
+ setAsk({
129
+ title: `${chosen.length} artikelen overnemen uit Floriday?`,
130
+ text: `${created ? `Hiervan maak je er ${created} nieuw aan. ` : ""}Voorraad en prijs worden overgenomen. Er gaat niets naar Floriday; deze artikelen blijven Floriday-leidend en volgen Floriday daarna elk uur. Je kunt dit terugdraaien.`,
131
+ label: `Overnemen (${chosen.length})`,
132
+ run: doApply,
133
+ });
134
+ };
135
+ const doApply = async () => {
136
+ if (!connectionId)
129
137
  return;
130
138
  setBusy(true);
131
139
  const items = chosen.map((r) => ({
@@ -145,9 +153,13 @@ export function FloridayTakeoverPanel({ connectionId }) {
145
153
  loadRuns();
146
154
  loadLeadRows();
147
155
  };
148
- const undo = async (runId) => {
149
- if (!window.confirm("Deze overname terugdraaien? Artikelen die sindsdien zijn gewijzigd blijven staan. Nieuw aangemaakte artikelen blijven bestaan (op Uit)."))
150
- return;
156
+ const undo = (runId) => setAsk({
157
+ title: "Deze overname terugdraaien?",
158
+ text: "Artikelen die sindsdien zijn gewijzigd blijven staan. Nieuw aangemaakte artikelen blijven bestaan (op Uit).",
159
+ label: "Terugdraaien",
160
+ run: () => doUndo(runId),
161
+ });
162
+ const doUndo = async (runId) => {
151
163
  const { data, error } = await sb.rpc("floriday_takeover_undo", { p_run_id: runId });
152
164
  if (error) {
153
165
  toast.error("Terugdraaien is niet gelukt.", { description: error.message });
@@ -192,5 +204,6 @@ export function FloridayTakeoverPanel({ connectionId }) {
192
204
  : "De artikelen uit Floriday zijn nog niet opgehaald – wacht tot dit compleet is. Overnemen kan daarna." })), fetchStatus && fetchStatus.tradeItems === "compleet" && (fetchStatus.catalogPrices === "bezig" || fetchStatus.customerOffers === "bezig") && (_jsx("p", { className: "text-sm text-muted-foreground", children: "Het aanbod wordt nog opgehaald \u2013 wacht tot dit compleet is voor de juiste prijzen. Maak daarna het proefrapport opnieuw." })), weekError && (_jsxs("p", { className: "text-sm text-destructive", children: ["Het weekaanbod kon niet worden gelezen; het rapport gebruikt alleen de overige gegevens.", " ", _jsxs("details", { className: "inline", children: [_jsx("summary", { className: "inline cursor-pointer", children: "Details voor beheer" }), weekError] })] })), rows && (_jsx("div", { className: "max-h-[28rem] overflow-auto rounded border", children: _jsxs("table", { className: "w-full text-xs", children: [_jsx("thead", { className: "sticky top-0 bg-muted", children: _jsxs("tr", { className: "text-left", children: [_jsx("th", { className: "p-1" }), _jsx("th", { className: "p-1", children: "Artikel" }), _jsx("th", { className: "p-1", children: "Actie" }), _jsx("th", { className: "p-1", children: "Floriday aantal" }), _jsx("th", { className: "p-1", children: "Floriday prijs" }), _jsx("th", { className: "p-1", children: "Nu in je voorraad" }), _jsx("th", { className: "p-1", children: "Aanbodvorm" })] }) }), _jsx("tbody", { children: rows.map((r) => (_jsxs("tr", { className: "border-t align-top", children: [_jsx("td", { className: "p-1", children: _jsx("input", { type: "checkbox", disabled: r.action === "niet", checked: selected.has(r.tradeItemId), onChange: (e) => setSelected((s) => { const n = new Set(s); e.target.checked ? n.add(r.tradeItemId) : n.delete(r.tradeItemId); return n; }) }) }), _jsxs("td", { className: "p-1", children: [_jsx("div", { className: "font-medium", children: r.name }), _jsx("div", { className: "text-muted-foreground", children: [r.articleCode, r.gtin, r.vbnCode && `VBN ${r.vbnCode}`].filter(Boolean).join(" · ") }), r.suggestion && _jsx("div", { className: "text-amber-700", children: r.suggestion })] }), _jsxs("td", { className: "p-1", children: [r.action === "aanmaken" ? "Nieuw aanmaken (Uit)" : r.action === "bijwerken" ? "Bijwerken" : "Niet over te nemen", r.reason && _jsx("div", { className: "text-muted-foreground", children: r.reason })] }), _jsxs("td", { className: "p-1", children: [num(r.floridayStock), _jsx("div", { className: "text-muted-foreground", children: r.stockSource ?? "" })] }), _jsxs("td", { className: "p-1", children: [eur(r.floridayPrice), _jsx("div", { className: "text-muted-foreground", children: r.priceSource ?? "" }), r.priceDiffers && _jsxs("div", { className: "text-amber-700", children: ["Aanbodregel ", eur(r.supplyLinePrice), " \u00B7 catalogus ", eur(r.catalogPrice)] })] }), _jsxs("td", { className: "p-1", children: [num(r.erpStock), " \u00B7 ", eur(r.erpPrice)] }), _jsxs("td", { className: "p-1", children: [formsText(r.forms), r.customerOffers.length > 0 && (_jsxs("details", { children: [_jsxs("summary", { className: "cursor-pointer", children: ["Klantaanbiedingen (", r.customerOffers.length, ", alleen getoond)"] }), _jsx("ul", { className: "list-disc pl-4", children: r.customerOffers.map((o) => _jsx("li", { children: offersText([o]) }, o.id)) })] }))] })] }, r.tradeItemId))) })] }) })), runs.length > 0 && (_jsxs("div", { className: "text-sm space-y-1", children: [_jsx("div", { className: "font-medium", children: "Laatste overnames" }), runs.map((r) => (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("span", { children: [new Date(r.created_at).toLocaleString("nl-NL"), " \u2014 ", r.total_items, " artikelen", r.created_products ? `, ${r.created_products} nieuw` : "", " \u2014 ", r.status] }), r.status !== "ongedaan" && _jsx(Button, { size: "sm", variant: "outline", onClick: () => undo(r.id), children: "Terugdraaien" })] }, r.id)))] }))] }), _jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-sm font-medium", children: "Eigen voorraad leidend maken" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Kies artikelen die nu Floriday-leidend zijn. Je ziet eerst wat er naar Floriday zou gaan; pas na bevestigen verandert er iets." }), leadRows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Er zijn geen Floriday-leidende artikelen." })) : (_jsxs("div", { className: "max-h-48 overflow-auto rounded border p-2 text-sm space-y-1", children: [_jsxs("label", { className: "flex items-center gap-2 font-medium", children: [_jsx("input", { type: "checkbox", checked: leadSel.size === leadRows.length, onChange: (e) => setLeadSel(e.target.checked ? new Set(leadRows.map((r) => r.product_id)) : new Set()) }), "Alles kiezen"] }), leadRows.map((r) => (_jsxs("label", { className: "flex items-center gap-2", children: [_jsx("input", { type: "checkbox", checked: leadSel.has(r.product_id), onChange: (e) => setLeadSel((s) => { const n = new Set(s); e.target.checked ? n.add(r.product_id) : n.delete(r.product_id); return n; }) }), r.name] }, r.product_id)))] })), _jsxs(Button, { size: "sm", variant: "outline", disabled: leadSel.size === 0, onClick: showErpPreview, children: ["Voorbeeld tonen (", leadSel.size, ")"] }), erpPreview && (_jsxs("div", { className: "space-y-2", children: [_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Alleen de huidige week en de komende ", erpPreview[0]?.horizon_weeks ?? "?", " weken worden aangepast; weken in het verleden nooit."] }), _jsxs("table", { className: "w-full text-xs rounded border", children: [_jsx("thead", { className: "bg-muted", children: _jsxs("tr", { className: "text-left", children: [_jsx("th", { className: "p-1", children: "Artikel" }), _jsx("th", { className: "p-1", children: "Week" }), _jsx("th", { className: "p-1", children: "Vorm" }), _jsx("th", { className: "p-1", children: "Aantal" }), _jsx("th", { className: "p-1", children: "Prijs per stuk" }), _jsx("th", { className: "p-1", children: "Nu in Floriday" }), _jsx("th", { className: "p-1", children: "Let op" })] }) }), _jsx("tbody", { children: erpPreview.flatMap((r) => {
193
205
  const ws = r.weeks?.length ? r.weeks : [null];
194
206
  return ws.map((w, i) => (_jsxs("tr", { className: "border-t align-top", children: [_jsx("td", { className: "p-1", children: i === 0 ? r.product_name : "" }), _jsx("td", { className: "p-1", children: w ? (w.week != null ? `${w.year} wk ${w.week}` : "Doorlopend") : "—" }), _jsx("td", { className: "p-1", children: w ? (w.form === "continuous" ? "Doorlopende voorraad" : "Weekaanbod") : "—" }), _jsx("td", { className: "p-1", children: w ? _jsxs(_Fragment, { children: [num(w.quantity), w.available === false ? " (niet beschikbaar)" : ""] }) : "—" }), _jsx("td", { className: "p-1", children: w ? eur(w.price) : eur(r.sale_price) }), _jsx("td", { className: "p-1", children: w && w.floriday_pieces != null ? num(w.floriday_pieces) : "onbekend" }), _jsx("td", { className: "p-1 text-amber-700", children: i === 0 ? r.blocker ?? "" : "" })] }, `${r.product_id}-${i}`)));
195
- }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { size: "sm", onClick: confirmErp, children: "Bevestigen" }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => setErpPreview(null), children: "Annuleren" })] })] }))] })] }))] }));
207
+ }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { size: "sm", onClick: confirmErp, children: "Bevestigen" }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => setErpPreview(null), children: "Annuleren" })] })] }))] })] })), _jsx(AlertDialog, { open: ask != null, onOpenChange: (o) => { if (!o)
208
+ setAsk(null); }, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: ask?.title }), _jsx(AlertDialogDescription, { children: ask?.text })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), _jsx(AlertDialogAction, { onClick: () => { const r = ask?.run; setAsk(null); r?.(); }, children: ask?.label })] })] }) })] }));
196
209
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InventoryStatusBadge.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/InventoryStatusBadge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAwC,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,CAAC;AAiCvB,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAA;CAAE,+BAuC1F"}
1
+ {"version":3,"file":"InventoryStatusBadge.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/InventoryStatusBadge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAwC,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,CAAC;AAiCvB,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAA;CAAE,+BAqD1F"}
@@ -39,6 +39,13 @@ export function InventoryStatusBadge({ setting }) {
39
39
  ? "UNKNOWN"
40
40
  : (setting.sync_status ?? "UNKNOWN");
41
41
  const dot = syncDot(status);
42
+ if (setting.erp_leading === false) {
43
+ const at = setting.follow_floriday_at
44
+ ? new Date(setting.follow_floriday_at).toLocaleString("nl-NL", { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" })
45
+ : "nog niet";
46
+ const failed = setting.follow_floriday_result?.startsWith("fout");
47
+ return (_jsxs("span", { className: `text-xs ${failed ? "text-destructive" : "text-muted-foreground"}`, title: failed ? setting.follow_floriday_result ?? undefined : "Aantal en prijs komen elk uur uit Floriday; er gaat niets naar Floriday.", children: ["Volgt Floriday \u00B7 laatst bijgewerkt ", at, failed ? " (niet gelukt)" : ""] }));
48
+ }
42
49
  return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Badge, { className: MODE_CLASSES[mode] ?? MODE_CLASSES.FOLLOW_ERP, children: MODE_LABELS[mode] ?? mode }), _jsx("span", { className: `h-2 w-2 shrink-0 rounded-full ${dot.cls}`, title: setting.action_reason
43
50
  ? `${dot.title}: ${ACTION_REASON_LABELS[setting.action_reason] ?? setting.action_reason}`
44
51
  : setting.last_sync_error
@@ -22,6 +22,9 @@ export type InventorySetting = {
22
22
  action_reason: string | null;
23
23
  packing_size: number | null;
24
24
  product_type: string | null;
25
+ erp_leading: boolean | null;
26
+ follow_floriday_at: string | null;
27
+ follow_floriday_result: string | null;
25
28
  };
26
29
  export declare function useInventorySettings(connectionId: string | null): {
27
30
  rows: InventorySetting[];
@@ -1 +1 @@
1
- {"version":3,"file":"useInventorySettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useInventorySettings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,EAAE,SAAS,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAKF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;;;;;;EA0D/D"}
1
+ {"version":3,"file":"useInventorySettings.d.ts","sourceRoot":"","sources":["../../src/hooks/useInventorySettings.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,UAAU,EAAE,SAAS,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC,CAAC;AAKF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;;;;;;EA0D/D"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { useCallback, useEffect, useState } from "react";
7
7
  import { supabase } from "../integrations/supabase/client.js";
8
- const SELECT = "id, connection_id, product_id, floriday_trade_item_id, stock_mode, buffer_quantity, maximum_quantity, fixed_quantity, manual_quantity, desired_quantity, desired_availability, remote_quantity, remote_available, remote_checked_at, sync_status, last_sync_error, last_published_at, last_confirmed_at, action_reason, packing_size, product_type";
8
+ const SELECT = "id, connection_id, product_id, floriday_trade_item_id, stock_mode, buffer_quantity, maximum_quantity, fixed_quantity, manual_quantity, desired_quantity, desired_availability, remote_quantity, remote_available, remote_checked_at, sync_status, last_sync_error, last_published_at, last_confirmed_at, action_reason, packing_size, product_type, erp_leading, follow_floriday_at, follow_floriday_result";
9
9
  export function useInventorySettings(connectionId) {
10
10
  const [rows, setRows] = useState([]);
11
11
  const [loading, setLoading] = useState(false);
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export { handleFloridayBaseSupply } from "./server-hooks/floriday-base-supply.js";
7
7
  export { handleFloridayContinuousStock } from "./server-hooks/floriday-continuous-stock.js";
8
+ export { handleFloridayFollow } from "./server-hooks/floriday-follow.js";
8
9
  export { handleFloridayContinuousStockPull } from "./server-hooks/floriday-continuous-stock-pull.js";
9
10
  export { handleFloridayStockReconcile } from "./server-hooks/floriday-stock-reconcile.js";
10
11
  export { handleLogisticsTasksRun } from "./server-hooks/logistics-tasks-run.js";
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-entry.d.ts","sourceRoot":"","sources":["../src/hooks-entry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"hooks-entry.d.ts","sourceRoot":"","sources":["../src/hooks-entry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export { handleFloridayBaseSupply } from "./server-hooks/floriday-base-supply.js";
7
7
  export { handleFloridayContinuousStock } from "./server-hooks/floriday-continuous-stock.js";
8
+ export { handleFloridayFollow } from "./server-hooks/floriday-follow.js";
8
9
  export { handleFloridayContinuousStockPull } from "./server-hooks/floriday-continuous-stock-pull.js";
9
10
  export { handleFloridayStockReconcile } from "./server-hooks/floriday-stock-reconcile.js";
10
11
  export { handleLogisticsTasksRun } from "./server-hooks/logistics-tasks-run.js";
@@ -2235,6 +2235,50 @@ export type Database = {
2235
2235
  }
2236
2236
  ];
2237
2237
  };
2238
+ customer_match_suggestions: {
2239
+ Row: {
2240
+ created_at: string;
2241
+ customer_id: string;
2242
+ decided_at: string | null;
2243
+ decided_by: string | null;
2244
+ floriday_organization_id: string;
2245
+ id: string;
2246
+ reason: string;
2247
+ status: string;
2248
+ updated_at: string;
2249
+ };
2250
+ Insert: {
2251
+ created_at?: string;
2252
+ customer_id: string;
2253
+ decided_at?: string | null;
2254
+ decided_by?: string | null;
2255
+ floriday_organization_id: string;
2256
+ id?: string;
2257
+ reason: string;
2258
+ status?: string;
2259
+ updated_at?: string;
2260
+ };
2261
+ Update: {
2262
+ created_at?: string;
2263
+ customer_id?: string;
2264
+ decided_at?: string | null;
2265
+ decided_by?: string | null;
2266
+ floriday_organization_id?: string;
2267
+ id?: string;
2268
+ reason?: string;
2269
+ status?: string;
2270
+ updated_at?: string;
2271
+ };
2272
+ Relationships: [
2273
+ {
2274
+ foreignKeyName: "customer_match_suggestions_customer_id_fkey";
2275
+ columns: ["customer_id"];
2276
+ isOneToOne: false;
2277
+ referencedRelation: "customers";
2278
+ referencedColumns: ["id"];
2279
+ }
2280
+ ];
2281
+ };
2238
2282
  customer_notes: {
2239
2283
  Row: {
2240
2284
  created_at: string;
@@ -3770,6 +3814,8 @@ export type Database = {
3770
3814
  orientatie: Database["public"]["Enums"]["doc_orientation"];
3771
3815
  page_settings: Json;
3772
3816
  papierformaat: string;
3817
+ standaard_sleutel: string | null;
3818
+ standaard_versie: number | null;
3773
3819
  systeem: boolean;
3774
3820
  thumbnail_url: string | null;
3775
3821
  updated_at: string;
@@ -3795,6 +3841,8 @@ export type Database = {
3795
3841
  orientatie?: Database["public"]["Enums"]["doc_orientation"];
3796
3842
  page_settings?: Json;
3797
3843
  papierformaat?: string;
3844
+ standaard_sleutel?: string | null;
3845
+ standaard_versie?: number | null;
3798
3846
  systeem?: boolean;
3799
3847
  thumbnail_url?: string | null;
3800
3848
  updated_at?: string;
@@ -3820,6 +3868,8 @@ export type Database = {
3820
3868
  orientatie?: Database["public"]["Enums"]["doc_orientation"];
3821
3869
  page_settings?: Json;
3822
3870
  papierformaat?: string;
3871
+ standaard_sleutel?: string | null;
3872
+ standaard_versie?: number | null;
3823
3873
  systeem?: boolean;
3824
3874
  thumbnail_url?: string | null;
3825
3875
  updated_at?: string;
@@ -6766,7 +6816,11 @@ export type Database = {
6766
6816
  id: string;
6767
6817
  is_active: boolean;
6768
6818
  label: string;
6819
+ organization_fetched_at: string | null;
6820
+ organization_id: string | null;
6821
+ organization_mailing_address: Json | null;
6769
6822
  organization_name: string | null;
6823
+ organization_physical_address: Json | null;
6770
6824
  preferred_warehouse_id: string | null;
6771
6825
  preferred_warehouse_name: string | null;
6772
6826
  read_only: boolean;
@@ -6784,7 +6838,11 @@ export type Database = {
6784
6838
  id?: string;
6785
6839
  is_active?: boolean;
6786
6840
  label?: string;
6841
+ organization_fetched_at?: string | null;
6842
+ organization_id?: string | null;
6843
+ organization_mailing_address?: Json | null;
6787
6844
  organization_name?: string | null;
6845
+ organization_physical_address?: Json | null;
6788
6846
  preferred_warehouse_id?: string | null;
6789
6847
  preferred_warehouse_name?: string | null;
6790
6848
  read_only?: boolean;
@@ -6802,7 +6860,11 @@ export type Database = {
6802
6860
  id?: string;
6803
6861
  is_active?: boolean;
6804
6862
  label?: string;
6863
+ organization_fetched_at?: string | null;
6864
+ organization_id?: string | null;
6865
+ organization_mailing_address?: Json | null;
6805
6866
  organization_name?: string | null;
6867
+ organization_physical_address?: Json | null;
6806
6868
  preferred_warehouse_id?: string | null;
6807
6869
  preferred_warehouse_name?: string | null;
6808
6870
  read_only?: boolean;
@@ -7666,6 +7728,8 @@ export type Database = {
7666
7728
  fixed_quantity: number | null;
7667
7729
  floriday_offer_forms: Json | null;
7668
7730
  floriday_trade_item_id: string | null;
7731
+ follow_floriday_at: string | null;
7732
+ follow_floriday_result: string | null;
7669
7733
  id: string;
7670
7734
  last_confirmed_at: string | null;
7671
7735
  last_enqueued_at: string | null;
@@ -7702,6 +7766,8 @@ export type Database = {
7702
7766
  fixed_quantity?: number | null;
7703
7767
  floriday_offer_forms?: Json | null;
7704
7768
  floriday_trade_item_id?: string | null;
7769
+ follow_floriday_at?: string | null;
7770
+ follow_floriday_result?: string | null;
7705
7771
  id?: string;
7706
7772
  last_confirmed_at?: string | null;
7707
7773
  last_enqueued_at?: string | null;
@@ -7738,6 +7804,8 @@ export type Database = {
7738
7804
  fixed_quantity?: number | null;
7739
7805
  floriday_offer_forms?: Json | null;
7740
7806
  floriday_trade_item_id?: string | null;
7807
+ follow_floriday_at?: string | null;
7808
+ follow_floriday_result?: string | null;
7741
7809
  id?: string;
7742
7810
  last_confirmed_at?: string | null;
7743
7811
  last_enqueued_at?: string | null;
@@ -11364,6 +11432,36 @@ export type Database = {
11364
11432
  };
11365
11433
  Relationships: [];
11366
11434
  };
11435
+ layout_auto_acties: {
11436
+ Row: {
11437
+ actie: string;
11438
+ created_at: string;
11439
+ detail: string;
11440
+ documenttype: string | null;
11441
+ id: string;
11442
+ layout_id: string | null;
11443
+ printer_id: string | null;
11444
+ };
11445
+ Insert: {
11446
+ actie: string;
11447
+ created_at?: string;
11448
+ detail?: string;
11449
+ documenttype?: string | null;
11450
+ id?: string;
11451
+ layout_id?: string | null;
11452
+ printer_id?: string | null;
11453
+ };
11454
+ Update: {
11455
+ actie?: string;
11456
+ created_at?: string;
11457
+ detail?: string;
11458
+ documenttype?: string | null;
11459
+ id?: string;
11460
+ layout_id?: string | null;
11461
+ printer_id?: string | null;
11462
+ };
11463
+ Relationships: [];
11464
+ };
11367
11465
  layout_logos: {
11368
11466
  Row: {
11369
11467
  bestand_url: string;
@@ -11421,6 +11519,51 @@ export type Database = {
11421
11519
  };
11422
11520
  Relationships: [];
11423
11521
  };
11522
+ layout_standaarden: {
11523
+ Row: {
11524
+ breedte_mm: number;
11525
+ config: Json;
11526
+ created_at: string;
11527
+ documenttype: Database["public"]["Enums"]["doc_layout_type"];
11528
+ hoogte_mm: number;
11529
+ naam: string;
11530
+ omschrijving: string;
11531
+ page_settings: Json;
11532
+ papierformaat: string;
11533
+ sleutel: string;
11534
+ updated_at: string;
11535
+ versie: number;
11536
+ };
11537
+ Insert: {
11538
+ breedte_mm?: number;
11539
+ config?: Json;
11540
+ created_at?: string;
11541
+ documenttype: Database["public"]["Enums"]["doc_layout_type"];
11542
+ hoogte_mm?: number;
11543
+ naam: string;
11544
+ omschrijving?: string;
11545
+ page_settings?: Json;
11546
+ papierformaat?: string;
11547
+ sleutel: string;
11548
+ updated_at?: string;
11549
+ versie: number;
11550
+ };
11551
+ Update: {
11552
+ breedte_mm?: number;
11553
+ config?: Json;
11554
+ created_at?: string;
11555
+ documenttype?: Database["public"]["Enums"]["doc_layout_type"];
11556
+ hoogte_mm?: number;
11557
+ naam?: string;
11558
+ omschrijving?: string;
11559
+ page_settings?: Json;
11560
+ papierformaat?: string;
11561
+ sleutel?: string;
11562
+ updated_at?: string;
11563
+ versie?: number;
11564
+ };
11565
+ Relationships: [];
11566
+ };
11424
11567
  leave_requests: {
11425
11568
  Row: {
11426
11569
  cancellation_requested_at: string | null;
@@ -29319,6 +29462,10 @@ export type Database = {
29319
29462
  };
29320
29463
  Returns: string[][];
29321
29464
  };
29465
+ _layout_is_beheerder: {
29466
+ Args: never;
29467
+ Returns: boolean;
29468
+ };
29322
29469
  _migrate_rewrite_stock_key: {
29323
29470
  Args: {
29324
29471
  _from_key: string;
@@ -30646,6 +30793,18 @@ export type Database = {
30646
30793
  Args: never;
30647
30794
  Returns: undefined;
30648
30795
  };
30796
+ floriday_customer_candidates: {
30797
+ Args: never;
30798
+ Returns: {
30799
+ in_cache: boolean;
30800
+ organization_id: string;
30801
+ reason: string;
30802
+ }[];
30803
+ };
30804
+ floriday_customer_promotion_preview: {
30805
+ Args: never;
30806
+ Returns: Json;
30807
+ };
30649
30808
  floriday_default_owner: {
30650
30809
  Args: {
30651
30810
  p_connection_id: string;
@@ -30682,6 +30841,19 @@ export type Database = {
30682
30841
  source_id: string;
30683
30842
  }[];
30684
30843
  };
30844
+ floriday_eigen_organisatie: {
30845
+ Args: never;
30846
+ Returns: {
30847
+ adres: string;
30848
+ gln: string;
30849
+ land: string;
30850
+ naam: string;
30851
+ opgehaald_op: string;
30852
+ organisatie_id: string;
30853
+ plaats: string;
30854
+ postcode: string;
30855
+ }[];
30856
+ };
30685
30857
  floriday_erp_leading_preview: {
30686
30858
  Args: {
30687
30859
  p_connection_id: string;
@@ -30706,6 +30878,13 @@ export type Database = {
30706
30878
  Args: never;
30707
30879
  Returns: number;
30708
30880
  };
30881
+ floriday_follow_apply: {
30882
+ Args: {
30883
+ p_connection_id: string;
30884
+ p_items: Json;
30885
+ };
30886
+ Returns: Json;
30887
+ };
30709
30888
  floriday_ingest_sales_orders: {
30710
30889
  Args: {
30711
30890
  p_limit?: number;
@@ -31657,6 +31836,10 @@ export type Database = {
31657
31836
  };
31658
31837
  Returns: boolean;
31659
31838
  };
31839
+ klanten_install_check: {
31840
+ Args: never;
31841
+ Returns: Json;
31842
+ };
31660
31843
  layout_print_document: {
31661
31844
  Args: {
31662
31845
  _documentnaam: string;
@@ -31683,6 +31866,18 @@ export type Database = {
31683
31866
  status: string;
31684
31867
  }[];
31685
31868
  };
31869
+ layout_standaard_overnemen: {
31870
+ Args: {
31871
+ _layout_id: string;
31872
+ };
31873
+ Returns: Json;
31874
+ };
31875
+ layout_versie_terugzetten: {
31876
+ Args: {
31877
+ _versie_id: string;
31878
+ };
31879
+ Returns: number;
31880
+ };
31686
31881
  layout_verwijzing_omzetten: {
31687
31882
  Args: {
31688
31883
  _nieuw: string;
@@ -31696,6 +31891,10 @@ export type Database = {
31696
31891
  Args: never;
31697
31892
  Returns: Json;
31698
31893
  };
31894
+ layout_zorg_systeemlayouts: {
31895
+ Args: never;
31896
+ Returns: number;
31897
+ };
31699
31898
  list_medewerkers: {
31700
31899
  Args: never;
31701
31900
  Returns: {
@@ -32869,6 +33068,10 @@ export type Database = {
32869
33068
  };
32870
33069
  Returns: Json;
32871
33070
  };
33071
+ logistics_ensure_runtime_defaults: {
33072
+ Args: never;
33073
+ Returns: undefined;
33074
+ };
32872
33075
  logistics_ensure_shipping_notes: {
32873
33076
  Args: {
32874
33077
  p_limit?: number;
@@ -36764,6 +36967,10 @@ export type Database = {
36764
36967
  Args: never;
36765
36968
  Returns: undefined;
36766
36969
  };
36970
+ run_floriday_follow: {
36971
+ Args: never;
36972
+ Returns: undefined;
36973
+ };
36767
36974
  run_floriday_stock_queue_process: {
36768
36975
  Args: never;
36769
36976
  Returns: undefined;
@@ -38282,6 +38489,13 @@ export type Database = {
38282
38489
  Args: never;
38283
38490
  Returns: boolean;
38284
38491
  };
38492
+ voorraad_schema_ddl: {
38493
+ Args: {
38494
+ p_functions: string[];
38495
+ p_tables: string[];
38496
+ };
38497
+ Returns: string;
38498
+ };
38285
38499
  voorraad_week_is_past: {
38286
38500
  Args: {
38287
38501
  p_week: number;