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