@burdenoff/microfe-movethewheels 2026.925.2 → 2026.929.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/StatusBadge.js +34 -31
- package/dist/constants/index.js +12 -5
- package/dist/hooks/useCustomers.js +0 -3
- package/dist/hooks/useFleet.js +148 -135
- package/dist/hooks/useInventory.js +146 -146
- package/dist/hooks/useRoutes.js +5 -14
- package/dist/movethewheels/components/StatusBadge.d.ts +3 -1
- package/dist/movethewheels/constants/index.d.ts +1 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +17 -4
- package/dist/movethewheels/hooks/useInventory.d.ts +11 -0
- package/dist/movethewheels/types/index.d.ts +19 -75
- package/dist/pages/CustomerDetailsPage.js +666 -344
- package/dist/pages/CustomersPage.js +71 -80
- package/dist/pages/DriverDetailsPage.js +2 -2
- package/dist/pages/DriversPage.js +2 -2
- package/dist/pages/FleetPage.js +1 -3
- package/dist/pages/InventoryPage.js +5 -5
- package/dist/pages/RouteDetailsPage.js +273 -248
- package/dist/pages/RoutesPage.js +130 -67
- package/dist/pages/VehicleDetailsPage.js +527 -389
- package/dist/pages/VehiclesPage.js +120 -71
- package/dist/pages/WarehouseDetailsPage.js +411 -368
- package/dist/pages/WarehousesPage.js +132 -83
- package/package.json +1 -1
- package/src/movethewheels/components/StatusBadge.tsx +15 -7
- package/src/movethewheels/constants/index.ts +9 -0
- package/src/movethewheels/hooks/useCustomers.ts +0 -3
- package/src/movethewheels/hooks/useFleet.ts +89 -25
- package/src/movethewheels/hooks/useInventory.ts +77 -33
- package/src/movethewheels/hooks/useRoutes.ts +17 -12
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +376 -109
- package/src/movethewheels/pages/CustomersPage.tsx +6 -15
- package/src/movethewheels/pages/DriverDetailsPage.tsx +3 -1
- package/src/movethewheels/pages/DriversPage.tsx +5 -1
- package/src/movethewheels/pages/FleetPage.tsx +2 -1
- package/src/movethewheels/pages/InventoryPage.tsx +18 -6
- package/src/movethewheels/pages/RouteDetailsPage.tsx +74 -34
- package/src/movethewheels/pages/RoutesPage.tsx +66 -2
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +185 -23
- package/src/movethewheels/pages/VehiclesPage.tsx +72 -5
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +217 -138
- package/src/movethewheels/pages/WarehousesPage.tsx +81 -17
- package/src/movethewheels/types/index.ts +28 -75
|
@@ -2,83 +2,93 @@ import { ArrowLeft as e } from "../node_modules/lucide-react/dist/esm/icons/arro
|
|
|
2
2
|
import { Building as t } from "../node_modules/lucide-react/dist/esm/icons/building.js";
|
|
3
3
|
import { FileText as n } from "../node_modules/lucide-react/dist/esm/icons/file-text.js";
|
|
4
4
|
import { Mail as r } from "../node_modules/lucide-react/dist/esm/icons/mail.js";
|
|
5
|
-
import { MapPin as
|
|
6
|
-
import { Package as
|
|
7
|
-
import { Phone as
|
|
8
|
-
import { Save as
|
|
9
|
-
import { SquarePen as
|
|
10
|
-
import { Star as
|
|
5
|
+
import { MapPin as ee } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
|
|
6
|
+
import { Package as i } from "../node_modules/lucide-react/dist/esm/icons/package.js";
|
|
7
|
+
import { Phone as a } from "../node_modules/lucide-react/dist/esm/icons/phone.js";
|
|
8
|
+
import { Save as o } from "../node_modules/lucide-react/dist/esm/icons/save.js";
|
|
9
|
+
import { SquarePen as s } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
|
|
10
|
+
import { Star as c } from "../node_modules/lucide-react/dist/esm/icons/star.js";
|
|
11
|
+
import { Trash2 as l } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
|
|
11
12
|
import { Users as u } from "../node_modules/lucide-react/dist/esm/icons/users.js";
|
|
12
13
|
import { X as d } from "../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
13
14
|
import { buildOrderCustomerPath as f, getSafeCustomerReturnPath as p, joinPath as m } from "../utils/navigation.js";
|
|
14
15
|
import { useMoveTheWheels as h } from "../providers/MoveTheWheelsProvider.js";
|
|
15
16
|
import { useOrders as g } from "../hooks/useOrders.js";
|
|
16
|
-
import { useCustomer as
|
|
17
|
-
import {
|
|
18
|
-
import { ErrorState as
|
|
19
|
-
import { StatusBadge as
|
|
17
|
+
import { useCustomer as te, useCustomers as _ } from "../hooks/useCustomers.js";
|
|
18
|
+
import { Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Input as C, Label as w, Select as T, SelectContent as E, SelectItem as D, SelectTrigger as O, SelectValue as k } from "../components/ui.js";
|
|
19
|
+
import { ErrorState as A, LoadingState as j, PageLayout as ne } from "../components/PageLayout.js";
|
|
20
|
+
import { StatusBadge as M, TypeBadge as re } from "../components/StatusBadge.js";
|
|
20
21
|
import { FormError as N } from "../components/FormError.js";
|
|
21
22
|
import { Notice as ie, useNotice as ae } from "../components/Notice.js";
|
|
22
23
|
import { formatAddress as oe, formatCurrency as se, formatDate as P } from "../utils/formatters.js";
|
|
23
24
|
import { useEffect as ce, useState as F } from "react";
|
|
24
25
|
import { useParams as le, useSearchParams as I } from "react-router";
|
|
25
26
|
import { Fragment as ue, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
26
|
-
import { EmphasisPanel as z, NextSteps as de, PagePurpose as B } from "@burdenoff/fe-libs/ui";
|
|
27
|
+
import { EmphasisPanel as z, NextSteps as de, PagePurpose as B, ResponsiveDialog as fe, ResponsiveDialogContent as pe, ResponsiveDialogDescription as me, ResponsiveDialogFooter as he, ResponsiveDialogHeader as ge, ResponsiveDialogTitle as _e } from "@burdenoff/fe-libs/ui";
|
|
27
28
|
//#region src/movethewheels/pages/CustomerDetailsPage.tsx
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_("Customer name is required.");
|
|
29
|
+
var V = {
|
|
30
|
+
name: "",
|
|
31
|
+
type: "b2c",
|
|
32
|
+
email: "",
|
|
33
|
+
phone: "",
|
|
34
|
+
company: "",
|
|
35
|
+
street: "",
|
|
36
|
+
city: "",
|
|
37
|
+
state: "",
|
|
38
|
+
postalCode: "",
|
|
39
|
+
country: "",
|
|
40
|
+
businessLicense: "",
|
|
41
|
+
taxId: "",
|
|
42
|
+
rating: ""
|
|
43
|
+
};
|
|
44
|
+
function ve() {
|
|
45
|
+
let { basePath: t, navigate: r } = h(), [i] = I(), a = p(i.get("returnTo")), { createCustomer: s } = _(), [c, l] = F(V), [d, g] = F(!1), [te, A] = F(null), j = () => r?.(m(t, "customers")), M = async (e) => {
|
|
46
|
+
if (e.preventDefault(), !c.name.trim()) {
|
|
47
|
+
A("Customer name is required.");
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
g(!0), A(null);
|
|
51
51
|
try {
|
|
52
|
-
let e = await
|
|
53
|
-
name:
|
|
54
|
-
type:
|
|
55
|
-
email:
|
|
56
|
-
phone:
|
|
57
|
-
company:
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
let e = await s({
|
|
53
|
+
name: c.name.trim(),
|
|
54
|
+
type: c.type,
|
|
55
|
+
email: c.email.trim() || void 0,
|
|
56
|
+
phone: c.phone.trim() || void 0,
|
|
57
|
+
company: c.company.trim() || void 0,
|
|
58
|
+
address: c.street || c.city || c.state || c.postalCode || c.country ? {
|
|
59
|
+
street: c.street.trim(),
|
|
60
|
+
city: c.city.trim(),
|
|
61
|
+
state: c.state.trim(),
|
|
62
|
+
postalCode: c.postalCode.trim(),
|
|
63
|
+
country: c.country.trim()
|
|
64
|
+
} : void 0,
|
|
65
|
+
businessLicense: c.businessLicense.trim() || void 0,
|
|
66
|
+
taxId: c.taxId.trim() || void 0,
|
|
67
|
+
rating: c.rating ? Number(c.rating) : void 0
|
|
68
|
+
}), n = a ? f(a, e.id) : `customers/${e.id}`;
|
|
69
|
+
r?.(m(t, n));
|
|
60
70
|
} catch (e) {
|
|
61
|
-
console.error("Failed to create customer:", e),
|
|
71
|
+
console.error("Failed to create customer:", e), A(e instanceof Error ? e.message : "Failed to create customer. Please try again."), g(!1);
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
|
-
return /* @__PURE__ */ R(
|
|
74
|
+
return /* @__PURE__ */ R(ne, {
|
|
65
75
|
title: "New Customer",
|
|
66
76
|
subtitle: "Add a new customer to your account",
|
|
67
77
|
icon: /* @__PURE__ */ L(u, { size: 24 }),
|
|
68
78
|
headerActions: /* @__PURE__ */ R("div", {
|
|
69
79
|
className: "flex gap-2",
|
|
70
|
-
children: [/* @__PURE__ */ R(
|
|
80
|
+
children: [/* @__PURE__ */ R(v, {
|
|
71
81
|
variant: "outline",
|
|
72
|
-
onClick:
|
|
73
|
-
disabled:
|
|
82
|
+
onClick: j,
|
|
83
|
+
disabled: d,
|
|
74
84
|
children: [/* @__PURE__ */ L(e, { size: 16 }), " Cancel"]
|
|
75
|
-
}), /* @__PURE__ */ R(
|
|
76
|
-
onClick:
|
|
77
|
-
disabled:
|
|
85
|
+
}), /* @__PURE__ */ R(v, {
|
|
86
|
+
onClick: M,
|
|
87
|
+
disabled: d,
|
|
78
88
|
children: [
|
|
79
|
-
/* @__PURE__ */ L(
|
|
89
|
+
/* @__PURE__ */ L(o, { size: 16 }),
|
|
80
90
|
" ",
|
|
81
|
-
|
|
91
|
+
d ? "Saving..." : "Create Customer"
|
|
82
92
|
]
|
|
83
93
|
})]
|
|
84
94
|
}),
|
|
@@ -86,206 +96,350 @@ function V() {
|
|
|
86
96
|
icon: /* @__PURE__ */ L(u, { size: 18 }),
|
|
87
97
|
children: "Add a customer once and their contact details auto-fill every future order you book for them. Only a name is required — add email, phone and company to make deliveries easier to arrange."
|
|
88
98
|
}), /* @__PURE__ */ R("form", {
|
|
89
|
-
onSubmit:
|
|
99
|
+
onSubmit: M,
|
|
90
100
|
className: "max-w-2xl space-y-6",
|
|
91
|
-
children: [
|
|
92
|
-
|
|
93
|
-
children: "
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
className: "
|
|
101
|
-
children: [/* @__PURE__ */ R(
|
|
102
|
-
|
|
103
|
-
children: [
|
|
104
|
-
|
|
105
|
-
children: "
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ L(N, { message: te }),
|
|
103
|
+
/* @__PURE__ */ R(z, { children: [/* @__PURE__ */ L("h2", {
|
|
104
|
+
className: "text-base font-semibold text-text-primary mb-4",
|
|
105
|
+
children: "Customer Details"
|
|
106
|
+
}), /* @__PURE__ */ R("div", {
|
|
107
|
+
className: "space-y-4",
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ R("div", {
|
|
110
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
111
|
+
children: [/* @__PURE__ */ R("div", {
|
|
112
|
+
className: "space-y-2",
|
|
113
|
+
children: [/* @__PURE__ */ R(w, {
|
|
114
|
+
htmlFor: "name",
|
|
115
|
+
children: ["Name ", /* @__PURE__ */ L("span", {
|
|
116
|
+
className: "text-status-error-text",
|
|
117
|
+
children: "*"
|
|
118
|
+
})]
|
|
119
|
+
}), /* @__PURE__ */ L(C, {
|
|
120
|
+
id: "name",
|
|
121
|
+
value: c.name,
|
|
122
|
+
onChange: (e) => l((t) => ({
|
|
123
|
+
...t,
|
|
124
|
+
name: e.target.value
|
|
125
|
+
})),
|
|
126
|
+
placeholder: "Acme Corp or Jane Doe",
|
|
127
|
+
required: !0
|
|
128
|
+
})]
|
|
129
|
+
}), /* @__PURE__ */ R("div", {
|
|
130
|
+
className: "space-y-2",
|
|
131
|
+
children: [/* @__PURE__ */ L(w, {
|
|
132
|
+
htmlFor: "type",
|
|
133
|
+
children: "Customer Type"
|
|
134
|
+
}), /* @__PURE__ */ R(T, {
|
|
135
|
+
value: c.type,
|
|
136
|
+
onValueChange: (e) => l((t) => ({
|
|
137
|
+
...t,
|
|
138
|
+
type: e
|
|
139
|
+
})),
|
|
140
|
+
children: [/* @__PURE__ */ L(O, {
|
|
141
|
+
id: "type",
|
|
142
|
+
children: /* @__PURE__ */ L(k, {})
|
|
143
|
+
}), /* @__PURE__ */ R(E, { children: [/* @__PURE__ */ L(D, {
|
|
144
|
+
value: "b2c",
|
|
145
|
+
children: "B2C (Individual)"
|
|
146
|
+
}), /* @__PURE__ */ L(D, {
|
|
147
|
+
value: "b2b",
|
|
148
|
+
children: "B2B (Business)"
|
|
149
|
+
})] })]
|
|
106
150
|
})]
|
|
107
|
-
}), /* @__PURE__ */ L(T, {
|
|
108
|
-
id: "name",
|
|
109
|
-
value: o.name,
|
|
110
|
-
onChange: (e) => c((t) => ({
|
|
111
|
-
...t,
|
|
112
|
-
name: e.target.value
|
|
113
|
-
})),
|
|
114
|
-
placeholder: "Acme Corp or Jane Doe",
|
|
115
|
-
required: !0
|
|
116
151
|
})]
|
|
117
|
-
}),
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ R("div", {
|
|
154
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
155
|
+
children: [/* @__PURE__ */ R("div", {
|
|
156
|
+
className: "space-y-2",
|
|
157
|
+
children: [/* @__PURE__ */ L(w, {
|
|
158
|
+
htmlFor: "email",
|
|
159
|
+
children: "Email"
|
|
160
|
+
}), /* @__PURE__ */ L(C, {
|
|
161
|
+
id: "email",
|
|
162
|
+
type: "email",
|
|
163
|
+
value: c.email,
|
|
164
|
+
onChange: (e) => l((t) => ({
|
|
165
|
+
...t,
|
|
166
|
+
email: e.target.value
|
|
167
|
+
})),
|
|
168
|
+
placeholder: "customer@example.com"
|
|
169
|
+
})]
|
|
170
|
+
}), /* @__PURE__ */ R("div", {
|
|
171
|
+
className: "space-y-2",
|
|
172
|
+
children: [/* @__PURE__ */ L(w, {
|
|
173
|
+
htmlFor: "phone",
|
|
174
|
+
children: "Phone"
|
|
175
|
+
}), /* @__PURE__ */ L(C, {
|
|
176
|
+
id: "phone",
|
|
177
|
+
value: c.phone,
|
|
178
|
+
onChange: (e) => l((t) => ({
|
|
179
|
+
...t,
|
|
180
|
+
phone: e.target.value
|
|
181
|
+
})),
|
|
182
|
+
placeholder: "+1-555-0100"
|
|
183
|
+
})]
|
|
184
|
+
})]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ R("div", {
|
|
118
187
|
className: "space-y-2",
|
|
119
|
-
children: [/* @__PURE__ */ L(
|
|
120
|
-
htmlFor: "
|
|
121
|
-
children: "
|
|
122
|
-
}), /* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
|
|
188
|
+
children: [/* @__PURE__ */ L(w, {
|
|
189
|
+
htmlFor: "company",
|
|
190
|
+
children: "Company"
|
|
191
|
+
}), /* @__PURE__ */ L(C, {
|
|
192
|
+
id: "company",
|
|
193
|
+
value: c.company,
|
|
194
|
+
onChange: (e) => l((t) => ({
|
|
125
195
|
...t,
|
|
126
|
-
|
|
196
|
+
company: e.target.value
|
|
127
197
|
})),
|
|
128
|
-
|
|
129
|
-
id: "type",
|
|
130
|
-
children: /* @__PURE__ */ L(j, {})
|
|
131
|
-
}), /* @__PURE__ */ R(O, { children: [/* @__PURE__ */ L(k, {
|
|
132
|
-
value: "b2c",
|
|
133
|
-
children: "B2C (Individual)"
|
|
134
|
-
}), /* @__PURE__ */ L(k, {
|
|
135
|
-
value: "b2b",
|
|
136
|
-
children: "B2B (Business)"
|
|
137
|
-
})] })]
|
|
198
|
+
placeholder: "Company name (for B2B accounts)"
|
|
138
199
|
})]
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
})] }),
|
|
203
|
+
/* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ R(S, {
|
|
204
|
+
className: "flex items-center gap-2",
|
|
205
|
+
children: [/* @__PURE__ */ L(ee, { size: 18 }), " Address"]
|
|
206
|
+
}) }), /* @__PURE__ */ R(b, {
|
|
207
|
+
className: "space-y-4",
|
|
208
|
+
children: [/* @__PURE__ */ R("div", {
|
|
209
|
+
className: "space-y-2",
|
|
210
|
+
children: [/* @__PURE__ */ L(w, {
|
|
211
|
+
htmlFor: "street",
|
|
212
|
+
children: "Street"
|
|
213
|
+
}), /* @__PURE__ */ L(C, {
|
|
214
|
+
id: "street",
|
|
215
|
+
value: c.street,
|
|
216
|
+
onChange: (e) => l((t) => ({
|
|
217
|
+
...t,
|
|
218
|
+
street: e.target.value
|
|
219
|
+
})),
|
|
220
|
+
placeholder: "123 Main St"
|
|
139
221
|
})]
|
|
140
|
-
}),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
222
|
+
}), /* @__PURE__ */ R("div", {
|
|
223
|
+
className: "grid grid-cols-1 md:grid-cols-4 gap-4",
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ R("div", {
|
|
226
|
+
className: "space-y-2",
|
|
227
|
+
children: [/* @__PURE__ */ L(w, {
|
|
228
|
+
htmlFor: "city",
|
|
229
|
+
children: "City"
|
|
230
|
+
}), /* @__PURE__ */ L(C, {
|
|
231
|
+
id: "city",
|
|
232
|
+
value: c.city,
|
|
233
|
+
onChange: (e) => l((t) => ({
|
|
234
|
+
...t,
|
|
235
|
+
city: e.target.value
|
|
236
|
+
}))
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ R("div", {
|
|
240
|
+
className: "space-y-2",
|
|
241
|
+
children: [/* @__PURE__ */ L(w, {
|
|
242
|
+
htmlFor: "state",
|
|
243
|
+
children: "State"
|
|
244
|
+
}), /* @__PURE__ */ L(C, {
|
|
245
|
+
id: "state",
|
|
246
|
+
value: c.state,
|
|
247
|
+
onChange: (e) => l((t) => ({
|
|
248
|
+
...t,
|
|
249
|
+
state: e.target.value
|
|
250
|
+
}))
|
|
251
|
+
})]
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ R("div", {
|
|
254
|
+
className: "space-y-2",
|
|
255
|
+
children: [/* @__PURE__ */ L(w, {
|
|
256
|
+
htmlFor: "postalCode",
|
|
257
|
+
children: "Postal Code"
|
|
258
|
+
}), /* @__PURE__ */ L(C, {
|
|
259
|
+
id: "postalCode",
|
|
260
|
+
value: c.postalCode,
|
|
261
|
+
onChange: (e) => l((t) => ({
|
|
262
|
+
...t,
|
|
263
|
+
postalCode: e.target.value
|
|
264
|
+
}))
|
|
265
|
+
})]
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ R("div", {
|
|
268
|
+
className: "space-y-2",
|
|
269
|
+
children: [/* @__PURE__ */ L(w, {
|
|
270
|
+
htmlFor: "country",
|
|
271
|
+
children: "Country"
|
|
272
|
+
}), /* @__PURE__ */ L(C, {
|
|
273
|
+
id: "country",
|
|
274
|
+
value: c.country,
|
|
275
|
+
onChange: (e) => l((t) => ({
|
|
276
|
+
...t,
|
|
277
|
+
country: e.target.value
|
|
278
|
+
}))
|
|
279
|
+
})]
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
})]
|
|
283
|
+
})] }),
|
|
284
|
+
/* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ R(S, {
|
|
285
|
+
className: "flex items-center gap-2",
|
|
286
|
+
children: [/* @__PURE__ */ L(n, { size: 18 }), " Business Details"]
|
|
287
|
+
}) }), /* @__PURE__ */ L(b, { children: /* @__PURE__ */ R("div", {
|
|
288
|
+
className: "grid grid-cols-1 md:grid-cols-3 gap-4",
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ R("div", {
|
|
144
291
|
className: "space-y-2",
|
|
145
|
-
children: [/* @__PURE__ */ L(
|
|
146
|
-
htmlFor: "
|
|
147
|
-
children: "
|
|
148
|
-
}), /* @__PURE__ */ L(
|
|
149
|
-
id: "
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
onChange: (e) => c((t) => ({
|
|
292
|
+
children: [/* @__PURE__ */ L(w, {
|
|
293
|
+
htmlFor: "businessLicense",
|
|
294
|
+
children: "Business License"
|
|
295
|
+
}), /* @__PURE__ */ L(C, {
|
|
296
|
+
id: "businessLicense",
|
|
297
|
+
value: c.businessLicense,
|
|
298
|
+
onChange: (e) => l((t) => ({
|
|
153
299
|
...t,
|
|
154
|
-
|
|
155
|
-
}))
|
|
156
|
-
placeholder: "customer@example.com"
|
|
300
|
+
businessLicense: e.target.value
|
|
301
|
+
}))
|
|
157
302
|
})]
|
|
158
|
-
}),
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ R("div", {
|
|
159
305
|
className: "space-y-2",
|
|
160
|
-
children: [/* @__PURE__ */ L(
|
|
161
|
-
htmlFor: "
|
|
162
|
-
children: "
|
|
163
|
-
}), /* @__PURE__ */ L(
|
|
164
|
-
id: "
|
|
165
|
-
value:
|
|
166
|
-
onChange: (e) =>
|
|
306
|
+
children: [/* @__PURE__ */ L(w, {
|
|
307
|
+
htmlFor: "taxId",
|
|
308
|
+
children: "Tax ID"
|
|
309
|
+
}), /* @__PURE__ */ L(C, {
|
|
310
|
+
id: "taxId",
|
|
311
|
+
value: c.taxId,
|
|
312
|
+
onChange: (e) => l((t) => ({
|
|
167
313
|
...t,
|
|
168
|
-
|
|
169
|
-
}))
|
|
170
|
-
placeholder: "+1-555-0100"
|
|
314
|
+
taxId: e.target.value
|
|
315
|
+
}))
|
|
171
316
|
})]
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ R("div", {
|
|
319
|
+
className: "space-y-2",
|
|
320
|
+
children: [/* @__PURE__ */ L(w, {
|
|
321
|
+
htmlFor: "rating",
|
|
322
|
+
children: "Rating (0–5)"
|
|
323
|
+
}), /* @__PURE__ */ L(C, {
|
|
324
|
+
id: "rating",
|
|
325
|
+
type: "number",
|
|
326
|
+
min: 0,
|
|
327
|
+
max: 5,
|
|
328
|
+
step: .1,
|
|
329
|
+
value: c.rating,
|
|
330
|
+
onChange: (e) => l((t) => ({
|
|
331
|
+
...t,
|
|
332
|
+
rating: e.target.value
|
|
333
|
+
}))
|
|
334
|
+
})]
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
}) })] })
|
|
338
|
+
]
|
|
191
339
|
})]
|
|
192
340
|
});
|
|
193
341
|
}
|
|
194
|
-
function H() {
|
|
195
|
-
|
|
196
|
-
name:
|
|
197
|
-
email:
|
|
198
|
-
phone:
|
|
199
|
-
company: ""
|
|
200
|
-
|
|
342
|
+
function H(e) {
|
|
343
|
+
return {
|
|
344
|
+
name: e.name,
|
|
345
|
+
email: e.email,
|
|
346
|
+
phone: e.phone,
|
|
347
|
+
company: e.company ?? "",
|
|
348
|
+
type: e.type,
|
|
349
|
+
street: e.address.street,
|
|
350
|
+
city: e.address.city,
|
|
351
|
+
state: e.address.state,
|
|
352
|
+
postalCode: e.address.postalCode,
|
|
353
|
+
country: e.address.country,
|
|
354
|
+
businessLicense: e.businessLicense ?? "",
|
|
355
|
+
taxId: e.taxId ?? "",
|
|
356
|
+
rating: e.rating ? String(e.rating) : ""
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function U() {
|
|
360
|
+
let { customerId: p } = le(), { basePath: I, navigate: U } = h(), { customer: W, isLoading: ye, error: be, refetch: xe } = te(p), { updateCustomer: Se, deleteCustomer: Ce } = _(), { orders: we, isLoading: Te } = g({ filters: { customerId: p } }), { message: Ee, notify: De } = ae(), [Oe, G] = F(!1), [K, ke] = F(!1), [Ae, q] = F(null), [J, Y] = F(V), [je, X] = F(!1), [Z, Me] = F(!1), [Ne, Pe] = F(null);
|
|
201
361
|
ce(() => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
company: k.company ?? ""
|
|
207
|
-
});
|
|
208
|
-
}, [k]);
|
|
209
|
-
let ge = () => O?.(m(D, "customers")), Q = (e) => O?.(m(D, e)), $ = () => {
|
|
210
|
-
Y(null), K(!0);
|
|
362
|
+
W && Y(H(W));
|
|
363
|
+
}, [W]);
|
|
364
|
+
let Fe = () => U?.(m(I, "customers")), Q = (e) => U?.(m(I, e)), $ = () => {
|
|
365
|
+
q(null), G(!0);
|
|
211
366
|
};
|
|
212
|
-
return p ?
|
|
367
|
+
return p ? ye ? /* @__PURE__ */ L(j, { message: "Loading customer details..." }) : be || !W ? /* @__PURE__ */ L(A, {
|
|
213
368
|
title: "Customer not found",
|
|
214
|
-
onRetry:
|
|
215
|
-
}) : /* @__PURE__ */ R(
|
|
216
|
-
title:
|
|
217
|
-
subtitle:
|
|
369
|
+
onRetry: xe
|
|
370
|
+
}) : /* @__PURE__ */ R(ne, {
|
|
371
|
+
title: W.name,
|
|
372
|
+
subtitle: W.company || W.email,
|
|
218
373
|
icon: /* @__PURE__ */ L(u, { size: 24 }),
|
|
219
374
|
headerActions: /* @__PURE__ */ R("div", {
|
|
220
375
|
className: "flex gap-2",
|
|
221
|
-
children: [/* @__PURE__ */ R(
|
|
376
|
+
children: [/* @__PURE__ */ R(v, {
|
|
222
377
|
variant: "outline",
|
|
223
|
-
onClick:
|
|
378
|
+
onClick: Fe,
|
|
224
379
|
children: [/* @__PURE__ */ L(e, { size: 16 }), " Back"]
|
|
225
|
-
}),
|
|
380
|
+
}), Oe ? /* @__PURE__ */ R(ue, { children: [/* @__PURE__ */ R(v, {
|
|
226
381
|
variant: "outline",
|
|
227
382
|
onClick: () => {
|
|
228
|
-
|
|
229
|
-
name: k.name,
|
|
230
|
-
email: k.email,
|
|
231
|
-
phone: k.phone,
|
|
232
|
-
company: k.company ?? ""
|
|
233
|
-
});
|
|
383
|
+
q(null), G(!1), W && Y(H(W));
|
|
234
384
|
},
|
|
235
|
-
disabled:
|
|
385
|
+
disabled: K,
|
|
236
386
|
children: [/* @__PURE__ */ L(d, { size: 16 }), " Cancel"]
|
|
237
|
-
}), /* @__PURE__ */ R(
|
|
387
|
+
}), /* @__PURE__ */ R(v, {
|
|
238
388
|
onClick: async () => {
|
|
239
389
|
if (p) {
|
|
240
|
-
if (!
|
|
241
|
-
|
|
390
|
+
if (!J.name.trim()) {
|
|
391
|
+
q("Customer name is required.");
|
|
242
392
|
return;
|
|
243
393
|
}
|
|
244
|
-
|
|
394
|
+
ke(!0), q(null);
|
|
245
395
|
try {
|
|
246
|
-
await
|
|
247
|
-
name:
|
|
248
|
-
email:
|
|
249
|
-
phone:
|
|
250
|
-
company:
|
|
251
|
-
|
|
396
|
+
await Se(p, {
|
|
397
|
+
name: J.name.trim(),
|
|
398
|
+
email: J.email.trim(),
|
|
399
|
+
phone: J.phone.trim(),
|
|
400
|
+
company: J.company.trim() || void 0,
|
|
401
|
+
type: J.type,
|
|
402
|
+
address: {
|
|
403
|
+
street: J.street.trim(),
|
|
404
|
+
city: J.city.trim(),
|
|
405
|
+
state: J.state.trim(),
|
|
406
|
+
postalCode: J.postalCode.trim(),
|
|
407
|
+
country: J.country.trim()
|
|
408
|
+
},
|
|
409
|
+
businessLicense: J.businessLicense.trim() || void 0,
|
|
410
|
+
taxId: J.taxId.trim() || void 0,
|
|
411
|
+
rating: J.rating ? Number(J.rating) : void 0
|
|
412
|
+
}), De("Customer updated."), G(!1), xe();
|
|
252
413
|
} catch (e) {
|
|
253
|
-
|
|
414
|
+
q(e instanceof Error ? e.message : "Failed to update customer.");
|
|
254
415
|
} finally {
|
|
255
|
-
|
|
416
|
+
ke(!1);
|
|
256
417
|
}
|
|
257
418
|
}
|
|
258
419
|
},
|
|
259
|
-
disabled:
|
|
420
|
+
disabled: K,
|
|
260
421
|
children: [
|
|
261
|
-
/* @__PURE__ */ L(
|
|
422
|
+
/* @__PURE__ */ L(o, { size: 16 }),
|
|
262
423
|
" ",
|
|
263
|
-
|
|
424
|
+
K ? "Saving…" : "Save"
|
|
264
425
|
]
|
|
265
|
-
})] }) : /* @__PURE__ */ R(
|
|
426
|
+
})] }) : /* @__PURE__ */ R(v, {
|
|
266
427
|
onClick: $,
|
|
267
|
-
children: [/* @__PURE__ */ L(
|
|
428
|
+
children: [/* @__PURE__ */ L(s, { size: 16 }), " Edit"]
|
|
268
429
|
})]
|
|
269
430
|
}),
|
|
270
431
|
headerContent: /* @__PURE__ */ R("div", {
|
|
271
432
|
className: "flex items-center gap-4",
|
|
272
|
-
children: [
|
|
273
|
-
|
|
274
|
-
/* @__PURE__ */ L(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}),
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
className: "text-status-warning-text fill-current"
|
|
283
|
-
}), /* @__PURE__ */ L("span", {
|
|
284
|
-
className: "font-medium",
|
|
285
|
-
children: k.rating.toFixed(1)
|
|
286
|
-
})]
|
|
287
|
-
})
|
|
288
|
-
]
|
|
433
|
+
children: [/* @__PURE__ */ L(re, { type: W.type }), W.rating > 0 && /* @__PURE__ */ R("div", {
|
|
434
|
+
className: "flex items-center gap-1",
|
|
435
|
+
children: [/* @__PURE__ */ L(c, {
|
|
436
|
+
size: 16,
|
|
437
|
+
className: "text-status-warning-text fill-current"
|
|
438
|
+
}), /* @__PURE__ */ L("span", {
|
|
439
|
+
className: "font-medium",
|
|
440
|
+
children: W.rating.toFixed(1)
|
|
441
|
+
})]
|
|
442
|
+
})]
|
|
289
443
|
}),
|
|
290
444
|
children: [
|
|
291
445
|
/* @__PURE__ */ L(B, {
|
|
@@ -299,18 +453,18 @@ function H() {
|
|
|
299
453
|
label: "Book a delivery for this customer",
|
|
300
454
|
description: "Start a new order pre-filled for this account.",
|
|
301
455
|
icon: /* @__PURE__ */ L(n, { size: 16 }),
|
|
302
|
-
onClick: () => Q(f("orders/new",
|
|
456
|
+
onClick: () => Q(f("orders/new", W.id))
|
|
303
457
|
}, {
|
|
304
458
|
id: "edit",
|
|
305
459
|
label: "Update contact details",
|
|
306
460
|
description: "Keep email, phone and address current.",
|
|
307
|
-
icon: /* @__PURE__ */ L(
|
|
461
|
+
icon: /* @__PURE__ */ L(s, { size: 16 }),
|
|
308
462
|
onClick: $
|
|
309
463
|
}]
|
|
310
464
|
}),
|
|
311
|
-
|
|
465
|
+
Ee && /* @__PURE__ */ L("div", {
|
|
312
466
|
className: "mb-2",
|
|
313
|
-
children: /* @__PURE__ */ L(ie, { message:
|
|
467
|
+
children: /* @__PURE__ */ L(ie, { message: Ee })
|
|
314
468
|
}),
|
|
315
469
|
/* @__PURE__ */ R("div", {
|
|
316
470
|
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
@@ -320,74 +474,221 @@ function H() {
|
|
|
320
474
|
/* @__PURE__ */ R(z, { children: [/* @__PURE__ */ L("h2", {
|
|
321
475
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
322
476
|
children: "Contact Information"
|
|
323
|
-
}),
|
|
477
|
+
}), Oe ? /* @__PURE__ */ R("div", {
|
|
324
478
|
className: "space-y-4",
|
|
325
|
-
children: [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
children: [
|
|
333
|
-
|
|
334
|
-
children: "
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ L(N, { message: Ae }),
|
|
481
|
+
/* @__PURE__ */ R("div", {
|
|
482
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
483
|
+
children: [
|
|
484
|
+
/* @__PURE__ */ R("div", {
|
|
485
|
+
className: "space-y-2",
|
|
486
|
+
children: [/* @__PURE__ */ R(w, {
|
|
487
|
+
htmlFor: "edit-name",
|
|
488
|
+
children: ["Name ", /* @__PURE__ */ L("span", {
|
|
489
|
+
className: "text-status-error-text",
|
|
490
|
+
children: "*"
|
|
491
|
+
})]
|
|
492
|
+
}), /* @__PURE__ */ L(C, {
|
|
493
|
+
id: "edit-name",
|
|
494
|
+
value: J.name,
|
|
495
|
+
onChange: (e) => Y((t) => ({
|
|
496
|
+
...t,
|
|
497
|
+
name: e.target.value
|
|
498
|
+
}))
|
|
335
499
|
})]
|
|
336
|
-
}),
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
})
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ R("div", {
|
|
502
|
+
className: "space-y-2",
|
|
503
|
+
children: [/* @__PURE__ */ L(w, {
|
|
504
|
+
htmlFor: "edit-company",
|
|
505
|
+
children: "Company"
|
|
506
|
+
}), /* @__PURE__ */ L(C, {
|
|
507
|
+
id: "edit-company",
|
|
508
|
+
value: J.company,
|
|
509
|
+
onChange: (e) => Y((t) => ({
|
|
510
|
+
...t,
|
|
511
|
+
company: e.target.value
|
|
512
|
+
})),
|
|
513
|
+
placeholder: "Company name (for B2B accounts)"
|
|
514
|
+
})]
|
|
515
|
+
}),
|
|
516
|
+
/* @__PURE__ */ R("div", {
|
|
517
|
+
className: "space-y-2",
|
|
518
|
+
children: [/* @__PURE__ */ L(w, {
|
|
519
|
+
htmlFor: "edit-email",
|
|
520
|
+
children: "Email"
|
|
521
|
+
}), /* @__PURE__ */ L(C, {
|
|
522
|
+
id: "edit-email",
|
|
523
|
+
type: "email",
|
|
524
|
+
value: J.email,
|
|
525
|
+
onChange: (e) => Y((t) => ({
|
|
526
|
+
...t,
|
|
527
|
+
email: e.target.value
|
|
528
|
+
}))
|
|
529
|
+
})]
|
|
530
|
+
}),
|
|
531
|
+
/* @__PURE__ */ R("div", {
|
|
532
|
+
className: "space-y-2",
|
|
533
|
+
children: [/* @__PURE__ */ L(w, {
|
|
534
|
+
htmlFor: "edit-phone",
|
|
535
|
+
children: "Phone"
|
|
536
|
+
}), /* @__PURE__ */ L(C, {
|
|
537
|
+
id: "edit-phone",
|
|
538
|
+
value: J.phone,
|
|
539
|
+
onChange: (e) => Y((t) => ({
|
|
540
|
+
...t,
|
|
541
|
+
phone: e.target.value
|
|
542
|
+
}))
|
|
543
|
+
})]
|
|
544
|
+
}),
|
|
545
|
+
/* @__PURE__ */ R("div", {
|
|
546
|
+
className: "space-y-2",
|
|
547
|
+
children: [/* @__PURE__ */ L(w, {
|
|
548
|
+
htmlFor: "edit-type",
|
|
549
|
+
children: "Customer Type"
|
|
550
|
+
}), /* @__PURE__ */ R(T, {
|
|
551
|
+
value: J.type,
|
|
552
|
+
onValueChange: (e) => Y((t) => ({
|
|
553
|
+
...t,
|
|
554
|
+
type: e
|
|
555
|
+
})),
|
|
556
|
+
children: [/* @__PURE__ */ L(O, {
|
|
557
|
+
id: "edit-type",
|
|
558
|
+
children: /* @__PURE__ */ L(k, {})
|
|
559
|
+
}), /* @__PURE__ */ R(E, { children: [/* @__PURE__ */ L(D, {
|
|
560
|
+
value: "b2c",
|
|
561
|
+
children: "B2C (Individual)"
|
|
562
|
+
}), /* @__PURE__ */ L(D, {
|
|
563
|
+
value: "b2b",
|
|
564
|
+
children: "B2B (Business)"
|
|
565
|
+
})] })]
|
|
566
|
+
})]
|
|
567
|
+
}),
|
|
568
|
+
/* @__PURE__ */ R("div", {
|
|
569
|
+
className: "space-y-2",
|
|
570
|
+
children: [/* @__PURE__ */ L(w, {
|
|
571
|
+
htmlFor: "edit-rating",
|
|
572
|
+
children: "Rating (0–5)"
|
|
573
|
+
}), /* @__PURE__ */ L(C, {
|
|
574
|
+
id: "edit-rating",
|
|
575
|
+
type: "number",
|
|
576
|
+
min: 0,
|
|
577
|
+
max: 5,
|
|
578
|
+
step: .1,
|
|
579
|
+
value: J.rating,
|
|
580
|
+
onChange: (e) => Y((t) => ({
|
|
581
|
+
...t,
|
|
582
|
+
rating: e.target.value
|
|
583
|
+
}))
|
|
584
|
+
})]
|
|
585
|
+
})
|
|
586
|
+
]
|
|
587
|
+
}),
|
|
588
|
+
/* @__PURE__ */ R("div", {
|
|
589
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ R("div", {
|
|
592
|
+
className: "space-y-2",
|
|
593
|
+
children: [/* @__PURE__ */ L(w, {
|
|
594
|
+
htmlFor: "edit-street",
|
|
595
|
+
children: "Street"
|
|
596
|
+
}), /* @__PURE__ */ L(C, {
|
|
597
|
+
id: "edit-street",
|
|
598
|
+
value: J.street,
|
|
599
|
+
onChange: (e) => Y((t) => ({
|
|
600
|
+
...t,
|
|
601
|
+
street: e.target.value
|
|
602
|
+
}))
|
|
603
|
+
})]
|
|
604
|
+
}),
|
|
605
|
+
/* @__PURE__ */ R("div", {
|
|
606
|
+
className: "space-y-2",
|
|
607
|
+
children: [/* @__PURE__ */ L(w, {
|
|
608
|
+
htmlFor: "edit-city",
|
|
609
|
+
children: "City"
|
|
610
|
+
}), /* @__PURE__ */ L(C, {
|
|
611
|
+
id: "edit-city",
|
|
612
|
+
value: J.city,
|
|
613
|
+
onChange: (e) => Y((t) => ({
|
|
614
|
+
...t,
|
|
615
|
+
city: e.target.value
|
|
616
|
+
}))
|
|
617
|
+
})]
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ R("div", {
|
|
620
|
+
className: "space-y-2",
|
|
621
|
+
children: [/* @__PURE__ */ L(w, {
|
|
622
|
+
htmlFor: "edit-state",
|
|
623
|
+
children: "State"
|
|
624
|
+
}), /* @__PURE__ */ L(C, {
|
|
625
|
+
id: "edit-state",
|
|
626
|
+
value: J.state,
|
|
627
|
+
onChange: (e) => Y((t) => ({
|
|
628
|
+
...t,
|
|
629
|
+
state: e.target.value
|
|
630
|
+
}))
|
|
631
|
+
})]
|
|
632
|
+
}),
|
|
633
|
+
/* @__PURE__ */ R("div", {
|
|
634
|
+
className: "space-y-2",
|
|
635
|
+
children: [/* @__PURE__ */ L(w, {
|
|
636
|
+
htmlFor: "edit-postalCode",
|
|
637
|
+
children: "Postal Code"
|
|
638
|
+
}), /* @__PURE__ */ L(C, {
|
|
639
|
+
id: "edit-postalCode",
|
|
640
|
+
value: J.postalCode,
|
|
641
|
+
onChange: (e) => Y((t) => ({
|
|
642
|
+
...t,
|
|
643
|
+
postalCode: e.target.value
|
|
644
|
+
}))
|
|
645
|
+
})]
|
|
646
|
+
}),
|
|
647
|
+
/* @__PURE__ */ R("div", {
|
|
648
|
+
className: "space-y-2",
|
|
649
|
+
children: [/* @__PURE__ */ L(w, {
|
|
650
|
+
htmlFor: "edit-country",
|
|
651
|
+
children: "Country"
|
|
652
|
+
}), /* @__PURE__ */ L(C, {
|
|
653
|
+
id: "edit-country",
|
|
654
|
+
value: J.country,
|
|
655
|
+
onChange: (e) => Y((t) => ({
|
|
656
|
+
...t,
|
|
657
|
+
country: e.target.value
|
|
658
|
+
}))
|
|
659
|
+
})]
|
|
660
|
+
}),
|
|
661
|
+
/* @__PURE__ */ R("div", {
|
|
662
|
+
className: "space-y-2",
|
|
663
|
+
children: [/* @__PURE__ */ L(w, {
|
|
664
|
+
htmlFor: "edit-businessLicense",
|
|
665
|
+
children: "Business License"
|
|
666
|
+
}), /* @__PURE__ */ L(C, {
|
|
667
|
+
id: "edit-businessLicense",
|
|
668
|
+
value: J.businessLicense,
|
|
669
|
+
onChange: (e) => Y((t) => ({
|
|
670
|
+
...t,
|
|
671
|
+
businessLicense: e.target.value
|
|
672
|
+
}))
|
|
673
|
+
})]
|
|
674
|
+
}),
|
|
675
|
+
/* @__PURE__ */ R("div", {
|
|
676
|
+
className: "space-y-2",
|
|
677
|
+
children: [/* @__PURE__ */ L(w, {
|
|
678
|
+
htmlFor: "edit-taxId",
|
|
679
|
+
children: "Tax ID"
|
|
680
|
+
}), /* @__PURE__ */ L(C, {
|
|
681
|
+
id: "edit-taxId",
|
|
682
|
+
value: J.taxId,
|
|
683
|
+
onChange: (e) => Y((t) => ({
|
|
684
|
+
...t,
|
|
685
|
+
taxId: e.target.value
|
|
686
|
+
}))
|
|
687
|
+
})]
|
|
688
|
+
})
|
|
689
|
+
]
|
|
690
|
+
})
|
|
691
|
+
]
|
|
391
692
|
}) : /* @__PURE__ */ R("div", {
|
|
392
693
|
className: "grid grid-cols-1 md:grid-cols-2 gap-6",
|
|
393
694
|
children: [/* @__PURE__ */ R("div", {
|
|
@@ -402,11 +703,11 @@ function H() {
|
|
|
402
703
|
children: "Email"
|
|
403
704
|
}), /* @__PURE__ */ L("p", {
|
|
404
705
|
className: "font-medium",
|
|
405
|
-
children:
|
|
706
|
+
children: W.email || "—"
|
|
406
707
|
})] })]
|
|
407
708
|
}), /* @__PURE__ */ R("div", {
|
|
408
709
|
className: "flex items-center gap-3",
|
|
409
|
-
children: [/* @__PURE__ */ L(
|
|
710
|
+
children: [/* @__PURE__ */ L(a, {
|
|
410
711
|
size: 18,
|
|
411
712
|
className: "text-text-secondary"
|
|
412
713
|
}), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
@@ -414,12 +715,12 @@ function H() {
|
|
|
414
715
|
children: "Phone"
|
|
415
716
|
}), /* @__PURE__ */ L("p", {
|
|
416
717
|
className: "font-medium",
|
|
417
|
-
children:
|
|
718
|
+
children: W.phone || "—"
|
|
418
719
|
})] })]
|
|
419
720
|
})]
|
|
420
|
-
}), /* @__PURE__ */
|
|
721
|
+
}), /* @__PURE__ */ L("div", {
|
|
421
722
|
className: "space-y-4",
|
|
422
|
-
children:
|
|
723
|
+
children: W.company && /* @__PURE__ */ R("div", {
|
|
423
724
|
className: "flex items-center gap-3",
|
|
424
725
|
children: [/* @__PURE__ */ L(t, {
|
|
425
726
|
size: 18,
|
|
@@ -429,48 +730,32 @@ function H() {
|
|
|
429
730
|
children: "Company"
|
|
430
731
|
}), /* @__PURE__ */ L("p", {
|
|
431
732
|
className: "font-medium",
|
|
432
|
-
children:
|
|
733
|
+
children: W.company
|
|
433
734
|
})] })]
|
|
434
|
-
})
|
|
435
|
-
let e = fe(k.website);
|
|
436
|
-
return e ? /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
437
|
-
className: "text-sm text-text-secondary",
|
|
438
|
-
children: "Website"
|
|
439
|
-
}), /* @__PURE__ */ L("a", {
|
|
440
|
-
href: e,
|
|
441
|
-
target: "_blank",
|
|
442
|
-
rel: "noopener noreferrer",
|
|
443
|
-
className: "text-primary hover:underline",
|
|
444
|
-
children: e
|
|
445
|
-
})] }) : null;
|
|
446
|
-
})()]
|
|
735
|
+
})
|
|
447
736
|
})]
|
|
448
737
|
})] }),
|
|
449
|
-
/* @__PURE__ */ R(
|
|
738
|
+
/* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ R(S, {
|
|
450
739
|
className: "flex items-center gap-2",
|
|
451
|
-
children: [/* @__PURE__ */ L(
|
|
452
|
-
}) }), /* @__PURE__ */ L(
|
|
453
|
-
|
|
454
|
-
className: "flex items-center gap-2",
|
|
455
|
-
children: [/* @__PURE__ */ L(n, { size: 18 }), " Notes"]
|
|
456
|
-
}) }), /* @__PURE__ */ L(S, { children: /* @__PURE__ */ L("p", { children: k.notes }) })] }),
|
|
457
|
-
/* @__PURE__ */ R(x, { children: [/* @__PURE__ */ R(C, {
|
|
740
|
+
children: [/* @__PURE__ */ L(ee, { size: 18 }), " Address"]
|
|
741
|
+
}) }), /* @__PURE__ */ L(b, { children: /* @__PURE__ */ L("p", { children: oe(W.address) || "—" }) })] }),
|
|
742
|
+
/* @__PURE__ */ R(y, { children: [/* @__PURE__ */ R(x, {
|
|
458
743
|
className: "flex flex-row items-center justify-between",
|
|
459
|
-
children: [/* @__PURE__ */ R(
|
|
744
|
+
children: [/* @__PURE__ */ R(S, {
|
|
460
745
|
className: "flex items-center gap-2",
|
|
461
|
-
children: [/* @__PURE__ */ L(
|
|
462
|
-
}), /* @__PURE__ */ R(
|
|
746
|
+
children: [/* @__PURE__ */ L(i, { size: 18 }), " Orders"]
|
|
747
|
+
}), /* @__PURE__ */ R(v, {
|
|
463
748
|
variant: "outline",
|
|
464
749
|
size: "sm",
|
|
465
|
-
onClick: () => Q(f("orders/new",
|
|
750
|
+
onClick: () => Q(f("orders/new", W.id)),
|
|
466
751
|
children: [/* @__PURE__ */ L(n, { size: 14 }), " New order"]
|
|
467
752
|
})]
|
|
468
|
-
}), /* @__PURE__ */ L(
|
|
753
|
+
}), /* @__PURE__ */ L(b, { children: Te ? /* @__PURE__ */ L("p", {
|
|
469
754
|
className: "text-text-secondary text-center py-4",
|
|
470
755
|
children: "Loading orders…"
|
|
471
|
-
}) :
|
|
756
|
+
}) : we.length > 0 ? /* @__PURE__ */ L("div", {
|
|
472
757
|
className: "space-y-2",
|
|
473
|
-
children:
|
|
758
|
+
children: we.map((e) => /* @__PURE__ */ R("button", {
|
|
474
759
|
type: "button",
|
|
475
760
|
onClick: () => Q(`orders/${e.id}`),
|
|
476
761
|
className: "w-full flex items-center justify-between gap-3 p-3 border rounded-lg text-left hover:bg-bg-sunken/50 transition-colors",
|
|
@@ -488,7 +773,7 @@ function H() {
|
|
|
488
773
|
se(e.pricing.total)
|
|
489
774
|
]
|
|
490
775
|
})]
|
|
491
|
-
}), /* @__PURE__ */ L(
|
|
776
|
+
}), /* @__PURE__ */ L(M, {
|
|
492
777
|
status: e.status,
|
|
493
778
|
type: "order",
|
|
494
779
|
size: "sm"
|
|
@@ -497,7 +782,7 @@ function H() {
|
|
|
497
782
|
}) : /* @__PURE__ */ R("div", {
|
|
498
783
|
className: "text-center py-6",
|
|
499
784
|
children: [
|
|
500
|
-
/* @__PURE__ */ L(
|
|
785
|
+
/* @__PURE__ */ L(i, {
|
|
501
786
|
size: 32,
|
|
502
787
|
className: "mx-auto mb-2 text-text-secondary opacity-50"
|
|
503
788
|
}),
|
|
@@ -507,7 +792,7 @@ function H() {
|
|
|
507
792
|
}),
|
|
508
793
|
/* @__PURE__ */ L("button", {
|
|
509
794
|
type: "button",
|
|
510
|
-
onClick: () => Q(f("orders/new",
|
|
795
|
+
onClick: () => Q(f("orders/new", W.id)),
|
|
511
796
|
className: "mt-1 text-sm text-primary hover:underline",
|
|
512
797
|
children: "Book their first delivery"
|
|
513
798
|
})
|
|
@@ -516,52 +801,89 @@ function H() {
|
|
|
516
801
|
]
|
|
517
802
|
}), /* @__PURE__ */ R("div", {
|
|
518
803
|
className: "space-y-6",
|
|
519
|
-
children: [
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
804
|
+
children: [
|
|
805
|
+
(W.businessLicense || W.taxId) && /* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ L(S, { children: "Business Details" }) }), /* @__PURE__ */ R(b, {
|
|
806
|
+
className: "space-y-3",
|
|
807
|
+
children: [W.businessLicense && /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
523
808
|
className: "text-sm text-text-secondary",
|
|
524
809
|
children: "Business License"
|
|
525
810
|
}), /* @__PURE__ */ L("p", {
|
|
526
811
|
className: "font-mono",
|
|
527
|
-
children:
|
|
528
|
-
})] }),
|
|
529
|
-
k.taxId && /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
812
|
+
children: W.businessLicense
|
|
813
|
+
})] }), W.taxId && /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
530
814
|
className: "text-sm text-text-secondary",
|
|
531
815
|
children: "Tax ID"
|
|
532
816
|
}), /* @__PURE__ */ L("p", {
|
|
533
817
|
className: "font-mono",
|
|
534
|
-
children:
|
|
535
|
-
})] })
|
|
536
|
-
|
|
818
|
+
children: W.taxId
|
|
819
|
+
})] })]
|
|
820
|
+
})] }),
|
|
821
|
+
/* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ L(S, { children: "Account Info" }) }), /* @__PURE__ */ R(b, {
|
|
822
|
+
className: "space-y-3",
|
|
823
|
+
children: [/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
537
824
|
className: "text-sm text-text-secondary",
|
|
538
|
-
children: "
|
|
539
|
-
}), /* @__PURE__ */ L("p", {
|
|
540
|
-
className: "capitalize",
|
|
541
|
-
children: k.preferredContactMethod
|
|
542
|
-
})] }),
|
|
543
|
-
/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
825
|
+
children: "Created"
|
|
826
|
+
}), /* @__PURE__ */ L("p", { children: P(W.createdAt, "full") })] }), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
|
|
544
827
|
className: "text-sm text-text-secondary",
|
|
545
|
-
children: "
|
|
546
|
-
}), /* @__PURE__ */ L(
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
828
|
+
children: "Last Updated"
|
|
829
|
+
}), /* @__PURE__ */ L("p", { children: P(W.updatedAt, "relative") })] })]
|
|
830
|
+
})] }),
|
|
831
|
+
/* @__PURE__ */ R(y, {
|
|
832
|
+
className: "border-status-error-border",
|
|
833
|
+
children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ R(S, {
|
|
834
|
+
className: "flex items-center gap-2 text-status-error-text",
|
|
835
|
+
children: [/* @__PURE__ */ L(l, { size: 18 }), " Delete Customer"]
|
|
836
|
+
}) }), /* @__PURE__ */ R(b, { children: [/* @__PURE__ */ L("p", {
|
|
837
|
+
className: "mb-3 text-sm text-text-secondary",
|
|
838
|
+
children: "Removes this customer from your account. Their past orders stay on record. This cannot be undone from here."
|
|
839
|
+
}), /* @__PURE__ */ R(v, {
|
|
840
|
+
type: "button",
|
|
841
|
+
variant: "outline",
|
|
842
|
+
className: "border-status-error-border text-status-error-text hover:bg-status-error-bg-subtle",
|
|
843
|
+
onClick: () => X(!0),
|
|
844
|
+
children: [/* @__PURE__ */ L(l, { size: 16 }), " Delete this customer"]
|
|
845
|
+
})] })]
|
|
846
|
+
})
|
|
847
|
+
]
|
|
561
848
|
})]
|
|
849
|
+
}),
|
|
850
|
+
/* @__PURE__ */ L(fe, {
|
|
851
|
+
open: je,
|
|
852
|
+
onOpenChange: X,
|
|
853
|
+
children: /* @__PURE__ */ R(pe, { children: [
|
|
854
|
+
/* @__PURE__ */ R(ge, { children: [/* @__PURE__ */ L(_e, { children: "Delete this customer?" }), /* @__PURE__ */ R(me, { children: [
|
|
855
|
+
"This removes ",
|
|
856
|
+
W.name,
|
|
857
|
+
" from your account. It cannot be undone from here."
|
|
858
|
+
] })] }),
|
|
859
|
+
/* @__PURE__ */ L("div", {
|
|
860
|
+
className: "px-1",
|
|
861
|
+
children: /* @__PURE__ */ L(N, { message: Ne })
|
|
862
|
+
}),
|
|
863
|
+
/* @__PURE__ */ R(he, { children: [/* @__PURE__ */ L(v, {
|
|
864
|
+
variant: "outline",
|
|
865
|
+
onClick: () => X(!1),
|
|
866
|
+
disabled: Z,
|
|
867
|
+
children: "Cancel"
|
|
868
|
+
}), /* @__PURE__ */ L(v, {
|
|
869
|
+
className: "bg-status-error-text text-text-inverse hover:opacity-90",
|
|
870
|
+
onClick: async () => {
|
|
871
|
+
if (p) {
|
|
872
|
+
Me(!0), Pe(null);
|
|
873
|
+
try {
|
|
874
|
+
await Ce(p), X(!1), Fe();
|
|
875
|
+
} catch (e) {
|
|
876
|
+
Pe(e instanceof Error ? e.message : "Failed to delete customer."), Me(!1);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
disabled: Z,
|
|
881
|
+
children: Z ? "Deleting..." : "Delete customer"
|
|
882
|
+
})] })
|
|
883
|
+
] })
|
|
562
884
|
})
|
|
563
885
|
]
|
|
564
|
-
}) : /* @__PURE__ */ L(
|
|
886
|
+
}) : /* @__PURE__ */ L(ve, {});
|
|
565
887
|
}
|
|
566
888
|
//#endregion
|
|
567
|
-
export {
|
|
889
|
+
export { U as default };
|