@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.
Files changed (43) hide show
  1. package/dist/components/StatusBadge.js +34 -31
  2. package/dist/constants/index.js +12 -5
  3. package/dist/hooks/useCustomers.js +0 -3
  4. package/dist/hooks/useFleet.js +148 -135
  5. package/dist/hooks/useInventory.js +146 -146
  6. package/dist/hooks/useRoutes.js +5 -14
  7. package/dist/movethewheels/components/StatusBadge.d.ts +3 -1
  8. package/dist/movethewheels/constants/index.d.ts +1 -0
  9. package/dist/movethewheels/hooks/useFleet.d.ts +17 -4
  10. package/dist/movethewheels/hooks/useInventory.d.ts +11 -0
  11. package/dist/movethewheels/types/index.d.ts +19 -75
  12. package/dist/pages/CustomerDetailsPage.js +666 -344
  13. package/dist/pages/CustomersPage.js +71 -80
  14. package/dist/pages/DriverDetailsPage.js +2 -2
  15. package/dist/pages/DriversPage.js +2 -2
  16. package/dist/pages/FleetPage.js +1 -3
  17. package/dist/pages/InventoryPage.js +5 -5
  18. package/dist/pages/RouteDetailsPage.js +273 -248
  19. package/dist/pages/RoutesPage.js +130 -67
  20. package/dist/pages/VehicleDetailsPage.js +527 -389
  21. package/dist/pages/VehiclesPage.js +120 -71
  22. package/dist/pages/WarehouseDetailsPage.js +411 -368
  23. package/dist/pages/WarehousesPage.js +132 -83
  24. package/package.json +1 -1
  25. package/src/movethewheels/components/StatusBadge.tsx +15 -7
  26. package/src/movethewheels/constants/index.ts +9 -0
  27. package/src/movethewheels/hooks/useCustomers.ts +0 -3
  28. package/src/movethewheels/hooks/useFleet.ts +89 -25
  29. package/src/movethewheels/hooks/useInventory.ts +77 -33
  30. package/src/movethewheels/hooks/useRoutes.ts +17 -12
  31. package/src/movethewheels/pages/CustomerDetailsPage.tsx +376 -109
  32. package/src/movethewheels/pages/CustomersPage.tsx +6 -15
  33. package/src/movethewheels/pages/DriverDetailsPage.tsx +3 -1
  34. package/src/movethewheels/pages/DriversPage.tsx +5 -1
  35. package/src/movethewheels/pages/FleetPage.tsx +2 -1
  36. package/src/movethewheels/pages/InventoryPage.tsx +18 -6
  37. package/src/movethewheels/pages/RouteDetailsPage.tsx +74 -34
  38. package/src/movethewheels/pages/RoutesPage.tsx +66 -2
  39. package/src/movethewheels/pages/VehicleDetailsPage.tsx +185 -23
  40. package/src/movethewheels/pages/VehiclesPage.tsx +72 -5
  41. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +217 -138
  42. package/src/movethewheels/pages/WarehousesPage.tsx +81 -17
  43. 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 i } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
