@flowselections/floriday-verkoop-module 1.0.15 → 1.0.17

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.
Files changed (36) hide show
  1. package/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
  2. package/dist-lib/components/verkoop/CreateOrderPage.js +40 -28
  3. package/dist-lib/components/verkoop/SalesOrdersFilters.d.ts.map +1 -1
  4. package/dist-lib/components/verkoop/SalesOrdersFilters.js +2 -8
  5. package/dist-lib/components/verkoop/SearchableSelect.d.ts +1 -0
  6. package/dist-lib/components/verkoop/SearchableSelect.d.ts.map +1 -1
  7. package/dist-lib/components/verkoop/SearchableSelect.js +1 -1
  8. package/dist-lib/index.js +2 -2
  9. package/dist-lib/integrations/supabase/auth-middleware.d.ts +208 -1
  10. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  11. package/dist-lib/integrations/supabase/client.d.ts +208 -1
  12. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  13. package/dist-lib/integrations/supabase/client.server.d.ts +208 -1
  14. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  15. package/dist-lib/integrations/supabase/types.d.ts +217 -1
  16. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  17. package/dist-lib/lib/cart-lock.functions.d.ts +208 -1
  18. package/dist-lib/lib/cart-lock.functions.d.ts.map +1 -1
  19. package/dist-lib/lib/cart-replan.functions.d.ts +416 -2
  20. package/dist-lib/lib/cart-replan.functions.d.ts.map +1 -1
  21. package/dist-lib/lib/create-order.functions.d.ts +1882 -11
  22. package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
  23. package/dist-lib/lib/create-order.functions.js +102 -19
  24. package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts +624 -3
  25. package/dist-lib/lib/floriday-auto-fulfillment.functions.d.ts.map +1 -1
  26. package/dist-lib/lib/floriday-logistic-labels.functions.d.ts +208 -1
  27. package/dist-lib/lib/floriday-logistic-labels.functions.d.ts.map +1 -1
  28. package/dist-lib/lib/floriday-public.functions.d.ts +1456 -7
  29. package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
  30. package/dist-lib/lib/floriday-writes.functions.d.ts +1040 -5
  31. package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
  32. package/dist-lib/lib/salesorders.functions.d.ts +624 -3
  33. package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
  34. package/dist-lib/lib/tradeitems.functions.d.ts +208 -1
  35. package/dist-lib/lib/tradeitems.functions.d.ts.map +1 -1
  36. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,eAAe,4CA+b9B"}
1
+ {"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,eAAe,4CA6c9B"}
@@ -11,7 +11,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
11
11
  import { ArrowLeft, Plus, Trash2 } from "lucide-react";
12
12
  import { useServerFn } from "@tanstack/react-start";
13
13
  import { SearchableSelect } from "./SearchableSelect";
14
- import { CartAssignmentWizard } from "./CartAssignmentWizard";
15
14
  import { listCustomersForCreateOrder, listProductsForCreateOrder, listDeliveryLocationsForCustomerCO, listPickupLocationsCO, listCarriersForCreateOrder, getOrderPickDaysCO, createManualOrder, } from "../../lib/create-order.functions";
16
15
  function ReadOnlyField({ label, value }) {
17
16
  return (_jsxs("div", { className: "space-y-0.5", children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: label }), _jsx("div", { className: "text-sm", children: value && String(value).trim() !== "" ? value : _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) })] }));
@@ -61,7 +60,6 @@ export function CreateOrderPage() {
61
60
  const [lines, setLines] = useState([
62
61
  { product_id: null, product_name: "", quantity: null, unit: "stuks", unit_price: null },
63
62
  ]);
64
- const [cartOrderId, setCartOrderId] = useState(null);
65
63
  // Afleverlocaties van gekozen klant
66
64
  const deliveryLocQ = useQuery({
67
65
  queryKey: ["co-delivery-locations", customerId],
@@ -164,16 +162,23 @@ export function CreateOrderPage() {
164
162
  quantity: l.quantity,
165
163
  unit: l.unit ?? p?.unit ?? "stuks",
166
164
  unit_price: l.unit_price ?? undefined,
165
+ plants_per_crate: p?.plants_per_crate ?? undefined,
166
+ crates_per_layer: p?.crates_per_layer ?? undefined,
167
+ layers_per_cart: p?.layers_per_cart ?? undefined,
168
+ article_code: p?.article_code ?? undefined,
167
169
  };
168
170
  }),
169
171
  };
