@flowselections/floriday-voorraad 1.0.103 → 1.0.108
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/ArtikelWizard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ArtikelWizard.js +3 -2
- package/dist-lib/components/voorraad/FloridayLoadCarriers.d.ts +9 -0
- package/dist-lib/components/voorraad/FloridayLoadCarriers.d.ts.map +1 -0
- package/dist-lib/components/voorraad/FloridayLoadCarriers.js +60 -0
- package/dist-lib/components/voorraad/FustenPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/FustenPage.js +14 -6
- package/dist-lib/components/voorraad/NieuwArtikelPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/NieuwArtikelPage.js +10 -6
- package/dist-lib/components/voorraad/StockBulkButtons.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockBulkButtons.js +3 -6
- package/dist-lib/components/voorraad/StockSyncStatus.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockSyncStatus.js +10 -2
- package/dist-lib/components/voorraad/VoorraadStockCard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadStockCard.js +6 -4
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.js +6 -1
- package/dist-lib/hooks/useFloridayWriteMode.d.ts +7 -0
- package/dist-lib/hooks/useFloridayWriteMode.d.ts.map +1 -0
- package/dist-lib/hooks/useFloridayWriteMode.js +21 -0
- package/dist-lib/hooks/useStockSyncHealth.d.ts +9 -0
- package/dist-lib/hooks/useStockSyncHealth.d.ts.map +1 -1
- package/dist-lib/hooks/useStockSyncHealth.js +23 -0
- package/dist-lib/hooks/useTradeItemStock.d.ts.map +1 -1
- package/dist-lib/hooks/useTradeItemStock.js +23 -10
- package/dist-lib/integrations/supabase/types.d.ts +2247 -131
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/__tests__/floriday-write-mode.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/floriday-write-mode.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/floriday-write-mode.test.js +40 -0
- package/dist-lib/lib/floriday-write-mode.d.ts +21 -0
- package/dist-lib/lib/floriday-write-mode.d.ts.map +1 -0
- package/dist-lib/lib/floriday-write-mode.js +40 -0
- package/dist-lib/lib/fusten.d.ts +20 -0
- package/dist-lib/lib/fusten.d.ts.map +1 -1
- package/dist-lib/lib/fusten.js +48 -41
- package/dist-lib/lib/stock-scope.d.ts +3 -1
- package/dist-lib/lib/stock-scope.d.ts.map +1 -1
- package/dist-lib/lib/stock-scope.js +3 -1
- package/package.json +1 -1
- package/sql/AGENTS.md +2 -8
- package/sql/floriday-voorraad-schema.sql +194 -71
|
@@ -156,7 +156,10 @@ export function useTradeItemStock(connectionId, keyOrKeys, productId) {
|
|
|
156
156
|
p_physical_stock: values.physical_stock,
|
|
157
157
|
p_minimum_stock: values.minimum_stock,
|
|
158
158
|
p_incoming_stock: values.incoming_stock,
|
|
159
|
-
|
|
159
|
+
// Notitie altijd expliciet meegeven (huidige of nieuwe waarde); minimum
|
|
160
|
+
// en inkomend komen uit de geladen rij, dus nooit stil 0.
|
|
161
|
+
p_notes: values.notes ?? null,
|
|
162
|
+
p_change_source: "MANUAL_STOCK",
|
|
160
163
|
});
|
|
161
164
|
if (rpcError)
|
|
162
165
|
throw new Error(rpcError.message);
|
|
@@ -234,18 +237,28 @@ export function useTradeItemStock(connectionId, keyOrKeys, productId) {
|
|
|
234
237
|
return { row: row ?? EMPTY, loading, save, error, resolvedKey };
|
|
235
238
|
}
|
|
236
239
|
export async function fetchStockMap(connectionId) {
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
|
|
240
|
+
// Met koppeling: alleen de rijen van die koppeling. Zonder koppeling: de
|
|
241
|
+
// lokale voorraadcontext (1.0.107, één vaste rij in voorraad_local_context).
|
|
242
|
+
// Nooit rijen van andere koppelingen/omgevingen.
|
|
243
|
+
let scopeId = connectionId;
|
|
244
|
+
if (!scopeId) {
|
|
245
|
+
const { data: lc, error: lcErr } = await supabase
|
|
246
|
+
.from("voorraad_local_context")
|
|
247
|
+
.select("id")
|
|
248
|
+
.maybeSingle();
|
|
249
|
+
if (lcErr)
|
|
250
|
+
throw new Error(lcErr.message);
|
|
251
|
+
scopeId = lc?.id ?? null;
|
|
252
|
+
if (!scopeId)
|
|
253
|
+
return new Map(); // nog nooit eigen voorraad opgeslagen
|
|
254
|
+
}
|
|
255
|
+
const { data, error } = await supabase
|
|
240
256
|
.from("trade_item_stock")
|
|
241
|
-
.select("connection_id,trade_item_key,physical_stock,minimum_stock,reserved_stock,incoming_stock,notes,updated_at")
|
|
242
|
-
|
|
243
|
-
? query.or(`connection_id.is.null,connection_id.eq.${connectionId}`)
|
|
244
|
-
: query.is("connection_id", null);
|
|
245
|
-
const { data, error } = await query;
|
|
257
|
+
.select("connection_id,trade_item_key,physical_stock,minimum_stock,reserved_stock,incoming_stock,notes,updated_at")
|
|
258
|
+
.eq("connection_id", scopeId);
|
|
246
259
|
if (error)
|
|
247
260
|
throw new Error(error.message);
|
|
248
|
-
const scoped = buildScopedStockMap((data ?? []),
|
|
261
|
+
const scoped = buildScopedStockMap((data ?? []), scopeId);
|
|
249
262
|
const map = new Map();
|
|
250
263
|
for (const [k, r] of scoped)
|
|
251
264
|
map.set(k, r);
|