@flowselections/floriday-voorraad 1.0.71 → 1.0.73
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/FloridaySentCard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/FloridaySentCard.js +11 -3
- package/dist-lib/integrations/supabase/types.d.ts +925 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/base-supply-reader.server.d.ts +1 -0
- package/dist-lib/lib/base-supply-reader.server.d.ts.map +1 -1
- package/dist-lib/lib/base-supply-reader.server.js +4 -0
- package/dist-lib/lib/stock-sync.functions.d.ts +1 -1
- package/dist-lib/lib/stock-sync.functions.d.ts.map +1 -1
- package/dist-lib/lib/stock-sync.functions.js +17 -1
- package/dist-lib/server-hooks/floriday-base-supply.d.ts.map +1 -1
- package/dist-lib/server-hooks/floriday-base-supply.js +32 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloridaySentCard.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/FloridaySentCard.tsx"],"names":[],"mappings":"AAWA,KAAK,GAAG,GAAG;IACT,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,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AG,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC,GAAG,MAAM,CA0BxI;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,GACZ,EAAE;IACD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,+BA+IA"}
|
|
@@ -48,6 +48,7 @@ export function resultText(r) {
|
|
|
48
48
|
export function FloridaySentCard({ connectionId, productId, tradeItemId, productType, }) {
|
|
49
49
|
const [rows, setRows] = useState([]);
|
|
50
50
|
const [weekPrice, setWeekPrice] = useState({});
|
|
51
|
+
const [weekChange, setWeekChange] = useState({});
|
|
51
52
|
const [reason, setReason] = useState(null);
|
|
52
53
|
useEffect(() => {
|
|
53
54
|
if (!connectionId || (!productId && !tradeItemId))
|
|
@@ -83,17 +84,22 @@ export function FloridaySentCard({ connectionId, productId, tradeItemId, product
|
|
|
83
84
|
// (latere aantal-wijzigingen sturen geen prijs; die blijft in Floriday staan).
|
|
84
85
|
const { data: priced } = await supabase
|
|
85
86
|
.from("floriday_continuous_stock_queue")
|
|
86
|
-
.select("target_year,target_week,price_sent,updated_at")
|
|
87
|
+
.select("target_year,target_week,price_sent,price_previous,updated_at")
|
|
87
88
|
.eq("connection_id", connectionId)
|
|
88
89
|
.or(ors)
|
|
89
90
|
.not("price_sent", "is", null)
|
|
90
91
|
.order("updated_at", { ascending: false })
|
|
91
92
|
.limit(100);
|
|
92
93
|
const wp = {};
|
|
94
|
+
const wc = {};
|
|
93
95
|
for (const r of (priced ?? [])) {
|
|
94
96
|
const k = `${r.target_year ?? ""}-${r.target_week ?? ""}`;
|
|
95
|
-
if (!(k in wp))
|
|
97
|
+
if (!(k in wp)) {
|
|
96
98
|
wp[k] = Number(r.price_sent);
|
|
99
|
+
// M27: het ERP heeft een andere prijs in Floriday overschreven.
|
|
100
|
+
if (r.price_previous != null && Math.abs(Number(r.price_previous) - Number(r.price_sent)) > 0.0005)
|
|
101
|
+
wc[k] = `Prijs in Floriday aangepast van € ${Number(r.price_previous).toFixed(2)} naar € ${Number(r.price_sent).toFixed(2)}`;
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
// M26: werkelijke reden bij "Prijs ontbreekt" uit het artikel zelf.
|
|
99
105
|
let why = null;
|
|
@@ -106,6 +112,7 @@ export function FloridaySentCard({ connectionId, productId, tradeItemId, product
|
|
|
106
112
|
if (cancelled)
|
|
107
113
|
return;
|
|
108
114
|
setWeekPrice(wp);
|
|
115
|
+
setWeekChange(wc);
|
|
109
116
|
setReason(why);
|
|
110
117
|
})();
|
|
111
118
|
return () => {
|
|
@@ -115,5 +122,6 @@ export function FloridaySentCard({ connectionId, productId, tradeItemId, product
|
|
|
115
122
|
return (_jsx(Card, { children: _jsxs(CardContent, { className: "space-y-3 p-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Send, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium", children: "Laatst naar Floriday" })] }), _jsxs("p", { className: "text-xs text-muted-foreground break-all", children: ["Floriday-id: ", tradeItemId ? _jsx("span", { className: "font-mono", children: tradeItemId }) : "nog niet gekoppeld"] }), (productType === "GROUP" || productType === "SET" || productType === "COMPOSITION") && (_jsx("p", { className: "text-xs text-muted-foreground", children: "Productgroep (ERP): leden met eigen voorraad; alleen het totaal gaat naar Floriday. Set (Floriday): \u00E9\u00E9n artikel samengesteld uit onderdelen; de voorraad gaat pas naar Floriday na akkoord." })), rows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog niets naar Floriday gestuurd." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-xs", children: [_jsx("thead", { className: "text-left text-muted-foreground", children: _jsxs("tr", { children: [_jsx("th", { className: "py-1 pr-3", children: "Week" }), _jsx("th", { className: "py-1 pr-3 text-right", children: "Aantal" }), _jsx("th", { className: "py-1 pr-3 text-right", children: "Prijs (excl. btw)" }), _jsx("th", { className: "py-1 pr-3", children: "Modus" }), _jsx("th", { className: "py-1 pr-3", children: "Tijd" }), _jsx("th", { className: "py-1", children: "Resultaat" })] }) }), _jsx("tbody", { children: rows.map((r) => (_jsxs("tr", { className: "border-t align-top", children: [_jsx("td", { className: "py-1 pr-3 whitespace-nowrap", children: r.target_week ? `${r.target_year}-${r.target_week}` : "—" }), _jsx("td", { className: "py-1 pr-3 text-right tabular-nums", children: r.number_of_pieces ?? "—" }), _jsx("td", { className: "py-1 pr-3 text-right tabular-nums", children: (() => {
|
|
116
123
|
const p = r.price_sent ?? weekPrice[`${r.target_year ?? ""}-${r.target_week ?? ""}`];
|
|
117
124
|
return p != null ? `€ ${Number(p).toFixed(2)}` : "—";
|
|
118
|
-
})() }), _jsx("td", { className: "py-1 pr-3 whitespace-nowrap", children: r.stock_mode ? MODE_LABEL[r.stock_mode] ?? r.stock_mode : "—" }), _jsx("td", { className: "py-1 pr-3 whitespace-nowrap", children: new Date(r.sent_at ?? r.updated_at).toLocaleString("nl-NL") }), _jsxs("td", { className: "py-1", children: [r.status === "skipped_no_price" && reason ? reason : resultText(r), r.
|
|
125
|
+
})() }), _jsx("td", { className: "py-1 pr-3 whitespace-nowrap", children: r.stock_mode ? MODE_LABEL[r.stock_mode] ?? r.stock_mode : "—" }), _jsx("td", { className: "py-1 pr-3 whitespace-nowrap", children: new Date(r.sent_at ?? r.updated_at).toLocaleString("nl-NL") }), _jsxs("td", { className: "py-1", children: [r.status === "skipped_no_price" && reason ? reason : resultText(r), weekChange[`${r.target_year ?? ""}-${r.target_week ?? ""}`] &&
|
|
126
|
+
weekChange[`${r.target_year ?? ""}-${r.target_week ?? ""}`] !== resultText(r) && (_jsx("div", { className: "text-xs text-muted-foreground", children: weekChange[`${r.target_year ?? ""}-${r.target_week ?? ""}`] })), r.price_note && r.price_note !== resultText(r) && (_jsx("div", { className: "text-xs text-muted-foreground", children: r.price_note }))] })] }, r.id))) })] }) }))] }) }));
|
|
119
127
|
}
|