@flowselections/floriday-verkoop-module 1.0.19 → 1.0.20
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/integrations/supabase/auth-middleware.d.ts +6 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +6 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +6 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +6 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/cart-lock.functions.d.ts +6 -0
- package/dist-lib/lib/cart-lock.functions.d.ts.map +1 -1
- package/dist-lib/lib/cart-replan.functions.d.ts +12 -0
- package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.d.ts +72 -0
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.js +34 -25
- package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts +18 -0
- package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-logistic-labels.functions.d.ts +6 -0
- package/dist-lib/lib/floriday-logistic-labels.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-public.functions.d.ts +42 -0
- package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +30 -0
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/order-shipments.functions.d.ts +24 -0
- package/dist-lib/lib/order-shipments.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.d.ts +18 -0
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/tradeitems.functions.d.ts +6 -0
- package/dist-lib/lib/tradeitems.functions.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.js +62 -3
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ export const listProductsForCreateOrder = createServerFn({ method: "GET" })
|
|
|
49
49
|
.range(0, 9999),
|
|
50
50
|
context.supabase
|
|
51
51
|
.from("products")
|
|
52
|
-
.select("id, product, unit, sale_price, plants_per_crate, crates_per_layer, layers_per_cart, quantity, custom_fields")
|
|
52
|
+
.select("id, product, unit, sale_price, plants_per_crate, crates_per_layer, layers_per_cart, quantity, custom_fields, trade_item_key")
|
|
53
53
|
.range(0, 4999),
|
|
54
54
|
]);
|
|
55
55
|
// Supabase geeft standaard max. 1000 rijen terug. Voor productgroepen kan de
|
|
@@ -242,6 +242,13 @@ export const listProductsForCreateOrder = createServerFn({ method: "GET" })
|
|
|
242
242
|
for (const p of Array.isArray(productsRes.data) ? productsRes.data : []) {
|
|
243
243
|
productsById.set(p.id, p);
|
|
244
244
|
}
|
|
245
|
+
const productsByGroupId = new Map();
|
|
246
|
+
for (const p of Array.isArray(productsRes.data) ? productsRes.data : []) {
|
|
247
|
+
const key = p.trade_item_key;
|
|
248
|
+
if (typeof key === "string" && key.startsWith("group:")) {
|
|
249
|
+
productsByGroupId.set(key.slice("group:".length), p);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
245
252
|
const packingFromProductRow = (p) => ({
|
|
246
253
|
plants_per_crate: Math.max(1, Number(p?.plants_per_crate ?? 1)),
|
|
247
254
|
crates_per_layer: Math.max(1, Number(p?.crates_per_layer ?? 1)),
|
|
@@ -277,32 +284,34 @@ export const listProductsForCreateOrder = createServerFn({ method: "GET" })
|
|
|
277
284
|
reserved = resSum;
|
|
278
285
|
available = Math.max(0, physical - reserved);
|
|
279
286
|
}
|
|
280
|
-
//
|
|
281
|
-
//
|
|
287
|
+
// Head eerst — belading van de groep = belading van het hoofdproduct.
|
|
288
|
+
// Volgorde: head_trade_item_floriday_id → head_product_id → group-mirror
|
|
289
|
+
// products-rij (`trade_item_key = 'group:<id>'`) → eerste member.
|
|
282
290
|
let packing = { plants_per_crate: 1, crates_per_layer: 1, layers_per_cart: 1 };
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
for (const cand of candidates) {
|
|
291
|
+
const headFloriday = r.head_trade_item_floriday_id;
|
|
292
|
+
const headProduct = r.head_product_id;
|
|
293
|
+
const groupMirror = productsByGroupId.get(id);
|
|
294
|
+
const firstMemberId = members[0]?.trade_item_id ?? null;
|
|
295
|
+
const tryFromById = (cand) => {
|
|
289
296
|
if (!cand)
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
297
|
+
return null;
|
|
298
|
+
const hit = byId.get(cand);
|
|
299
|
+
if (!hit)
|
|
300
|
+
return null;
|
|
301
|
+
return {
|
|
302
|
+
plants_per_crate: hit.plants_per_crate,
|
|
303
|
+
crates_per_layer: hit.crates_per_layer,
|
|
304
|
+
layers_per_cart: hit.layers_per_cart,
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
const tryFromProductRow = (row) => (row ? packingFromProductRow(row) : null);
|
|
308
|
+
packing =
|
|
309
|
+
tryFromById(headFloriday) ??
|
|
310
|
+
tryFromProductRow(headProduct ? productsById.get(headProduct) : null) ??
|
|
311
|
+
tryFromProductRow(groupMirror) ??
|
|
312
|
+
tryFromById(firstMemberId) ??
|
|
313
|
+
tryFromProductRow(firstMemberId ? productsById.get(firstMemberId) : null) ??
|
|
314
|
+
packing;
|
|
306
315
|
byId.set(id, {
|
|
307
316
|
id,
|
|
308
317
|
product: displayName,
|
|
@@ -11786,6 +11786,12 @@ export declare const getPreferredWarehouseStatus: import("@tanstack/start-client
|
|
|
11786
11786
|
};
|
|
11787
11787
|
Returns: undefined;
|
|
11788
11788
|
};
|
|
11789
|
+
sync_product_group_belading: {
|
|
11790
|
+
Args: {
|
|
11791
|
+
_group_id: string;
|
|
11792
|
+
};
|
|
11793
|
+
Returns: undefined;
|
|
11794
|
+
};
|
|
11789
11795
|
sync_product_packing_from_floriday_cache: {
|
|
11790
11796
|
Args: {
|
|
11791
11797
|
p_floriday_id: string;
|
|
@@ -23620,6 +23626,12 @@ export declare const getAutoFulfillmentStatus: import("@tanstack/start-client-co
|
|
|
23620
23626
|
};
|
|
23621
23627
|
Returns: undefined;
|
|
23622
23628
|
};
|
|
23629
|
+
sync_product_group_belading: {
|
|
23630
|
+
Args: {
|
|
23631
|
+
_group_id: string;
|
|
23632
|
+
};
|
|
23633
|
+
Returns: undefined;
|
|
23634
|
+
};
|
|
23623
23635
|
sync_product_packing_from_floriday_cache: {
|
|
23624
23636
|
Args: {
|
|
23625
23637
|
p_floriday_id: string;
|
|
@@ -35463,6 +35475,12 @@ export declare const retryAutoFulfillment: import("@tanstack/start-client-core")
|
|
|
35463
35475
|
};
|
|
35464
35476
|
Returns: undefined;
|
|
35465
35477
|
};
|
|
35478
|
+
sync_product_group_belading: {
|
|
35479
|
+
Args: {
|
|
35480
|
+
_group_id: string;
|
|
35481
|
+
};
|
|
35482
|
+
Returns: undefined;
|
|
35483
|
+
};
|
|
35466
35484
|
sync_product_packing_from_floriday_cache: {
|
|
35467
35485
|
Args: {
|
|
35468
35486
|
p_floriday_id: string;
|