@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.
- package/dist/components/CustomerPicker.js +94 -101
- package/dist/components/EntityCombobox.js +105 -0
- package/dist/components/ui.js +2 -2
- package/dist/hooks/useFleet.js +53 -49
- package/dist/index.js +22 -22
- package/dist/movethewheels/components/CustomerPicker.d.ts +3 -2
- package/dist/movethewheels/components/EntityCombobox.d.ts +40 -0
- package/dist/movethewheels/components/ui.d.ts +1 -1
- package/dist/movethewheels/hooks/useFleet.d.ts +4 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js +11 -0
- package/dist/pages/CreateOrderPage.js +175 -169
- package/dist/pages/OrderDetailsPage.js +291 -294
- package/dist/pages/RouteDetailsPage.js +298 -296
- package/package.json +1 -1
- package/src/movethewheels/components/CustomerPicker.tsx +26 -36
- package/src/movethewheels/components/EntityCombobox.tsx +237 -0
- package/src/movethewheels/components/ui.tsx +9 -0
- package/src/movethewheels/hooks/useFleet.ts +10 -4
- package/src/movethewheels/pages/CreateOrderPage.tsx +39 -19
- package/src/movethewheels/pages/OrderDetailsPage.tsx +61 -60
- package/src/movethewheels/pages/RouteDetailsPage.tsx +53 -53
|
@@ -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 {
|
|
7
|
-
import {
|
|
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
|
|
10
|
+
var C = {
|
|
10
11
|
name: "",
|
|
11
12
|
type: "b2c",
|
|
12
13
|
email: "",
|
|
13
14
|
phone: "",
|
|
14
15
|
company: ""
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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__ */
|
|
23
|
+
return /* @__PURE__ */ S("div", {
|
|
26
24
|
className: "space-y-2",
|
|
27
25
|
children: [
|
|
28
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ S("div", {
|
|
29
27
|
className: "flex items-center justify-between gap-2",
|
|
30
|
-
children: [/* @__PURE__ */
|
|
28
|
+
children: [/* @__PURE__ */ x(d, {
|
|
31
29
|
htmlFor: "customer",
|
|
32
30
|
children: "Customer"
|
|
33
|
-
}), /* @__PURE__ */
|
|
31
|
+
}), /* @__PURE__ */ S(r, {
|
|
34
32
|
type: "button",
|
|
35
33
|
variant: "ghost",
|
|
36
34
|
size: "sm",
|
|
37
|
-
onClick:
|
|
38
|
-
disabled: F ||
|
|
39
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
43
|
+
/* @__PURE__ */ S("div", {
|
|
46
44
|
className: "flex flex-col gap-2 sm:flex-row sm:items-start",
|
|
47
|
-
children: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
78
|
+
A ? /* @__PURE__ */ S("div", {
|
|
86
79
|
className: "flex flex-wrap items-center gap-2",
|
|
87
|
-
children: [/* @__PURE__ */
|
|
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
|
-
}),
|
|
84
|
+
}), M && /* @__PURE__ */ x(r, {
|
|
92
85
|
type: "button",
|
|
93
86
|
variant: "outline",
|
|
94
87
|
size: "sm",
|
|
95
|
-
onClick:
|
|
88
|
+
onClick: M,
|
|
96
89
|
children: "Open customer page"
|
|
97
90
|
})]
|
|
98
|
-
}) : !
|
|
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__ */
|
|
93
|
+
children: [/* @__PURE__ */ S("div", {
|
|
101
94
|
className: "flex items-start gap-2",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ x(n, {
|
|
103
96
|
size: 16,
|
|
104
97
|
className: "mt-0.5 shrink-0 text-text-secondary"
|
|
105
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
105
|
+
}), /* @__PURE__ */ S(r, {
|
|
113
106
|
type: "button",
|
|
114
107
|
size: "sm",
|
|
115
108
|
className: "mt-3",
|
|
116
|
-
onClick:
|
|
109
|
+
onClick: W,
|
|
117
110
|
disabled: F,
|
|
118
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
117
|
+
/* @__PURE__ */ x(i, {
|
|
125
118
|
open: I,
|
|
126
|
-
onOpenChange: (e) => e ? L(!0) :
|
|
127
|
-
children: /* @__PURE__ */
|
|
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
|
-
|
|
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(
|
|
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__ */
|
|
153
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ x(_, { message: H }),
|
|
146
|
+
/* @__PURE__ */ S("div", {
|
|
154
147
|
className: "space-y-2",
|
|
155
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ x(d, {
|
|
156
149
|
htmlFor: "quick-customer-name",
|
|
157
150
|
children: "Name"
|
|
158
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
163
|
+
/* @__PURE__ */ S("div", {
|
|
171
164
|
className: "space-y-2",
|
|
172
|
-
children: [/* @__PURE__ */
|
|
165
|
+
children: [/* @__PURE__ */ x(d, {
|
|
173
166
|
htmlFor: "quick-customer-type",
|
|
174
167
|
children: "Customer type"
|
|
175
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
174
|
+
children: [/* @__PURE__ */ x(h, {
|
|
182
175
|
id: "quick-customer-type",
|
|
183
|
-
children: /* @__PURE__ */
|
|
184
|
-
}), /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ x(g, {})
|
|
177
|
+
}), /* @__PURE__ */ S(p, { children: [/* @__PURE__ */ x(m, {
|
|
185
178
|
value: "b2c",
|
|
186
179
|
children: "B2C (Individual)"
|
|
187
|
-
}), /* @__PURE__ */
|
|
180
|
+
}), /* @__PURE__ */ x(m, {
|
|
188
181
|
value: "b2b",
|
|
189
182
|
children: "B2B (Business)"
|
|
190
183
|
})] })]
|
|
191
184
|
})]
|
|
192
185
|
}),
|
|
193
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ S("div", {
|
|
194
187
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
195
|
-
children: [/* @__PURE__ */
|
|
188
|
+
children: [/* @__PURE__ */ S("div", {
|
|
196
189
|
className: "space-y-2",
|
|
197
|
-
children: [/* @__PURE__ */
|
|
190
|
+
children: [/* @__PURE__ */ x(d, {
|
|
198
191
|
htmlFor: "quick-customer-email",
|
|
199
192
|
children: "Email"
|
|
200
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
203
|
+
}), /* @__PURE__ */ S("div", {
|
|
211
204
|
className: "space-y-2",
|
|
212
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ x(d, {
|
|
213
206
|
htmlFor: "quick-customer-phone",
|
|
214
207
|
children: "Phone"
|
|
215
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
219
|
+
/* @__PURE__ */ S("div", {
|
|
227
220
|
className: "space-y-2",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
221
|
+
children: [/* @__PURE__ */ x(d, {
|
|
229
222
|
htmlFor: "quick-customer-company",
|
|
230
223
|
children: "Company"
|
|
231
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
242
|
-
|
|
234
|
+
/* @__PURE__ */ S(s, { children: [
|
|
235
|
+
M && /* @__PURE__ */ x(r, {
|
|
243
236
|
type: "button",
|
|
244
237
|
variant: "outline",
|
|
245
238
|
onClick: () => {
|
|
246
|
-
|
|
239
|
+
G(), M();
|
|
247
240
|
},
|
|
248
241
|
disabled: B,
|
|
249
242
|
children: "Use customer page"
|
|
250
243
|
}),
|
|
251
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ x(r, {
|
|
252
245
|
type: "button",
|
|
253
246
|
variant: "outline",
|
|
254
|
-
onClick:
|
|
247
|
+
onClick: G,
|
|
255
248
|
disabled: B,
|
|
256
249
|
children: "Cancel"
|
|
257
250
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ S(r, {
|
|
259
252
|
type: "submit",
|
|
260
253
|
disabled: B,
|
|
261
|
-
children: [/* @__PURE__ */
|
|
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 {
|
|
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 };
|
package/dist/components/ui.js
CHANGED
|
@@ -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
|
|
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,
|
|
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 };
|
package/dist/hooks/useFleet.js
CHANGED
|
@@ -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,
|
|
262
|
-
|
|
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(
|
|
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
|
-
|
|
276
|
+
x(s + e.vehicles.length < e.vehiclesCount), v(e.vehiclesCount), g(e.vehicles.map(C));
|
|
276
277
|
} catch (e) {
|
|
277
|
-
|
|
278
|
+
D(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load vehicles"));
|
|
278
279
|
} finally {
|
|
279
|
-
|
|
280
|
+
w(!1);
|
|
280
281
|
}
|
|
281
282
|
}, [
|
|
282
|
-
|
|
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
|
-
|
|
291
|
-
}, [
|
|
292
|
-
vehicles:
|
|
293
|
-
totalVehicles:
|
|
294
|
-
hasMore:
|
|
295
|
-
isLoading:
|
|
296
|
-
error:
|
|
292
|
+
O();
|
|
293
|
+
}, [O]), {
|
|
294
|
+
vehicles: h,
|
|
295
|
+
totalVehicles: _,
|
|
296
|
+
hasMore: y,
|
|
297
|
+
isLoading: S,
|
|
298
|
+
error: E,
|
|
297
299
|
refetch: n(() => {
|
|
298
|
-
|
|
299
|
-
}, [
|
|
300
|
+
O();
|
|
301
|
+
}, [O]),
|
|
300
302
|
updateVehicleStatus: n(async (e, n) => {
|
|
301
|
-
let r = C((await t(
|
|
303
|
+
let r = C((await t(m, u, {
|
|
302
304
|
id: e,
|
|
303
305
|
status: b(n)
|
|
304
306
|
})).updateVehicleStatus);
|
|
305
|
-
return
|
|
306
|
-
}, [
|
|
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(
|
|
310
|
+
await t(m, d, {
|
|
309
311
|
id: n,
|
|
310
312
|
vehicleId: e
|
|
311
313
|
});
|
|
312
|
-
let r =
|
|
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
|
|
320
|
-
}, [
|
|
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,
|
|
352
|
-
|
|
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(
|
|
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
|
-
|
|
368
|
+
b(o + e.drivers.length < e.driversCount), v(e.driversCount), g(e.drivers.map(w));
|
|
366
369
|
} catch (e) {
|
|
367
|
-
|
|
370
|
+
D(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load drivers"));
|
|
368
371
|
} finally {
|
|
369
|
-
|
|
372
|
+
C(!1);
|
|
370
373
|
}
|
|
371
374
|
}, [
|
|
372
|
-
|
|
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
|
-
|
|
381
|
-
}, [
|
|
382
|
-
drivers:
|
|
383
|
-
totalDrivers:
|
|
384
|
-
hasMore:
|
|
385
|
-
isLoading:
|
|
386
|
-
error:
|
|
384
|
+
O();
|
|
385
|
+
}, [O]), {
|
|
386
|
+
drivers: h,
|
|
387
|
+
totalDrivers: _,
|
|
388
|
+
hasMore: y,
|
|
389
|
+
isLoading: x,
|
|
390
|
+
error: E,
|
|
387
391
|
refetch: n(() => {
|
|
388
|
-
|
|
389
|
-
}, [
|
|
392
|
+
O();
|
|
393
|
+
}, [O]),
|
|
390
394
|
updateDriverStatus: n(async (e, n) => {
|
|
391
|
-
let r = w((await t(
|
|
395
|
+
let r = w((await t(m, f, {
|
|
392
396
|
id: e,
|
|
393
397
|
status: S(n)
|
|
394
398
|
})).updateDriverStatus);
|
|
395
|
-
return
|
|
396
|
-
}, [
|
|
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(
|
|
402
|
+
let r = w((await t(m, d, {
|
|
399
403
|
id: e,
|
|
400
404
|
vehicleId: n
|
|
401
405
|
})).assignDriverVehicle);
|
|
402
|
-
return
|
|
403
|
-
}, [
|
|
406
|
+
return g((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
407
|
+
}, [m])
|
|
404
408
|
};
|
|
405
409
|
}
|
|
406
410
|
function A(e) {
|