6
- import { Package as a } from "../node_modules/lucide-react/dist/esm/icons/package.js";
7
- import { Phone as o } from "../node_modules/lucide-react/dist/esm/icons/phone.js";
8
- import { Save as s } from "../node_modules/lucide-react/dist/esm/icons/save.js";
9
- import { SquarePen as c } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
10
- import { Star as l } from "../node_modules/lucide-react/dist/esm/icons/star.js";
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 _, useCustomers as v } from "../hooks/useCustomers.js";
17
- import { Badge as y, Button as b, Card as x, CardContent as S, CardHeader as C, CardTitle as w, Input as T, Label as E, Select as D, SelectContent as O, SelectItem as k, SelectTrigger as A, SelectValue as j } from "../components/ui.js";
18
- import { ErrorState as ee, LoadingState as te, PageLayout as M } from "../components/PageLayout.js";
19
- import { StatusBadge as ne, TypeBadge as re } from "../components/StatusBadge.js";
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
- function fe(e) {
29
- if (!e) return null;
30
- let t = e.trim(), n = /^https?:\/\//i.test(t) ? t : `https://${t}`;
31
- try {
32
- let e = new URL(n);
33
- return e.protocol === "http:" || e.protocol === "https:" ? e.href : null;
34
- } catch {
35
- return null;
36
- }
37
- }
38
- function V() {
39
- let { basePath: t, navigate: n } = h(), [r] = I(), i = p(r.get("returnTo")), { createCustomer: a } = v(), [o, c] = F({
40
- name: "",
41
- type: "b2c",
42
- email: "",
43
- phone: "",
44
- company: ""
45
- }), [l, d] = F(!1), [g, _] = F(null), y = () => n?.(m(t, "customers")), x = async (e) => {
46
- if (e.preventDefault(), !o.name.trim()) {
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
- d(!0), _(null);
50
+ g(!0), A(null);
51
51
  try {
52
- let e = await a({
53
- name: o.name.trim(),
54
- type: o.type,
55
- email: o.email.trim() || void 0,
56
- phone: o.phone.trim() || void 0,
57
- company: o.company.trim() || void 0
58
- }), r = i ? f(i, e.id) : `customers/${e.id}`;
59
- n?.(m(t, r));
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), _(e instanceof Error ? e.message : "Failed to create customer. Please try again."), d(!1);
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(M, {
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(b, {
80
+ children: [/* @__PURE__ */ R(v, {
71
81
  variant: "outline",
72
- onClick: y,
73
- disabled: l,
82
+ onClick: j,
83
+ disabled: d,
74
84
  children: [/* @__PURE__ */ L(e, { size: 16 }), " Cancel"]
75
- }), /* @__PURE__ */ R(b, {
76
- onClick: x,
77
- disabled: l,
85
+ }), /* @__PURE__ */ R(v, {
86
+ onClick: M,
87
+ disabled: d,
78
88
  children: [
79
- /* @__PURE__ */ L(s, { size: 16 }),
89
+ /* @__PURE__ */ L(o, { size: 16 }),
80
90
  " ",
81
- l ? "Saving..." : "Create Customer"
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: x,
99
+ onSubmit: M,
90
100
  className: "max-w-2xl space-y-6",
91
- children: [/* @__PURE__ */ L(N, { message: g }), /* @__PURE__ */ R(z, { children: [/* @__PURE__ */ L("h2", {
92
- className: "text-base font-semibold text-text-primary mb-4",
93
- children: "Customer Details"
94
- }), /* @__PURE__ */ R("div", {
95
- className: "space-y-4",
96
- children: [
97
- /* @__PURE__ */ R("div", {
98
- className: "grid grid-cols-1 md:grid-cols-2 gap-4",
99
- children: [/* @__PURE__ */ R("div", {
100
- className: "space-y-2",
101
- children: [/* @__PURE__ */ R(E, {
102
- htmlFor: "name",
103
- children: ["Name ", /* @__PURE__ */ L("span", {
104
- className: "text-status-error-text",
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
- }), /* @__PURE__ */ R("div", {
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(E, {
120
- htmlFor: "type",
121
- children: "Customer Type"
122
- }), /* @__PURE__ */ R(D, {
123
- value: o.type,
124
- onValueChange: (e) => c((t) => ({
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
- type: e
196
+ company: e.target.value
127
197
  })),
128
- children: [/* @__PURE__ */ L(A, {
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
- /* @__PURE__ */ R("div", {
142
- className: "grid grid-cols-1 md:grid-cols-2 gap-4",
143
- children: [/* @__PURE__ */ R("div", {
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(E, {
146
- htmlFor: "email",
147
- children: "Email"
148
- }), /* @__PURE__ */ L(T, {
149
- id: "email",
150
- type: "email",
151
- value: o.email,
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
- email: e.target.value
155
- })),
156
- placeholder: "customer@example.com"
300
+ businessLicense: e.target.value
301
+ }))
157
302
  })]
158
- }), /* @__PURE__ */ R("div", {
303
+ }),
304
+ /* @__PURE__ */ R("div", {
159
305
  className: "space-y-2",
160
- children: [/* @__PURE__ */ L(E, {
161
- htmlFor: "phone",
162
- children: "Phone"
163
- }), /* @__PURE__ */ L(T, {
164
- id: "phone",
165
- value: o.phone,
166
- onChange: (e) => c((t) => ({
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
- phone: e.target.value
169
- })),
170
- placeholder: "+1-555-0100"
314
+ taxId: e.target.value
315
+ }))
171
316
  })]
172
- })]
173
- }),
174
- /* @__PURE__ */ R("div", {
175
- className: "space-y-2",
176
- children: [/* @__PURE__ */ L(E, {
177
- htmlFor: "company",
178
- children: "Company"
179
- }), /* @__PURE__ */ L(T, {
180
- id: "company",
181
- value: o.company,
182
- onChange: (e) => c((t) => ({
183
- ...t,
184
- company: e.target.value
185
- })),
186
- placeholder: "Company name (for B2B accounts)"
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
- let { customerId: p } = le(), { basePath: D, navigate: O } = h(), { customer: k, isLoading: A, error: j, refetch: I } = _(p), { updateCustomer: H } = v(), { orders: U, isLoading: pe } = g({ filters: { customerId: p } }), { message: W, notify: me } = ae(), [G, K] = F(!1), [q, J] = F(!1), [he, Y] = F(null), [X, Z] = F({
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
- k && Z({
203
- name: k.name,
204
- email: k.email,
205
- phone: k.phone,
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 ? A ? /* @__PURE__ */ L(te, { message: "Loading customer details..." }) : j || !k ? /* @__PURE__ */ L(ee, {
367
+ return p ? ye ? /* @__PURE__ */ L(j, { message: "Loading customer details..." }) : be || !W ? /* @__PURE__ */ L(A, {
213
368
  title: "Customer not found",
214
- onRetry: I
215
- }) : /* @__PURE__ */ R(M, {
216
- title: k.name,
217
- subtitle: k.company || k.email,
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(b, {
376
+ children: [/* @__PURE__ */ R(v, {
222
377
  variant: "outline",
223
- onClick: ge,
378
+ onClick: Fe,
224
379
  children: [/* @__PURE__ */ L(e, { size: 16 }), " Back"]
225
- }), G ? /* @__PURE__ */ R(ue, { children: [/* @__PURE__ */ R(b, {
380
+ }), Oe ? /* @__PURE__ */ R(ue, { children: [/* @__PURE__ */ R(v, {
226
381
  variant: "outline",
227
382
  onClick: () => {
228
- Y(null), K(!1), k && Z({
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: q,
385
+ disabled: K,
236
386
  children: [/* @__PURE__ */ L(d, { size: 16 }), " Cancel"]
237
- }), /* @__PURE__ */ R(b, {
387
+ }), /* @__PURE__ */ R(v, {
238
388
  onClick: async () => {
239
389
  if (p) {
240
- if (!X.name.trim()) {
241
- Y("Customer name is required.");
390
+ if (!J.name.trim()) {
391
+ q("Customer name is required.");
242
392
  return;
243
393
  }
244
- J(!0), Y(null);
394
+ ke(!0), q(null);
245
395
  try {
246
- await H(p, {
247
- name: X.name.trim(),
248
- email: X.email.trim(),
249
- phone: X.phone.trim(),
250
- company: X.company.trim() || void 0
251
- }), me("Customer updated."), K(!1), I();
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
- Y(e instanceof Error ? e.message : "Failed to update customer.");
414
+ q(e instanceof Error ? e.message : "Failed to update customer.");
254
415
  } finally {
255
- J(!1);
416
+ ke(!1);
256
417
  }
257
418
  }
258
419
  },
259
- disabled: q,
420
+ disabled: K,
260
421
  children: [
261
- /* @__PURE__ */ L(s, { size: 16 }),
422
+ /* @__PURE__ */ L(o, { size: 16 }),
262
423
  " ",
263
- q ? "Saving…" : "Save"
424
+ K ? "Saving…" : "Save"
264
425
  ]
265
- })] }) : /* @__PURE__ */ R(b, {
426
+ })] }) : /* @__PURE__ */ R(v, {
266
427
  onClick: $,
267
- children: [/* @__PURE__ */ L(c, { size: 16 }), " Edit"]
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
- /* @__PURE__ */ L(re, { type: k.type }),
274
- /* @__PURE__ */ L(y, {
275
- variant: k.isActive ? "default" : "secondary",
276
- children: k.isActive ? "Active" : "Inactive"
277
- }),
278
- /* @__PURE__ */ R("div", {
279
- className: "flex items-center gap-1",
280
- children: [/* @__PURE__ */ L(l, {
281
- size: 16,
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", k.id))
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(c, { size: 16 }),
461
+ icon: /* @__PURE__ */ L(s, { size: 16 }),
308
462
  onClick: $
309
463
  }]
310
464
  }),
311
- W && /* @__PURE__ */ L("div", {
465
+ Ee && /* @__PURE__ */ L("div", {
312
466
  className: "mb-2",
313
- children: /* @__PURE__ */ L(ie, { message: W })
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
- }), G ? /* @__PURE__ */ R("div", {
477
+ }), Oe ? /* @__PURE__ */ R("div", {
324
478
  className: "space-y-4",
325
- children: [/* @__PURE__ */ L(N, { message: he }), /* @__PURE__ */ R("div", {
326
- className: "grid grid-cols-1 md:grid-cols-2 gap-4",
327
- children: [
328
- /* @__PURE__ */ R("div", {
329
- className: "space-y-2",
330
- children: [/* @__PURE__ */ R(E, {
331
- htmlFor: "edit-name",
332
- children: ["Name ", /* @__PURE__ */ L("span", {
333
- className: "text-status-error-text",
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
- }), /* @__PURE__ */ L(T, {
337
- id: "edit-name",
338
- value: X.name,
339
- onChange: (e) => Z((t) => ({
340
- ...t,
341
- name: e.target.value
342
- }))
343
- })]
344
- }),
345
- /* @__PURE__ */ R("div", {
346
- className: "space-y-2",
347
- children: [/* @__PURE__ */ L(E, {
348
- htmlFor: "edit-company",
349
- children: "Company"
350
- }), /* @__PURE__ */ L(T, {
351
- id: "edit-company",
352
- value: X.company,
353
- onChange: (e) => Z((t) => ({
354
- ...t,
355
- company: e.target.value
356
- })),
357
- placeholder: "Company name (for B2B accounts)"
358
- })]
359
- }),
360
- /* @__PURE__ */ R("div", {
361
- className: "space-y-2",
362
- children: [/* @__PURE__ */ L(E, {
363
- htmlFor: "edit-email",
364
- children: "Email"
365
- }), /* @__PURE__ */ L(T, {
366
- id: "edit-email",
367
- type: "email",
368
- value: X.email,
369
- onChange: (e) => Z((t) => ({
370
- ...t,
371
- email: e.target.value
372
- }))
373
- })]
374
- }),
375
- /* @__PURE__ */ R("div", {
376
- className: "space-y-2",
377
- children: [/* @__PURE__ */ L(E, {
378
- htmlFor: "edit-phone",
379
- children: "Phone"
380
- }), /* @__PURE__ */ L(T, {
381
- id: "edit-phone",
382
- value: X.phone,
383
- onChange: (e) => Z((t) => ({
384
- ...t,
385
- phone: e.target.value
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: k.email || "—"
706
+ children: W.email || "—"
406
707
  })] })]
407
708
  }), /* @__PURE__ */ R("div", {
408
709
  className: "flex items-center gap-3",
409
- children: [/* @__PURE__ */ L(o, {
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: k.phone || "—"
718
+ children: W.phone || "—"
418
719
  })] })]
419
720
  })]
420
- }), /* @__PURE__ */ R("div", {
721
+ }), /* @__PURE__ */ L("div", {
421
722
  className: "space-y-4",
422
- children: [k.company && /* @__PURE__ */ R("div", {
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: k.company
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(x, { children: [/* @__PURE__ */ L(C, { children: /* @__PURE__ */ R(w, {
738
+ /* @__PURE__ */ R(y, { children: [/* @__PURE__ */ L(x, { children: /* @__PURE__ */ R(S, {
450
739
  className: "flex items-center gap-2",
451
- children: [/* @__PURE__ */ L(i, { size: 18 }), " Address"]
452
- }) }), /* @__PURE__ */ L(S, { children: /* @__PURE__ */ L("p", { children: oe(k.address) }) })] }),
453
- k.notes && /* @__PURE__ */ R(x, { children: [/* @__PURE__ */ L(C, { children: /* @__PURE__ */ R(w, {
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(w, {
744
+ children: [/* @__PURE__ */ R(S, {
460
745
  className: "flex items-center gap-2",
461
- children: [/* @__PURE__ */ L(a, { size: 18 }), " Orders"]
462
- }), /* @__PURE__ */ R(b, {
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", k.id)),
750
+ onClick: () => Q(f("orders/new", W.id)),
466
751
  children: [/* @__PURE__ */ L(n, { size: 14 }), " New order"]
467
752
  })]
468
- }), /* @__PURE__ */ L(S, { children: pe ? /* @__PURE__ */ L("p", {
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
- }) : U.length > 0 ? /* @__PURE__ */ L("div", {
756
+ }) : we.length > 0 ? /* @__PURE__ */ L("div", {
472
757
  className: "space-y-2",
473
- children: U.map((e) => /* @__PURE__ */ R("button", {
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(ne, {
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(a, {
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", k.id)),
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: [/* @__PURE__ */ R(x, { children: [/* @__PURE__ */ L(C, { children: /* @__PURE__ */ L(w, { children: "Business Details" }) }), /* @__PURE__ */ R(S, {
520
- className: "space-y-3",
521
- children: [
522
- k.businessLicense && /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
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: k.businessLicense
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: k.taxId
535
- })] }),
536
- /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
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: "Preferred Contact"
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: "Marketing Opt-in"
546
- }), /* @__PURE__ */ L(y, {
547
- variant: k.marketingOptIn ? "default" : "secondary",
548
- children: k.marketingOptIn ? "Yes" : "No"
549
- })] })
550
- ]
551
- })] }), /* @__PURE__ */ R(x, { children: [/* @__PURE__ */ L(C, { children: /* @__PURE__ */ L(w, { children: "Account Info" }) }), /* @__PURE__ */ R(S, {
552
- className: "space-y-3",
553
- children: [/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
554
- className: "text-sm text-text-secondary",
555
- children: "Created"
556
- }), /* @__PURE__ */ L("p", { children: P(k.createdAt, "full") })] }), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("p", {
557
- className: "text-sm text-text-secondary",
558
- children: "Last Updated"
559
- }), /* @__PURE__ */ L("p", { children: P(k.updatedAt, "relative") })] })]
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(V, {});
886
+ }) : /* @__PURE__ */ L(ve, {});
565
887
  }
566
888
  //#endregion
567
- export { H as default };
889
+ export { U as default };