@burdenoff/microfe-movethewheels 2026.930.2 → 2026.930.4
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/StockActionDialogs.js +385 -0
- package/dist/hooks/useFleet.js +112 -109
- package/dist/hooks/useInventory.js +248 -124
- package/dist/index.js +34 -34
- package/dist/movethewheels/components/StockActionDialogs.d.ts +24 -0
- package/dist/movethewheels/hooks/index.d.ts +1 -1
- package/dist/movethewheels/hooks/useFleet.d.ts +1 -0
- package/dist/movethewheels/hooks/useInventory.d.ts +30 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/package-plus.js +33 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js +69 -0
- package/dist/pages/DriverDetailsPage.js +401 -347
- package/dist/pages/InventoryPage.js +279 -200
- package/dist/pages/RouteDetailsPage.js +4 -4
- package/package.json +1 -1
- package/src/movethewheels/components/StockActionDialogs.tsx +512 -0
- package/src/movethewheels/hooks/index.ts +3 -0
- package/src/movethewheels/hooks/useFleet.ts +18 -0
- package/src/movethewheels/hooks/useInventory.ts +294 -35
- package/src/movethewheels/pages/DriverDetailsPage.tsx +72 -1
- package/src/movethewheels/pages/InventoryPage.tsx +98 -1
- package/src/movethewheels/pages/RouteDetailsPage.tsx +5 -4
|
@@ -7,31 +7,32 @@ import { Save as a } from "../node_modules/lucide-react/dist/esm/icons/save.js";
|
|
|
7
7
|
import { SquarePen as o } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
|
|
8
8
|
import { Star as s } from "../node_modules/lucide-react/dist/esm/icons/star.js";
|
|
9
9
|
import { StickyNote as ee } from "../node_modules/lucide-react/dist/esm/icons/sticky-note.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
10
|
+
import { Trash2 as c } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
|
|
11
|
+
import { Truck as l } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
|
|
12
|
+
import { UserX as u } from "../node_modules/lucide-react/dist/esm/icons/user-x.js";
|
|
13
|
+
import { Users as d } from "../node_modules/lucide-react/dist/esm/icons/users.js";
|
|
14
|
+
import { joinPath as f } from "../utils/navigation.js";
|
|
15
|
+
import { useMoveTheWheels as te } from "../providers/MoveTheWheelsProvider.js";
|
|
16
|
+
import { toApiDriverStatus as p, useDriver as ne, useFleet as m, useVehicle as re, useVehicles as ie } from "../hooks/useFleet.js";
|
|
17
|
+
import { Button as h, Card as g, CardContent as _, CardHeader as v, CardTitle as y, Input as b, Label as x, Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as E, Textarea as D } from "../components/ui.js";
|
|
18
|
+
import { ErrorState as ae, LoadingState as O, PageLayout as oe } from "../components/PageLayout.js";
|
|
19
|
+
import { DRIVER_STATUS_LABELS as k } from "../constants/index.js";
|
|
20
|
+
import { StatusBadge as A } from "../components/StatusBadge.js";
|
|
21
|
+
import { FormError as j } from "../components/FormError.js";
|
|
22
|
+
import { formatCurrency as M, formatDate as N } from "../utils/formatters.js";
|
|
23
|
+
import { DocumentsCard as P } from "../components/DocumentsCard.js";
|
|
24
|
+
import { useDebouncedValue as se } from "../hooks/useDebouncedValue.js";
|
|
25
|
+
import { EntityCombobox as ce } from "../components/EntityCombobox.js";
|
|
26
|
+
import { useRefetchOnLeaveEdit as F } from "../hooks/useRefetchOnLeaveEdit.js";
|
|
27
|
+
import { useEffect as le, useState as I } from "react";
|
|
28
|
+
import { useLocation as L, useParams as R } from "react-router";
|
|
29
|
+
import { Fragment as ue, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
30
|
+
import { EmphasisPanel as de, NextSteps as V, PagePurpose as H, ResponsiveDialog as U, ResponsiveDialogContent as fe, ResponsiveDialogDescription as pe, ResponsiveDialogFooter as me, ResponsiveDialogHeader as he, ResponsiveDialogTitle as ge } from "@burdenoff/fe-libs/ui";
|
|
30
31
|
//#region src/movethewheels/pages/DriverDetailsPage.tsx
|
|
31
|
-
var
|
|
32
|
+
var _e = Object.entries(k).map(([e, t]) => ({
|
|
32
33
|
value: e,
|
|
33
34
|
label: t
|
|
34
|
-
})),
|
|
35
|
+
})), W = (e) => e ? e.toISOString().slice(0, 10) : "", G = (e) => e ? `${e}T12:00:00.000Z` : void 0, ve = {
|
|
35
36
|
employeeId: "",
|
|
36
37
|
firstName: "",
|
|
37
38
|
lastName: "",
|
|
@@ -51,186 +52,197 @@ var pe = Object.entries(M).map(([e, t]) => ({
|
|
|
51
52
|
payCurrency: "",
|
|
52
53
|
onLeaveUntil: ""
|
|
53
54
|
};
|
|
54
|
-
function
|
|
55
|
-
let { basePath: r, navigate: i } =
|
|
55
|
+
function K({ editId: t }) {
|
|
56
|
+
let { basePath: r, navigate: i } = te(), { createDriver: o, updateDriver: s, deleteDriver: ae } = m(), { driver: O, refetch: k } = ne(t), A = !!t, [M, P] = I(ve), [F, L] = I(!1), [R, V] = I(null), [K, q] = I(!1), [J, ye] = I(""), [Y, be] = I(!1), [xe, X] = I(null), [Se, Z] = I(!1), [Q, Ce] = I(!1), [we, Te] = I(null), [Ee, De] = I(""), { vehicles: Oe, isLoading: ke, isLoadingMore: Ae, hasMore: je, totalVehicles: Me, loadMore: Ne } = ie({
|
|
56
57
|
limit: 20,
|
|
57
|
-
search:
|
|
58
|
-
}), { vehicle:
|
|
59
|
-
|
|
60
|
-
if (!t || !
|
|
61
|
-
let [e, ...n] =
|
|
62
|
-
|
|
63
|
-
employeeId:
|
|
58
|
+
search: se(Ee) || void 0
|
|
59
|
+
}), { vehicle: Pe, isLoading: Fe } = re(M.vehicleId || void 0);
|
|
60
|
+
le(() => {
|
|
61
|
+
if (!t || !O) return;
|
|
62
|
+
let [e, ...n] = O.fullName.trim().split(/\s+/);
|
|
63
|
+
P({
|
|
64
|
+
employeeId: O.employeeId || "",
|
|
64
65
|
firstName: e || "",
|
|
65
66
|
lastName: n.join(" "),
|
|
66
|
-
email:
|
|
67
|
-
phone:
|
|
68
|
-
licenseNumber:
|
|
69
|
-
licenseClass:
|
|
70
|
-
licenseExpiry:
|
|
71
|
-
status:
|
|
72
|
-
vehicleId:
|
|
73
|
-
vehicleIds:
|
|
74
|
-
rating:
|
|
75
|
-
notes:
|
|
76
|
-
hireDate:
|
|
77
|
-
baseSalary:
|
|
78
|
-
bonusYtd:
|
|
79
|
-
payCurrency:
|
|
80
|
-
onLeaveUntil:
|
|
67
|
+
email: O.email || "",
|
|
68
|
+
phone: O.phone || "",
|
|
69
|
+
licenseNumber: O.licenseNumber || "",
|
|
70
|
+
licenseClass: O.licenseType || "",
|
|
71
|
+
licenseExpiry: W(O.licenseExpiry),
|
|
72
|
+
status: O.status,
|
|
73
|
+
vehicleId: O.assignedVehicle || "",
|
|
74
|
+
vehicleIds: O.vehicleIds,
|
|
75
|
+
rating: O.rating ? String(O.rating) : "",
|
|
76
|
+
notes: O.notes || "",
|
|
77
|
+
hireDate: W(O.hireDate),
|
|
78
|
+
baseSalary: O.baseSalary === void 0 ? "" : String(O.baseSalary),
|
|
79
|
+
bonusYtd: O.bonusYtd === void 0 ? "" : String(O.bonusYtd),
|
|
80
|
+
payCurrency: O.payCurrency || "",
|
|
81
|
+
onLeaveUntil: W(O.onLeaveUntil)
|
|
81
82
|
});
|
|
82
|
-
}, [t,
|
|
83
|
-
let
|
|
84
|
-
firstName:
|
|
85
|
-
lastName:
|
|
86
|
-
email:
|
|
87
|
-
phone:
|
|
88
|
-
licenseNumber:
|
|
89
|
-
licenseClass:
|
|
90
|
-
licenseExpiry:
|
|
91
|
-
status:
|
|
92
|
-
vehicleId:
|
|
93
|
-
vehicleIds:
|
|
94
|
-
rating:
|
|
95
|
-
notes:
|
|
96
|
-
hireDate:
|
|
97
|
-
baseSalary:
|
|
98
|
-
bonusYtd:
|
|
99
|
-
payCurrency:
|
|
100
|
-
...e ? { onLeaveUntil:
|
|
101
|
-
}),
|
|
102
|
-
employeeId:
|
|
83
|
+
}, [t, O]);
|
|
84
|
+
let Ie = () => i?.(f(r, "fleet/drivers")), $ = (e = !0) => ({
|
|
85
|
+
firstName: M.firstName.trim(),
|
|
86
|
+
lastName: M.lastName.trim(),
|
|
87
|
+
email: M.email.trim() || void 0,
|
|
88
|
+
phone: M.phone.trim() || void 0,
|
|
89
|
+
licenseNumber: M.licenseNumber.trim() || void 0,
|
|
90
|
+
licenseClass: M.licenseClass.trim() || void 0,
|
|
91
|
+
licenseExpiry: G(M.licenseExpiry),
|
|
92
|
+
status: p(M.status),
|
|
93
|
+
vehicleId: M.vehicleId || null,
|
|
94
|
+
vehicleIds: M.vehicleIds,
|
|
95
|
+
rating: M.rating.trim() ? Number(M.rating) : void 0,
|
|
96
|
+
notes: M.notes.trim() || void 0,
|
|
97
|
+
hireDate: G(M.hireDate),
|
|
98
|
+
baseSalary: M.baseSalary.trim() ? Number(M.baseSalary) : void 0,
|
|
99
|
+
bonusYtd: M.bonusYtd.trim() ? Number(M.bonusYtd) : void 0,
|
|
100
|
+
payCurrency: M.payCurrency.trim() || void 0,
|
|
101
|
+
...e ? { onLeaveUntil: G(M.onLeaveUntil) ?? null } : {}
|
|
102
|
+
}), Le = () => ({
|
|
103
|
+
employeeId: M.employeeId.trim(),
|
|
103
104
|
...$(!1)
|
|
104
|
-
}),
|
|
105
|
-
if (e.preventDefault(), !
|
|
105
|
+
}), Re = async (e) => {
|
|
106
|
+
if (e.preventDefault(), !M.employeeId.trim() || !M.firstName.trim() || !M.lastName.trim()) {
|
|
106
107
|
V("Employee ID, first name and last name are required.");
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
|
-
if (!
|
|
110
|
+
if (!M.phone.trim()) {
|
|
110
111
|
V("Phone is required so this driver can be reached.");
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
L(!0), V(null);
|
|
114
115
|
try {
|
|
115
116
|
if (t) {
|
|
116
117
|
let e = await s(t, $());
|
|
117
|
-
i?.(
|
|
118
|
+
i?.(f(r, `fleet/drivers/${e.id}`));
|
|
118
119
|
} else {
|
|
119
|
-
let e = await o(
|
|
120
|
-
i?.(
|
|
120
|
+
let e = await o(Le());
|
|
121
|
+
i?.(f(r, `fleet/drivers/${e.id}`));
|
|
121
122
|
}
|
|
122
123
|
} catch (e) {
|
|
123
|
-
console.error("Failed to save driver:", e), V(e instanceof Error ? e.message : "Failed to save driver. Please try again."),
|
|
124
|
+
console.error("Failed to save driver:", e), V(e instanceof Error ? e.message : "Failed to save driver. Please try again."), L(!1);
|
|
124
125
|
}
|
|
125
|
-
},
|
|
126
|
-
if (!t || !
|
|
127
|
-
|
|
126
|
+
}, ze = async () => {
|
|
127
|
+
if (!t || !J.trim()) {
|
|
128
|
+
X("A reason is required to dismiss a driver.");
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
be(!0), X(null);
|
|
131
132
|
try {
|
|
132
133
|
await s(t, {
|
|
133
134
|
...$(),
|
|
134
135
|
terminatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
135
|
-
terminationReason:
|
|
136
|
-
}),
|
|
136
|
+
terminationReason: J.trim()
|
|
137
|
+
}), q(!1), await k(), i?.(f(r, `fleet/drivers/${t}`));
|
|
137
138
|
} catch (e) {
|
|
138
|
-
|
|
139
|
+
X(e instanceof Error ? e.message : "Failed to dismiss driver.");
|
|
139
140
|
} finally {
|
|
140
|
-
|
|
141
|
+
be(!1);
|
|
141
142
|
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
}, Be = async () => {
|
|
144
|
+
if (t) {
|
|
145
|
+
Ce(!0), Te(null);
|
|
146
|
+
try {
|
|
147
|
+
await ae(t), Z(!1), i?.(f(r, "fleet/drivers"));
|
|
148
|
+
} catch (e) {
|
|
149
|
+
Te(e instanceof Error ? e.message : "Failed to delete driver.");
|
|
150
|
+
} finally {
|
|
151
|
+
Ce(!1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, Ve = A && !!O?.terminatedAt;
|
|
155
|
+
return /* @__PURE__ */ B(oe, {
|
|
156
|
+
title: A ? "Edit Driver" : "Add Driver",
|
|
145
157
|
subtitle: "Add a driver to your workforce",
|
|
146
|
-
icon: /* @__PURE__ */
|
|
147
|
-
headerActions: /* @__PURE__ */
|
|
158
|
+
icon: /* @__PURE__ */ z(d, { size: 24 }),
|
|
159
|
+
headerActions: /* @__PURE__ */ B("div", {
|
|
148
160
|
className: "flex gap-2",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ B(h, {
|
|
150
162
|
variant: "outline",
|
|
151
|
-
onClick:
|
|
152
|
-
disabled:
|
|
153
|
-
children: [/* @__PURE__ */
|
|
154
|
-
}), /* @__PURE__ */
|
|
155
|
-
onClick:
|
|
156
|
-
disabled:
|
|
163
|
+
onClick: Ie,
|
|
164
|
+
disabled: F,
|
|
165
|
+
children: [/* @__PURE__ */ z(e, { size: 16 }), " Cancel"]
|
|
166
|
+
}), /* @__PURE__ */ B(h, {
|
|
167
|
+
onClick: Re,
|
|
168
|
+
disabled: F,
|
|
157
169
|
children: [
|
|
158
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ z(a, { size: 16 }),
|
|
159
171
|
" ",
|
|
160
|
-
|
|
172
|
+
A ? F ? "Saving..." : "Save Changes" : F ? "Saving..." : "Add Driver"
|
|
161
173
|
]
|
|
162
174
|
})]
|
|
163
175
|
}),
|
|
164
176
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
icon: /* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ z(H, {
|
|
178
|
+
icon: /* @__PURE__ */ z(d, { size: 18 }),
|
|
167
179
|
children: "Add a driver so they can be assigned to orders and routes. An employee ID, name and phone get them on the roster — add licensing, a vehicle and HR details to keep the record complete."
|
|
168
180
|
}),
|
|
169
|
-
|
|
181
|
+
Ve && O?.terminatedAt && /* @__PURE__ */ B("div", {
|
|
170
182
|
className: "rounded-card border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
|
|
171
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ B("p", {
|
|
172
184
|
className: "font-medium",
|
|
173
185
|
children: [
|
|
174
186
|
"This driver was dismissed on ",
|
|
175
|
-
|
|
187
|
+
N(O.terminatedAt, "full"),
|
|
176
188
|
"."
|
|
177
189
|
]
|
|
178
|
-
}),
|
|
190
|
+
}), O.terminationReason && /* @__PURE__ */ B("p", {
|
|
179
191
|
className: "mt-1",
|
|
180
|
-
children: ["Reason: ",
|
|
192
|
+
children: ["Reason: ", O.terminationReason]
|
|
181
193
|
})]
|
|
182
194
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
onSubmit:
|
|
195
|
+
/* @__PURE__ */ B("form", {
|
|
196
|
+
onSubmit: Re,
|
|
185
197
|
className: "max-w-3xl space-y-6",
|
|
186
198
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ z(j, { message: R }),
|
|
200
|
+
/* @__PURE__ */ B(de, { children: [/* @__PURE__ */ z("h2", {
|
|
189
201
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
190
202
|
children: "Driver Details"
|
|
191
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ B("div", {
|
|
192
204
|
className: "space-y-4",
|
|
193
205
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ B("div", {
|
|
195
207
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
196
208
|
children: [
|
|
197
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ B("div", {
|
|
198
210
|
className: "space-y-2",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
211
|
+
children: [/* @__PURE__ */ B(x, {
|
|
200
212
|
htmlFor: "employeeId",
|
|
201
213
|
children: [
|
|
202
214
|
"Employee ID ",
|
|
203
|
-
|
|
215
|
+
A ? "(immutable)" : "",
|
|
204
216
|
" ",
|
|
205
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ z("span", {
|
|
206
218
|
className: "text-status-error-text",
|
|
207
|
-
children: !
|
|
219
|
+
children: !A && "*"
|
|
208
220
|
})
|
|
209
221
|
]
|
|
210
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ z(b, {
|
|
211
223
|
id: "employeeId",
|
|
212
|
-
value:
|
|
213
|
-
onChange: (e) =>
|
|
224
|
+
value: M.employeeId,
|
|
225
|
+
onChange: (e) => P((t) => ({
|
|
214
226
|
...t,
|
|
215
227
|
employeeId: e.target.value
|
|
216
228
|
})),
|
|
217
229
|
placeholder: "EMP-001",
|
|
218
230
|
required: !0,
|
|
219
|
-
disabled:
|
|
231
|
+
disabled: A
|
|
220
232
|
})]
|
|
221
233
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ B("div", {
|
|
223
235
|
className: "space-y-2",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
236
|
+
children: [/* @__PURE__ */ B(x, {
|
|
225
237
|
htmlFor: "firstName",
|
|
226
|
-
children: ["First Name ", /* @__PURE__ */
|
|
238
|
+
children: ["First Name ", /* @__PURE__ */ z("span", {
|
|
227
239
|
className: "text-status-error-text",
|
|
228
240
|
children: "*"
|
|
229
241
|
})]
|
|
230
|
-
}), /* @__PURE__ */
|
|
242
|
+
}), /* @__PURE__ */ z(b, {
|
|
231
243
|
id: "firstName",
|
|
232
|
-
value:
|
|
233
|
-
onChange: (e) =>
|
|
244
|
+
value: M.firstName,
|
|
245
|
+
onChange: (e) => P((t) => ({
|
|
234
246
|
...t,
|
|
235
247
|
firstName: e.target.value
|
|
236
248
|
})),
|
|
@@ -238,18 +250,18 @@ function Y({ editId: t }) {
|
|
|
238
250
|
required: !0
|
|
239
251
|
})]
|
|
240
252
|
}),
|
|
241
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ B("div", {
|
|
242
254
|
className: "space-y-2",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
255
|
+
children: [/* @__PURE__ */ B(x, {
|
|
244
256
|
htmlFor: "lastName",
|
|
245
|
-
children: ["Last Name ", /* @__PURE__ */
|
|
257
|
+
children: ["Last Name ", /* @__PURE__ */ z("span", {
|
|
246
258
|
className: "text-status-error-text",
|
|
247
259
|
children: "*"
|
|
248
260
|
})]
|
|
249
|
-
}), /* @__PURE__ */
|
|
261
|
+
}), /* @__PURE__ */ z(b, {
|
|
250
262
|
id: "lastName",
|
|
251
|
-
value:
|
|
252
|
-
onChange: (e) =>
|
|
263
|
+
value: M.lastName,
|
|
264
|
+
onChange: (e) => P((t) => ({
|
|
253
265
|
...t,
|
|
254
266
|
lastName: e.target.value
|
|
255
267
|
})),
|
|
@@ -259,37 +271,37 @@ function Y({ editId: t }) {
|
|
|
259
271
|
})
|
|
260
272
|
]
|
|
261
273
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ B("div", {
|
|
263
275
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
264
276
|
children: [
|
|
265
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ B("div", {
|
|
266
278
|
className: "space-y-2",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
279
|
+
children: [/* @__PURE__ */ z(x, {
|
|
268
280
|
htmlFor: "email",
|
|
269
281
|
children: "Email"
|
|
270
|
-
}), /* @__PURE__ */
|
|
282
|
+
}), /* @__PURE__ */ z(b, {
|
|
271
283
|
id: "email",
|
|
272
284
|
type: "email",
|
|
273
|
-
value:
|
|
274
|
-
onChange: (e) =>
|
|
285
|
+
value: M.email,
|
|
286
|
+
onChange: (e) => P((t) => ({
|
|
275
287
|
...t,
|
|
276
288
|
email: e.target.value
|
|
277
289
|
})),
|
|
278
290
|
placeholder: "jane.doe@example.com"
|
|
279
291
|
})]
|
|
280
292
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ B("div", {
|
|
282
294
|
className: "space-y-2",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
295
|
+
children: [/* @__PURE__ */ B(x, {
|
|
284
296
|
htmlFor: "phone",
|
|
285
|
-
children: ["Phone ", /* @__PURE__ */
|
|
297
|
+
children: ["Phone ", /* @__PURE__ */ z("span", {
|
|
286
298
|
className: "text-status-error-text",
|
|
287
299
|
children: "*"
|
|
288
300
|
})]
|
|
289
|
-
}), /* @__PURE__ */
|
|
301
|
+
}), /* @__PURE__ */ z(b, {
|
|
290
302
|
id: "phone",
|
|
291
|
-
value:
|
|
292
|
-
onChange: (e) =>
|
|
303
|
+
value: M.phone,
|
|
304
|
+
onChange: (e) => P((t) => ({
|
|
293
305
|
...t,
|
|
294
306
|
phone: e.target.value
|
|
295
307
|
})),
|
|
@@ -297,21 +309,21 @@ function Y({ editId: t }) {
|
|
|
297
309
|
required: !0
|
|
298
310
|
})]
|
|
299
311
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ B("div", {
|
|
301
313
|
className: "space-y-2",
|
|
302
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ z(x, {
|
|
303
315
|
htmlFor: "status",
|
|
304
316
|
children: "Status"
|
|
305
|
-
}), /* @__PURE__ */
|
|
306
|
-
value:
|
|
307
|
-
onValueChange: (e) =>
|
|
317
|
+
}), /* @__PURE__ */ B(S, {
|
|
318
|
+
value: M.status,
|
|
319
|
+
onValueChange: (e) => P((t) => ({
|
|
308
320
|
...t,
|
|
309
321
|
status: e
|
|
310
322
|
})),
|
|
311
|
-
children: [/* @__PURE__ */
|
|
323
|
+
children: [/* @__PURE__ */ z(T, {
|
|
312
324
|
id: "status",
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
-
}), /* @__PURE__ */
|
|
325
|
+
children: /* @__PURE__ */ z(E, {})
|
|
326
|
+
}), /* @__PURE__ */ z(C, { children: _e.map((e) => /* @__PURE__ */ z(w, {
|
|
315
327
|
value: e.value,
|
|
316
328
|
children: e.label
|
|
317
329
|
}, e.value)) })]
|
|
@@ -319,49 +331,49 @@ function Y({ editId: t }) {
|
|
|
319
331
|
})
|
|
320
332
|
]
|
|
321
333
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ B("div", {
|
|
323
335
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
324
336
|
children: [
|
|
325
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ B("div", {
|
|
326
338
|
className: "space-y-2",
|
|
327
|
-
children: [/* @__PURE__ */
|
|
339
|
+
children: [/* @__PURE__ */ z(x, {
|
|
328
340
|
htmlFor: "licenseNumber",
|
|
329
341
|
children: "License Number"
|
|
330
|
-
}), /* @__PURE__ */
|
|
342
|
+
}), /* @__PURE__ */ z(b, {
|
|
331
343
|
id: "licenseNumber",
|
|
332
|
-
value:
|
|
333
|
-
onChange: (e) =>
|
|
344
|
+
value: M.licenseNumber,
|
|
345
|
+
onChange: (e) => P((t) => ({
|
|
334
346
|
...t,
|
|
335
347
|
licenseNumber: e.target.value
|
|
336
348
|
})),
|
|
337
349
|
placeholder: "D1234567"
|
|
338
350
|
})]
|
|
339
351
|
}),
|
|
340
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ B("div", {
|
|
341
353
|
className: "space-y-2",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ z(x, {
|
|
343
355
|
htmlFor: "licenseClass",
|
|
344
356
|
children: "License Class"
|
|
345
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ z(b, {
|
|
346
358
|
id: "licenseClass",
|
|
347
|
-
value:
|
|
348
|
-
onChange: (e) =>
|
|
359
|
+
value: M.licenseClass,
|
|
360
|
+
onChange: (e) => P((t) => ({
|
|
349
361
|
...t,
|
|
350
362
|
licenseClass: e.target.value
|
|
351
363
|
})),
|
|
352
364
|
placeholder: "Class A"
|
|
353
365
|
})]
|
|
354
366
|
}),
|
|
355
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ B("div", {
|
|
356
368
|
className: "space-y-2",
|
|
357
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ z(x, {
|
|
358
370
|
htmlFor: "licenseExpiry",
|
|
359
371
|
children: "License Expiry"
|
|
360
|
-
}), /* @__PURE__ */
|
|
372
|
+
}), /* @__PURE__ */ z(b, {
|
|
361
373
|
id: "licenseExpiry",
|
|
362
374
|
type: "date",
|
|
363
|
-
value:
|
|
364
|
-
onChange: (e) =>
|
|
375
|
+
value: M.licenseExpiry,
|
|
376
|
+
onChange: (e) => P((t) => ({
|
|
365
377
|
...t,
|
|
366
378
|
licenseExpiry: e.target.value
|
|
367
379
|
}))
|
|
@@ -369,38 +381,38 @@ function Y({ editId: t }) {
|
|
|
369
381
|
})
|
|
370
382
|
]
|
|
371
383
|
}),
|
|
372
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ B("div", {
|
|
373
385
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
374
|
-
children: [/* @__PURE__ */
|
|
386
|
+
children: [/* @__PURE__ */ B("div", {
|
|
375
387
|
className: "space-y-2",
|
|
376
|
-
children: [/* @__PURE__ */
|
|
388
|
+
children: [/* @__PURE__ */ z(x, {
|
|
377
389
|
htmlFor: "vehicleSearch",
|
|
378
390
|
children: "Search vehicles"
|
|
379
|
-
}), /* @__PURE__ */
|
|
391
|
+
}), /* @__PURE__ */ z(b, {
|
|
380
392
|
id: "vehicleSearch",
|
|
381
|
-
value:
|
|
382
|
-
onChange: (e) =>
|
|
393
|
+
value: Ee,
|
|
394
|
+
onChange: (e) => De(e.target.value),
|
|
383
395
|
placeholder: "Vehicle number or type"
|
|
384
396
|
})]
|
|
385
|
-
}), /* @__PURE__ */
|
|
397
|
+
}), /* @__PURE__ */ B("div", {
|
|
386
398
|
className: "space-y-2",
|
|
387
|
-
children: [/* @__PURE__ */
|
|
399
|
+
children: [/* @__PURE__ */ z(x, {
|
|
388
400
|
htmlFor: "vehicle",
|
|
389
401
|
children: "Assigned Vehicle"
|
|
390
|
-
}), /* @__PURE__ */
|
|
402
|
+
}), /* @__PURE__ */ z(ce, {
|
|
391
403
|
id: "vehicle",
|
|
392
|
-
value:
|
|
393
|
-
onChange: (e) =>
|
|
404
|
+
value: M.vehicleId,
|
|
405
|
+
onChange: (e) => P((t) => ({
|
|
394
406
|
...t,
|
|
395
407
|
vehicleId: e,
|
|
396
408
|
vehicleIds: e ? [e] : []
|
|
397
409
|
})),
|
|
398
|
-
options:
|
|
399
|
-
loading:
|
|
410
|
+
options: Oe,
|
|
411
|
+
loading: ke,
|
|
400
412
|
getId: (e) => e.id,
|
|
401
413
|
getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
|
|
402
|
-
renderOption: (e) => /* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
414
|
+
renderOption: (e) => /* @__PURE__ */ B(ue, { children: [
|
|
415
|
+
/* @__PURE__ */ z(l, {
|
|
404
416
|
size: 14,
|
|
405
417
|
className: "mr-2 inline text-text-secondary"
|
|
406
418
|
}),
|
|
@@ -409,76 +421,76 @@ function Y({ editId: t }) {
|
|
|
409
421
|
e.type,
|
|
410
422
|
")"
|
|
411
423
|
] }),
|
|
412
|
-
selectedOption:
|
|
413
|
-
selectedLoading:
|
|
414
|
-
hasMore:
|
|
415
|
-
totalCount:
|
|
416
|
-
onLoadMore:
|
|
417
|
-
loadingMore:
|
|
424
|
+
selectedOption: Pe,
|
|
425
|
+
selectedLoading: Fe,
|
|
426
|
+
hasMore: je,
|
|
427
|
+
totalCount: Me,
|
|
428
|
+
onLoadMore: Ne,
|
|
429
|
+
loadingMore: Ae,
|
|
418
430
|
placeholder: "Unassigned",
|
|
419
431
|
emptyText: "No vehicles match that search."
|
|
420
432
|
})]
|
|
421
433
|
})]
|
|
422
434
|
}),
|
|
423
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ B("div", {
|
|
424
436
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
425
437
|
children: [
|
|
426
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ B("div", {
|
|
427
439
|
className: "space-y-2",
|
|
428
|
-
children: [/* @__PURE__ */
|
|
440
|
+
children: [/* @__PURE__ */ z(x, {
|
|
429
441
|
htmlFor: "rating",
|
|
430
442
|
children: "Rating (0–5)"
|
|
431
|
-
}), /* @__PURE__ */
|
|
443
|
+
}), /* @__PURE__ */ z(b, {
|
|
432
444
|
id: "rating",
|
|
433
445
|
type: "number",
|
|
434
446
|
min: 0,
|
|
435
447
|
max: 5,
|
|
436
448
|
step: .1,
|
|
437
|
-
value:
|
|
438
|
-
onChange: (e) =>
|
|
449
|
+
value: M.rating,
|
|
450
|
+
onChange: (e) => P((t) => ({
|
|
439
451
|
...t,
|
|
440
452
|
rating: e.target.value
|
|
441
453
|
})),
|
|
442
454
|
placeholder: "4.8"
|
|
443
455
|
})]
|
|
444
456
|
}),
|
|
445
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ B("div", {
|
|
446
458
|
className: "space-y-2",
|
|
447
|
-
children: [/* @__PURE__ */
|
|
459
|
+
children: [/* @__PURE__ */ z(x, {
|
|
448
460
|
htmlFor: "hireDate",
|
|
449
461
|
children: "Hire Date"
|
|
450
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ z(b, {
|
|
451
463
|
id: "hireDate",
|
|
452
464
|
type: "date",
|
|
453
|
-
value:
|
|
454
|
-
onChange: (e) =>
|
|
465
|
+
value: M.hireDate,
|
|
466
|
+
onChange: (e) => P((t) => ({
|
|
455
467
|
...t,
|
|
456
468
|
hireDate: e.target.value
|
|
457
469
|
}))
|
|
458
470
|
})]
|
|
459
471
|
}),
|
|
460
|
-
/* @__PURE__ */
|
|
472
|
+
/* @__PURE__ */ B("div", {
|
|
461
473
|
className: "space-y-2",
|
|
462
|
-
children: [/* @__PURE__ */
|
|
474
|
+
children: [/* @__PURE__ */ B("div", {
|
|
463
475
|
className: "flex items-center justify-between gap-2",
|
|
464
|
-
children: [/* @__PURE__ */
|
|
476
|
+
children: [/* @__PURE__ */ z(x, {
|
|
465
477
|
htmlFor: "onLeaveUntil",
|
|
466
478
|
children: "On Leave Until"
|
|
467
|
-
}),
|
|
479
|
+
}), M.onLeaveUntil && /* @__PURE__ */ z(h, {
|
|
468
480
|
type: "button",
|
|
469
481
|
variant: "ghost",
|
|
470
482
|
size: "sm",
|
|
471
|
-
onClick: () =>
|
|
483
|
+
onClick: () => P((e) => ({
|
|
472
484
|
...e,
|
|
473
485
|
onLeaveUntil: ""
|
|
474
486
|
})),
|
|
475
487
|
children: "Clear"
|
|
476
488
|
})]
|
|
477
|
-
}), /* @__PURE__ */
|
|
489
|
+
}), /* @__PURE__ */ z(b, {
|
|
478
490
|
id: "onLeaveUntil",
|
|
479
491
|
type: "date",
|
|
480
|
-
value:
|
|
481
|
-
onChange: (e) =>
|
|
492
|
+
value: M.onLeaveUntil,
|
|
493
|
+
onChange: (e) => P((t) => ({
|
|
482
494
|
...t,
|
|
483
495
|
onLeaveUntil: e.target.value
|
|
484
496
|
}))
|
|
@@ -488,57 +500,57 @@ function Y({ editId: t }) {
|
|
|
488
500
|
})
|
|
489
501
|
]
|
|
490
502
|
})] }),
|
|
491
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
492
504
|
className: "flex items-center gap-2",
|
|
493
|
-
children: [/* @__PURE__ */
|
|
494
|
-
}) }), /* @__PURE__ */
|
|
505
|
+
children: [/* @__PURE__ */ z(n, { size: 18 }), " Compensation"]
|
|
506
|
+
}) }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ B("div", {
|
|
495
507
|
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
496
508
|
children: [
|
|
497
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ B("div", {
|
|
498
510
|
className: "space-y-2",
|
|
499
|
-
children: [/* @__PURE__ */
|
|
511
|
+
children: [/* @__PURE__ */ z(x, {
|
|
500
512
|
htmlFor: "baseSalary",
|
|
501
513
|
children: "Base Salary (annual)"
|
|
502
|
-
}), /* @__PURE__ */
|
|
514
|
+
}), /* @__PURE__ */ z(b, {
|
|
503
515
|
id: "baseSalary",
|
|
504
516
|
type: "number",
|
|
505
517
|
min: 0,
|
|
506
518
|
step: .01,
|
|
507
|
-
value:
|
|
508
|
-
onChange: (e) =>
|
|
519
|
+
value: M.baseSalary,
|
|
520
|
+
onChange: (e) => P((t) => ({
|
|
509
521
|
...t,
|
|
510
522
|
baseSalary: e.target.value
|
|
511
523
|
})),
|
|
512
524
|
placeholder: "55000"
|
|
513
525
|
})]
|
|
514
526
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ B("div", {
|
|
516
528
|
className: "space-y-2",
|
|
517
|
-
children: [/* @__PURE__ */
|
|
529
|
+
children: [/* @__PURE__ */ z(x, {
|
|
518
530
|
htmlFor: "bonusYtd",
|
|
519
531
|
children: "Bonus (YTD)"
|
|
520
|
-
}), /* @__PURE__ */
|
|
532
|
+
}), /* @__PURE__ */ z(b, {
|
|
521
533
|
id: "bonusYtd",
|
|
522
534
|
type: "number",
|
|
523
535
|
min: 0,
|
|
524
536
|
step: .01,
|
|
525
|
-
value:
|
|
526
|
-
onChange: (e) =>
|
|
537
|
+
value: M.bonusYtd,
|
|
538
|
+
onChange: (e) => P((t) => ({
|
|
527
539
|
...t,
|
|
528
540
|
bonusYtd: e.target.value
|
|
529
541
|
})),
|
|
530
542
|
placeholder: "1200"
|
|
531
543
|
})]
|
|
532
544
|
}),
|
|
533
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ B("div", {
|
|
534
546
|
className: "space-y-2",
|
|
535
|
-
children: [/* @__PURE__ */
|
|
547
|
+
children: [/* @__PURE__ */ z(x, {
|
|
536
548
|
htmlFor: "payCurrency",
|
|
537
549
|
children: "Currency"
|
|
538
|
-
}), /* @__PURE__ */
|
|
550
|
+
}), /* @__PURE__ */ z(b, {
|
|
539
551
|
id: "payCurrency",
|
|
540
|
-
value:
|
|
541
|
-
onChange: (e) =>
|
|
552
|
+
value: M.payCurrency,
|
|
553
|
+
onChange: (e) => P((t) => ({
|
|
542
554
|
...t,
|
|
543
555
|
payCurrency: e.target.value
|
|
544
556
|
})),
|
|
@@ -548,112 +560,154 @@ function Y({ editId: t }) {
|
|
|
548
560
|
})
|
|
549
561
|
]
|
|
550
562
|
}) })] }),
|
|
551
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
552
564
|
className: "flex items-center gap-2",
|
|
553
|
-
children: [/* @__PURE__ */
|
|
554
|
-
}) }), /* @__PURE__ */
|
|
555
|
-
value:
|
|
556
|
-
onChange: (e) =>
|
|
565
|
+
children: [/* @__PURE__ */ z(ee, { size: 18 }), " HR Notes"]
|
|
566
|
+
}) }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z(D, {
|
|
567
|
+
value: M.notes,
|
|
568
|
+
onChange: (e) => P((t) => ({
|
|
557
569
|
...t,
|
|
558
570
|
notes: e.target.value
|
|
559
571
|
})),
|
|
560
572
|
placeholder: "Performance notes, disciplinary history, anything worth tracking for this driver...",
|
|
561
573
|
rows: 4
|
|
562
574
|
}) })] }),
|
|
563
|
-
|
|
575
|
+
A && !Ve && /* @__PURE__ */ B(g, {
|
|
564
576
|
className: "border-status-error-border",
|
|
565
|
-
children: [/* @__PURE__ */
|
|
577
|
+
children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
566
578
|
className: "flex items-center gap-2 text-status-error-text",
|
|
567
|
-
children: [/* @__PURE__ */
|
|
568
|
-
}) }), /* @__PURE__ */
|
|
579
|
+
children: [/* @__PURE__ */ z(u, { size: 18 }), " Dismiss Driver"]
|
|
580
|
+
}) }), /* @__PURE__ */ B(_, { children: [/* @__PURE__ */ z("p", {
|
|
569
581
|
className: "mb-3 text-sm text-text-secondary",
|
|
570
582
|
children: "Dismissing a driver marks them as no longer employed. Their delivery and route history stays visible; they can no longer be assigned new work. This cannot be undone from here."
|
|
571
|
-
}), /* @__PURE__ */
|
|
583
|
+
}), /* @__PURE__ */ B(h, {
|
|
572
584
|
type: "button",
|
|
573
585
|
variant: "outline",
|
|
574
586
|
className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
|
|
575
|
-
onClick: () =>
|
|
576
|
-
children: [/* @__PURE__ */
|
|
587
|
+
onClick: () => q(!0),
|
|
588
|
+
children: [/* @__PURE__ */ z(u, { size: 16 }), " Dismiss this driver"]
|
|
589
|
+
})] })]
|
|
590
|
+
}),
|
|
591
|
+
A && /* @__PURE__ */ B(g, {
|
|
592
|
+
className: "border-status-error-border",
|
|
593
|
+
children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
594
|
+
className: "flex items-center gap-2 text-status-error-text",
|
|
595
|
+
children: [/* @__PURE__ */ z(c, { size: 18 }), " Delete Driver"]
|
|
596
|
+
}) }), /* @__PURE__ */ B(_, { children: [/* @__PURE__ */ z("p", {
|
|
597
|
+
className: "mb-3 text-sm text-text-secondary",
|
|
598
|
+
children: "Removes this driver record, for example one entered by mistake, and unlinks them from any vehicle. To keep delivery history for someone who has left, dismiss them instead. This cannot be undone from here."
|
|
599
|
+
}), /* @__PURE__ */ B(h, {
|
|
600
|
+
type: "button",
|
|
601
|
+
variant: "outline",
|
|
602
|
+
className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
|
|
603
|
+
onClick: () => Z(!0),
|
|
604
|
+
children: [/* @__PURE__ */ z(c, { size: 16 }), " Delete this driver"]
|
|
577
605
|
})] })]
|
|
578
606
|
})
|
|
579
607
|
]
|
|
580
608
|
}),
|
|
581
|
-
/* @__PURE__ */ U
|
|
582
|
-
open:
|
|
583
|
-
onOpenChange:
|
|
584
|
-
children: /* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
|
|
609
|
+
/* @__PURE__ */ z(U, {
|
|
610
|
+
open: Se,
|
|
611
|
+
onOpenChange: Z,
|
|
612
|
+
children: /* @__PURE__ */ B(fe, { children: [
|
|
613
|
+
/* @__PURE__ */ B(he, { children: [/* @__PURE__ */ z(ge, { children: "Delete this driver?" }), /* @__PURE__ */ B(pe, { children: [
|
|
614
|
+
"This removes ",
|
|
615
|
+
`${M.firstName} ${M.lastName}`.trim() || "this driver",
|
|
616
|
+
" and unlinks them from any vehicle. It cannot be undone from here."
|
|
617
|
+
] })] }),
|
|
618
|
+
/* @__PURE__ */ z("div", {
|
|
619
|
+
className: "px-1",
|
|
620
|
+
children: /* @__PURE__ */ z(j, { message: we })
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ B(me, { children: [/* @__PURE__ */ z(h, {
|
|
623
|
+
variant: "outline",
|
|
624
|
+
onClick: () => Z(!1),
|
|
625
|
+
disabled: Q,
|
|
626
|
+
children: "Cancel"
|
|
627
|
+
}), /* @__PURE__ */ z(h, {
|
|
628
|
+
className: "bg-status-error-text text-text-inverse hover:opacity-90",
|
|
629
|
+
onClick: Be,
|
|
630
|
+
disabled: Q,
|
|
631
|
+
children: Q ? "Deleting..." : "Delete driver"
|
|
632
|
+
})] })
|
|
633
|
+
] })
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ z(U, {
|
|
636
|
+
open: K,
|
|
637
|
+
onOpenChange: q,
|
|
638
|
+
children: /* @__PURE__ */ B(fe, { children: [
|
|
639
|
+
/* @__PURE__ */ B(he, { children: [/* @__PURE__ */ z(ge, { children: "Dismiss this driver?" }), /* @__PURE__ */ z(pe, { children: "This records the driver as dismissed and requires a reason. It cannot be undone from here." })] }),
|
|
640
|
+
/* @__PURE__ */ B("div", {
|
|
587
641
|
className: "space-y-2 px-1",
|
|
588
642
|
children: [
|
|
589
|
-
/* @__PURE__ */
|
|
643
|
+
/* @__PURE__ */ B(x, {
|
|
590
644
|
htmlFor: "dismissReason",
|
|
591
|
-
children: ["Reason ", /* @__PURE__ */
|
|
645
|
+
children: ["Reason ", /* @__PURE__ */ z("span", {
|
|
592
646
|
className: "text-status-error-text",
|
|
593
647
|
children: "*"
|
|
594
648
|
})]
|
|
595
649
|
}),
|
|
596
|
-
/* @__PURE__ */
|
|
650
|
+
/* @__PURE__ */ z(D, {
|
|
597
651
|
id: "dismissReason",
|
|
598
|
-
value:
|
|
599
|
-
onChange: (e) =>
|
|
652
|
+
value: J,
|
|
653
|
+
onChange: (e) => ye(e.target.value),
|
|
600
654
|
placeholder: "e.g. Repeated policy violations, voluntary resignation, performance...",
|
|
601
655
|
rows: 3
|
|
602
656
|
}),
|
|
603
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ z(j, { message: xe })
|
|
604
658
|
]
|
|
605
659
|
}),
|
|
606
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ B(me, { children: [/* @__PURE__ */ z(h, {
|
|
607
661
|
variant: "outline",
|
|
608
|
-
onClick: () =>
|
|
609
|
-
disabled:
|
|
662
|
+
onClick: () => q(!1),
|
|
663
|
+
disabled: Y,
|
|
610
664
|
children: "Cancel"
|
|
611
|
-
}), /* @__PURE__ */
|
|
665
|
+
}), /* @__PURE__ */ z(h, {
|
|
612
666
|
className: "bg-status-error-text text-text-inverse hover:opacity-90",
|
|
613
|
-
onClick:
|
|
614
|
-
disabled:
|
|
615
|
-
children:
|
|
667
|
+
onClick: ze,
|
|
668
|
+
disabled: Y,
|
|
669
|
+
children: Y ? "Dismissing..." : "Confirm dismissal"
|
|
616
670
|
})] })
|
|
617
671
|
] })
|
|
618
672
|
})
|
|
619
673
|
]
|
|
620
674
|
});
|
|
621
675
|
}
|
|
622
|
-
function
|
|
623
|
-
let { driverId: a } =
|
|
624
|
-
|
|
625
|
-
let { vehicle:
|
|
626
|
-
if (!a) return /* @__PURE__ */
|
|
627
|
-
if (c) return /* @__PURE__ */
|
|
628
|
-
if (
|
|
629
|
-
if (
|
|
676
|
+
function q() {
|
|
677
|
+
let { driverId: a } = R(), c = L().pathname.endsWith("/edit"), { basePath: u, navigate: p } = te(), { driver: m, isLoading: ie, error: b, refetch: x } = ne(a);
|
|
678
|
+
F(c, x);
|
|
679
|
+
let { vehicle: S } = re(m?.assignedVehicle), C = () => p?.(f(u, "fleet/drivers")), w = (e) => p?.(f(u, e));
|
|
680
|
+
if (!a) return /* @__PURE__ */ z(K, {});
|
|
681
|
+
if (c) return /* @__PURE__ */ z(K, { editId: a });
|
|
682
|
+
if (ie) return /* @__PURE__ */ z(O, { message: "Loading driver details..." });
|
|
683
|
+
if (b || !m) return /* @__PURE__ */ z(ae, {
|
|
630
684
|
title: "Driver not found",
|
|
631
|
-
onRetry:
|
|
685
|
+
onRetry: x
|
|
632
686
|
});
|
|
633
|
-
let
|
|
634
|
-
return /* @__PURE__ */
|
|
635
|
-
title:
|
|
636
|
-
subtitle: `Employee ID: ${
|
|
637
|
-
icon: /* @__PURE__ */
|
|
638
|
-
headerActions: /* @__PURE__ */
|
|
687
|
+
let T = !!m.terminatedAt, E = m.onLeaveUntil && m.onLeaveUntil.getTime() > (/* @__PURE__ */ new Date()).getTime() ? m.onLeaveUntil : void 0, D = m.baseSalary !== void 0 || m.bonusYtd !== void 0;
|
|
688
|
+
return /* @__PURE__ */ B(oe, {
|
|
689
|
+
title: m.fullName,
|
|
690
|
+
subtitle: `Employee ID: ${m.employeeId}`,
|
|
691
|
+
icon: /* @__PURE__ */ z(d, { size: 24 }),
|
|
692
|
+
headerActions: /* @__PURE__ */ B("div", {
|
|
639
693
|
className: "flex gap-2",
|
|
640
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ B(h, {
|
|
641
695
|
variant: "outline",
|
|
642
|
-
onClick:
|
|
643
|
-
children: [/* @__PURE__ */
|
|
644
|
-
}), /* @__PURE__ */
|
|
645
|
-
onClick: () => p?.(u
|
|
646
|
-
children: [/* @__PURE__ */
|
|
696
|
+
onClick: C,
|
|
697
|
+
children: [/* @__PURE__ */ z(e, { size: 16 }), " Back"]
|
|
698
|
+
}), /* @__PURE__ */ B(h, {
|
|
699
|
+
onClick: () => p?.(f(u, "fleet/drivers/" + a + "/edit")),
|
|
700
|
+
children: [/* @__PURE__ */ z(o, { size: 16 }), " Edit"]
|
|
647
701
|
})]
|
|
648
702
|
}),
|
|
649
|
-
headerContent: /* @__PURE__ */
|
|
703
|
+
headerContent: /* @__PURE__ */ B("div", {
|
|
650
704
|
className: "flex flex-wrap items-center gap-4",
|
|
651
705
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
status:
|
|
706
|
+
/* @__PURE__ */ z(A, {
|
|
707
|
+
status: m.status,
|
|
654
708
|
type: "driver"
|
|
655
709
|
}),
|
|
656
|
-
|
|
710
|
+
T && /* @__PURE__ */ z(A, {
|
|
657
711
|
status: "dismissed",
|
|
658
712
|
label: "Dismissed",
|
|
659
713
|
customColors: {
|
|
@@ -661,168 +715,168 @@ function X() {
|
|
|
661
715
|
text: "text-status-error-text"
|
|
662
716
|
}
|
|
663
717
|
}),
|
|
664
|
-
|
|
718
|
+
E && !T && /* @__PURE__ */ z(A, {
|
|
665
719
|
status: "on_leave",
|
|
666
|
-
label: `On leave until ${
|
|
720
|
+
label: `On leave until ${N(E, "short")}`,
|
|
667
721
|
customColors: {
|
|
668
722
|
bg: "bg-status-warning-bg-subtle",
|
|
669
723
|
text: "text-status-warning-text"
|
|
670
724
|
}
|
|
671
725
|
}),
|
|
672
|
-
|
|
726
|
+
m.rating !== void 0 && /* @__PURE__ */ B("div", {
|
|
673
727
|
className: "flex items-center gap-1",
|
|
674
|
-
children: [/* @__PURE__ */
|
|
728
|
+
children: [/* @__PURE__ */ z(s, {
|
|
675
729
|
size: 16,
|
|
676
730
|
className: "text-status-warning-text fill-current"
|
|
677
|
-
}), /* @__PURE__ */
|
|
731
|
+
}), /* @__PURE__ */ z("span", {
|
|
678
732
|
className: "font-medium",
|
|
679
|
-
children:
|
|
733
|
+
children: m.rating.toFixed(1)
|
|
680
734
|
})]
|
|
681
735
|
})
|
|
682
736
|
]
|
|
683
737
|
}),
|
|
684
738
|
children: [
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
icon: /* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ z(H, {
|
|
740
|
+
icon: /* @__PURE__ */ z(d, { size: 18 }),
|
|
687
741
|
children: "A driver's full profile — licensing, assigned vehicle, documents and HR record. Use it to confirm someone is road-ready and compliant before assigning them an order or route."
|
|
688
742
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ z(V, {
|
|
690
744
|
storageKey: "movethewheels-driver-details",
|
|
691
745
|
steps: [
|
|
692
746
|
{
|
|
693
747
|
id: "assign",
|
|
694
748
|
label: "Assign to an order",
|
|
695
749
|
description: "Hand a pending delivery to this driver.",
|
|
696
|
-
icon: /* @__PURE__ */
|
|
697
|
-
onClick: () =>
|
|
750
|
+
icon: /* @__PURE__ */ z(i, { size: 16 }),
|
|
751
|
+
onClick: () => w("orders")
|
|
698
752
|
},
|
|
699
753
|
{
|
|
700
754
|
id: "routes",
|
|
701
755
|
label: "Plan their route",
|
|
702
756
|
description: "Batch nearby drop-offs into an optimized itinerary.",
|
|
703
|
-
icon: /* @__PURE__ */
|
|
704
|
-
onClick: () =>
|
|
757
|
+
icon: /* @__PURE__ */ z(t, { size: 16 }),
|
|
758
|
+
onClick: () => w("routes")
|
|
705
759
|
},
|
|
706
760
|
{
|
|
707
761
|
id: "edit",
|
|
708
762
|
label: "Update driver record",
|
|
709
763
|
description: "Refresh documents, license or HR details.",
|
|
710
|
-
icon: /* @__PURE__ */
|
|
764
|
+
icon: /* @__PURE__ */ z(o, { size: 16 }),
|
|
711
765
|
onClick: () => {}
|
|
712
766
|
}
|
|
713
767
|
]
|
|
714
768
|
}),
|
|
715
|
-
|
|
769
|
+
T && /* @__PURE__ */ B("div", {
|
|
716
770
|
className: "rounded-card border border-status-error-border bg-status-error-bg-subtle p-4 text-sm text-status-error-text",
|
|
717
|
-
children: [/* @__PURE__ */
|
|
771
|
+
children: [/* @__PURE__ */ B("p", {
|
|
718
772
|
className: "font-medium",
|
|
719
|
-
children: ["Dismissed ",
|
|
720
|
-
}),
|
|
773
|
+
children: ["Dismissed ", m.terminatedAt && N(m.terminatedAt, "full")]
|
|
774
|
+
}), m.terminationReason && /* @__PURE__ */ B("p", {
|
|
721
775
|
className: "mt-1",
|
|
722
|
-
children: ["Reason: ",
|
|
776
|
+
children: ["Reason: ", m.terminationReason]
|
|
723
777
|
})]
|
|
724
778
|
}),
|
|
725
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ B("div", {
|
|
726
780
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
727
|
-
children: [/* @__PURE__ */
|
|
781
|
+
children: [/* @__PURE__ */ B("div", {
|
|
728
782
|
className: "lg:col-span-2 space-y-6",
|
|
729
783
|
children: [
|
|
730
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
731
785
|
className: "flex items-center gap-2",
|
|
732
|
-
children: [/* @__PURE__ */
|
|
733
|
-
}) }), /* @__PURE__ */
|
|
786
|
+
children: [/* @__PURE__ */ z(r, { size: 18 }), " License"]
|
|
787
|
+
}) }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z("div", {
|
|
734
788
|
className: "flex items-center justify-between p-3 border rounded-lg",
|
|
735
|
-
children: /* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
789
|
+
children: /* @__PURE__ */ B("div", { children: [
|
|
790
|
+
/* @__PURE__ */ z("p", {
|
|
737
791
|
className: "font-medium",
|
|
738
792
|
children: "Driver's License"
|
|
739
793
|
}),
|
|
740
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ B("p", {
|
|
741
795
|
className: "text-sm text-text-secondary",
|
|
742
|
-
children: [
|
|
796
|
+
children: [m.licenseNumber || "—", m.licenseType ? ` - ${m.licenseType}` : ""]
|
|
743
797
|
}),
|
|
744
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ z("p", {
|
|
745
799
|
className: "text-sm text-text-secondary",
|
|
746
|
-
children:
|
|
800
|
+
children: m.licenseExpiry ? `Expires: ${N(m.licenseExpiry)}` : "Expiry not recorded"
|
|
747
801
|
})
|
|
748
802
|
] })
|
|
749
803
|
}) })] }),
|
|
750
|
-
|
|
804
|
+
m.notes && /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
751
805
|
className: "flex items-center gap-2",
|
|
752
|
-
children: [/* @__PURE__ */
|
|
753
|
-
}) }), /* @__PURE__ */
|
|
806
|
+
children: [/* @__PURE__ */ z(ee, { size: 18 }), " HR Notes"]
|
|
807
|
+
}) }), /* @__PURE__ */ z(_, { children: /* @__PURE__ */ z("p", {
|
|
754
808
|
className: "text-sm whitespace-pre-wrap",
|
|
755
|
-
children:
|
|
809
|
+
children: m.notes
|
|
756
810
|
}) })] }),
|
|
757
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ z(P, {
|
|
758
812
|
entityType: "driver",
|
|
759
|
-
entityId:
|
|
813
|
+
entityId: m.id
|
|
760
814
|
})
|
|
761
815
|
]
|
|
762
|
-
}), /* @__PURE__ */
|
|
816
|
+
}), /* @__PURE__ */ B("div", {
|
|
763
817
|
className: "space-y-6",
|
|
764
818
|
children: [
|
|
765
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
766
820
|
className: "flex items-center gap-2",
|
|
767
|
-
children: [/* @__PURE__ */
|
|
768
|
-
}) }), /* @__PURE__ */
|
|
821
|
+
children: [/* @__PURE__ */ z(l, { size: 18 }), " Assigned Vehicle"]
|
|
822
|
+
}) }), /* @__PURE__ */ z(_, { children: m.assignedVehicle ? S ? /* @__PURE__ */ B("button", {
|
|
769
823
|
type: "button",
|
|
770
824
|
className: "text-sm font-medium text-primary hover:underline",
|
|
771
|
-
onClick: () =>
|
|
825
|
+
onClick: () => w(`fleet/vehicles/${S.id}`),
|
|
772
826
|
children: [
|
|
773
|
-
|
|
827
|
+
S.vehicleNumber,
|
|
774
828
|
" (",
|
|
775
|
-
|
|
829
|
+
S.type,
|
|
776
830
|
")"
|
|
777
831
|
]
|
|
778
|
-
}) : /* @__PURE__ */
|
|
832
|
+
}) : /* @__PURE__ */ z("p", {
|
|
779
833
|
className: "text-sm text-text-secondary",
|
|
780
834
|
children: "Loading…"
|
|
781
|
-
}) : /* @__PURE__ */
|
|
835
|
+
}) : /* @__PURE__ */ z("p", {
|
|
782
836
|
className: "text-sm text-text-secondary",
|
|
783
837
|
children: "No vehicle assigned"
|
|
784
838
|
}) })] }),
|
|
785
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ z(y, { children: "Record" }) }), /* @__PURE__ */ z(_, {
|
|
786
840
|
className: "space-y-4",
|
|
787
|
-
children: /* @__PURE__ */
|
|
841
|
+
children: /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
|
|
788
842
|
className: "text-sm text-text-secondary",
|
|
789
843
|
children: "Hire Date"
|
|
790
|
-
}), /* @__PURE__ */
|
|
844
|
+
}), /* @__PURE__ */ z("p", {
|
|
791
845
|
className: "font-medium",
|
|
792
|
-
children:
|
|
846
|
+
children: m.hireDate ? N(m.hireDate) : "Not recorded"
|
|
793
847
|
})] })
|
|
794
848
|
})] }),
|
|
795
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
796
850
|
className: "flex items-center gap-2",
|
|
797
|
-
children: [/* @__PURE__ */
|
|
798
|
-
}) }), /* @__PURE__ */
|
|
851
|
+
children: [/* @__PURE__ */ z(n, { size: 18 }), " Compensation"]
|
|
852
|
+
}) }), /* @__PURE__ */ z(_, {
|
|
799
853
|
className: "space-y-3",
|
|
800
|
-
children:
|
|
854
|
+
children: D ? /* @__PURE__ */ B(ue, { children: [m.baseSalary !== void 0 && /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
|
|
801
855
|
className: "text-sm text-text-secondary",
|
|
802
856
|
children: "Base Salary"
|
|
803
|
-
}), /* @__PURE__ */
|
|
857
|
+
}), /* @__PURE__ */ B("p", {
|
|
804
858
|
className: "font-medium",
|
|
805
|
-
children: [
|
|
806
|
-
})] }),
|
|
859
|
+
children: [M(m.baseSalary, m.payCurrency || void 0), "/year"]
|
|
860
|
+
})] }), m.bonusYtd !== void 0 && /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("p", {
|
|
807
861
|
className: "text-sm text-text-secondary",
|
|
808
862
|
children: "Bonus (YTD)"
|
|
809
|
-
}), /* @__PURE__ */
|
|
863
|
+
}), /* @__PURE__ */ z("p", {
|
|
810
864
|
className: "font-medium",
|
|
811
|
-
children:
|
|
812
|
-
})] })] }) : /* @__PURE__ */
|
|
865
|
+
children: M(m.bonusYtd, m.payCurrency || void 0)
|
|
866
|
+
})] })] }) : /* @__PURE__ */ z("p", {
|
|
813
867
|
className: "text-sm text-text-secondary",
|
|
814
868
|
children: "Not recorded"
|
|
815
869
|
})
|
|
816
870
|
})] }),
|
|
817
|
-
|
|
871
|
+
m.currentLocation && /* @__PURE__ */ B(g, { children: [/* @__PURE__ */ z(v, { children: /* @__PURE__ */ B(y, {
|
|
818
872
|
className: "flex items-center gap-2",
|
|
819
|
-
children: [/* @__PURE__ */
|
|
820
|
-
}) }), /* @__PURE__ */
|
|
873
|
+
children: [/* @__PURE__ */ z(i, { size: 18 }), " Current Location"]
|
|
874
|
+
}) }), /* @__PURE__ */ B(_, { children: [/* @__PURE__ */ z("p", {
|
|
821
875
|
className: "text-sm",
|
|
822
|
-
children:
|
|
823
|
-
}), /* @__PURE__ */
|
|
876
|
+
children: m.currentLocation.address || "Location updating..."
|
|
877
|
+
}), /* @__PURE__ */ z("p", {
|
|
824
878
|
className: "text-xs text-text-secondary mt-1",
|
|
825
|
-
children:
|
|
879
|
+
children: m.currentLocation.timestamp ? `Updated ${N(m.currentLocation.timestamp, "relative")}` : "Update time not recorded"
|
|
826
880
|
})] })] })
|
|
827
881
|
]
|
|
828
882
|
})]
|
|
@@ -831,4 +885,4 @@ function X() {
|
|
|
831
885
|
});
|
|
832
886
|
}
|
|
833
887
|
//#endregion
|
|
834
|
-
export {
|
|
888
|
+
export { q as default };
|