170
172
  return await fetchCreate({ data: payload });
171
173
  },
172
174
  onSuccess: (res) => {
173
- toast.success("Bestelling aangemaakt — deel nu de karren in");
175
+ toast.success("Bestelling aangemaakt — karindeling is automatisch berekend");
174
176
  qc.invalidateQueries({ queryKey: ["floriday", "salesorders-cache"] });
175
177
  if (res?.orderId) {
176
- setCartOrderId(res.orderId);
178
+ navigate({
179
+ to: "/floriday-verkoop/verkooporders/$salesOrderId",
180
+ params: { salesOrderId: `local:${res.orderId}` },
181
+ });
177
182
  }
178
183
  else {
179
184
  navigate({ to: "/floriday-verkoop/verkooporders" });
@@ -211,26 +216,36 @@ export function CreateOrderPage() {
211
216
  const ppc = Math.max(1, Number(product?.plants_per_crate ?? 1));
212
217
  const plants = line.quantity ?? null;
213
218
  const cratesDisplay = plants === null ? "" : String(Math.ceil(plants / ppc));
214
- return (_jsxs("div", { className: "grid grid-cols-12 gap-2 items-start", children: [_jsx("div", { className: "col-span-5", children: _jsx(SearchableSelect, { value: line.product_id, placeholder: "Kies product...", clearLabel: "\u2014 Handmatig \u2014", options: products.map((p) => ({ value: p.id, label: p.product, hint: p.unit })), onChange: (v) => {
215
- const next = [...lines];
216
- if (v === null)
217
- next[idx] = { ...next[idx], product_id: null };
218
- else {
219
- const p = products.find((x) => x.id === v);
220
- const newPpc = Math.max(1, Number(p?.plants_per_crate ?? 1));
221
- const currentQ = Number(next[idx].quantity ?? 0);
222
- const normalizedQ = currentQ > 0 ? Math.ceil(currentQ / newPpc) * newPpc : newPpc;
223
- next[idx] = {
224
- ...next[idx],
225
- product_id: v,
226
- product_name: p?.product ?? "",
227
- unit: next[idx].unit ?? p?.unit ?? "stuks",
228
- quantity: normalizedQ,
229
- unit_price: next[idx].unit_price ?? (p?.sale_price != null ? Number(p.sale_price) : null),
230
- };
231
- }
232
- setLines(next);
233
- } }) }), _jsx(Input, { className: "col-span-2", type: "number", min: ppc, step: ppc, inputMode: "numeric", onKeyDown: blockDecimal, value: plants ?? "", onChange: (e) => {
219
+ const outOfStock = !!product && product.in_stock === false;
220
+ 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) => {
221
+ const code = p.article_code ? `${p.article_code} · ` : "";
222
+ const label = p.in_stock
223
+ ? `${code}${p.product}`
224
+ : `${code}${p.product} — niet op voorraad`;
225
+ const hint = p.in_stock
226
+ ? `Beschikbaar: ${p.available_stock} · ${p.plants_per_crate}/fust`
227
+ : `Voorraad 0 · ${p.plants_per_crate}/fust`;
228
+ return { value: p.id, label, hint, muted: !p.in_stock };
229
+ }), onChange: (v) => {
230
+ const next = [...lines];
231
+ if (v === null)
232
+ next[idx] = { ...next[idx], product_id: null };
233
+ else {
234
+ const p = products.find((x) => x.id === v);
235
+ const newPpc = Math.max(1, Number(p?.plants_per_crate ?? 1));
236
+ const currentQ = Number(next[idx].quantity ?? 0);
237
+ const normalizedQ = currentQ > 0 ? Math.ceil(currentQ / newPpc) * newPpc : newPpc;
238
+ next[idx] = {
239
+ ...next[idx],
240
+ product_id: v,
241
+ product_name: p?.product ?? "",
242
+ unit: next[idx].unit ?? p?.unit ?? "stuks",
243
+ quantity: normalizedQ,
244
+ unit_price: next[idx].unit_price ?? (p?.sale_price != null ? Number(p.sale_price) : null),
245
+ };
246
+ }
247
+ setLines(next);
248
+ } }), 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
249
  const next = [...lines];
235
250
  const raw = e.target.value.replace(/[.,]/g, "");
236
251
  const v = raw ? Number(raw) : null;
@@ -249,8 +264,5 @@ export function CreateOrderPage() {
249
264
  next[idx] = { ...next[idx], unit_price: v };
250
265
  setLines(next);
251
266
  }, placeholder: "\u20AC prijs" }), _jsx(Button, { variant: "ghost", size: "icon", className: "col-span-1", onClick: () => setLines(lines.filter((_, i) => i !== idx)), "aria-label": "Regel verwijderen", children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, idx));
252
- }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setLines([...lines, { product_id: null, product_name: "", quantity: null, unit: "stuks", unit_price: null }]), children: [_jsx(Plus, { className: "h-3 w-3 mr-1" }), " Regel toevoegen"] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Opmerkingen" }), _jsx(Textarea, { value: notes, onChange: (e) => setNotes(e.target.value), placeholder: "Optionele notities bij deze bestelling", rows: 3 })] }), _jsxs("div", { className: "flex items-center justify-end gap-2 pt-2", children: [_jsx(Button, { variant: "outline", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders" }), disabled: createMut.isPending, children: "Annuleren" }), _jsx(Button, { onClick: () => createMut.mutate(), disabled: createMut.isPending, children: createMut.isPending ? "Bezig..." : "Bestelling Aanmaken" })] })] })] }), _jsx(CartAssignmentWizard, { orderId: cartOrderId, open: !!cartOrderId, onClose: () => {
253
- setCartOrderId(null);
254
- navigate({ to: "/floriday-verkoop/verkooporders" });
255
- } })] }));
267
+ }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setLines([...lines, { product_id: null, product_name: "", quantity: null, unit: "stuks", unit_price: null }]), children: [_jsx(Plus, { className: "h-3 w-3 mr-1" }), " Regel toevoegen"] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { children: "Opmerkingen" }), _jsx(Textarea, { value: notes, onChange: (e) => setNotes(e.target.value), placeholder: "Optionele notities bij deze bestelling", rows: 3 })] }), _jsxs("div", { className: "flex items-center justify-end gap-2 pt-2", children: [_jsx(Button, { variant: "outline", onClick: () => navigate({ to: "/floriday-verkoop/verkooporders" }), disabled: createMut.isPending, children: "Annuleren" }), _jsx(Button, { onClick: () => createMut.mutate(), disabled: createMut.isPending, children: createMut.isPending ? "Bezig..." : "Bestelling Aanmaken" })] })] })] })] }));
256
268
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnE;AAoCD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,2CA4PA"}
1
+ {"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"AA4BA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnE;AAoCD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,2CA0NA"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
4
- import { ChevronDown, ChevronLeft, ChevronRight, MoreVertical, ShoppingCart, Truck, Search, } from "lucide-react";
4
+ import { ChevronDown, ChevronLeft, ChevronRight, MoreVertical, Search, } from "lucide-react";
5
5
  import { WeekCalendar } from "./WeekCalendar";
6
6
  function getCurrentWeek() {
7
7
  const now = new Date();
@@ -127,13 +127,7 @@ export function SalesOrdersFilters({ value, onChange, }) {
127
127
  return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs("div", { className: "flex h-9 items-center gap-1 rounded-md border border-border bg-card px-1", children: [showArrows && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => shiftPeriod(-1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Vorige", children: _jsx(ChevronLeft, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => shiftPeriod(1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Volgende", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] })), period === "month" ? (_jsxs(Select, { value: `${monthYear}-${month}`, onValueChange: (v) => {
128
128
  const [y, m] = v.split("-").map(Number);
129
129
  onChange({ ...value, month: m, monthYear: y });
130
- }, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: period, onValueChange: (v) => handlePeriodChange(v), children: [_jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [periodLabel(), _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] }), _jsxs("div", { className: "flex h-9 items-center rounded-md border border-border bg-card", children: [_jsx("button", { type: "button", onClick: () => onChange({ ...value, dateField: "ordered" }), className: "inline-flex h-9 w-9 items-center justify-center rounded-l-md border-r border-border " +
131
- ((value.dateField ?? "ordered") === "ordered"
132
- ? "bg-accent text-foreground"
133
- : "text-muted-foreground hover:bg-accent hover:text-foreground"), "aria-label": "Filter op besteldatum", title: "Filter op besteldatum", "aria-pressed": (value.dateField ?? "ordered") === "ordered", children: _jsx(ShoppingCart, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => onChange({ ...value, dateField: "delivery" }), className: "inline-flex h-9 w-9 items-center justify-center rounded-r-md " +
134
- (value.dateField === "delivery"
135
- ? "bg-accent text-foreground"
136
- : "text-muted-foreground hover:bg-accent hover:text-foreground"), "aria-label": "Filter op transportdatum", title: "Filter op transportdatum", "aria-pressed": value.dateField === "delivery", children: _jsx(Truck, { className: "h-4 w-4" }) })] }), _jsxs("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border bg-card", children: [_jsx(Input, { placeholder: "Op briefnummer zoeken", value: search, onChange: (e) => setSearch(e.target.value), onKeyDown: (e) => {
130
+ }, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: period, onValueChange: (v) => handlePeriodChange(v), children: [_jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [periodLabel(), _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] }), _jsxs("div", { className: "flex h-9 items-center overflow-hidden rounded-md border border-border bg-card", children: [_jsx(Input, { placeholder: "Op briefnummer zoeken", value: search, onChange: (e) => setSearch(e.target.value), onKeyDown: (e) => {
137
131
  if (e.key === "Enter")
138
132
  onChange({ ...value, search });
139
133
  }, onBlur: () => onChange({ ...value, search }), className: "h-9 w-56 border-0 shadow-none focus-visible:ring-0" }), _jsx("button", { type: "button", onClick: () => onChange({ ...value, search }), className: "inline-flex h-9 w-10 items-center justify-center bg-primary text-primary-foreground hover:opacity-90", "aria-label": "Zoeken", children: _jsx(Search, { className: "h-4 w-4" }) })] })] }));
@@ -2,6 +2,7 @@ export interface SearchableOption {
2
2
  value: string;
3
3
  label: string;
4
4
  hint?: string | null;
5
+ muted?: boolean;
5
6
  }
6
7
  interface SearchableSelectProps {
7
8
  value: string | 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;CACtB;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"}
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: "truncate", children: o.label }), o.hint && _jsx("div", { className: "text-xs text-muted-foreground truncate", 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" }))] })] })] }));
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
  }
package/dist-lib/index.js CHANGED
@@ -5,10 +5,10 @@ export { SalesOrderDetailPage } from "./components/verkoop/SalesOrderDetailPage"
5
5
  export { CreateOrderPage } from "./components/verkoop/CreateOrderPage";
6
6
  export const floridayVerkoopModule = {
7
7
  id: "verkoop",
8
- name: "Verkoop",
8
+ name: "Orders",
9
9
  version: "1.0.0",
10
10
  nav: {
11
- label: "Verkoop",
11
+ label: "Orders",
12
12
  href: "/floriday-verkoop",
13
13
  icon: ShoppingCart,
14
14
  children: [
@@ -242,6 +242,165 @@ export declare const requireSupabaseAuth: import("@tanstack/start-client-core").
242
242
  };
243
243
  Relationships: [];
244
244
  };
245
+ ai_credentials: {
246
+ Row: {
247
+ active: boolean;
248
+ api_key: string;
249
+ created_at: string;
250
+ created_by: string | null;
251
+ id: string;
252
+ label: string;
253
+ provider_id: string;
254
+ updated_at: string;
255
+ };
256
+ Insert: {
257
+ active?: boolean;
258
+ api_key: string;
259
+ created_at?: string;
260
+ created_by?: string | null;
261
+ id?: string;
262
+ label: string;
263
+ provider_id: string;
264
+ updated_at?: string;
265
+ };
266
+ Update: {
267
+ active?: boolean;
268
+ api_key?: string;
269
+ created_at?: string;
270
+ created_by?: string | null;
271
+ id?: string;
272
+ label?: string;
273
+ provider_id?: string;
274
+ updated_at?: string;
275
+ };
276
+ Relationships: [{
277
+ foreignKeyName: "ai_credentials_provider_id_fkey";
278
+ columns: ["provider_id"];
279
+ isOneToOne: false;
280
+ referencedRelation: "ai_providers";
281
+ referencedColumns: ["id"];
282
+ }];
283
+ };
284
+ ai_models: {
285
+ Row: {
286
+ active: boolean;
287
+ context_window: number | null;
288
+ created_at: string;
289
+ display_name: string;
290
+ id: string;
291
+ is_default: boolean;
292
+ modality: string;
293
+ provider_id: string;
294
+ slug: string;
295
+ updated_at: string;
296
+ };
297
+ Insert: {
298
+ active?: boolean;
299
+ context_window?: number | null;
300
+ created_at?: string;
301
+ display_name: string;
302
+ id?: string;
303
+ is_default?: boolean;
304
+ modality?: string;
305
+ provider_id: string;
306
+ slug: string;
307
+ updated_at?: string;
308
+ };
309
+ Update: {
310
+ active?: boolean;
311
+ context_window?: number | null;
312
+ created_at?: string;
313
+ display_name?: string;
314
+ id?: string;
315
+ is_default?: boolean;
316
+ modality?: string;
317
+ provider_id?: string;
318
+ slug?: string;
319
+ updated_at?: string;
320
+ };
321
+ Relationships: [{
322
+ foreignKeyName: "ai_models_provider_id_fkey";
323
+ columns: ["provider_id"];
324
+ isOneToOne: false;
325
+ referencedRelation: "ai_providers";
326
+ referencedColumns: ["id"];
327
+ }];
328
+ };
329
+ ai_module_bindings: {
330
+ Row: {
331
+ consumer_module_id: string;
332
+ created_at: string;
333
+ credential_id: string;
334
+ id: string;
335
+ model_id: string;
336
+ notes: string | null;
337
+ updated_at: string;
338
+ };
339
+ Insert: {
340
+ consumer_module_id: string;
341
+ created_at?: string;
342
+ credential_id: string;
343
+ id?: string;
344
+ model_id: string;
345
+ notes?: string | null;
346
+ updated_at?: string;
347
+ };
348
+ Update: {
349
+ consumer_module_id?: string;
350
+ created_at?: string;
351
+ credential_id?: string;
352
+ id?: string;
353
+ model_id?: string;
354
+ notes?: string | null;
355
+ updated_at?: string;
356
+ };
357
+ Relationships: [{
358
+ foreignKeyName: "ai_module_bindings_credential_id_fkey";
359
+ columns: ["credential_id"];
360
+ isOneToOne: false;
361
+ referencedRelation: "ai_credentials";
362
+ referencedColumns: ["id"];
363
+ }, {
364
+ foreignKeyName: "ai_module_bindings_model_id_fkey";
365
+ columns: ["model_id"];
366
+ isOneToOne: false;
367
+ referencedRelation: "ai_models";
368
+ referencedColumns: ["id"];
369
+ }];
370
+ };
371
+ ai_providers: {
372
+ Row: {
373
+ active: boolean;
374
+ auth_type: string;
375
+ base_url: string | null;
376
+ created_at: string;
377
+ id: string;
378
+ name: string;
379
+ slug: string;
380
+ updated_at: string;
381
+ };
382
+ Insert: {
383
+ active?: boolean;
384
+ auth_type?: string;
385
+ base_url?: string | null;
386
+ created_at?: string;
387
+ id?: string;
388
+ name: string;
389
+ slug: string;
390
+ updated_at?: string;
391
+ };
392
+ Update: {
393
+ active?: boolean;
394
+ auth_type?: string;
395
+ base_url?: string | null;
396
+ created_at?: string;
397
+ id?: string;
398
+ name?: string;
399
+ slug?: string;
400
+ updated_at?: string;
401
+ };
402
+ Relationships: [];
403
+ };
245
404
  app_settings: {
246
405
  Row: {
247
406
  created_at: string;
@@ -3845,6 +4004,27 @@ export declare const requireSupabaseAuth: import("@tanstack/start-client-core").
3845
4004
  referencedColumns: ["id"];
3846
4005
  }];
3847
4006
  };
4007
+ floriday_continuous_stock_cache: {
4008
+ Row: {
4009
+ connection_id: string;
4010
+ fetched_at: string;
4011
+ number_of_pieces: number;
4012
+ trade_item_id: string;
4013
+ };
4014
+ Insert: {
4015
+ connection_id: string;
4016
+ fetched_at?: string;
4017
+ number_of_pieces?: number;
4018
+ trade_item_id: string;
4019
+ };
4020
+ Update: {
4021
+ connection_id?: string;
4022
+ fetched_at?: string;
4023
+ number_of_pieces?: number;
4024
+ trade_item_id?: string;
4025
+ };
4026
+ Relationships: [];
4027
+ };
3848
4028
  floriday_continuous_stock_queue: {
3849
4029
  Row: {
3850
4030
  attempts: number;
@@ -5968,39 +6148,60 @@ export declare const requireSupabaseAuth: import("@tanstack/start-client-core").
5968
6148
  };
5969
6149
  manufacture_products: {
5970
6150
  Row: {
6151
+ aantal_te_produceren: number;
5971
6152
  created_at: string;
5972
6153
  description: string | null;
5973
6154
  id: string;
5974
6155
  is_active: boolean;
6156
+ location_id: string | null;
5975
6157
  name: string;
6158
+ partij_nummer: string | null;
6159
+ photos: import("./types").Json;
5976
6160
  produced_stock: number;
5977
6161
  product_code: string;
5978
6162
  tenant_id: string;
6163
+ unit: string;
5979
6164
  updated_at: string;
5980
6165
  };
5981
6166
  Insert: {
6167
+ aantal_te_produceren?: number;
5982
6168
  created_at?: string;
5983
6169
  description?: string | null;
5984
6170
  id?: string;
5985
6171
  is_active?: boolean;
6172
+ location_id?: string | null;
5986
6173
  name: string;
6174
+ partij_nummer?: string | null;
6175
+ photos?: import("./types").Json;
5987
6176
  produced_stock?: number;
5988
6177
  product_code: string;
5989
6178
  tenant_id: string;
6179
+ unit?: string;
5990
6180
  updated_at?: string;
5991
6181
  };
5992
6182
  Update: {
6183
+ aantal_te_produceren?: number;
5993
6184
  created_at?: string;
5994
6185
  description?: string | null;
5995
6186
  id?: string;
5996
6187
  is_active?: boolean;
6188
+ location_id?: string | null;
5997
6189
  name?: string;
6190
+ partij_nummer?: string | null;
6191
+ photos?: import("./types").Json;
5998
6192
  produced_stock?: number;
5999
6193
  product_code?: string;
6000
6194
  tenant_id?: string;
6195
+ unit?: string;
6001
6196
  updated_at?: string;
6002
6197
  };
6003
- Relationships: [];
6198
+ Relationships: [{
6199
+ foreignKeyName: "manufacture_products_location_id_fkey";
6200
+ columns: ["location_id"];
6201
+ isOneToOne: false;
6202
+ referencedRelation: "locations";
6203
+ referencedColumns: ["id"];
6204
+ }];
6004
6205
  };
6005
6206
  monteurs: {
6006
6207
  Row: {
@@ -10864,6 +11065,12 @@ export declare const requireSupabaseAuth: import("@tanstack/start-client-core").
10864
11065
  };
10865
11066
  Returns: undefined;
10866
11067
  };
11068
+ next_manufacture_partij: {
11069
+ Args: {
11070
+ _tenant_id: string;
11071
+ };
11072
+ Returns: string;
11073
+ };
10867
11074
  next_order_number: {
10868
11075
  Args: {
10869
11076
  p_prefix: string;