@burdenoff/microfe-movethewheels 2026.703.2 → 2026.703.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AIAssistantPage-C3cPsWt-.js → AIAssistantPage-3YOnHO9Y.js} +3 -3
- package/dist/{AnalyticsPage-Dz6g2MvK.js → AnalyticsPage-CMpI1070.js} +11 -11
- package/dist/CreateOrderPage-DRAgGo9i.js +490 -0
- package/dist/CustomerDetailsPage-BCeMmOFe.js +615 -0
- package/dist/{CustomersPage-2Y05LVyh.js → CustomersPage-CaNBMXmM.js} +64 -53
- package/dist/{DashboardPage-BVjQi0EB.js → DashboardPage-DIKlXde3.js} +16 -16
- package/dist/DataTable-XvUcTjwi.js +340 -0
- package/dist/DocumentsCard-U2lSe-cn.js +169 -0
- package/dist/{DriverDetailsPage-CN3WQ0B9.js → DriverDetailsPage-BQrYd_Lp.js} +178 -195
- package/dist/{DriversPage-B0Zpx8OQ.js → DriversPage-PYmdFiby.js} +65 -54
- package/dist/FinancePage-Cwh9Bw4M.js +136 -0
- package/dist/{FleetPage-DqkFi3s3.js → FleetPage-3ZHsB-TN.js} +23 -22
- package/dist/{FormError-BlOjnXOq.js → FormError-cuLV2jVD.js} +1 -1
- package/dist/{ImportExportPage-DKJRCezl.js → ImportExportPage-C6f7DqhM.js} +50 -70
- package/dist/{InventoryPage-DwfgCUQq.js → InventoryPage-DpiqVu1v.js} +9 -9
- package/dist/{LiveTrackingPage-DCX-K-LR.js → LiveTrackingPage-FAzzlVnX.js} +9 -9
- package/dist/MarketplacePage-Bh_2ns4v.js +426 -0
- package/dist/Notice-CSoDYKw9.js +46 -0
- package/dist/OrderDetailsPage-zCj0lW0j.js +584 -0
- package/dist/{OrdersListPage-BjDlCKJd.js → OrdersListPage-CAMsuUck.js} +166 -89
- package/dist/{ProductDetailsPage-C9uOiYLp.js → ProductDetailsPage-wsxAQkA0.js} +12 -12
- package/dist/{ProductsPage-C1G9h7Xd.js → ProductsPage-DC5qDLfz.js} +60 -49
- package/dist/ReportsPage-BwUJ37eO.js +356 -0
- package/dist/RouteDetailsPage-DyMJE9AS.js +583 -0
- package/dist/{RoutesPage-DMfoicM1.js → RoutesPage-Dtc669yc.js} +57 -46
- package/dist/{SettingsPage-Bn-v0mbQ.js → SettingsPage-CpH9xhQg.js} +5 -27
- package/dist/{TrackingPage-W-jtdM3Y.js → TrackingPage-DaNEFG_h.js} +10 -10
- package/dist/{VehicleDetailsPage-Bceo5oz3.js → VehicleDetailsPage-DldYNsYV.js} +125 -142
- package/dist/{VehiclesPage-VBtOep91.js → VehiclesPage-BFw13iMt.js} +61 -50
- package/dist/{WarehouseDetailsPage-L_6sWigM.js → WarehouseDetailsPage-CMG7or6G.js} +17 -17
- package/dist/{WarehousesPage-DCbXXXWE.js → WarehousesPage-Wkytnt86.js} +58 -47
- package/dist/arrow-right-Q3XQpTPR.js +11 -0
- package/dist/arrow-up-xNF1zJUG.js +17 -0
- package/dist/chevron-left-B2_r0Elx.js +8 -0
- package/dist/{wrench-CANXWxF-.js → fuel-B6_lnKDs.js} +2 -5
- package/dist/index.js +163 -174
- package/dist/upload-CHZofOqb.js +21 -0
- package/dist/{useAnalytics-DS8n0xgg.js → useAnalytics-D7HW2XRb.js} +52 -2
- package/dist/{useCustomers-BmTNGxiI.js → useCustomers-BPW4__PR.js} +29 -26
- package/dist/{useFleet-DKqXZ16m.js → useFleet-ChBkxAd6.js} +81 -69
- package/dist/{useInventory-DkyiVY_A.js → useInventory-CAAVMRp6.js} +83 -38
- package/dist/{useOrders-Cfk1GLiq.js → useOrders-B465S2nt.js} +58 -47
- package/dist/{useReports-CTqZr-AB.js → useReports-jQ3GpNOm.js} +40 -34
- package/dist/{useRoutes-BQWO607N.js → useRoutes-hS3d5-xr.js} +49 -41
- package/dist/{useTracking-B-va1kO3.js → useTracking-RjGz9PZG.js} +2 -2
- package/dist/user-check-BEKRCi7v.js +20 -0
- package/dist/wrench-q_rgJfaP.js +8 -0
- package/dist/x-tMeDMcCw.js +11 -0
- package/package.json +1 -1
- package/src/movethewheels/components/DataTable.tsx +252 -84
- package/src/movethewheels/components/DocumentsCard.tsx +102 -0
- package/src/movethewheels/components/Notice.tsx +61 -0
- package/src/movethewheels/components/index.ts +7 -0
- package/src/movethewheels/hooks/index.ts +9 -0
- package/src/movethewheels/hooks/useAnalytics.ts +95 -0
- package/src/movethewheels/hooks/useCustomers.ts +11 -4
- package/src/movethewheels/hooks/useEntityDocuments.ts +132 -0
- package/src/movethewheels/hooks/useFleet.ts +26 -7
- package/src/movethewheels/hooks/useInventory.ts +70 -7
- package/src/movethewheels/hooks/useOrders.ts +32 -2
- package/src/movethewheels/hooks/useReports.ts +14 -4
- package/src/movethewheels/hooks/useRoutes.ts +20 -3
- package/src/movethewheels/pages/AnalyticsPage.tsx +2 -2
- package/src/movethewheels/pages/CreateOrderPage.tsx +44 -16
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +239 -33
- package/src/movethewheels/pages/CustomersPage.tsx +27 -11
- package/src/movethewheels/pages/DriverDetailsPage.tsx +16 -30
- package/src/movethewheels/pages/DriversPage.tsx +26 -9
- package/src/movethewheels/pages/FinancePage.tsx +67 -84
- package/src/movethewheels/pages/InventoryPage.tsx +1 -1
- package/src/movethewheels/pages/MarketplacePage.tsx +265 -50
- package/src/movethewheels/pages/OrderDetailsPage.tsx +214 -10
- package/src/movethewheels/pages/OrdersListPage.tsx +77 -14
- package/src/movethewheels/pages/ProductsPage.tsx +27 -7
- package/src/movethewheels/pages/ReportsPage.tsx +65 -4
- package/src/movethewheels/pages/RouteDetailsPage.tsx +74 -13
- package/src/movethewheels/pages/RoutesPage.tsx +22 -6
- package/src/movethewheels/pages/SettingsPage.tsx +3 -19
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +3 -33
- package/src/movethewheels/pages/VehiclesPage.tsx +26 -5
- package/src/movethewheels/pages/WarehousesPage.tsx +22 -17
- package/src/movethewheels/types/index.ts +8 -0
- package/src/movethewheels/utils/download.ts +62 -0
- package/dist/CreateOrderPage-C5iwnjp4.js +0 -479
- package/dist/CustomerDetailsPage-B6nwFyLO.js +0 -406
- package/dist/DataTable-DmciIKKM.js +0 -249
- package/dist/FinancePage-DEDykSOP.js +0 -158
- package/dist/MarketplacePage-CIQ97_zp.js +0 -247
- package/dist/OrderDetailsPage-DYiZ-9UK.js +0 -429
- package/dist/ReportsPage-Zp53q3_8.js +0 -284
- package/dist/RouteDetailsPage-DUStXSf9.js +0 -531
- /package/dist/{MetricCard-BY0QrMD4.js → MetricCard-CVBVpu7o.js} +0 -0
- /package/dist/{StatusBadge-BZurYHMy.js → StatusBadge-C87mDpDP.js} +0 -0
- /package/dist/{box-D9Pal4HM.js → box-Eu05PXDh.js} +0 -0
- /package/dist/{chart-column-BFIJysDR.js → chart-column-ouzgxIv_.js} +0 -0
- /package/dist/{chevron-right-EMIIyyJ1.js → chevron-right-eV4LjaSi.js} +0 -0
- /package/dist/{circle-alert-iY24lSlp.js → circle-alert-Bzh2DBSF.js} +0 -0
- /package/dist/{circle-check-big-w0TrLKMF.js → circle-check-big-CGMSpQmD.js} +0 -0
- /package/dist/{clock-DJZtdl8u.js → clock-Bl3ptexL.js} +0 -0
- /package/dist/{dollar-sign-CgKQRz_e.js → dollar-sign-CAVU95SO.js} +0 -0
- /package/dist/{download-DRXxoiQR.js → download-C5NbvVDc.js} +0 -0
- /package/dist/{file-text-DWWY6_f5.js → file-text-D-1uvLZG.js} +0 -0
- /package/dist/{filter-DloLC2eE.js → filter-DUfUg6BO.js} +0 -0
- /package/dist/{formatters-CF2S2l1m.js → formatters-BQr-aR5W.js} +0 -0
- /package/dist/{map-CkJaULb2.js → map-C-M-FQLR.js} +0 -0
- /package/dist/{map-pin-BGiCvyCs.js → map-pin-Dznl5l40.js} +0 -0
- /package/dist/{navigation-D36prnAn.js → navigation-BJSJl-VG.js} +0 -0
- /package/dist/{package-BChUzpJS.js → package-CcRttV2N.js} +0 -0
- /package/dist/{phone-Ac9s3mo_.js → phone-DVSZHt_j.js} +0 -0
- /package/dist/{plus-Z76q-FZm.js → plus-C_XZDwBz.js} +0 -0
- /package/dist/{refresh-cw-DKt6f5T6.js → refresh-cw-CfgN67l3.js} +0 -0
- /package/dist/{save-CojywNhG.js → save-DJE8Fpdv.js} +0 -0
- /package/dist/{search-CDGefqb3.js → search-D_VyGcZT.js} +0 -0
- /package/dist/{square-pen-CopE9GmB.js → square-pen-D-6JYrVQ.js} +0 -0
- /package/dist/{star-nHlLjDKR.js → star-BpRlUZuU.js} +0 -0
- /package/dist/{store-BR9Voi5E.js → store-B-8HMuyZ.js} +0 -0
- /package/dist/{trash-2-BKhar6Hs.js → trash-2-8vmv-XV_.js} +0 -0
- /package/dist/{trending-up-Dohgd4t_.js → trending-up-Dz6PqPRj.js} +0 -0
- /package/dist/{triangle-alert-i-XQL9Rd.js → triangle-alert-D7Y3J_4z.js} +0 -0
- /package/dist/{truck-C0v_hbLR.js → truck-D-y2IDzv.js} +0 -0
- /package/dist/{useAssistant-D4v3oxD3.js → useAssistant-DVW4QgQb.js} +0 -0
- /package/dist/{useImportExport-DHr-SWSw.js → useImportExport-DrPDHEDK.js} +0 -0
- /package/dist/{useSettings-CkDH_-gM.js → useSettings-BB8X2RLh.js} +0 -0
- /package/dist/{user-jyFU3lXk.js → user-DzfTn4dE.js} +0 -0
- /package/dist/{users-DZ-ilS6B.js → users-CCrq-w0C.js} +0 -0
- /package/dist/{warehouse-6m5kXMLu.js → warehouse-CaqfmMKh.js} +0 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import { A as e, F as t, I as n, L as r, P as i, R as a, ct as o, d as s, f as c, g as l, h as u, i as d, j as f, l as p, lt as m, n as h, ot as g, r as _, u as v } from "./PageLayout-D4LDHJJq.js";
|
|
2
|
+
import { t as y } from "./arrow-left-n48Y-Wis.js";
|
|
3
|
+
import { t as b } from "./file-text-D-1uvLZG.js";
|
|
4
|
+
import { n as x, t as S } from "./Notice-CSoDYKw9.js";
|
|
5
|
+
import { n as ee, t as te } from "./phone-DVSZHt_j.js";
|
|
6
|
+
import { t as ne } from "./map-pin-Dznl5l40.js";
|
|
7
|
+
import { t as C } from "./package-CcRttV2N.js";
|
|
8
|
+
import { t as w } from "./save-DJE8Fpdv.js";
|
|
9
|
+
import { t as T } from "./square-pen-D-6JYrVQ.js";
|
|
10
|
+
import { t as re } from "./star-BpRlUZuU.js";
|
|
11
|
+
import { t as E } from "./users-CCrq-w0C.js";
|
|
12
|
+
import { t as ie } from "./x-tMeDMcCw.js";
|
|
13
|
+
import { r as ae } from "./useOrders-B465S2nt.js";
|
|
14
|
+
import { r as D, t as O } from "./useCustomers-BPW4__PR.js";
|
|
15
|
+
import { i as k, r as oe } from "./StatusBadge-C87mDpDP.js";
|
|
16
|
+
import { t as A } from "./FormError-cuLV2jVD.js";
|
|
17
|
+
import { n as se, r as j, t as ce } from "./formatters-BQr-aR5W.js";
|
|
18
|
+
import { useEffect as le, useState as M } from "react";
|
|
19
|
+
import { useParams as ue } from "react-router-dom";
|
|
20
|
+
import { Fragment as de, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
21
|
+
import { EmphasisPanel as F, NextSteps as I, PagePurpose as L } from "@burdenoff/fe-libs/ui";
|
|
22
|
+
//#region node_modules/lucide-react/dist/esm/icons/building.js
|
|
23
|
+
var R = m("Building", [
|
|
24
|
+
["rect", {
|
|
25
|
+
width: "16",
|
|
26
|
+
height: "20",
|
|
27
|
+
x: "4",
|
|
28
|
+
y: "2",
|
|
29
|
+
rx: "2",
|
|
30
|
+
ry: "2",
|
|
31
|
+
key: "76otgf"
|
|
32
|
+
}],
|
|
33
|
+
["path", {
|
|
34
|
+
d: "M9 22v-4h6v4",
|
|
35
|
+
key: "r93iot"
|
|
36
|
+
}],
|
|
37
|
+
["path", {
|
|
38
|
+
d: "M8 6h.01",
|
|
39
|
+
key: "1dz90k"
|
|
40
|
+
}],
|
|
41
|
+
["path", {
|
|
42
|
+
d: "M16 6h.01",
|
|
43
|
+
key: "1x0f13"
|
|
44
|
+
}],
|
|
45
|
+
["path", {
|
|
46
|
+
d: "M12 6h.01",
|
|
47
|
+
key: "1vi96p"
|
|
48
|
+
}],
|
|
49
|
+
["path", {
|
|
50
|
+
d: "M12 10h.01",
|
|
51
|
+
key: "1nrarc"
|
|
52
|
+
}],
|
|
53
|
+
["path", {
|
|
54
|
+
d: "M12 14h.01",
|
|
55
|
+
key: "1etili"
|
|
56
|
+
}],
|
|
57
|
+
["path", {
|
|
58
|
+
d: "M16 10h.01",
|
|
59
|
+
key: "1m94wz"
|
|
60
|
+
}],
|
|
61
|
+
["path", {
|
|
62
|
+
d: "M16 14h.01",
|
|
63
|
+
key: "1gbofw"
|
|
64
|
+
}],
|
|
65
|
+
["path", {
|
|
66
|
+
d: "M8 10h.01",
|
|
67
|
+
key: "19clt8"
|
|
68
|
+
}],
|
|
69
|
+
["path", {
|
|
70
|
+
d: "M8 14h.01",
|
|
71
|
+
key: "6423bh"
|
|
72
|
+
}]
|
|
73
|
+
]);
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/movethewheels/pages/CustomerDetailsPage.tsx
|
|
76
|
+
function z(e) {
|
|
77
|
+
if (!e) return null;
|
|
78
|
+
let t = e.trim(), n = /^https?:\/\//i.test(t) ? t : `https://${t}`;
|
|
79
|
+
try {
|
|
80
|
+
let e = new URL(n);
|
|
81
|
+
return e.protocol === "http:" || e.protocol === "https:" ? e.href : null;
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function B() {
|
|
87
|
+
let { basePath: s, navigate: c } = g(), { createCustomer: l } = D(), [u, p] = M({
|
|
88
|
+
name: "",
|
|
89
|
+
type: "b2c",
|
|
90
|
+
email: "",
|
|
91
|
+
phone: "",
|
|
92
|
+
company: ""
|
|
93
|
+
}), [m, h] = M(!1), [_, b] = M(null), x = () => c?.(o(s, "customers")), S = async (e) => {
|
|
94
|
+
if (e.preventDefault(), !u.name.trim()) {
|
|
95
|
+
b("Customer name is required.");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
h(!0), b(null);
|
|
99
|
+
try {
|
|
100
|
+
let e = await l({
|
|
101
|
+
name: u.name.trim(),
|
|
102
|
+
type: u.type,
|
|
103
|
+
email: u.email.trim() || void 0,
|
|
104
|
+
phone: u.phone.trim() || void 0,
|
|
105
|
+
company: u.company.trim() || void 0
|
|
106
|
+
});
|
|
107
|
+
c?.(o(s, `customers/${e.id}`));
|
|
108
|
+
} catch (e) {
|
|
109
|
+
console.error("Failed to create customer:", e), b(e instanceof Error ? e.message : "Failed to create customer. Please try again."), h(!1);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ P(d, {
|
|
113
|
+
title: "New Customer",
|
|
114
|
+
subtitle: "Add a new customer to your account",
|
|
115
|
+
icon: /* @__PURE__ */ N(E, { size: 24 }),
|
|
116
|
+
headerActions: /* @__PURE__ */ P("div", {
|
|
117
|
+
className: "flex gap-2",
|
|
118
|
+
children: [/* @__PURE__ */ P(v, {
|
|
119
|
+
variant: "outline",
|
|
120
|
+
onClick: x,
|
|
121
|
+
disabled: m,
|
|
122
|
+
children: [/* @__PURE__ */ N(y, { size: 16 }), " Cancel"]
|
|
123
|
+
}), /* @__PURE__ */ P(v, {
|
|
124
|
+
onClick: S,
|
|
125
|
+
disabled: m,
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ N(w, { size: 16 }),
|
|
128
|
+
" ",
|
|
129
|
+
m ? "Saving..." : "Create Customer"
|
|
130
|
+
]
|
|
131
|
+
})]
|
|
132
|
+
}),
|
|
133
|
+
children: [/* @__PURE__ */ N(L, {
|
|
134
|
+
icon: /* @__PURE__ */ N(E, { size: 18 }),
|
|
135
|
+
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."
|
|
136
|
+
}), /* @__PURE__ */ P("form", {
|
|
137
|
+
onSubmit: S,
|
|
138
|
+
className: "max-w-2xl space-y-6",
|
|
139
|
+
children: [/* @__PURE__ */ N(A, { message: _ }), /* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("h2", {
|
|
140
|
+
className: "text-base font-semibold text-text-primary mb-4",
|
|
141
|
+
children: "Customer Details"
|
|
142
|
+
}), /* @__PURE__ */ P("div", {
|
|
143
|
+
className: "space-y-4",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ P("div", {
|
|
146
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
147
|
+
children: [/* @__PURE__ */ P("div", {
|
|
148
|
+
className: "space-y-2",
|
|
149
|
+
children: [/* @__PURE__ */ P(f, {
|
|
150
|
+
htmlFor: "name",
|
|
151
|
+
children: ["Name ", /* @__PURE__ */ N("span", {
|
|
152
|
+
className: "text-status-error-text",
|
|
153
|
+
children: "*"
|
|
154
|
+
})]
|
|
155
|
+
}), /* @__PURE__ */ N(e, {
|
|
156
|
+
id: "name",
|
|
157
|
+
value: u.name,
|
|
158
|
+
onChange: (e) => p((t) => ({
|
|
159
|
+
...t,
|
|
160
|
+
name: e.target.value
|
|
161
|
+
})),
|
|
162
|
+
placeholder: "Acme Corp or Jane Doe",
|
|
163
|
+
required: !0
|
|
164
|
+
})]
|
|
165
|
+
}), /* @__PURE__ */ P("div", {
|
|
166
|
+
className: "space-y-2",
|
|
167
|
+
children: [/* @__PURE__ */ N(f, {
|
|
168
|
+
htmlFor: "type",
|
|
169
|
+
children: "Customer Type"
|
|
170
|
+
}), /* @__PURE__ */ P(i, {
|
|
171
|
+
value: u.type,
|
|
172
|
+
onValueChange: (e) => p((t) => ({
|
|
173
|
+
...t,
|
|
174
|
+
type: e
|
|
175
|
+
})),
|
|
176
|
+
children: [/* @__PURE__ */ N(r, {
|
|
177
|
+
id: "type",
|
|
178
|
+
children: /* @__PURE__ */ N(a, {})
|
|
179
|
+
}), /* @__PURE__ */ P(t, { children: [/* @__PURE__ */ N(n, {
|
|
180
|
+
value: "b2c",
|
|
181
|
+
children: "B2C (Individual)"
|
|
182
|
+
}), /* @__PURE__ */ N(n, {
|
|
183
|
+
value: "b2b",
|
|
184
|
+
children: "B2B (Business)"
|
|
185
|
+
})] })]
|
|
186
|
+
})]
|
|
187
|
+
})]
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ P("div", {
|
|
190
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
191
|
+
children: [/* @__PURE__ */ P("div", {
|
|
192
|
+
className: "space-y-2",
|
|
193
|
+
children: [/* @__PURE__ */ N(f, {
|
|
194
|
+
htmlFor: "email",
|
|
195
|
+
children: "Email"
|
|
196
|
+
}), /* @__PURE__ */ N(e, {
|
|
197
|
+
id: "email",
|
|
198
|
+
type: "email",
|
|
199
|
+
value: u.email,
|
|
200
|
+
onChange: (e) => p((t) => ({
|
|
201
|
+
...t,
|
|
202
|
+
email: e.target.value
|
|
203
|
+
})),
|
|
204
|
+
placeholder: "customer@example.com"
|
|
205
|
+
})]
|
|
206
|
+
}), /* @__PURE__ */ P("div", {
|
|
207
|
+
className: "space-y-2",
|
|
208
|
+
children: [/* @__PURE__ */ N(f, {
|
|
209
|
+
htmlFor: "phone",
|
|
210
|
+
children: "Phone"
|
|
211
|
+
}), /* @__PURE__ */ N(e, {
|
|
212
|
+
id: "phone",
|
|
213
|
+
value: u.phone,
|
|
214
|
+
onChange: (e) => p((t) => ({
|
|
215
|
+
...t,
|
|
216
|
+
phone: e.target.value
|
|
217
|
+
})),
|
|
218
|
+
placeholder: "+1-555-0100"
|
|
219
|
+
})]
|
|
220
|
+
})]
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ P("div", {
|
|
223
|
+
className: "space-y-2",
|
|
224
|
+
children: [/* @__PURE__ */ N(f, {
|
|
225
|
+
htmlFor: "company",
|
|
226
|
+
children: "Company"
|
|
227
|
+
}), /* @__PURE__ */ N(e, {
|
|
228
|
+
id: "company",
|
|
229
|
+
value: u.company,
|
|
230
|
+
onChange: (e) => p((t) => ({
|
|
231
|
+
...t,
|
|
232
|
+
company: e.target.value
|
|
233
|
+
})),
|
|
234
|
+
placeholder: "Company name (for B2B accounts)"
|
|
235
|
+
})]
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
})] })]
|
|
239
|
+
})]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function V() {
|
|
243
|
+
let { customerId: t } = ue(), { basePath: n, navigate: r } = g(), { customer: i, isLoading: a, error: m, refetch: V } = O(t), { updateCustomer: fe } = D(), { orders: H, isLoading: pe } = ae({ filters: { customerId: t } }), { message: U, notify: me } = x(), [W, G] = M(!1), [K, q] = M(!1), [J, Y] = M(null), [X, Z] = M({
|
|
244
|
+
name: "",
|
|
245
|
+
email: "",
|
|
246
|
+
phone: "",
|
|
247
|
+
company: ""
|
|
248
|
+
});
|
|
249
|
+
le(() => {
|
|
250
|
+
i && Z({
|
|
251
|
+
name: i.name,
|
|
252
|
+
email: i.email,
|
|
253
|
+
phone: i.phone,
|
|
254
|
+
company: i.company ?? ""
|
|
255
|
+
});
|
|
256
|
+
}, [i]);
|
|
257
|
+
let he = () => r?.(o(n, "customers")), Q = (e) => r?.(o(n, e)), $ = () => {
|
|
258
|
+
Y(null), G(!0);
|
|
259
|
+
};
|
|
260
|
+
return t ? a ? /* @__PURE__ */ N(_, { message: "Loading customer details..." }) : m || !i ? /* @__PURE__ */ N(h, {
|
|
261
|
+
title: "Customer not found",
|
|
262
|
+
onRetry: V
|
|
263
|
+
}) : /* @__PURE__ */ P(d, {
|
|
264
|
+
title: i.name,
|
|
265
|
+
subtitle: i.company || i.email,
|
|
266
|
+
icon: /* @__PURE__ */ N(E, { size: 24 }),
|
|
267
|
+
headerActions: /* @__PURE__ */ P("div", {
|
|
268
|
+
className: "flex gap-2",
|
|
269
|
+
children: [/* @__PURE__ */ P(v, {
|
|
270
|
+
variant: "outline",
|
|
271
|
+
onClick: he,
|
|
272
|
+
children: [/* @__PURE__ */ N(y, { size: 16 }), " Back"]
|
|
273
|
+
}), W ? /* @__PURE__ */ P(de, { children: [/* @__PURE__ */ P(v, {
|
|
274
|
+
variant: "outline",
|
|
275
|
+
onClick: () => {
|
|
276
|
+
Y(null), G(!1), i && Z({
|
|
277
|
+
name: i.name,
|
|
278
|
+
email: i.email,
|
|
279
|
+
phone: i.phone,
|
|
280
|
+
company: i.company ?? ""
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
disabled: K,
|
|
284
|
+
children: [/* @__PURE__ */ N(ie, { size: 16 }), " Cancel"]
|
|
285
|
+
}), /* @__PURE__ */ P(v, {
|
|
286
|
+
onClick: async () => {
|
|
287
|
+
if (t) {
|
|
288
|
+
if (!X.name.trim()) {
|
|
289
|
+
Y("Customer name is required.");
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
q(!0), Y(null);
|
|
293
|
+
try {
|
|
294
|
+
await fe(t, {
|
|
295
|
+
name: X.name.trim(),
|
|
296
|
+
email: X.email.trim(),
|
|
297
|
+
phone: X.phone.trim(),
|
|
298
|
+
company: X.company.trim() || void 0
|
|
299
|
+
}), me("Customer updated."), G(!1), V();
|
|
300
|
+
} catch (e) {
|
|
301
|
+
Y(e instanceof Error ? e.message : "Failed to update customer.");
|
|
302
|
+
} finally {
|
|
303
|
+
q(!1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
disabled: K,
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ N(w, { size: 16 }),
|
|
310
|
+
" ",
|
|
311
|
+
K ? "Saving…" : "Save"
|
|
312
|
+
]
|
|
313
|
+
})] }) : /* @__PURE__ */ P(v, {
|
|
314
|
+
onClick: $,
|
|
315
|
+
children: [/* @__PURE__ */ N(T, { size: 16 }), " Edit"]
|
|
316
|
+
})]
|
|
317
|
+
}),
|
|
318
|
+
headerContent: /* @__PURE__ */ P("div", {
|
|
319
|
+
className: "flex items-center gap-4",
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ N(k, { type: i.type }),
|
|
322
|
+
/* @__PURE__ */ N(p, {
|
|
323
|
+
variant: i.isActive ? "default" : "secondary",
|
|
324
|
+
children: i.isActive ? "Active" : "Inactive"
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ P("div", {
|
|
327
|
+
className: "flex items-center gap-1",
|
|
328
|
+
children: [/* @__PURE__ */ N(re, {
|
|
329
|
+
size: 16,
|
|
330
|
+
className: "text-status-warning-text fill-current"
|
|
331
|
+
}), /* @__PURE__ */ N("span", {
|
|
332
|
+
className: "font-medium",
|
|
333
|
+
children: i.rating.toFixed(1)
|
|
334
|
+
})]
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
}),
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ N(L, {
|
|
340
|
+
icon: /* @__PURE__ */ N(E, { size: 18 }),
|
|
341
|
+
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."
|
|
342
|
+
}),
|
|
343
|
+
/* @__PURE__ */ N(I, {
|
|
344
|
+
storageKey: "movethewheels-customer-details",
|
|
345
|
+
steps: [{
|
|
346
|
+
id: "new-order",
|
|
347
|
+
label: "Book a delivery for this customer",
|
|
348
|
+
description: "Start a new order pre-filled for this account.",
|
|
349
|
+
icon: /* @__PURE__ */ N(b, { size: 16 }),
|
|
350
|
+
onClick: () => Q("orders/new")
|
|
351
|
+
}, {
|
|
352
|
+
id: "edit",
|
|
353
|
+
label: "Update contact details",
|
|
354
|
+
description: "Keep email, phone and address current.",
|
|
355
|
+
icon: /* @__PURE__ */ N(T, { size: 16 }),
|
|
356
|
+
onClick: $
|
|
357
|
+
}]
|
|
358
|
+
}),
|
|
359
|
+
U && /* @__PURE__ */ N("div", {
|
|
360
|
+
className: "mb-2",
|
|
361
|
+
children: /* @__PURE__ */ N(S, { message: U })
|
|
362
|
+
}),
|
|
363
|
+
/* @__PURE__ */ P("div", {
|
|
364
|
+
className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
|
|
365
|
+
children: [/* @__PURE__ */ P("div", {
|
|
366
|
+
className: "lg:col-span-2 space-y-6",
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ P(F, { children: [/* @__PURE__ */ N("h2", {
|
|
369
|
+
className: "text-base font-semibold text-text-primary mb-4",
|
|
370
|
+
children: "Contact Information"
|
|
371
|
+
}), W ? /* @__PURE__ */ P("div", {
|
|
372
|
+
className: "space-y-4",
|
|
373
|
+
children: [/* @__PURE__ */ N(A, { message: J }), /* @__PURE__ */ P("div", {
|
|
374
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ P("div", {
|
|
377
|
+
className: "space-y-2",
|
|
378
|
+
children: [/* @__PURE__ */ P(f, {
|
|
379
|
+
htmlFor: "edit-name",
|
|
380
|
+
children: ["Name ", /* @__PURE__ */ N("span", {
|
|
381
|
+
className: "text-status-error-text",
|
|
382
|
+
children: "*"
|
|
383
|
+
})]
|
|
384
|
+
}), /* @__PURE__ */ N(e, {
|
|
385
|
+
id: "edit-name",
|
|
386
|
+
value: X.name,
|
|
387
|
+
onChange: (e) => Z((t) => ({
|
|
388
|
+
...t,
|
|
389
|
+
name: e.target.value
|
|
390
|
+
}))
|
|
391
|
+
})]
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ P("div", {
|
|
394
|
+
className: "space-y-2",
|
|
395
|
+
children: [/* @__PURE__ */ N(f, {
|
|
396
|
+
htmlFor: "edit-company",
|
|
397
|
+
children: "Company"
|
|
398
|
+
}), /* @__PURE__ */ N(e, {
|
|
399
|
+
id: "edit-company",
|
|
400
|
+
value: X.company,
|
|
401
|
+
onChange: (e) => Z((t) => ({
|
|
402
|
+
...t,
|
|
403
|
+
company: e.target.value
|
|
404
|
+
})),
|
|
405
|
+
placeholder: "Company name (for B2B accounts)"
|
|
406
|
+
})]
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ P("div", {
|
|
409
|
+
className: "space-y-2",
|
|
410
|
+
children: [/* @__PURE__ */ N(f, {
|
|
411
|
+
htmlFor: "edit-email",
|
|
412
|
+
children: "Email"
|
|
413
|
+
}), /* @__PURE__ */ N(e, {
|
|
414
|
+
id: "edit-email",
|
|
415
|
+
type: "email",
|
|
416
|
+
value: X.email,
|
|
417
|
+
onChange: (e) => Z((t) => ({
|
|
418
|
+
...t,
|
|
419
|
+
email: e.target.value
|
|
420
|
+
}))
|
|
421
|
+
})]
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ P("div", {
|
|
424
|
+
className: "space-y-2",
|
|
425
|
+
children: [/* @__PURE__ */ N(f, {
|
|
426
|
+
htmlFor: "edit-phone",
|
|
427
|
+
children: "Phone"
|
|
428
|
+
}), /* @__PURE__ */ N(e, {
|
|
429
|
+
id: "edit-phone",
|
|
430
|
+
value: X.phone,
|
|
431
|
+
onChange: (e) => Z((t) => ({
|
|
432
|
+
...t,
|
|
433
|
+
phone: e.target.value
|
|
434
|
+
}))
|
|
435
|
+
})]
|
|
436
|
+
})
|
|
437
|
+
]
|
|
438
|
+
})]
|
|
439
|
+
}) : /* @__PURE__ */ P("div", {
|
|
440
|
+
className: "grid grid-cols-1 md:grid-cols-2 gap-6",
|
|
441
|
+
children: [/* @__PURE__ */ P("div", {
|
|
442
|
+
className: "space-y-4",
|
|
443
|
+
children: [/* @__PURE__ */ P("div", {
|
|
444
|
+
className: "flex items-center gap-3",
|
|
445
|
+
children: [/* @__PURE__ */ N(ee, {
|
|
446
|
+
size: 18,
|
|
447
|
+
className: "text-text-secondary"
|
|
448
|
+
}), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
449
|
+
className: "text-sm text-text-secondary",
|
|
450
|
+
children: "Email"
|
|
451
|
+
}), /* @__PURE__ */ N("p", {
|
|
452
|
+
className: "font-medium",
|
|
453
|
+
children: i.email || "—"
|
|
454
|
+
})] })]
|
|
455
|
+
}), /* @__PURE__ */ P("div", {
|
|
456
|
+
className: "flex items-center gap-3",
|
|
457
|
+
children: [/* @__PURE__ */ N(te, {
|
|
458
|
+
size: 18,
|
|
459
|
+
className: "text-text-secondary"
|
|
460
|
+
}), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
461
|
+
className: "text-sm text-text-secondary",
|
|
462
|
+
children: "Phone"
|
|
463
|
+
}), /* @__PURE__ */ N("p", {
|
|
464
|
+
className: "font-medium",
|
|
465
|
+
children: i.phone || "—"
|
|
466
|
+
})] })]
|
|
467
|
+
})]
|
|
468
|
+
}), /* @__PURE__ */ P("div", {
|
|
469
|
+
className: "space-y-4",
|
|
470
|
+
children: [i.company && /* @__PURE__ */ P("div", {
|
|
471
|
+
className: "flex items-center gap-3",
|
|
472
|
+
children: [/* @__PURE__ */ N(R, {
|
|
473
|
+
size: 18,
|
|
474
|
+
className: "text-text-secondary"
|
|
475
|
+
}), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
476
|
+
className: "text-sm text-text-secondary",
|
|
477
|
+
children: "Company"
|
|
478
|
+
}), /* @__PURE__ */ N("p", {
|
|
479
|
+
className: "font-medium",
|
|
480
|
+
children: i.company
|
|
481
|
+
})] })]
|
|
482
|
+
}), (() => {
|
|
483
|
+
let e = z(i.website);
|
|
484
|
+
return e ? /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
485
|
+
className: "text-sm text-text-secondary",
|
|
486
|
+
children: "Website"
|
|
487
|
+
}), /* @__PURE__ */ N("a", {
|
|
488
|
+
href: e,
|
|
489
|
+
target: "_blank",
|
|
490
|
+
rel: "noopener noreferrer",
|
|
491
|
+
className: "text-primary hover:underline",
|
|
492
|
+
children: e
|
|
493
|
+
})] }) : null;
|
|
494
|
+
})()]
|
|
495
|
+
})]
|
|
496
|
+
})] }),
|
|
497
|
+
/* @__PURE__ */ P(s, { children: [/* @__PURE__ */ N(u, { children: /* @__PURE__ */ P(l, {
|
|
498
|
+
className: "flex items-center gap-2",
|
|
499
|
+
children: [/* @__PURE__ */ N(ne, { size: 18 }), " Address"]
|
|
500
|
+
}) }), /* @__PURE__ */ N(c, { children: /* @__PURE__ */ N("p", { children: ce(i.address) }) })] }),
|
|
501
|
+
i.notes && /* @__PURE__ */ P(s, { children: [/* @__PURE__ */ N(u, { children: /* @__PURE__ */ P(l, {
|
|
502
|
+
className: "flex items-center gap-2",
|
|
503
|
+
children: [/* @__PURE__ */ N(b, { size: 18 }), " Notes"]
|
|
504
|
+
}) }), /* @__PURE__ */ N(c, { children: /* @__PURE__ */ N("p", { children: i.notes }) })] }),
|
|
505
|
+
/* @__PURE__ */ P(s, { children: [/* @__PURE__ */ P(u, {
|
|
506
|
+
className: "flex flex-row items-center justify-between",
|
|
507
|
+
children: [/* @__PURE__ */ P(l, {
|
|
508
|
+
className: "flex items-center gap-2",
|
|
509
|
+
children: [/* @__PURE__ */ N(C, { size: 18 }), " Orders"]
|
|
510
|
+
}), /* @__PURE__ */ P(v, {
|
|
511
|
+
variant: "outline",
|
|
512
|
+
size: "sm",
|
|
513
|
+
onClick: () => Q("orders/new"),
|
|
514
|
+
children: [/* @__PURE__ */ N(b, { size: 14 }), " New order"]
|
|
515
|
+
})]
|
|
516
|
+
}), /* @__PURE__ */ N(c, { children: pe ? /* @__PURE__ */ N("p", {
|
|
517
|
+
className: "text-text-secondary text-center py-4",
|
|
518
|
+
children: "Loading orders…"
|
|
519
|
+
}) : H.length > 0 ? /* @__PURE__ */ N("div", {
|
|
520
|
+
className: "space-y-2",
|
|
521
|
+
children: H.map((e) => /* @__PURE__ */ P("button", {
|
|
522
|
+
type: "button",
|
|
523
|
+
onClick: () => Q(`orders/${e.id}`),
|
|
524
|
+
className: "w-full flex items-center justify-between gap-3 p-3 border rounded-lg text-left hover:bg-bg-sunken/50 transition-colors",
|
|
525
|
+
children: [/* @__PURE__ */ P("div", {
|
|
526
|
+
className: "min-w-0",
|
|
527
|
+
children: [/* @__PURE__ */ N("p", {
|
|
528
|
+
className: "font-medium truncate",
|
|
529
|
+
children: e.orderNumber
|
|
530
|
+
}), /* @__PURE__ */ P("p", {
|
|
531
|
+
className: "text-sm text-text-secondary",
|
|
532
|
+
children: [
|
|
533
|
+
j(e.createdAt, "relative"),
|
|
534
|
+
" ·",
|
|
535
|
+
" ",
|
|
536
|
+
se(e.pricing.total)
|
|
537
|
+
]
|
|
538
|
+
})]
|
|
539
|
+
}), /* @__PURE__ */ N(oe, {
|
|
540
|
+
status: e.status,
|
|
541
|
+
type: "order",
|
|
542
|
+
size: "sm"
|
|
543
|
+
})]
|
|
544
|
+
}, e.id))
|
|
545
|
+
}) : /* @__PURE__ */ P("div", {
|
|
546
|
+
className: "text-center py-6",
|
|
547
|
+
children: [
|
|
548
|
+
/* @__PURE__ */ N(C, {
|
|
549
|
+
size: 32,
|
|
550
|
+
className: "mx-auto mb-2 text-text-secondary opacity-50"
|
|
551
|
+
}),
|
|
552
|
+
/* @__PURE__ */ N("p", {
|
|
553
|
+
className: "text-text-secondary",
|
|
554
|
+
children: "No orders yet for this customer"
|
|
555
|
+
}),
|
|
556
|
+
/* @__PURE__ */ N("button", {
|
|
557
|
+
type: "button",
|
|
558
|
+
onClick: () => Q("orders/new"),
|
|
559
|
+
className: "mt-1 text-sm text-primary hover:underline",
|
|
560
|
+
children: "Book their first delivery"
|
|
561
|
+
})
|
|
562
|
+
]
|
|
563
|
+
}) })] })
|
|
564
|
+
]
|
|
565
|
+
}), /* @__PURE__ */ P("div", {
|
|
566
|
+
className: "space-y-6",
|
|
567
|
+
children: [/* @__PURE__ */ P(s, { children: [/* @__PURE__ */ N(u, { children: /* @__PURE__ */ N(l, { children: "Business Details" }) }), /* @__PURE__ */ P(c, {
|
|
568
|
+
className: "space-y-3",
|
|
569
|
+
children: [
|
|
570
|
+
i.businessLicense && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
571
|
+
className: "text-sm text-text-secondary",
|
|
572
|
+
children: "Business License"
|
|
573
|
+
}), /* @__PURE__ */ N("p", {
|
|
574
|
+
className: "font-mono",
|
|
575
|
+
children: i.businessLicense
|
|
576
|
+
})] }),
|
|
577
|
+
i.taxId && /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
578
|
+
className: "text-sm text-text-secondary",
|
|
579
|
+
children: "Tax ID"
|
|
580
|
+
}), /* @__PURE__ */ N("p", {
|
|
581
|
+
className: "font-mono",
|
|
582
|
+
children: i.taxId
|
|
583
|
+
})] }),
|
|
584
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
585
|
+
className: "text-sm text-text-secondary",
|
|
586
|
+
children: "Preferred Contact"
|
|
587
|
+
}), /* @__PURE__ */ N("p", {
|
|
588
|
+
className: "capitalize",
|
|
589
|
+
children: i.preferredContactMethod
|
|
590
|
+
})] }),
|
|
591
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
592
|
+
className: "text-sm text-text-secondary",
|
|
593
|
+
children: "Marketing Opt-in"
|
|
594
|
+
}), /* @__PURE__ */ N(p, {
|
|
595
|
+
variant: i.marketingOptIn ? "default" : "secondary",
|
|
596
|
+
children: i.marketingOptIn ? "Yes" : "No"
|
|
597
|
+
})] })
|
|
598
|
+
]
|
|
599
|
+
})] }), /* @__PURE__ */ P(s, { children: [/* @__PURE__ */ N(u, { children: /* @__PURE__ */ N(l, { children: "Account Info" }) }), /* @__PURE__ */ P(c, {
|
|
600
|
+
className: "space-y-3",
|
|
601
|
+
children: [/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
602
|
+
className: "text-sm text-text-secondary",
|
|
603
|
+
children: "Created"
|
|
604
|
+
}), /* @__PURE__ */ N("p", { children: j(i.createdAt, "full") })] }), /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("p", {
|
|
605
|
+
className: "text-sm text-text-secondary",
|
|
606
|
+
children: "Last Updated"
|
|
607
|
+
}), /* @__PURE__ */ N("p", { children: j(i.updatedAt, "relative") })] })]
|
|
608
|
+
})] })]
|
|
609
|
+
})]
|
|
610
|
+
})
|
|
611
|
+
]
|
|
612
|
+
}) : /* @__PURE__ */ N(B, {});
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
615
|
+
export { V as default };
|