@flowselections/floriday-voorraad 1.0.125 → 1.0.129
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/voorraad/NieuwArtikelPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/NieuwArtikelPage.js +2 -0
- package/dist-lib/components/voorraad/StockSyncStatus.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockSyncStatus.js +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.js +1 -1
- package/dist-lib/hooks/useLocalTradeItems.d.ts.map +1 -1
- package/dist-lib/hooks/useLocalTradeItems.js +7 -1
- package/dist-lib/hooks/useStockSyncHealth.d.ts +7 -2
- package/dist-lib/hooks/useStockSyncHealth.d.ts.map +1 -1
- package/dist-lib/hooks/useStockSyncHealth.js +28 -5
- package/dist-lib/integrations/supabase/types.d.ts +230 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/__tests__/article-code.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/article-code.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/article-code.test.js +11 -0
- package/dist-lib/lib/article-code.d.ts +12 -0
- package/dist-lib/lib/article-code.d.ts.map +1 -0
- package/dist-lib/lib/article-code.js +29 -0
- package/dist-lib/lib/floriday-payload.d.ts.map +1 -1
- package/dist-lib/lib/floriday-payload.js +3 -0
- package/dist-lib/lib/voorraad-page-head.d.ts +19 -0
- package/dist-lib/lib/voorraad-page-head.d.ts.map +1 -0
- package/dist-lib/lib/voorraad-page-head.js +11 -0
- package/package.json +1 -1
- package/sql/floriday-voorraad-schema.sql +232 -85
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NieuwArtikelPage.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/NieuwArtikelPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NieuwArtikelPage.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/NieuwArtikelPage.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,gBAAgB,gCA4X/B"}
|
|
@@ -17,6 +17,7 @@ import { LOCAL_STOCK_TEXT } from "../../lib/stock-scope.js";
|
|
|
17
17
|
import { FloridayConnectionNotice } from "./FloridayConnectionNotice.js";
|
|
18
18
|
import { useLoadCarriers } from "../../hooks/useLoadCarriers.js";
|
|
19
19
|
import { saveOwnPackings } from "../../lib/product-packings.js";
|
|
20
|
+
import { assertArticleCode } from "../../lib/article-code.js";
|
|
20
21
|
import { EMPTY_SIMPLE_PACKING, engineOordeelRegel, missingPackingFields, simplePackingToRow, } from "../../lib/simple-packing.js";
|
|
21
22
|
const STEPS = ["Naam en code", "Voorraad", "Prijs", "Belading"];
|
|
22
23
|
export function NieuwArtikelPage() {
|
|
@@ -95,6 +96,7 @@ export function NieuwArtikelPage() {
|
|
|
95
96
|
const priceNum = price.trim() === "" ? null : Number(price.replace(",", "."));
|
|
96
97
|
if (priceNum !== null && !(priceNum > 0))
|
|
97
98
|
throw new Error("Vul een geldige prijs in (groter dan 0)");
|
|
99
|
+
assertArticleCode(code, name, "manual");
|
|
98
100
|
const packingRow = simplePackingToRow(packing);
|
|
99
101
|
let id = insertedIdRef.current;
|
|
100
102
|
if (!id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StockSyncStatus.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockSyncStatus.tsx"],"names":[],"mappings":"AAeA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"StockSyncStatus.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockSyncStatus.tsx"],"names":[],"mappings":"AAeA,wBAAgB,eAAe,uCA8H9B"}
|
|
@@ -44,5 +44,5 @@ export function StockSyncStatus() {
|
|
|
44
44
|
if (stalePending > 0) {
|
|
45
45
|
parts.push(`${stalePending} wacht${stalePending === 1 ? "" : "en"} langer dan 10 minuten`);
|
|
46
46
|
}
|
|
47
|
-
return (_jsxs("div", { className: "flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-800", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { className: "flex-1 space-y-0.5", children: [parts.length > 0 && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Voorraadsync naar Floriday: " }), parts.join(" · "), " (laatste 24 uur), voor ", articleCount, " artikel", articleCount === 1 ? "" : "en", ".", oldestPendingAt && (_jsxs("span", { className: "opacity-80", children: [" ", "Oudste wachtende regel: ", new Date(oldestPendingAt).toLocaleString("nl-NL"), "."] }))] })), cause && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Oorzaak: " }), cause] })), blockedCount > 0 && (_jsxs("div", { className: "space-y-0.5", children: [_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Wacht op Floriday \u2013 verpakkingsverschil: " }), blockedCount, " artikel", blockedCount === 1 ? "" : "en", " tegengehouden."] }), _jsxs("ul", { className: "list-disc pl-5 text-xs", children: [blocked.map((b) => (_jsx("li", { children: _jsx(Link, { to: "/voorraad/$id", params: { id: b.productId }, className: "underline hover:no-underline", children: gateBlockedText({ name: b.name, code: b.code }) }) }, b.productId))), data.blockedWithoutProduct > 0 && (_jsxs("li", { children: [data.blockedWithoutProduct, " Floriday-artikel", data.blockedWithoutProduct === 1 ? "" : "en", " zonder lokaal artikel"] }))] })] })), topReason && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Meest voorkomende reden: " }), topReason, "."] })), noPriceCount > 0 && (_jsxs("div", { className: "opacity-90", children: [noPriceCount, " van deze artikelen ", noPriceCount === 1 ? "heeft" : "hebben", " nog geen prijs in het weekaanbod; het aantal wordt dan zonder prijs doorgezet."] }))] }), failed > 0 && (_jsxs("button", { type: "button", className: "inline-flex shrink-0 items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-900 hover:bg-amber-500/20 disabled:opacity-50", disabled: mutation.isPending, onClick: () => mutation.mutate(), children: [_jsx(RotateCw, { className: `mr-1 h-3.5 w-3.5 ${mutation.isPending ? "animate-spin" : ""}` }), "Opnieuw proberen"] }))] }));
|
|
47
|
+
return (_jsxs("div", { className: "flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-800", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { className: "flex-1 space-y-0.5", children: [parts.length > 0 && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Voorraadsync naar Floriday: " }), parts.join(" · "), " (laatste 24 uur), voor ", articleCount, " artikel", articleCount === 1 ? "" : "en", ".", oldestPendingAt && (_jsxs("span", { className: "opacity-80", children: [" ", "Oudste wachtende regel: ", new Date(oldestPendingAt).toLocaleString("nl-NL"), "."] }))] })), cause && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Oorzaak: " }), cause] })), blockedCount > 0 && (_jsxs("div", { className: "space-y-0.5", children: [_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Wacht op Floriday \u2013 verpakkingsverschil: " }), blockedCount, " artikel", blockedCount === 1 ? "" : "en", " tegengehouden."] }), _jsxs("ul", { className: "list-disc pl-5 text-xs", children: [blocked.map((b) => (_jsx("li", { children: _jsx(Link, { to: "/voorraad/$id", params: { id: b.productId }, className: "underline hover:no-underline", children: gateBlockedText({ name: b.name, code: b.code }) }) }, b.productId))), data.blockedWithoutProduct > 0 && (_jsxs("li", { children: [data.blockedWithoutProduct, " Floriday-artikel", data.blockedWithoutProduct === 1 ? "" : "en", " zonder lokaal artikel"] }))] }), data.blockedOther.length > 0 && (_jsxs("div", { className: "mt-1", children: [_jsx("span", { className: "font-medium", children: "Ook tegengehouden (geen artikel): " }), data.blockedOther.map((o) => `${o.kind}: ${o.ref ?? "onbekend"}`).join(" · ")] }))] })), topReason && (_jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Meest voorkomende reden: " }), topReason, "."] })), noPriceCount > 0 && (_jsxs("div", { className: "opacity-90", children: [noPriceCount, " van deze artikelen ", noPriceCount === 1 ? "heeft" : "hebben", " nog geen prijs in het weekaanbod; het aantal wordt dan zonder prijs doorgezet."] }))] }), failed > 0 && (_jsxs("button", { type: "button", className: "inline-flex shrink-0 items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-900 hover:bg-amber-500/20 disabled:opacity-50", disabled: mutation.isPending, onClick: () => mutation.mutate(), children: [_jsx(RotateCw, { className: `mr-1 h-3.5 w-3.5 ${mutation.isPending ? "animate-spin" : ""}` }), "Opnieuw proberen"] }))] }));
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoorraadTable.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/VoorraadTable.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAgFzE,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,cAAc,GACf,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,+
|
|
1
|
+
{"version":3,"file":"VoorraadTable.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/VoorraadTable.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAgFzE,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE3D;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,cAAc,GACf,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,+BAoUA"}
|
|
@@ -155,7 +155,7 @@ export function VoorraadTable({ items, loading, settingsByKey, selected, onToggl
|
|
|
155
155
|
open();
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
: undefined, "aria-label": clickable ? `Bewerk ${item.name}` : undefined, children: [onToggleSelect && (_jsx("td", { className: "p-3", onClick: (e) => e.stopPropagation(), children: _jsx(Checkbox, { checked: settingProductId ? selected?.has(settingProductId) : false, disabled: !settingProductId, onCheckedChange: () => settingProductId && onToggleSelect(settingProductId), "aria-label": `Selecteer ${item.name}` }) })), _jsx("td", { className: "p-2", children: thumbUrl ? (_jsx("img", { src: thumbUrl, alt: item.name, className: "h-10 w-10 rounded object-cover", loading: "lazy" })) : (_jsx("div", { className: "h-10 w-10 rounded bg-muted flex items-center justify-center", children: _jsx(Package, { className: "h-4 w-4 text-muted-foreground" }) })) }), _jsxs("td", { className: "p-3", children: [_jsxs("div", { className: "flex flex-col items-start gap-1", children: [_jsx("span", { className: "font-medium text-foreground", children: item.name }), item.productId && incompletePacking.has(item.productId) && (
|
|
158
|
+
: undefined, "aria-label": clickable ? `Bewerk ${item.name}` : undefined, children: [onToggleSelect && (_jsx("td", { className: "p-3", onClick: (e) => e.stopPropagation(), children: _jsx(Checkbox, { checked: settingProductId ? selected?.has(settingProductId) : false, disabled: !settingProductId, onCheckedChange: () => settingProductId && onToggleSelect(settingProductId), "aria-label": `Selecteer ${item.name}` }) })), _jsx("td", { className: "p-2", children: thumbUrl ? (_jsx("img", { src: thumbUrl, alt: item.name, className: "h-10 w-10 rounded object-cover", loading: "lazy" })) : (_jsx("div", { className: "h-10 w-10 rounded bg-muted flex items-center justify-center", children: _jsx(Package, { className: "h-4 w-4 text-muted-foreground" }) })) }), _jsxs("td", { className: "p-3", children: [_jsxs("div", { className: "flex flex-col items-start gap-1", children: [_jsx("span", { className: "font-medium text-foreground", children: item.name }), item.productId && incompletePacking.has(item.productId) && (_jsxs("span", { className: "text-[11px] font-medium text-destructive", children: [PACKING_INCOMPLETE_TEXT, item.linkError && _jsx("span", { className: "block", children: item.linkError })] })), _jsxs("div", { role: "status", "aria-label": floriday
|
|
159
159
|
? "Online in Floriday"
|
|
160
160
|
: "Niet online in Floriday", title: floriday
|
|
161
161
|
? "Online in Floriday"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalTradeItems.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocalTradeItems.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAwB,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useLocalTradeItems.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocalTradeItems.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAwB,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIvG;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uBAAuB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AA0ED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;;;;EA0B9D;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CA4BrF;AAED,MAAM,WAAW,SAAS;IACxB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,QAAQ,GAAG,cAAc,CAAC;CACpC;AAED,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAWjF;AAqBD,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iFAAiF;IACjF,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuGlB;AAED,wEAAwE;AACxE,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAqBf;AAGD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhF;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { supabase } from "../integrations/supabase/client.js";
|
|
3
3
|
import { derivePrimaryPacking } from "../lib/floriday-client.js";
|
|
4
|
+
import { assertArticleCode } from "../lib/article-code.js";
|
|
4
5
|
function asRecord(value) {
|
|
5
6
|
return value && typeof value === "object" && !Array.isArray(value)
|
|
6
7
|
? value
|
|
@@ -41,7 +42,9 @@ function productToTradeItem(row) {
|
|
|
41
42
|
published: Boolean(floridayId),
|
|
42
43
|
linkStatus: floridayId ? "published" : "linked",
|
|
43
44
|
missingFields: [],
|
|
44
|
-
linkError:
|
|
45
|
+
linkError: cf.voorraad_packing_link?.ok === false
|
|
46
|
+
? String(cf.voorraad_packing_link.melding ?? "Hoofdverpakking niet overgenomen")
|
|
47
|
+
: null,
|
|
45
48
|
lastSyncAt: null,
|
|
46
49
|
floridayId,
|
|
47
50
|
packingConfigurations,
|
|
@@ -148,6 +151,9 @@ export async function upsertLocalTradeItem(params) {
|
|
|
148
151
|
if (!userId)
|
|
149
152
|
throw new Error("Niet ingelogd");
|
|
150
153
|
const payload = params.data ?? {};
|
|
154
|
+
// Handmatig opslaan in het scherm: invultekst of code gelijk aan naam weigeren (concept mag nog leeg zijn).
|
|
155
|
+
if ((payload.articleCode ?? "").trim())
|
|
156
|
+
assertArticleCode(payload.articleCode, payload.name, "manual");
|
|
151
157
|
const linkedProductId = typeof payload.linkedProductId === "string" && payload.linkedProductId
|
|
152
158
|
? String(payload.linkedProductId)
|
|
153
159
|
: null;
|
|
@@ -13,8 +13,13 @@ export interface StockSyncHealth {
|
|
|
13
13
|
blocked: BlockedArticle[];
|
|
14
14
|
/** Tegengehouden artikelen zonder bekend lokaal artikel. */
|
|
15
15
|
blockedWithoutProduct: number;
|
|
16
|
-
/** Bron van de telling: Floriday-auth of (oude bron) de wachtrij. */
|
|
17
|
-
blockedSource: "floriday-auth" | "wachtrij";
|
|
16
|
+
/** Bron van de telling: Floriday-auth (v2 of v1) of (oude bron) de wachtrij. */
|
|
17
|
+
blockedSource: "floriday-auth-v2" | "floriday-auth" | "wachtrij";
|
|
18
|
+
/** v2: tegengehouden bronnen die geen artikel zijn (bv. verkooporder), met source_ref. */
|
|
19
|
+
blockedOther: {
|
|
20
|
+
kind: string;
|
|
21
|
+
ref: string | null;
|
|
22
|
+
}[];
|
|
18
23
|
}
|
|
19
24
|
export interface BlockedArticle {
|
|
20
25
|
productId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStockSyncHealth.d.ts","sourceRoot":"","sources":["../../src/hooks/useStockSyncHealth.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kEAAkE;IAClE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"useStockSyncHealth.d.ts","sourceRoot":"","sources":["../../src/hooks/useStockSyncHealth.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kEAAkE;IAClE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,4DAA4D;IAC5D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gFAAgF;IAChF,aAAa,EAAE,kBAAkB,GAAG,eAAe,GAAG,UAAU,CAAC;IACjE,0FAA0F;IAC1F,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED,wBAAgB,kBAAkB,2EA2KjC"}
|
|
@@ -92,16 +92,38 @@ export function useStockSyncHealth() {
|
|
|
92
92
|
const ctxRow = Array.isArray(ctx) ? ctx[0] : ctx;
|
|
93
93
|
const connectionId = ctxRow?.connection_id ?? null;
|
|
94
94
|
let viaAuth = false;
|
|
95
|
+
const blockedOther = [];
|
|
95
96
|
if (connectionId) {
|
|
96
|
-
|
|
97
|
+
// v2 (source_kind/source_ref/source_paths) alleen als die bestaat; anders v1.
|
|
98
|
+
let { data: items, error: itemsErr } = await supabase.rpc("floriday_packing_blocked_items_v2", {
|
|
97
99
|
p_connection_id: connectionId,
|
|
98
100
|
});
|
|
101
|
+
let isV2 = !itemsErr;
|
|
102
|
+
if (itemsErr && isMissingFunctionError(itemsErr)) {
|
|
103
|
+
({ data: items, error: itemsErr } = await supabase.rpc("floriday_packing_blocked_items", {
|
|
104
|
+
p_connection_id: connectionId,
|
|
105
|
+
}));
|
|
106
|
+
isV2 = false;
|
|
107
|
+
}
|
|
99
108
|
if (!itemsErr) {
|
|
100
109
|
viaAuth = true;
|
|
101
|
-
blockedSource = "floriday-auth";
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
blockedSource = isV2 ? "floriday-auth-v2" : "floriday-auth";
|
|
111
|
+
// Match uitsluitend op trade_item_id; alleen lezen. In v2 telt alleen source_kind='artikel'.
|
|
112
|
+
let all = (items ?? []);
|
|
113
|
+
if (isV2) {
|
|
114
|
+
const seenOther = new Set();
|
|
115
|
+
for (const r of all) {
|
|
116
|
+
if (r?.source_kind === "artikel")
|
|
117
|
+
continue;
|
|
118
|
+
const key = `${r?.source_kind}|${r?.source_ref}`;
|
|
119
|
+
if (seenOther.has(key))
|
|
120
|
+
continue;
|
|
121
|
+
seenOther.add(key);
|
|
122
|
+
blockedOther.push({ kind: String(r?.source_kind ?? "onbekend"), ref: r?.source_ref ?? null });
|
|
123
|
+
}
|
|
124
|
+
all = all.filter((r) => r?.source_kind === "artikel");
|
|
125
|
+
}
|
|
126
|
+
const rows = all.filter((r) => r?.trade_item_id);
|
|
105
127
|
const tradeIds = Array.from(new Set(rows.map((r) => String(r.trade_item_id))));
|
|
106
128
|
const prodByTrade = new Map();
|
|
107
129
|
if (tradeIds.length) {
|
|
@@ -161,6 +183,7 @@ export function useStockSyncHealth() {
|
|
|
161
183
|
blocked,
|
|
162
184
|
blockedWithoutProduct: gateNoProduct,
|
|
163
185
|
blockedSource,
|
|
186
|
+
blockedOther,
|
|
164
187
|
};
|
|
165
188
|
},
|
|
166
189
|
});
|
|
@@ -26298,6 +26298,72 @@ export type Database = {
|
|
|
26298
26298
|
}
|
|
26299
26299
|
];
|
|
26300
26300
|
};
|
|
26301
|
+
twinfield_invoice_mail_queue: {
|
|
26302
|
+
Row: {
|
|
26303
|
+
attempts: number;
|
|
26304
|
+
cc_addresses: string[];
|
|
26305
|
+
connection_id: string;
|
|
26306
|
+
created_at: string;
|
|
26307
|
+
group_key: string;
|
|
26308
|
+
id: string;
|
|
26309
|
+
invoice_number: string;
|
|
26310
|
+
last_error: string | null;
|
|
26311
|
+
mailbox_connection_id: string | null;
|
|
26312
|
+
next_attempt_at: string;
|
|
26313
|
+
purpose: string;
|
|
26314
|
+
sent_at: string | null;
|
|
26315
|
+
status: string;
|
|
26316
|
+
subject: string;
|
|
26317
|
+
test_mode: boolean;
|
|
26318
|
+
text_body: string;
|
|
26319
|
+
to_addresses: string[];
|
|
26320
|
+
updated_at: string;
|
|
26321
|
+
user_id: string;
|
|
26322
|
+
};
|
|
26323
|
+
Insert: {
|
|
26324
|
+
attempts?: number;
|
|
26325
|
+
cc_addresses?: string[];
|
|
26326
|
+
connection_id: string;
|
|
26327
|
+
created_at?: string;
|
|
26328
|
+
group_key: string;
|
|
26329
|
+
id?: string;
|
|
26330
|
+
invoice_number: string;
|
|
26331
|
+
last_error?: string | null;
|
|
26332
|
+
mailbox_connection_id?: string | null;
|
|
26333
|
+
next_attempt_at?: string;
|
|
26334
|
+
purpose: string;
|
|
26335
|
+
sent_at?: string | null;
|
|
26336
|
+
status?: string;
|
|
26337
|
+
subject: string;
|
|
26338
|
+
test_mode?: boolean;
|
|
26339
|
+
text_body: string;
|
|
26340
|
+
to_addresses: string[];
|
|
26341
|
+
updated_at?: string;
|
|
26342
|
+
user_id: string;
|
|
26343
|
+
};
|
|
26344
|
+
Update: {
|
|
26345
|
+
attempts?: number;
|
|
26346
|
+
cc_addresses?: string[];
|
|
26347
|
+
connection_id?: string;
|
|
26348
|
+
created_at?: string;
|
|
26349
|
+
group_key?: string;
|
|
26350
|
+
id?: string;
|
|
26351
|
+
invoice_number?: string;
|
|
26352
|
+
last_error?: string | null;
|
|
26353
|
+
mailbox_connection_id?: string | null;
|
|
26354
|
+
next_attempt_at?: string;
|
|
26355
|
+
purpose?: string;
|
|
26356
|
+
sent_at?: string | null;
|
|
26357
|
+
status?: string;
|
|
26358
|
+
subject?: string;
|
|
26359
|
+
test_mode?: boolean;
|
|
26360
|
+
text_body?: string;
|
|
26361
|
+
to_addresses?: string[];
|
|
26362
|
+
updated_at?: string;
|
|
26363
|
+
user_id?: string;
|
|
26364
|
+
};
|
|
26365
|
+
Relationships: [];
|
|
26366
|
+
};
|
|
26301
26367
|
twinfield_invoice_pdf_cache: {
|
|
26302
26368
|
Row: {
|
|
26303
26369
|
connection_id: string;
|
|
@@ -28527,6 +28593,21 @@ export type Database = {
|
|
|
28527
28593
|
};
|
|
28528
28594
|
Relationships: [];
|
|
28529
28595
|
};
|
|
28596
|
+
voorraad_placeholder_codes: {
|
|
28597
|
+
Row: {
|
|
28598
|
+
code: string;
|
|
28599
|
+
created_at: string;
|
|
28600
|
+
};
|
|
28601
|
+
Insert: {
|
|
28602
|
+
code: string;
|
|
28603
|
+
created_at?: string;
|
|
28604
|
+
};
|
|
28605
|
+
Update: {
|
|
28606
|
+
code?: string;
|
|
28607
|
+
created_at?: string;
|
|
28608
|
+
};
|
|
28609
|
+
Relationships: [];
|
|
28610
|
+
};
|
|
28530
28611
|
voorraad_publish_attempts: {
|
|
28531
28612
|
Row: {
|
|
28532
28613
|
action: string;
|
|
@@ -33090,6 +33171,26 @@ export type Database = {
|
|
|
33090
33171
|
trade_item_id: string;
|
|
33091
33172
|
}[];
|
|
33092
33173
|
};
|
|
33174
|
+
floriday_packing_blocked_items_v2: {
|
|
33175
|
+
Args: {
|
|
33176
|
+
p_connection_id: string;
|
|
33177
|
+
};
|
|
33178
|
+
Returns: {
|
|
33179
|
+
article_code: string;
|
|
33180
|
+
article_name: string;
|
|
33181
|
+
blocked_attempts: number;
|
|
33182
|
+
blocked_by: string;
|
|
33183
|
+
details: string;
|
|
33184
|
+
last_blocked_at: string;
|
|
33185
|
+
mismatch_id: string;
|
|
33186
|
+
reason: string;
|
|
33187
|
+
since: string;
|
|
33188
|
+
source_kind: string;
|
|
33189
|
+
source_paths: string[];
|
|
33190
|
+
source_ref: string;
|
|
33191
|
+
trade_item_id: string;
|
|
33192
|
+
}[];
|
|
33193
|
+
};
|
|
33093
33194
|
floriday_publish_horizon_weeks: {
|
|
33094
33195
|
Args: never;
|
|
33095
33196
|
Returns: number;
|
|
@@ -35090,6 +35191,12 @@ export type Database = {
|
|
|
35090
35191
|
};
|
|
35091
35192
|
Returns: Json;
|
|
35092
35193
|
};
|
|
35194
|
+
logistics_cart_plan_status_slim: {
|
|
35195
|
+
Args: {
|
|
35196
|
+
p_ref: string;
|
|
35197
|
+
};
|
|
35198
|
+
Returns: Json;
|
|
35199
|
+
};
|
|
35093
35200
|
logistics_cart_platen_verrijk: {
|
|
35094
35201
|
Args: {
|
|
35095
35202
|
p_cart: Json;
|
|
@@ -35211,6 +35318,18 @@ export type Database = {
|
|
|
35211
35318
|
};
|
|
35212
35319
|
Returns: boolean;
|
|
35213
35320
|
};
|
|
35321
|
+
logistics_cart_verouderd_core: {
|
|
35322
|
+
Args: {
|
|
35323
|
+
p_cart_id: string;
|
|
35324
|
+
};
|
|
35325
|
+
Returns: Json;
|
|
35326
|
+
};
|
|
35327
|
+
logistics_cart_vulgraad_core: {
|
|
35328
|
+
Args: {
|
|
35329
|
+
p_cart_id: string;
|
|
35330
|
+
};
|
|
35331
|
+
Returns: number;
|
|
35332
|
+
};
|
|
35214
35333
|
logistics_cart_wait_until: {
|
|
35215
35334
|
Args: {
|
|
35216
35335
|
p_cart_id: string;
|
|
@@ -36165,6 +36284,22 @@ export type Database = {
|
|
|
36165
36284
|
uitleg: string;
|
|
36166
36285
|
}[];
|
|
36167
36286
|
};
|
|
36287
|
+
logistics_install_check_208: {
|
|
36288
|
+
Args: never;
|
|
36289
|
+
Returns: {
|
|
36290
|
+
ok: boolean;
|
|
36291
|
+
punt: string;
|
|
36292
|
+
uitleg: string;
|
|
36293
|
+
}[];
|
|
36294
|
+
};
|
|
36295
|
+
logistics_install_check_210: {
|
|
36296
|
+
Args: never;
|
|
36297
|
+
Returns: {
|
|
36298
|
+
ok: boolean;
|
|
36299
|
+
punt: string;
|
|
36300
|
+
uitleg: string;
|
|
36301
|
+
}[];
|
|
36302
|
+
};
|
|
36168
36303
|
logistics_is_beheer: {
|
|
36169
36304
|
Args: never;
|
|
36170
36305
|
Returns: boolean;
|
|
@@ -36203,6 +36338,21 @@ export type Database = {
|
|
|
36203
36338
|
};
|
|
36204
36339
|
Returns: Json;
|
|
36205
36340
|
};
|
|
36341
|
+
logistics_kar_blokkade_vul: {
|
|
36342
|
+
Args: {
|
|
36343
|
+
p_kar: string;
|
|
36344
|
+
p_vul: number;
|
|
36345
|
+
};
|
|
36346
|
+
Returns: Json;
|
|
36347
|
+
};
|
|
36348
|
+
logistics_kar_tekst: {
|
|
36349
|
+
Args: {
|
|
36350
|
+
p_carrier_code: string;
|
|
36351
|
+
p_lagen: number;
|
|
36352
|
+
p_pct: number;
|
|
36353
|
+
};
|
|
36354
|
+
Returns: string;
|
|
36355
|
+
};
|
|
36206
36356
|
logistics_key_product: {
|
|
36207
36357
|
Args: {
|
|
36208
36358
|
p_key: string;
|
|
@@ -36240,6 +36390,20 @@ export type Database = {
|
|
|
36240
36390
|
Args: never;
|
|
36241
36391
|
Returns: Json;
|
|
36242
36392
|
};
|
|
36393
|
+
logistics_laag_tolerantie: {
|
|
36394
|
+
Args: never;
|
|
36395
|
+
Returns: number;
|
|
36396
|
+
};
|
|
36397
|
+
logistics_laag_tolerantie_tekst: {
|
|
36398
|
+
Args: {
|
|
36399
|
+
p_fl: number;
|
|
36400
|
+
p_fw: number;
|
|
36401
|
+
p_ll: number;
|
|
36402
|
+
p_lw: number;
|
|
36403
|
+
p_n: number;
|
|
36404
|
+
};
|
|
36405
|
+
Returns: string;
|
|
36406
|
+
};
|
|
36243
36407
|
logistics_ladingdrager_referentie: {
|
|
36244
36408
|
Args: never;
|
|
36245
36409
|
Returns: {
|
|
@@ -36249,6 +36413,12 @@ export type Database = {
|
|
|
36249
36413
|
lengte_cm: number;
|
|
36250
36414
|
}[];
|
|
36251
36415
|
};
|
|
36416
|
+
logistics_ladingdrager_resolve: {
|
|
36417
|
+
Args: {
|
|
36418
|
+
p_code: string;
|
|
36419
|
+
};
|
|
36420
|
+
Returns: Json;
|
|
36421
|
+
};
|
|
36252
36422
|
logistics_ladingdrager_tekst: {
|
|
36253
36423
|
Args: {
|
|
36254
36424
|
p_carrier_code: string;
|
|
@@ -36324,6 +36494,22 @@ export type Database = {
|
|
|
36324
36494
|
};
|
|
36325
36495
|
Returns: number;
|
|
36326
36496
|
};
|
|
36497
|
+
logistics_max_fusten_per_laag_alle: {
|
|
36498
|
+
Args: {
|
|
36499
|
+
p_fust_b: number;
|
|
36500
|
+
p_fust_l: number;
|
|
36501
|
+
};
|
|
36502
|
+
Returns: number;
|
|
36503
|
+
};
|
|
36504
|
+
logistics_max_fusten_per_laag_strikt: {
|
|
36505
|
+
Args: {
|
|
36506
|
+
p_fl: number;
|
|
36507
|
+
p_fw: number;
|
|
36508
|
+
p_ll: number;
|
|
36509
|
+
p_lw: number;
|
|
36510
|
+
};
|
|
36511
|
+
Returns: number;
|
|
36512
|
+
};
|
|
36327
36513
|
logistics_merge_decision: {
|
|
36328
36514
|
Args: {
|
|
36329
36515
|
p_lines: Json;
|
|
@@ -37026,6 +37212,12 @@ export type Database = {
|
|
|
37026
37212
|
Args: never;
|
|
37027
37213
|
Returns: boolean;
|
|
37028
37214
|
};
|
|
37215
|
+
logistics_pick_cart_breakdown_fast: {
|
|
37216
|
+
Args: {
|
|
37217
|
+
_order_id: string;
|
|
37218
|
+
};
|
|
37219
|
+
Returns: Json;
|
|
37220
|
+
};
|
|
37029
37221
|
logistics_pick_email_purpose: {
|
|
37030
37222
|
Args: never;
|
|
37031
37223
|
Returns: string;
|
|
@@ -37422,6 +37614,12 @@ export type Database = {
|
|
|
37422
37614
|
};
|
|
37423
37615
|
Returns: Json;
|
|
37424
37616
|
};
|
|
37617
|
+
logistics_product_hoofdverpakking: {
|
|
37618
|
+
Args: {
|
|
37619
|
+
p_product_id: string;
|
|
37620
|
+
};
|
|
37621
|
+
Returns: Json;
|
|
37622
|
+
};
|
|
37425
37623
|
logistics_product_maten: {
|
|
37426
37624
|
Args: {
|
|
37427
37625
|
p_product_ids: string[];
|
|
@@ -43818,6 +44016,18 @@ export type Database = {
|
|
|
43818
44016
|
};
|
|
43819
44017
|
Returns: Json;
|
|
43820
44018
|
};
|
|
44019
|
+
voorraad_correctie_1126: {
|
|
44020
|
+
Args: {
|
|
44021
|
+
p_uitvoeren?: boolean;
|
|
44022
|
+
};
|
|
44023
|
+
Returns: Json;
|
|
44024
|
+
};
|
|
44025
|
+
voorraad_correctie_1127: {
|
|
44026
|
+
Args: {
|
|
44027
|
+
p_uitvoeren?: boolean;
|
|
44028
|
+
};
|
|
44029
|
+
Returns: Json;
|
|
44030
|
+
};
|
|
43821
44031
|
voorraad_correctie_status: {
|
|
43822
44032
|
Args: {
|
|
43823
44033
|
p_correctie?: string;
|
|
@@ -43908,6 +44118,26 @@ export type Database = {
|
|
|
43908
44118
|
};
|
|
43909
44119
|
Returns: boolean;
|
|
43910
44120
|
};
|
|
44121
|
+
voorraad_packing_from_floriday: {
|
|
44122
|
+
Args: {
|
|
44123
|
+
p_product_id: string;
|
|
44124
|
+
p_uitvoeren: boolean;
|
|
44125
|
+
};
|
|
44126
|
+
Returns: Json;
|
|
44127
|
+
};
|
|
44128
|
+
voorraad_packing_missing: {
|
|
44129
|
+
Args: {
|
|
44130
|
+
p_packing: Json;
|
|
44131
|
+
};
|
|
44132
|
+
Returns: string[];
|
|
44133
|
+
};
|
|
44134
|
+
voorraad_placeholder_code_reason: {
|
|
44135
|
+
Args: {
|
|
44136
|
+
p_code: string;
|
|
44137
|
+
p_name: string;
|
|
44138
|
+
};
|
|
44139
|
+
Returns: string;
|
|
44140
|
+
};
|
|
43911
44141
|
voorraad_production_enabled: {
|
|
43912
44142
|
Args: never;
|
|
43913
44143
|
Returns: boolean;
|