@burdenoff/microfe-movethewheels 2026.923.1 → 2026.924.1

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.
@@ -3,128 +3,121 @@ import { RefreshCw as t } from "../node_modules/lucide-react/dist/esm/icons/refr
3
3
  import { UserPlus as n } from "../node_modules/lucide-react/dist/esm/icons/user-plus.js";
4
4
  import { Button as r, Dialog as i, DialogContent as a, DialogDescription as o, DialogFooter as s, DialogHeader as c, DialogTitle as l, Input as u, Label as d, Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, SelectValue as g } from "./ui.js";
5
5
  import { FormError as _ } from "./FormError.js";
6
- import { useState as v } from "react";
7
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
6
+ import { EntityCombobox as v } from "./EntityCombobox.js";
7
+ import { useState as y } from "react";
8
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
8
9
  //#region src/movethewheels/components/CustomerPicker.tsx
9
- var x = {
10
+ var C = {
10
11
  name: "",
11
12
  type: "b2c",
12
13
  email: "",
13
14
  phone: "",
14
15
  company: ""
15
16
  };
16
- function S(e, t) {
17
- return !t || e.some((e) => e.id === t.id) ? e : [t, ...e];
18
- }
19
- function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCustomer: D, isLoading: O, error: k, onRetry: A, onOpenCustomers: j, selectedCustomer: M, searchQuery: N = "", onSearchQueryChange: P, disabled: F = !1 }) {
20
- let [I, L] = v(!1), [R, z] = v(x), [B, V] = v(!1), [H, U] = v(null), W = S(C, M), G = () => {
21
- U(null), z(x), L(!0);
22
- }, K = () => {
17
+ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCustomer: O, isLoading: k, error: A, onRetry: j, onOpenCustomers: M, selectedCustomer: N, onSearchQueryChange: P, disabled: F = !1 }) {
18
+ let [I, L] = y(!1), [R, z] = y(C), [B, V] = y(!1), [H, U] = y(null), W = () => {
19
+ U(null), z(C), L(!0);
20
+ }, G = () => {
23
21
  B || L(!1);
24
22
  };
25
- return /* @__PURE__ */ b("div", {
23
+ return /* @__PURE__ */ S("div", {
26
24
  className: "space-y-2",
27
25
  children: [
28
- /* @__PURE__ */ b("div", {
26
+ /* @__PURE__ */ S("div", {
29
27
  className: "flex items-center justify-between gap-2",
30
- children: [/* @__PURE__ */ y(d, {
28
+ children: [/* @__PURE__ */ x(d, {
31
29
  htmlFor: "customer",
32
30
  children: "Customer"
33
- }), /* @__PURE__ */ b(r, {
31
+ }), /* @__PURE__ */ S(r, {
34
32
  type: "button",
35
33
  variant: "ghost",
36
34
  size: "sm",
37
- onClick: G,
38
- disabled: F || O,
39
- children: [/* @__PURE__ */ y(e, {
35
+ onClick: W,
36
+ disabled: F || k,
37
+ children: [/* @__PURE__ */ x(e, {
40
38
  size: 14,
41
39
  className: "mr-1"
42
40
  }), "Add customer"]
43
41
  })]
44
42
  }),
45
- /* @__PURE__ */ b("div", {
43
+ /* @__PURE__ */ S("div", {
46
44
  className: "flex flex-col gap-2 sm:flex-row sm:items-start",
47
- children: [
48
- P && /* @__PURE__ */ y(u, {
49
- value: N,
50
- onChange: (e) => P(e.target.value),
51
- placeholder: "Search customers",
52
- "aria-label": "Search customers",
53
- disabled: F,
54
- className: "sm:max-w-56"
55
- }),
56
- /* @__PURE__ */ b(f, {
57
- value: w,
58
- onValueChange: T,
59
- disabled: F || O || !!k,
60
- children: [/* @__PURE__ */ y(h, {
61
- id: "customer",
62
- className: "flex-1",
63
- children: /* @__PURE__ */ y(g, { placeholder: O ? "Loading customers..." : "Select customer" })
64
- }), /* @__PURE__ */ y(p, { children: W.map((e) => /* @__PURE__ */ b(m, {
65
- value: e.id,
66
- children: [
67
- e.name,
68
- " ",
69
- e.email ? `(${e.email})` : ""
70
- ]
71
- }, e.id)) })]
72
- }),
73
- k && /* @__PURE__ */ b(r, {
74
- type: "button",
75
- variant: "outline",
76
- size: "sm",
77
- onClick: A,
78
- children: [/* @__PURE__ */ y(t, {
79
- size: 14,
80
- className: "mr-1"
81
- }), "Retry"]
82
- })
83
- ]
45
+ children: [/* @__PURE__ */ x(v, {
46
+ id: "customer",
47
+ value: T,
48
+ onChange: E,
49
+ options: w,
50
+ loading: k,
51
+ getId: (e) => e.id,
52
+ getLabel: (e) => `${e.name}${e.email ? ` (${e.email})` : ""}`,
53
+ renderOption: (e) => /* @__PURE__ */ S(b, { children: [
54
+ e.name,
55
+ " ",
56
+ e.email ? `(${e.email})` : ""
57
+ ] }),
58
+ selectedOption: N,
59
+ required: !0,
60
+ placeholder: k ? "Loading customers..." : "Select customer",
61
+ searchPlaceholder: "Search customers",
62
+ emptyText: "No customers found.",
63
+ disabled: F || !!A,
64
+ error: A ? "Customers could not be loaded" : void 0,
65
+ onSearchChange: P,
66
+ className: "flex-1"
67
+ }), A && /* @__PURE__ */ S(r, {
68
+ type: "button",
69
+ variant: "outline",
70
+ size: "sm",
71
+ onClick: j,
72
+ children: [/* @__PURE__ */ x(t, {
73
+ size: 14,
74
+ className: "mr-1"
75
+ }), "Retry"]
76
+ })]
84
77
  }),
85
- k ? /* @__PURE__ */ b("div", {
78
+ A ? /* @__PURE__ */ S("div", {
86
79
  className: "flex flex-wrap items-center gap-2",
87
- children: [/* @__PURE__ */ y("p", {
80
+ children: [/* @__PURE__ */ x("p", {
88
81
  role: "alert",
89
82
  className: "text-sm text-status-error-text",
90
83
  children: "Customers could not be loaded. Retry or add a customer to continue."
91
- }), j && /* @__PURE__ */ y(r, {
84
+ }), M && /* @__PURE__ */ x(r, {
92
85
  type: "button",
93
86
  variant: "outline",
94
87
  size: "sm",
95
- onClick: j,
88
+ onClick: M,
96
89
  children: "Open customer page"
97
90
  })]
98
- }) : !O && W.length === 0 ? /* @__PURE__ */ b("div", {
91
+ }) : !k && w.length === 0 ? /* @__PURE__ */ S("div", {
99
92
  className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-3",
100
- children: [/* @__PURE__ */ b("div", {
93
+ children: [/* @__PURE__ */ S("div", {
101
94
  className: "flex items-start gap-2",
102
- children: [/* @__PURE__ */ y(n, {
95
+ children: [/* @__PURE__ */ x(n, {
103
96
  size: 16,
104
97
  className: "mt-0.5 shrink-0 text-text-secondary"
105
- }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("p", {
98
+ }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
106
99
  className: "text-sm font-medium text-text-primary",
107
100
  children: "Add a customer to continue"
108
- }), /* @__PURE__ */ y("p", {
101
+ }), /* @__PURE__ */ x("p", {
109
102
  className: "text-sm text-text-secondary",
110
103
  children: "The customer will be selected automatically and your order details will stay here."
111
104
  })] })]
112
- }), /* @__PURE__ */ b(r, {
105
+ }), /* @__PURE__ */ S(r, {
113
106
  type: "button",
114
107
  size: "sm",
115
108
  className: "mt-3",
116
- onClick: G,
109
+ onClick: W,
117
110
  disabled: F,
118
- children: [/* @__PURE__ */ y(e, {
111
+ children: [/* @__PURE__ */ x(e, {
119
112
  size: 14,
120
113
  className: "mr-1.5"
121
114
  }), "Create customer"]
122
115
  })]
123
116
  }) : null,
124
- /* @__PURE__ */ y(i, {
117
+ /* @__PURE__ */ x(i, {
125
118
  open: I,
126
- onOpenChange: (e) => e ? L(!0) : K(),
127
- children: /* @__PURE__ */ b(a, { children: [/* @__PURE__ */ b(c, { children: [/* @__PURE__ */ y(l, { children: "Create customer" }), /* @__PURE__ */ y(o, { children: "Add the customer without leaving this order. They will be selected automatically." })] }), /* @__PURE__ */ b("form", {
119
+ onOpenChange: (e) => e ? L(!0) : G(),
120
+ children: /* @__PURE__ */ S(a, { children: [/* @__PURE__ */ S(c, { children: [/* @__PURE__ */ x(l, { children: "Create customer" }), /* @__PURE__ */ x(o, { children: "Add the customer without leaving this order. They will be selected automatically." })] }), /* @__PURE__ */ S("form", {
128
121
  onSubmit: async (e) => {
129
122
  e.preventDefault(), e.stopPropagation();
130
123
  let t = R.name.trim();
@@ -134,13 +127,13 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
134
127
  }
135
128
  V(!0), U(null);
136
129
  try {
137
- E(await D({
130
+ D(await O({
138
131
  name: t,
139
132
  type: R.type,
140
133
  email: R.email.trim() || void 0,
141
134
  phone: R.phone.trim() || void 0,
142
135
  company: R.company.trim() || void 0
143
- })), L(!1), z(x);
136
+ })), L(!1), z(C);
144
137
  } catch (e) {
145
138
  U(e instanceof Error ? e.message : "Could not create the customer. Please try again.");
146
139
  } finally {
@@ -149,13 +142,13 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
149
142
  },
150
143
  className: "space-y-4",
151
144
  children: [
152
- /* @__PURE__ */ y(_, { message: H }),
153
- /* @__PURE__ */ b("div", {
145
+ /* @__PURE__ */ x(_, { message: H }),
146
+ /* @__PURE__ */ S("div", {
154
147
  className: "space-y-2",
155
- children: [/* @__PURE__ */ y(d, {
148
+ children: [/* @__PURE__ */ x(d, {
156
149
  htmlFor: "quick-customer-name",
157
150
  children: "Name"
158
- }), /* @__PURE__ */ y(u, {
151
+ }), /* @__PURE__ */ x(u, {
159
152
  id: "quick-customer-name",
160
153
  value: R.name,
161
154
  onChange: (e) => z((t) => ({
@@ -167,37 +160,37 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
167
160
  required: !0
168
161
  })]
169
162
  }),
170
- /* @__PURE__ */ b("div", {
163
+ /* @__PURE__ */ S("div", {
171
164
  className: "space-y-2",
172
- children: [/* @__PURE__ */ y(d, {
165
+ children: [/* @__PURE__ */ x(d, {
173
166
  htmlFor: "quick-customer-type",
174
167
  children: "Customer type"
175
- }), /* @__PURE__ */ b(f, {
168
+ }), /* @__PURE__ */ S(f, {
176
169
  value: R.type,
177
170
  onValueChange: (e) => z((t) => ({
178
171
  ...t,
179
172
  type: e
180
173
  })),
181
- children: [/* @__PURE__ */ y(h, {
174
+ children: [/* @__PURE__ */ x(h, {
182
175
  id: "quick-customer-type",
183
- children: /* @__PURE__ */ y(g, {})
184
- }), /* @__PURE__ */ b(p, { children: [/* @__PURE__ */ y(m, {
176
+ children: /* @__PURE__ */ x(g, {})
177
+ }), /* @__PURE__ */ S(p, { children: [/* @__PURE__ */ x(m, {
185
178
  value: "b2c",
186
179
  children: "B2C (Individual)"
187
- }), /* @__PURE__ */ y(m, {
180
+ }), /* @__PURE__ */ x(m, {
188
181
  value: "b2b",
189
182
  children: "B2B (Business)"
190
183
  })] })]
191
184
  })]
192
185
  }),
193
- /* @__PURE__ */ b("div", {
186
+ /* @__PURE__ */ S("div", {
194
187
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
195
- children: [/* @__PURE__ */ b("div", {
188
+ children: [/* @__PURE__ */ S("div", {
196
189
  className: "space-y-2",
197
- children: [/* @__PURE__ */ y(d, {
190
+ children: [/* @__PURE__ */ x(d, {
198
191
  htmlFor: "quick-customer-email",
199
192
  children: "Email"
200
- }), /* @__PURE__ */ y(u, {
193
+ }), /* @__PURE__ */ x(u, {
201
194
  id: "quick-customer-email",
202
195
  type: "email",
203
196
  value: R.email,
@@ -207,12 +200,12 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
207
200
  })),
208
201
  placeholder: "customer@example.com"
209
202
  })]
210
- }), /* @__PURE__ */ b("div", {
203
+ }), /* @__PURE__ */ S("div", {
211
204
  className: "space-y-2",
212
- children: [/* @__PURE__ */ y(d, {
205
+ children: [/* @__PURE__ */ x(d, {
213
206
  htmlFor: "quick-customer-phone",
214
207
  children: "Phone"
215
- }), /* @__PURE__ */ y(u, {
208
+ }), /* @__PURE__ */ x(u, {
216
209
  id: "quick-customer-phone",
217
210
  value: R.phone,
218
211
  onChange: (e) => z((t) => ({
@@ -223,12 +216,12 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
223
216
  })]
224
217
  })]
225
218
  }),
226
- /* @__PURE__ */ b("div", {
219
+ /* @__PURE__ */ S("div", {
227
220
  className: "space-y-2",
228
- children: [/* @__PURE__ */ y(d, {
221
+ children: [/* @__PURE__ */ x(d, {
229
222
  htmlFor: "quick-customer-company",
230
223
  children: "Company"
231
- }), /* @__PURE__ */ y(u, {
224
+ }), /* @__PURE__ */ x(u, {
232
225
  id: "quick-customer-company",
233
226
  value: R.company,
234
227
  onChange: (e) => z((t) => ({
@@ -238,27 +231,27 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
238
231
  placeholder: "Company name (optional)"
239
232
  })]
240
233
  }),
241
- /* @__PURE__ */ b(s, { children: [
242
- j && /* @__PURE__ */ y(r, {
234
+ /* @__PURE__ */ S(s, { children: [
235
+ M && /* @__PURE__ */ x(r, {
243
236
  type: "button",
244
237
  variant: "outline",
245
238
  onClick: () => {
246
- K(), j();
239
+ G(), M();
247
240
  },
248
241
  disabled: B,
249
242
  children: "Use customer page"
250
243
  }),
251
- /* @__PURE__ */ y(r, {
244
+ /* @__PURE__ */ x(r, {
252
245
  type: "button",
253
246
  variant: "outline",
254
- onClick: K,
247
+ onClick: G,
255
248
  disabled: B,
256
249
  children: "Cancel"
257
250
  }),
258
- /* @__PURE__ */ b(r, {
251
+ /* @__PURE__ */ S(r, {
259
252
  type: "submit",
260
253
  disabled: B,
261
- children: [/* @__PURE__ */ y(e, { size: 16 }), B ? "Creating..." : "Create and select"]
254
+ children: [/* @__PURE__ */ x(e, { size: 16 }), B ? "Creating..." : "Create and select"]
262
255
  })
263
256
  ] })
264
257
  ]
@@ -268,4 +261,4 @@ function C({ customers: C, value: w, onValueChange: T, onCreated: E, createCusto
268
261
  });
269
262
  }
270
263
  //#endregion
271
- export { C as CustomerPicker };
264
+ export { w as CustomerPicker };
@@ -0,0 +1,105 @@
1
+ import { Check as e } from "../node_modules/lucide-react/dist/esm/icons/check.js";
2
+ import { ChevronsUpDown as t } from "../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js";
3
+ import { cn as n } from "../utils/cn.js";
4
+ import { Command as r, CommandEmpty as i, CommandInput as a, CommandItem as o, CommandList as s, Popover as c, PopoverContent as l, PopoverTrigger as u } from "./ui.js";
5
+ import { useDebouncedValue as d } from "../hooks/useDebouncedValue.js";
6
+ import { useEffect as f, useState as p } from "react";
7
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
+ //#region src/movethewheels/components/EntityCombobox.tsx
9
+ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, renderOption: x, getLabel: S, selectedOption: C = null, selectedLoading: w = !1, required: T = !1, placeholder: E = "Select…", searchPlaceholder: D = "Search…", emptyText: O = "No results found.", noneLabel: k = "None", disabled: A = !1, id: j, error: M, className: N, onSearchChange: P, hasMore: F = !1, totalCount: I }) {
10
+ let [L, R] = p(!1), [z, B] = p(""), V = d(z.trim(), 200);
11
+ f(() => {
12
+ P && P(V);
13
+ }, [V]);
14
+ let H = C ? S(C) : g ? w ? "Loading…" : g : E, U = n("w-full flex items-center justify-between gap-2 px-3 py-2", "bg-surface", "border border-default", "rounded-lg", "text-left text-sm text-text-primary", "focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]", "disabled:bg-bg-sunken disabled:cursor-not-allowed", "transition-all duration-200", M && "border-[var(--color-status-error)]", !C && "text-text-tertiary", N), W = F && typeof I == "number" && I > v.length;
15
+ return /* @__PURE__ */ h(c, {
16
+ open: L,
17
+ onOpenChange: (e) => {
18
+ R(e), e || B("");
19
+ },
20
+ children: [/* @__PURE__ */ m(u, {
21
+ asChild: !0,
22
+ children: /* @__PURE__ */ h("button", {
23
+ type: "button",
24
+ id: j,
25
+ role: "combobox",
26
+ "aria-expanded": L,
27
+ "aria-required": T,
28
+ "aria-invalid": M ? !0 : void 0,
29
+ disabled: A,
30
+ className: U,
31
+ children: [/* @__PURE__ */ m("span", {
32
+ className: "truncate",
33
+ children: H
34
+ }), /* @__PURE__ */ m(t, {
35
+ size: 16,
36
+ className: "shrink-0 text-text-tertiary",
37
+ "aria-hidden": "true"
38
+ })]
39
+ })
40
+ }), /* @__PURE__ */ m(l, {
41
+ align: "start",
42
+ className: "w-[var(--radix-popover-trigger-width)] p-0 border border-default bg-surface",
43
+ children: /* @__PURE__ */ h(r, {
44
+ shouldFilter: !1,
45
+ className: "bg-surface text-text-primary",
46
+ children: [P && /* @__PURE__ */ m(a, {
47
+ value: z,
48
+ onValueChange: B,
49
+ placeholder: D,
50
+ className: "text-text-primary placeholder:text-text-tertiary"
51
+ }), /* @__PURE__ */ h(s, { children: [
52
+ /* @__PURE__ */ m(i, {
53
+ className: "text-text-tertiary",
54
+ children: y ? "Searching…" : O
55
+ }),
56
+ !T && /* @__PURE__ */ h(o, {
57
+ value: "__none__",
58
+ onSelect: () => {
59
+ _(""), R(!1);
60
+ },
61
+ className: "text-text-tertiary",
62
+ children: [/* @__PURE__ */ m(e, {
63
+ size: 16,
64
+ className: n("shrink-0", g === "" ? "opacity-100" : "opacity-0"),
65
+ "aria-hidden": "true"
66
+ }), /* @__PURE__ */ m("span", {
67
+ className: "truncate italic",
68
+ children: k
69
+ })]
70
+ }),
71
+ v.map((t) => {
72
+ let r = b(t);
73
+ return /* @__PURE__ */ h(o, {
74
+ value: r,
75
+ onSelect: () => {
76
+ _(r), R(!1);
77
+ },
78
+ className: "text-text-primary",
79
+ children: [/* @__PURE__ */ m(e, {
80
+ size: 16,
81
+ className: n("shrink-0", r === g ? "opacity-100" : "opacity-0"),
82
+ "aria-hidden": "true"
83
+ }), /* @__PURE__ */ m("span", {
84
+ className: "truncate",
85
+ children: x(t)
86
+ })]
87
+ }, r);
88
+ }),
89
+ W && /* @__PURE__ */ h("div", {
90
+ className: "px-2 py-1.5 text-xs text-text-tertiary border-t border-border-seam",
91
+ children: [
92
+ "Showing ",
93
+ v.length,
94
+ " of ",
95
+ I,
96
+ P ? " — keep typing to narrow results." : "."
97
+ ]
98
+ })
99
+ ] })]
100
+ })
101
+ })]
102
+ });
103
+ }
104
+ //#endregion
105
+ export { g as EntityCombobox };
@@ -1,7 +1,7 @@
1
1
  import { cn as e } from "../utils/cn.js";
2
2
  import * as t from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
- import { Badge as r, Button as i, Card as a, CardContent as o, CardDescription as s, CardFooter as c, CardHeader as l, CardTitle as u, Checkbox as d, Dialog as f, DialogContent as p, DialogDescription as m, DialogFooter as h, DialogHeader as g, DialogTitle as _, DialogTrigger as v, DropdownMenu as y, DropdownMenuContent as b, DropdownMenuItem as x, DropdownMenuSeparator as S, DropdownMenuTrigger as C, Input as w, Label as T, ScrollArea as E, Select as D, SelectContent as O, SelectItem as k, SelectTrigger as A, SelectValue as j, Separator as M, Skeleton as N, Switch as P, Table as F, TableBody as I, TableCell as L, TableHead as R, TableHeader as z, TableRow as B, Tabs as V, TabsContent as H, TabsList as U, TabsTrigger as W, Textarea as G, Tooltip as K, TooltipContent as q, TooltipProvider as J, TooltipTrigger as Y } from "@burdenoff/fe-libs/ui";
4
+ import { Badge as r, Button as i, Card as a, CardContent as o, CardDescription as s, CardFooter as c, CardHeader as ee, CardTitle as te, Checkbox as ne, Command as re, CommandEmpty as l, CommandGroup as u, CommandInput as d, CommandItem as f, CommandList as p, Dialog as m, DialogContent as h, DialogDescription as g, DialogFooter as _, DialogHeader as v, DialogTitle as y, DialogTrigger as b, DropdownMenu as x, DropdownMenuContent as S, DropdownMenuItem as C, DropdownMenuSeparator as w, DropdownMenuTrigger as T, Input as E, Label as D, Popover as O, PopoverContent as k, PopoverTrigger as A, ScrollArea as j, Select as M, SelectContent as ie, SelectItem as N, SelectTrigger as P, SelectValue as F, Separator as I, Skeleton as L, Switch as R, Table as z, TableBody as B, TableCell as V, TableHead as H, TableHeader as U, TableRow as W, Tabs as G, TabsContent as K, TabsList as q, TabsTrigger as J, Textarea as Y, Tooltip as ae, TooltipContent as oe, TooltipProvider as se, TooltipTrigger as ce } from "@burdenoff/fe-libs/ui";
5
5
  //#region src/movethewheels/components/ui.tsx
6
6
  var X = t.forwardRef(({ className: t, value: r = 0, max: i = 100, ...a }, o) => {
7
7
  let s = Math.min(Math.max(r / i * 100, 0), 100);
@@ -35,4 +35,4 @@ var $ = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("div", {
35
35
  }));
36
36
  $.displayName = "AvatarFallback";
37
37
  //#endregion
38
- export { Z as Avatar, $ as AvatarFallback, Q as AvatarImage, r as Badge, i as Button, a as Card, o as CardContent, s as CardDescription, c as CardFooter, l as CardHeader, u as CardTitle, d as Checkbox, f as Dialog, p as DialogContent, m as DialogDescription, h as DialogFooter, g as DialogHeader, _ as DialogTitle, v as DialogTrigger, y as DropdownMenu, b as DropdownMenuContent, x as DropdownMenuItem, S as DropdownMenuSeparator, C as DropdownMenuTrigger, w as Input, T as Label, X as Progress, E as ScrollArea, D as Select, O as SelectContent, k as SelectItem, A as SelectTrigger, j as SelectValue, M as Separator, N as Skeleton, P as Switch, F as Table, I as TableBody, L as TableCell, R as TableHead, z as TableHeader, B as TableRow, V as Tabs, H as TabsContent, U as TabsList, W as TabsTrigger, G as Textarea, K as Tooltip, q as TooltipContent, J as TooltipProvider, Y as TooltipTrigger };
38
+ export { Z as Avatar, $ as AvatarFallback, Q as AvatarImage, r as Badge, i as Button, a as Card, o as CardContent, s as CardDescription, c as CardFooter, ee as CardHeader, te as CardTitle, ne as Checkbox, re as Command, l as CommandEmpty, u as CommandGroup, d as CommandInput, f as CommandItem, p as CommandList, m as Dialog, h as DialogContent, g as DialogDescription, _ as DialogFooter, v as DialogHeader, y as DialogTitle, b as DialogTrigger, x as DropdownMenu, S as DropdownMenuContent, C as DropdownMenuItem, w as DropdownMenuSeparator, T as DropdownMenuTrigger, E as Input, D as Label, O as Popover, k as PopoverContent, A as PopoverTrigger, X as Progress, j as ScrollArea, M as Select, ie as SelectContent, N as SelectItem, P as SelectTrigger, F as SelectValue, I as Separator, L as Skeleton, R as Switch, z as Table, B as TableBody, V as TableCell, H as TableHead, U as TableHeader, W as TableRow, G as Tabs, K as TabsContent, q as TabsList, J as TabsTrigger, Y as Textarea, ae as Tooltip, oe as TooltipContent, se as TooltipProvider, ce as TooltipTrigger };
@@ -258,66 +258,68 @@ function E(e = {}) {
258
258
  };
259
259
  }
260
260
  function D(e = {}) {
261
- let { limit: i = 20, offset: s = 0, search: c, status: l, vehicleType: f } = e, p = T(), [m, h] = a([]), [g, _] = a(0), [v, y] = a(!1), [x, S] = a(!1), [w, E] = a(null), D = n(async () => {
262
- S(!0), E(null);
261
+ let { limit: i = 20, offset: s = 0, search: c, status: l, vehicleType: f, driverId: p } = e, m = T(), [h, g] = a([]), [_, v] = a(0), [y, x] = a(!1), [S, w] = a(!1), [E, D] = a(null), O = n(async () => {
262
+ w(!0), D(null);
263
263
  try {
264
- let e = await t(p, o, {
264
+ let e = await t(m, o, {
265
265
  filter: {
266
266
  search: c || void 0,
267
267
  status: l ? b(l) : void 0,
268
- type: f?.toUpperCase()
268
+ type: f?.toUpperCase(),
269
+ driverId: p || void 0
269
270
  },
270
271
  pagination: {
271
272
  limit: i,
272
273
  offset: s
273
274
  }
274
275
  });
275
- y(s + e.vehicles.length < e.vehiclesCount), _(e.vehiclesCount), h(e.vehicles.map(C));
276
+ x(s + e.vehicles.length < e.vehiclesCount), v(e.vehiclesCount), g(e.vehicles.map(C));
276
277
  } catch (e) {
277
- E(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load vehicles"));
278
+ D(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load vehicles"));
278
279
  } finally {
279
- S(!1);
280
+ w(!1);
280
281
  }
281
282
  }, [
282
- p,
283
+ m,
283
284
  i,
284
285
  s,
285
286
  c,
286
287
  l,
287
- f
288
+ f,
289
+ p
288
290
  ]);
289
291
  return r(() => {
290
- D();
291
- }, [D]), {
292
- vehicles: m,
293
- totalVehicles: g,
294
- hasMore: v,
295
- isLoading: x,
296
- error: w,
292
+ O();
293
+ }, [O]), {
294
+ vehicles: h,
295
+ totalVehicles: _,
296
+ hasMore: y,
297
+ isLoading: S,
298
+ error: E,
297
299
  refetch: n(() => {
298
- D();
299
- }, [D]),
300
+ O();
301
+ }, [O]),
300
302
  updateVehicleStatus: n(async (e, n) => {
301
- let r = C((await t(p, u, {
303
+ let r = C((await t(m, u, {
302
304
  id: e,
303
305
  status: b(n)
304
306
  })).updateVehicleStatus);
305
- return h((t) => t.map((t) => t.id === e ? r : t)), r;
306
- }, [p]),
307
+ return g((t) => t.map((t) => t.id === e ? r : t)), r;
308
+ }, [m]),
307
309
  assignDriver: n(async (e, n) => {
308
- await t(p, d, {
310
+ await t(m, d, {
309
311
  id: n,
310
312
  vehicleId: e
311
313
  });
312
- let r = m.find((t) => t.id === e);
314
+ let r = h.find((t) => t.id === e);
313
315
  if (!r) throw Error("Vehicle not found");
314
316
  let i = {
315
317
  ...r,
316
318
  driverId: n,
317
319
  status: "assigned"
318
320
  };
319
- return h((t) => t.map((t) => t.id === e ? i : t)), i;
320
- }, [p, m])
321
+ return g((t) => t.map((t) => t.id === e ? i : t)), i;
322
+ }, [m, h])
321
323
  };
322
324
  }
323
325
  function O(e) {
@@ -348,59 +350,61 @@ function O(e) {
348
350
  };
349
351
  }
350
352
  function k(e = {}) {
351
- let { limit: i = 20, offset: o = 0, status: c, search: l, licenseClass: u } = e, p = T(), [m, h] = a([]), [g, _] = a(0), [v, y] = a(!1), [b, x] = a(!1), [C, E] = a(null), D = n(async () => {
352
- x(!0), E(null);
353
+ let { limit: i = 20, offset: o = 0, status: c, search: l, licenseClass: u, vehicleId: p } = e, m = T(), [h, g] = a([]), [_, v] = a(0), [y, b] = a(!1), [x, C] = a(!1), [E, D] = a(null), O = n(async () => {
354
+ C(!0), D(null);
353
355
  try {
354
- let e = await t(p, s, {
356
+ let e = await t(m, s, {
355
357
  filter: {
356
358
  status: c ? S(c) : void 0,
357
359
  search: l || void 0,
358
- licenseClass: u || void 0
360
+ licenseClass: u || void 0,
361
+ vehicleId: p || void 0
359
362
  },
360
363
  pagination: {
361
364
  limit: i,
362
365
  offset: o
363
366
  }
364
367
  });
365
- y(o + e.drivers.length < e.driversCount), _(e.driversCount), h(e.drivers.map(w));
368
+ b(o + e.drivers.length < e.driversCount), v(e.driversCount), g(e.drivers.map(w));
366
369
  } catch (e) {
367
- E(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load drivers"));
370
+ D(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load drivers"));
368
371
  } finally {
369
- x(!1);
372
+ C(!1);
370
373
  }
371
374
  }, [
372
- p,
375
+ m,
373
376
  i,
374
377
  o,
375
378
  c,
376
379
  l,
377
- u
380
+ u,
381
+ p
378
382
  ]);
379
383
  return r(() => {
380
- D();
381
- }, [D]), {
382
- drivers: m,
383
- totalDrivers: g,
384
- hasMore: v,
385
- isLoading: b,
386
- error: C,
384
+ O();
385
+ }, [O]), {
386
+ drivers: h,
387
+ totalDrivers: _,
388
+ hasMore: y,
389
+ isLoading: x,
390
+ error: E,
387
391
  refetch: n(() => {
388
- D();
389
- }, [D]),
392
+ O();
393
+ }, [O]),
390
394
  updateDriverStatus: n(async (e, n) => {
391
- let r = w((await t(p, f, {
395
+ let r = w((await t(m, f, {
392
396
  id: e,
393
397
  status: S(n)
394
398
  })).updateDriverStatus);
395
- return h((t) => t.map((t) => t.id === e ? r : t)), r;
396
- }, [p]),
399
+ return g((t) => t.map((t) => t.id === e ? r : t)), r;
400
+ }, [m]),
397
401
  assignVehicle: n(async (e, n) => {
398
- let r = w((await t(p, d, {
402
+ let r = w((await t(m, d, {
399
403
  id: e,
400
404
  vehicleId: n
401
405
  })).assignDriverVehicle);
402
- return h((t) => t.map((t) => t.id === e ? r : t)), r;
403
- }, [p])
406
+ return g((t) => t.map((t) => t.id === e ? r : t)), r;
407
+ }, [m])
404
408
  };
405
409
  }
406
410
  function A(e) {