@flowselections/floriday-verkoop-module 1.0.14 → 1.0.16
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/verkoop/CreateOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/CreateOrderPage.js +34 -20
- package/dist-lib/components/verkoop/SearchableSelect.d.ts +1 -0
- package/dist-lib/components/verkoop/SearchableSelect.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SearchableSelect.js +1 -1
- package/dist-lib/lib/create-order.functions.d.ts +10 -2
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.js +102 -19
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,eAAe,4CAkd9B"}
|
|
@@ -164,6 +164,10 @@ export function CreateOrderPage() {
|
|
|
164
164
|
quantity: l.quantity,
|
|
165
165
|
unit: l.unit ?? p?.unit ?? "stuks",
|
|
166
166
|
unit_price: l.unit_price ?? undefined,
|
|
167
|
+
plants_per_crate: p?.plants_per_crate ?? undefined,
|
|
168
|
+
crates_per_layer: p?.crates_per_layer ?? undefined,
|
|
169
|
+
layers_per_cart: p?.layers_per_cart ?? undefined,
|
|
170
|
+
article_code: p?.article_code ?? undefined,
|
|
167
171
|
};
|
|
168
172
|
}),
|
|
169
173
|
};
|
|
@@ -211,26 +215,36 @@ export function CreateOrderPage() {
|
|
|
211
215
|
const ppc = Math.max(1, Number(product?.plants_per_crate ?? 1));
|
|
212
216
|
const plants = line.quantity ?? null;
|
|
213
217
|
const cratesDisplay = plants === null ? "" : String(Math.ceil(plants / ppc));
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
218
|
+
const outOfStock = !!product && product.in_stock === false;
|
|
219
|
+
return (_jsxs("div", { className: "grid grid-cols-12 gap-2 items-start", children: [_jsxs("div", { className: "col-span-5", children: [_jsx(SearchableSelect, { value: line.product_id, placeholder: "Kies product...", clearLabel: "\u2014 Handmatig \u2014", options: products.map((p) => {
|
|
220
|
+
const code = p.article_code ? `${p.article_code} · ` : "";
|
|
221
|
+
const label = p.in_stock
|
|
222
|
+
? `${code}${p.product}`
|
|
223
|
+
: `${code}${p.product} — niet op voorraad`;
|
|
224
|
+
const hint = p.in_stock
|
|
225
|
+
? `Beschikbaar: ${p.available_stock} · ${p.plants_per_crate}/fust`
|
|
226
|
+
: `Voorraad 0 · ${p.plants_per_crate}/fust`;
|
|
227
|
+
return { value: p.id, label, hint, muted: !p.in_stock };
|
|
228
|
+
}), onChange: (v) => {
|
|
229
|
+
const next = [...lines];
|
|
230
|
+
if (v === null)
|
|
231
|
+
next[idx] = { ...next[idx], product_id: null };
|
|
232
|
+
else {
|
|
233
|
+
const p = products.find((x) => x.id === v);
|
|
234
|
+
const newPpc = Math.max(1, Number(p?.plants_per_crate ?? 1));
|
|
235
|
+
const currentQ = Number(next[idx].quantity ?? 0);
|
|
236
|
+
const normalizedQ = currentQ > 0 ? Math.ceil(currentQ / newPpc) * newPpc : newPpc;
|
|
237
|
+
next[idx] = {
|
|
238
|
+
...next[idx],
|
|
239
|
+
product_id: v,
|
|
240
|
+
product_name: p?.product ?? "",
|
|
241
|
+
unit: next[idx].unit ?? p?.unit ?? "stuks",
|
|
242
|
+
quantity: normalizedQ,
|
|
243
|
+
unit_price: next[idx].unit_price ?? (p?.sale_price != null ? Number(p.sale_price) : null),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
setLines(next);
|
|
247
|
+
} }), outOfStock && (_jsx("div", { className: "mt-1 text-xs text-amber-600", children: "Let op: dit product staat momenteel niet op voorraad." }))] }), _jsx(Input, { className: "col-span-2", type: "number", min: ppc, step: ppc, inputMode: "numeric", onKeyDown: blockDecimal, value: plants ?? "", onChange: (e) => {
|
|
234
248
|
const next = [...lines];
|
|
235
249
|
const raw = e.target.value.replace(/[.,]/g, "");
|
|
236
250
|
const v = raw ? Number(raw) : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchableSelect.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SearchableSelect.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchableSelect.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SearchableSelect.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EAAE,OAAO,EAAE,WAAuB,EAAE,UAA6B,EACtE,UAAiB,EAAE,UAAiC,EACpD,QAAQ,EAAE,SAAS,EAAE,QAAgB,GACtC,EAAE,qBAAqB,2CAuFvB"}
|
|
@@ -17,5 +17,5 @@ export function SearchableSelect({ value, options, placeholder = "Kies...", empt
|
|
|
17
17
|
}, [options, q]);
|
|
18
18
|
return (_jsxs(Popover, { open: open, onOpenChange: (o) => { if (disabled)
|
|
19
19
|
return; setOpen(o); if (!o)
|
|
20
|
-
setQ(""); }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", role: "combobox", "aria-expanded": open, disabled: disabled, className: `w-full justify-between font-normal ${className ?? ""}`, children: [_jsx("span", { className: `truncate ${selected ? "" : "text-muted-foreground"}`, children: selected?.label ?? placeholder }), _jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsxs(PopoverContent, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: [_jsx("div", { className: "p-2 border-b", children: _jsxs("div", { className: "relative", children: [_jsx(Search, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }), _jsx(Input, { autoFocus: true, value: q, onChange: (e) => setQ(e.target.value), placeholder: `Zoek in ${options.length} items...`, className: "pl-8 h-9" })] }) }), _jsxs("div", { className: "max-h-64 overflow-y-auto py-1", children: [allowClear && (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-center gap-2", onClick: () => { onChange(null); setOpen(false); }, children: [value === null && _jsx(Check, { className: "h-3 w-3" }), _jsx("span", { className: "text-muted-foreground italic", children: clearLabel })] })), filtered.length === 0 ? (_jsx("div", { className: "px-3 py-6 text-sm text-muted-foreground text-center", children: emptyLabel })) : (filtered.map((o) => (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-start gap-2", onClick: () => { onChange(o.value); setOpen(false); }, children: [_jsx(Check, { className: `h-3 w-3 mt-1 shrink-0 ${value === o.value ? "" : "invisible"}` }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className:
|
|
20
|
+
setQ(""); }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", role: "combobox", "aria-expanded": open, disabled: disabled, className: `w-full justify-between font-normal ${className ?? ""}`, children: [_jsx("span", { className: `truncate ${selected ? "" : "text-muted-foreground"}`, children: selected?.label ?? placeholder }), _jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsxs(PopoverContent, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", children: [_jsx("div", { className: "p-2 border-b", children: _jsxs("div", { className: "relative", children: [_jsx(Search, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }), _jsx(Input, { autoFocus: true, value: q, onChange: (e) => setQ(e.target.value), placeholder: `Zoek in ${options.length} items...`, className: "pl-8 h-9" })] }) }), _jsxs("div", { className: "max-h-64 overflow-y-auto py-1", children: [allowClear && (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-center gap-2", onClick: () => { onChange(null); setOpen(false); }, children: [value === null && _jsx(Check, { className: "h-3 w-3" }), _jsx("span", { className: "text-muted-foreground italic", children: clearLabel })] })), filtered.length === 0 ? (_jsx("div", { className: "px-3 py-6 text-sm text-muted-foreground text-center", children: emptyLabel })) : (filtered.map((o) => (_jsxs("button", { type: "button", className: "w-full text-left text-sm px-3 py-2 hover:bg-accent flex items-start gap-2", onClick: () => { onChange(o.value); setOpen(false); }, children: [_jsx(Check, { className: `h-3 w-3 mt-1 shrink-0 ${value === o.value ? "" : "invisible"}` }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: `truncate ${o.muted ? "text-muted-foreground" : ""}`, children: o.label }), o.hint && _jsx("div", { className: `text-xs truncate ${o.muted ? "text-muted-foreground/70" : "text-muted-foreground"}`, children: o.hint })] })] }, o.value)))), filtered.length === 200 && (_jsx("div", { className: "px-3 py-2 text-xs text-muted-foreground text-center border-t", children: "Toon eerste 200 resultaten \u2014 verfijn je zoekopdracht" }))] })] })] }));
|
|
21
21
|
}
|
|
@@ -22680,13 +22680,17 @@ export declare const listProductsForCreateOrder: import("@tanstack/start-client-
|
|
|
22680
22680
|
}, undefined, undefined, undefined>], undefined, Promise<{
|
|
22681
22681
|
items: {
|
|
22682
22682
|
id: string;
|
|
22683
|
-
product:
|
|
22683
|
+
product: any;
|
|
22684
|
+
article_code: string | null;
|
|
22684
22685
|
unit: string;
|
|
22685
22686
|
sale_price: number | null;
|
|
22686
22687
|
plants_per_crate: number;
|
|
22687
22688
|
crates_per_layer: number;
|
|
22688
22689
|
layers_per_cart: number;
|
|
22689
|
-
|
|
22690
|
+
physical_stock: number;
|
|
22691
|
+
reserved_stock: number;
|
|
22692
|
+
available_stock: number;
|
|
22693
|
+
in_stock: boolean;
|
|
22690
22694
|
}[];
|
|
22691
22695
|
}>>;
|
|
22692
22696
|
export declare const listDeliveryLocationsForCustomerCO: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
@@ -79421,6 +79425,10 @@ export declare const createManualOrder: import("@tanstack/start-client-core").Op
|
|
|
79421
79425
|
quantity: number;
|
|
79422
79426
|
unit?: string | null | undefined;
|
|
79423
79427
|
unit_price?: number | undefined;
|
|
79428
|
+
plants_per_crate?: number | undefined;
|
|
79429
|
+
crates_per_layer?: number | undefined;
|
|
79430
|
+
layers_per_cart?: number | undefined;
|
|
79431
|
+
article_code?: string | null | undefined;
|
|
79424
79432
|
}[];
|
|
79425
79433
|
notes?: string | null | undefined;
|
|
79426
79434
|
}, Promise<{
|