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