@burdenoff/microfe-movethewheels 2026.920.2 → 2026.921.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 (82) hide show
  1. package/dist/components/CarbonFootprintPanel.js +1 -1
  2. package/dist/components/CustomerPicker.js +271 -0
  3. package/dist/components/DataTable.js +140 -139
  4. package/dist/components/DocumentsCard.js +14 -8
  5. package/dist/generated/wspace-types.d.ts +1043 -5
  6. package/dist/hooks/useAnalytics.js +21 -1
  7. package/dist/hooks/useCustomers.js +94 -78
  8. package/dist/hooks/useDebouncedValue.js +11 -0
  9. package/dist/hooks/useEntityDocuments.js +28 -18
  10. package/dist/hooks/useEpod.js +24 -17
  11. package/dist/hooks/useFleet.js +146 -125
  12. package/dist/hooks/useInventory.js +255 -186
  13. package/dist/hooks/useMultiModalShipments.js +35 -27
  14. package/dist/hooks/useOrders.js +73 -73
  15. package/dist/hooks/useRoutes.js +97 -75
  16. package/dist/hooks/useTracking.js +100 -88
  17. package/dist/movethewheels/components/CustomerPicker.d.ts +19 -0
  18. package/dist/movethewheels/components/DataTable.d.ts +5 -1
  19. package/dist/movethewheels/hooks/useCustomers.d.ts +0 -1
  20. package/dist/movethewheels/hooks/useDebouncedValue.d.ts +1 -0
  21. package/dist/movethewheels/hooks/useEntityDocuments.d.ts +2 -0
  22. package/dist/movethewheels/hooks/useEpod.d.ts +6 -1
  23. package/dist/movethewheels/hooks/useFleet.d.ts +49 -5
  24. package/dist/movethewheels/hooks/useInventory.d.ts +24 -17
  25. package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +6 -1
  26. package/dist/movethewheels/hooks/useOrders.d.ts +33 -5
  27. package/dist/movethewheels/hooks/useRoutes.d.ts +2 -1
  28. package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
  29. package/dist/movethewheels/types/index.d.ts +7 -5
  30. package/dist/movethewheels/utils/navigation.d.ts +14 -0
  31. package/dist/pages/CreateOrderPage.js +228 -217
  32. package/dist/pages/CustomerDetailsPage.js +220 -220
  33. package/dist/pages/CustomersPage.js +61 -54
  34. package/dist/pages/DeliveryCapturePage.js +131 -109
  35. package/dist/pages/DriversPage.js +100 -92
  36. package/dist/pages/InventoryPage.js +239 -236
  37. package/dist/pages/MultiModalShipmentPage.js +163 -130
  38. package/dist/pages/OrderDetailsPage.js +224 -208
  39. package/dist/pages/OrdersListPage.js +66 -60
  40. package/dist/pages/ProductDetailsPage.js +241 -200
  41. package/dist/pages/ProductsPage.js +59 -52
  42. package/dist/pages/RouteDetailsPage.js +343 -321
  43. package/dist/pages/RoutesPage.js +55 -48
  44. package/dist/pages/VehiclesPage.js +63 -56
  45. package/dist/pages/WarehousesPage.js +60 -53
  46. package/dist/utils/navigation.js +22 -1
  47. package/package.json +1 -1
  48. package/src/generated/wspace-types.ts +1188 -5
  49. package/src/movethewheels/components/CarbonFootprintPanel.tsx +0 -1
  50. package/src/movethewheels/components/CustomerPicker.tsx +321 -0
  51. package/src/movethewheels/components/DataTable.tsx +34 -18
  52. package/src/movethewheels/components/DocumentsCard.tsx +6 -1
  53. package/src/movethewheels/components/maps/leaflet-setup.ts +1 -8
  54. package/src/movethewheels/hooks/useAnalytics.ts +27 -0
  55. package/src/movethewheels/hooks/useCustomers.ts +64 -24
  56. package/src/movethewheels/hooks/useDebouncedValue.ts +12 -0
  57. package/src/movethewheels/hooks/useEntityDocuments.ts +43 -25
  58. package/src/movethewheels/hooks/useEpod.ts +14 -7
  59. package/src/movethewheels/hooks/useFleet.ts +58 -37
  60. package/src/movethewheels/hooks/useFleetIntelligence.ts +1 -4
  61. package/src/movethewheels/hooks/useInventory.ts +211 -90
  62. package/src/movethewheels/hooks/useMultiModalShipments.ts +15 -11
  63. package/src/movethewheels/hooks/useOrders.ts +13 -14
  64. package/src/movethewheels/hooks/useRoutes.ts +80 -23
  65. package/src/movethewheels/hooks/useTracking.ts +130 -98
  66. package/src/movethewheels/pages/CreateOrderPage.tsx +92 -31
  67. package/src/movethewheels/pages/CustomerDetailsPage.tsx +15 -6
  68. package/src/movethewheels/pages/CustomersPage.tsx +11 -1
  69. package/src/movethewheels/pages/DeliveryCapturePage.tsx +31 -1
  70. package/src/movethewheels/pages/DriversPage.tsx +24 -12
  71. package/src/movethewheels/pages/InventoryPage.tsx +57 -32
  72. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +52 -3
  73. package/src/movethewheels/pages/OrderDetailsPage.tsx +17 -1
  74. package/src/movethewheels/pages/OrdersListPage.tsx +20 -3
  75. package/src/movethewheels/pages/ProductDetailsPage.tsx +52 -3
  76. package/src/movethewheels/pages/ProductsPage.tsx +11 -1
  77. package/src/movethewheels/pages/RouteDetailsPage.tsx +35 -5
  78. package/src/movethewheels/pages/RoutesPage.tsx +11 -1
  79. package/src/movethewheels/pages/VehiclesPage.tsx +19 -2
  80. package/src/movethewheels/pages/WarehousesPage.tsx +11 -1
  81. package/src/movethewheels/types/index.ts +7 -5
  82. package/src/movethewheels/utils/navigation.ts +32 -0
@@ -4,117 +4,130 @@ import { MapPin as n } from "../node_modules/lucide-react/dist/esm/icons/map-pin
4
4
  import { Package as r } from "../node_modules/lucide-react/dist/esm/icons/package.js";
5
5
  import { Plus as i } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
6
6
  import { Save as a } from "../node_modules/lucide-react/dist/esm/icons/save.js";
7
- import { Trash2 as o } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
8
- import { Users as s } from "../node_modules/lucide-react/dist/esm/icons/users.js";
9
- import { joinPath as c } from "../utils/navigation.js";
10
- import { useMoveTheWheels as l } from "../providers/MoveTheWheelsProvider.js";
11
- import { useOrder as u, useOrders as d } from "../hooks/useOrders.js";
12
- import { useCustomers as f } from "../hooks/useCustomers.js";
13
- import { Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Input as v, Label as y, Select as b, SelectContent as x, SelectItem as S, SelectTrigger as C, SelectValue as w, Separator as ee, Textarea as te } from "../components/ui.js";
14
- import { EmptyState as ne, PageLayout as re } from "../components/PageLayout.js";
15
- import { FormError as T } from "../components/FormError.js";
16
- import { useEffect as E, useState as D } from "react";
17
- import { useParams as O } from "react-router";
18
- import { jsx as k, jsxs as A } from "react/jsx-runtime";
19
- import { EmphasisPanel as j, NextSteps as M, PagePurpose as N } from "@burdenoff/fe-libs/ui";
7
+ import { Trash2 as ee } from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
8
+ import { Users as o } from "../node_modules/lucide-react/dist/esm/icons/users.js";
9
+ import { buildCustomerCreatePath as te, joinPath as s } from "../utils/navigation.js";
10
+ import { useMoveTheWheels as c } from "../providers/MoveTheWheelsProvider.js";
11
+ import { useOrder as l, useOrders as u } from "../hooks/useOrders.js";
12
+ import { useCustomer as ne, useCustomers as re } from "../hooks/useCustomers.js";
13
+ import { Button as d, Card as f, CardContent as p, CardHeader as m, CardTitle as h, Input as g, Label as _, Select as v, SelectContent as ie, SelectItem as y, SelectTrigger as ae, SelectValue as oe, Separator as se, Textarea as ce } from "../components/ui.js";
14
+ import { EmptyState as le, PageLayout as ue } from "../components/PageLayout.js";
15
+ import { FormError as de } from "../components/FormError.js";
16
+ import { useDebouncedValue as fe } from "../hooks/useDebouncedValue.js";
17
+ import { CustomerPicker as pe } from "../components/CustomerPicker.js";
18
+ import { useEffect as b, useState as x } from "react";
19
+ import { useParams as me, useSearchParams as he } from "react-router";
20
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
21
+ import { EmphasisPanel as ge, NextSteps as _e, PagePurpose as ve } from "@burdenoff/fe-libs/ui";
20
22
  //#region src/movethewheels/pages/CreateOrderPage.tsx
21
- function P(e) {
23
+ function w(e) {
22
24
  if (!e || Number.isNaN(e.getTime())) return "";
23
25
  let t = (e) => String(e).padStart(2, "0");
24
26
  return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`;
25
27
  }
26
- function F() {
27
- let { orderId: F } = O(), { basePath: I, navigate: L } = l(), { order: R } = u(F), { createOrder: z, updateOrder: B } = d(), { customers: V } = f({ limit: 100 }), H = !!F && !!R, [U, W] = D({
28
- customerId: R?.customerId || "",
29
- priority: R?.priority || "normal",
28
+ function T() {
29
+ let { orderId: T } = me(), [ye] = he(), E = ye.get("customerId")?.trim() || void 0, { basePath: D, navigate: O } = c(), { order: k } = l(T), { createOrder: A, updateOrder: j } = u(), [M, N] = x(""), { customers: P, createCustomer: be, isLoading: F, error: I, refetch: xe } = re({
30
+ limit: 20,
31
+ filters: { search: fe(M) || void 0 }
32
+ }), { customer: L } = ne(E ?? k?.customerId), R = !!T && !!k, [z, B] = x(null), [V, H] = x({
33
+ customerId: E || k?.customerId || "",
34
+ priority: k?.priority || "normal",
30
35
  pickupAddress: {
31
- street: R?.pickupAddress.street || "",
32
- city: R?.pickupAddress.city || "",
33
- state: R?.pickupAddress.state || "",
34
- postalCode: R?.pickupAddress.postalCode || "",
35
- country: R?.pickupAddress.country || "USA"
36
+ street: k?.pickupAddress.street || "",
37
+ city: k?.pickupAddress.city || "",
38
+ state: k?.pickupAddress.state || "",
39
+ postalCode: k?.pickupAddress.postalCode || "",
40
+ country: k?.pickupAddress.country || "USA"
36
41
  },
37
42
  deliveryAddress: {
38
- street: R?.deliveryAddress.street || "",
39
- city: R?.deliveryAddress.city || "",
40
- state: R?.deliveryAddress.state || "",
41
- postalCode: R?.deliveryAddress.postalCode || "",
42
- country: R?.deliveryAddress.country || "USA"
43
+ street: k?.deliveryAddress.street || "",
44
+ city: k?.deliveryAddress.city || "",
45
+ state: k?.deliveryAddress.state || "",
46
+ postalCode: k?.deliveryAddress.postalCode || "",
47
+ country: k?.deliveryAddress.country || "USA"
43
48
  },
44
- items: R?.items || [],
45
- scheduledDelivery: P(R?.scheduledDelivery),
46
- specialInstructions: R?.specialInstructions || ""
47
- }), [G, K] = D(!1), [ie, q] = D(null);
48
- E(() => {
49
- R && W({
50
- customerId: R.customerId || "",
51
- priority: R.priority || "normal",
49
+ items: k?.items || [],
50
+ scheduledDelivery: w(k?.scheduledDelivery),
51
+ specialInstructions: k?.specialInstructions || ""
52
+ }), [U, W] = x(!1), [Se, G] = x(null);
53
+ b(() => {
54
+ L && (B((e) => e?.id === L.id ? e : L), H((e) => e.customerId ? e : {
55
+ ...e,
56
+ customerId: L.id
57
+ }));
58
+ }, [L]), b(() => {
59
+ k && H({
60
+ customerId: k.customerId || "",
61
+ priority: k.priority || "normal",
52
62
  pickupAddress: {
53
- street: R.pickupAddress.street || "",
54
- city: R.pickupAddress.city || "",
55
- state: R.pickupAddress.state || "",
56
- postalCode: R.pickupAddress.postalCode || "",
57
- country: R.pickupAddress.country || "USA"
63
+ street: k.pickupAddress.street || "",
64
+ city: k.pickupAddress.city || "",
65
+ state: k.pickupAddress.state || "",
66
+ postalCode: k.pickupAddress.postalCode || "",
67
+ country: k.pickupAddress.country || "USA"
58
68
  },
59
69
  deliveryAddress: {
60
- street: R.deliveryAddress.street || "",
61
- city: R.deliveryAddress.city || "",
62
- state: R.deliveryAddress.state || "",
63
- postalCode: R.deliveryAddress.postalCode || "",
64
- country: R.deliveryAddress.country || "USA"
70
+ street: k.deliveryAddress.street || "",
71
+ city: k.deliveryAddress.city || "",
72
+ state: k.deliveryAddress.state || "",
73
+ postalCode: k.deliveryAddress.postalCode || "",
74
+ country: k.deliveryAddress.country || "USA"
65
75
  },
66
- items: R.items || [],
67
- scheduledDelivery: P(R.scheduledDelivery),
68
- specialInstructions: R.specialInstructions || ""
76
+ items: k.items || [],
77
+ scheduledDelivery: w(k.scheduledDelivery),
78
+ specialInstructions: k.specialInstructions || ""
69
79
  });
70
- }, [R]);
71
- let J = () => {
72
- L && L(c(I, "orders"));
73
- }, ae = () => {
74
- let e = V.find((e) => e.id === U.customerId);
75
- return !U.customerId || !e ? "Select a customer for this order." : U.pickupAddress.street.trim() ? U.deliveryAddress.street.trim() ? U.items.length === 0 ? "Add at least one item to the order." : U.scheduledDelivery && Number.isNaN(Date.parse(U.scheduledDelivery)) ? "Enter a valid scheduled delivery date and time." : null : "Enter a delivery street address." : "Enter a pickup street address.";
76
- }, Y = async (e) => {
77
- e.preventDefault(), q(null);
78
- let t = ae();
80
+ }, [k]);
81
+ let K = () => {
82
+ if (O) {
83
+ if (!R && E) {
84
+ O(s(D, `customers/${E}`));
85
+ return;
86
+ }
87
+ O(s(D, "orders"));
88
+ }
89
+ }, q = () => z ?? P.find((e) => e.id === V.customerId), J = () => !V.customerId || !q() ? I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order." : V.pickupAddress.street.trim() ? V.deliveryAddress.street.trim() ? V.items.length === 0 ? "Add at least one item to the order." : V.scheduledDelivery && Number.isNaN(Date.parse(V.scheduledDelivery)) ? "Enter a valid scheduled delivery date and time." : null : "Enter a delivery street address." : "Enter a pickup street address.", Y = async (e) => {
90
+ e.preventDefault(), G(null);
91
+ let t = J();
79
92
  if (t) {
80
- q(t);
93
+ G(t);
81
94
  return;
82
95
  }
83
- let n = V.find((e) => e.id === U.customerId);
96
+ let n = q();
84
97
  if (!n) {
85
- q("Select a customer for this order.");
98
+ G(I ? "Customers could not be loaded. Retry or create a customer before continuing." : "Select a customer for this order.");
86
99
  return;
87
100
  }
88
- K(!0);
101
+ W(!0);
89
102
  try {
90
103
  let e = {
91
- customerId: U.customerId,
104
+ customerId: V.customerId,
92
105
  customerInfo: {
93
106
  name: n.name,
94
107
  email: n.email,
95
108
  phone: n.phone,
96
109
  company: n.company
97
110
  },
98
- priority: U.priority,
99
- pickupAddress: U.pickupAddress,
100
- deliveryAddress: U.deliveryAddress,
101
- items: U.items,
102
- scheduledDelivery: U.scheduledDelivery ? new Date(U.scheduledDelivery) : null,
103
- specialInstructions: U.specialInstructions
111
+ priority: V.priority,
112
+ pickupAddress: V.pickupAddress,
113
+ deliveryAddress: V.deliveryAddress,
114
+ items: V.items,
115
+ scheduledDelivery: V.scheduledDelivery ? new Date(V.scheduledDelivery) : null,
116
+ specialInstructions: V.specialInstructions
104
117
  };
105
- H && F ? (await B(F, e), L && L(c(I, `orders/${F}`))) : (await z(e), J());
118
+ R && T ? (await j(T, e), O && O(s(D, `orders/${T}`))) : (await A(e), K());
106
119
  } catch (e) {
107
- q(e instanceof Error ? e.message : H ? "Could not update the order. Please try again." : "Could not create the order. Please try again.");
120
+ G(e instanceof Error ? e.message : R ? "Could not update the order. Please try again." : "Could not create the order. Please try again.");
108
121
  } finally {
109
- K(!1);
122
+ W(!1);
110
123
  }
111
124
  }, X = (e, t) => {
112
- W((n) => ({
125
+ H((n) => ({
113
126
  ...n,
114
127
  [e]: t
115
128
  }));
116
129
  }, Z = (e, t, n) => {
117
- W((r) => ({
130
+ H((r) => ({
118
131
  ...r,
119
132
  [e]: {
120
133
  ...r[e],
@@ -122,7 +135,7 @@ function F() {
122
135
  }
123
136
  }));
124
137
  }, Q = () => {
125
- W((e) => ({
138
+ H((e) => ({
126
139
  ...e,
127
140
  items: [...e.items, {
128
141
  id: `item-${Date.now()}`,
@@ -140,13 +153,13 @@ function F() {
140
153
  sku: ""
141
154
  }]
142
155
  }));
143
- }, oe = (e) => {
144
- W((t) => ({
156
+ }, Ce = (e) => {
157
+ H((t) => ({
145
158
  ...t,
146
159
  items: t.items.filter((t, n) => n !== e)
147
160
  }));
148
161
  }, $ = (e, t, n) => {
149
- W((r) => ({
162
+ H((r) => ({
150
163
  ...r,
151
164
  items: r.items.map((r, i) => i === e ? {
152
165
  ...r,
@@ -154,114 +167,112 @@ function F() {
154
167
  } : r)
155
168
  }));
156
169
  };
157
- return /* @__PURE__ */ A(re, {
158
- title: H ? "Edit Order" : "Create Order",
159
- subtitle: H ? `Editing ${R?.orderNumber}` : "Create a new delivery order",
160
- icon: /* @__PURE__ */ k(r, { size: 24 }),
161
- headerActions: /* @__PURE__ */ A("div", {
170
+ return /* @__PURE__ */ C(ue, {
171
+ title: R ? "Edit Order" : "Create Order",
172
+ subtitle: R ? `Editing ${k?.orderNumber}` : "Create a new delivery order",
173
+ icon: /* @__PURE__ */ S(r, { size: 24 }),
174
+ headerActions: /* @__PURE__ */ C("div", {
162
175
  className: "flex gap-2",
163
- children: [/* @__PURE__ */ A(p, {
176
+ children: [/* @__PURE__ */ C(d, {
164
177
  variant: "outline",
165
- onClick: J,
166
- children: [/* @__PURE__ */ k(e, { size: 16 }), "Cancel"]
167
- }), /* @__PURE__ */ A(p, {
178
+ onClick: K,
179
+ children: [/* @__PURE__ */ S(e, { size: 16 }), "Cancel"]
180
+ }), /* @__PURE__ */ C(d, {
168
181
  onClick: Y,
169
- disabled: G,
170
- children: [/* @__PURE__ */ k(a, { size: 16 }), G ? "Saving..." : H ? "Save Changes" : "Create Order"]
182
+ disabled: U || F,
183
+ children: [/* @__PURE__ */ S(a, { size: 16 }), U ? "Saving..." : R ? "Save Changes" : "Create Order"]
171
184
  })]
172
185
  }),
173
186
  children: [
174
- /* @__PURE__ */ k(N, {
175
- icon: /* @__PURE__ */ k(r, { size: 18 }),
176
- children: H ? "Update this delivery before it goes out — change the customer, addresses, items or handling notes, then save." : "Book a new delivery in a few steps: choose who it’s for, set pickup and drop-off addresses, list what’s being shipped, and add any handling notes. Once created it joins the orders pipeline ready to assign and track."
187
+ /* @__PURE__ */ S(ve, {
188
+ icon: /* @__PURE__ */ S(r, { size: 18 }),
189
+ children: R ? "Update this delivery before it goes out — change the customer, addresses, items or handling notes, then save." : "Book a new delivery in a few steps: choose who it’s for, set pickup and drop-off addresses, list what’s being shipped, and add any handling notes. Once created it joins the orders pipeline ready to assign and track."
177
190
  }),
178
- /* @__PURE__ */ k(M, {
191
+ /* @__PURE__ */ S(_e, {
179
192
  storageKey: "movethewheels-create-order",
180
193
  steps: [
181
194
  {
182
195
  id: "customer",
183
196
  label: "Pick the customer first",
184
197
  description: "Their saved contact details auto-fill the order.",
185
- icon: /* @__PURE__ */ k(s, { size: 16 }),
186
- done: !!U.customerId,
198
+ icon: /* @__PURE__ */ S(o, { size: 16 }),
199
+ done: !!V.customerId,
187
200
  onClick: () => document.getElementById("customer")?.focus()
188
201
  },
189
202
  {
190
203
  id: "addresses",
191
204
  label: "Set pickup & delivery addresses",
192
205
  description: "Where the shipment is collected and dropped off.",
193
- icon: /* @__PURE__ */ k(n, { size: 16 }),
194
- done: !!U.pickupAddress.street && !!U.deliveryAddress.street,
206
+ icon: /* @__PURE__ */ S(n, { size: 16 }),
207
+ done: !!V.pickupAddress.street && !!V.deliveryAddress.street,
195
208
  onClick: () => document.getElementById("pickupStreet")?.focus()
196
209
  },
197
210
  {
198
211
  id: "items",
199
212
  label: "Add the items to ship",
200
213
  description: "List each product with its quantity and value.",
201
- icon: /* @__PURE__ */ k(r, { size: 16 }),
202
- done: U.items.length > 0,
214
+ icon: /* @__PURE__ */ S(r, { size: 16 }),
215
+ done: V.items.length > 0,
203
216
  onClick: Q
204
217
  }
205
218
  ]
206
219
  }),
207
- /* @__PURE__ */ A("form", {
220
+ /* @__PURE__ */ C("form", {
208
221
  onSubmit: Y,
209
222
  className: "space-y-6",
210
223
  children: [
211
- /* @__PURE__ */ k(T, { message: ie }),
212
- /* @__PURE__ */ A(j, { children: [/* @__PURE__ */ k("h2", {
224
+ /* @__PURE__ */ S(de, { message: Se }),
225
+ /* @__PURE__ */ C(ge, { children: [/* @__PURE__ */ S("h2", {
213
226
  className: "text-base font-semibold text-text-primary mb-4",
214
227
  children: "Order Details"
215
- }), /* @__PURE__ */ k("div", {
228
+ }), /* @__PURE__ */ S("div", {
216
229
  className: "space-y-4",
217
- children: /* @__PURE__ */ A("div", {
230
+ children: /* @__PURE__ */ C("div", {
218
231
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
219
- children: [/* @__PURE__ */ A("div", {
220
- className: "space-y-2",
221
- children: [/* @__PURE__ */ k(y, {
222
- htmlFor: "customer",
223
- children: "Customer"
224
- }), /* @__PURE__ */ A(b, {
225
- value: U.customerId,
226
- onValueChange: (e) => X("customerId", e),
227
- children: [/* @__PURE__ */ k(C, {
228
- id: "customer",
229
- children: /* @__PURE__ */ k(w, { placeholder: "Select customer" })
230
- }), /* @__PURE__ */ k(x, { children: V.map((e) => /* @__PURE__ */ A(S, {
231
- value: e.id,
232
- children: [
233
- e.name,
234
- " (",
235
- e.email,
236
- ")"
237
- ]
238
- }, e.id)) })]
239
- })]
240
- }), /* @__PURE__ */ A("div", {
232
+ children: [/* @__PURE__ */ S(pe, {
233
+ customers: P,
234
+ value: V.customerId,
235
+ onValueChange: (e) => {
236
+ e && (X("customerId", e), B(P.find((t) => t.id === e) ?? (z?.id === e ? z : null)), G(null));
237
+ },
238
+ onCreated: (e) => {
239
+ B(e), X("customerId", e.id), G(null);
240
+ },
241
+ createCustomer: be,
242
+ isLoading: F,
243
+ error: I,
244
+ onRetry: xe,
245
+ onOpenCustomers: () => {
246
+ O && O(s(D, te(R && T ? `orders/${T}/edit` : "orders/new")));
247
+ },
248
+ selectedCustomer: z,
249
+ searchQuery: M,
250
+ onSearchQueryChange: N
251
+ }), /* @__PURE__ */ C("div", {
241
252
  className: "space-y-2",
242
- children: [/* @__PURE__ */ k(y, {
253
+ children: [/* @__PURE__ */ S(_, {
243
254
  htmlFor: "priority",
244
255
  children: "Priority"
245
- }), /* @__PURE__ */ A(b, {
246
- value: U.priority,
256
+ }), /* @__PURE__ */ C(v, {
257
+ value: V.priority,
247
258
  onValueChange: (e) => X("priority", e),
248
- children: [/* @__PURE__ */ k(C, {
259
+ children: [/* @__PURE__ */ S(ae, {
249
260
  id: "priority",
250
- children: /* @__PURE__ */ k(w, {})
251
- }), /* @__PURE__ */ A(x, { children: [
252
- /* @__PURE__ */ k(S, {
261
+ children: /* @__PURE__ */ S(oe, {})
262
+ }), /* @__PURE__ */ C(ie, { children: [
263
+ /* @__PURE__ */ S(y, {
253
264
  value: "low",
254
265
  children: "Low"
255
266
  }),
256
- /* @__PURE__ */ k(S, {
267
+ /* @__PURE__ */ S(y, {
257
268
  value: "normal",
258
269
  children: "Normal"
259
270
  }),
260
- /* @__PURE__ */ k(S, {
271
+ /* @__PURE__ */ S(y, {
261
272
  value: "high",
262
273
  children: "High"
263
274
  }),
264
- /* @__PURE__ */ k(S, {
275
+ /* @__PURE__ */ S(y, {
265
276
  value: "urgent",
266
277
  children: "Urgent"
267
278
  })
@@ -270,138 +281,138 @@ function F() {
270
281
  })]
271
282
  })
272
283
  })] }),
273
- /* @__PURE__ */ A("div", {
284
+ /* @__PURE__ */ C("div", {
274
285
  className: "grid grid-cols-1 md:grid-cols-2 gap-6",
275
- children: [/* @__PURE__ */ A(m, { children: [/* @__PURE__ */ k(g, { children: /* @__PURE__ */ k(_, { children: "Pickup Address" }) }), /* @__PURE__ */ A(h, {
286
+ children: [/* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Pickup Address" }) }), /* @__PURE__ */ C(p, {
276
287
  className: "space-y-4",
277
288
  children: [
278
- /* @__PURE__ */ A("div", {
289
+ /* @__PURE__ */ C("div", {
279
290
  className: "space-y-2",
280
- children: [/* @__PURE__ */ k(y, {
291
+ children: [/* @__PURE__ */ S(_, {
281
292
  htmlFor: "pickupStreet",
282
293
  children: "Street Address"
283
- }), /* @__PURE__ */ k(v, {
294
+ }), /* @__PURE__ */ S(g, {
284
295
  id: "pickupStreet",
285
- value: U.pickupAddress.street,
296
+ value: V.pickupAddress.street,
286
297
  onChange: (e) => Z("pickupAddress", "street", e.target.value),
287
298
  placeholder: "123 Main St"
288
299
  })]
289
300
  }),
290
- /* @__PURE__ */ A("div", {
301
+ /* @__PURE__ */ C("div", {
291
302
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
292
- children: [/* @__PURE__ */ A("div", {
303
+ children: [/* @__PURE__ */ C("div", {
293
304
  className: "space-y-2",
294
- children: [/* @__PURE__ */ k(y, {
305
+ children: [/* @__PURE__ */ S(_, {
295
306
  htmlFor: "pickupCity",
296
307
  children: "City"
297
- }), /* @__PURE__ */ k(v, {
308
+ }), /* @__PURE__ */ S(g, {
298
309
  id: "pickupCity",
299
- value: U.pickupAddress.city,
310
+ value: V.pickupAddress.city,
300
311
  onChange: (e) => Z("pickupAddress", "city", e.target.value),
301
312
  placeholder: "San Francisco"
302
313
  })]
303
- }), /* @__PURE__ */ A("div", {
314
+ }), /* @__PURE__ */ C("div", {
304
315
  className: "space-y-2",
305
- children: [/* @__PURE__ */ k(y, {
316
+ children: [/* @__PURE__ */ S(_, {
306
317
  htmlFor: "pickupState",
307
318
  children: "State"
308
- }), /* @__PURE__ */ k(v, {
319
+ }), /* @__PURE__ */ S(g, {
309
320
  id: "pickupState",
310
- value: U.pickupAddress.state,
321
+ value: V.pickupAddress.state,
311
322
  onChange: (e) => Z("pickupAddress", "state", e.target.value),
312
323
  placeholder: "CA"
313
324
  })]
314
325
  })]
315
326
  }),
316
- /* @__PURE__ */ A("div", {
327
+ /* @__PURE__ */ C("div", {
317
328
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
318
- children: [/* @__PURE__ */ A("div", {
329
+ children: [/* @__PURE__ */ C("div", {
319
330
  className: "space-y-2",
320
- children: [/* @__PURE__ */ k(y, {
331
+ children: [/* @__PURE__ */ S(_, {
321
332
  htmlFor: "pickupPostal",
322
333
  children: "Postal Code"
323
- }), /* @__PURE__ */ k(v, {
334
+ }), /* @__PURE__ */ S(g, {
324
335
  id: "pickupPostal",
325
- value: U.pickupAddress.postalCode,
336
+ value: V.pickupAddress.postalCode,
326
337
  onChange: (e) => Z("pickupAddress", "postalCode", e.target.value),
327
338
  placeholder: "94103"
328
339
  })]
329
- }), /* @__PURE__ */ A("div", {
340
+ }), /* @__PURE__ */ C("div", {
330
341
  className: "space-y-2",
331
- children: [/* @__PURE__ */ k(y, {
342
+ children: [/* @__PURE__ */ S(_, {
332
343
  htmlFor: "pickupCountry",
333
344
  children: "Country"
334
- }), /* @__PURE__ */ k(v, {
345
+ }), /* @__PURE__ */ S(g, {
335
346
  id: "pickupCountry",
336
- value: U.pickupAddress.country,
347
+ value: V.pickupAddress.country,
337
348
  onChange: (e) => Z("pickupAddress", "country", e.target.value),
338
349
  placeholder: "USA"
339
350
  })]
340
351
  })]
341
352
  })
342
353
  ]
343
- })] }), /* @__PURE__ */ A(m, { children: [/* @__PURE__ */ k(g, { children: /* @__PURE__ */ k(_, { children: "Delivery Address" }) }), /* @__PURE__ */ A(h, {
354
+ })] }), /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Delivery Address" }) }), /* @__PURE__ */ C(p, {
344
355
  className: "space-y-4",
345
356
  children: [
346
- /* @__PURE__ */ A("div", {
357
+ /* @__PURE__ */ C("div", {
347
358
  className: "space-y-2",
348
- children: [/* @__PURE__ */ k(y, {
359
+ children: [/* @__PURE__ */ S(_, {
349
360
  htmlFor: "deliveryStreet",
350
361
  children: "Street Address"
351
- }), /* @__PURE__ */ k(v, {
362
+ }), /* @__PURE__ */ S(g, {
352
363
  id: "deliveryStreet",
353
- value: U.deliveryAddress.street,
364
+ value: V.deliveryAddress.street,
354
365
  onChange: (e) => Z("deliveryAddress", "street", e.target.value),
355
366
  placeholder: "456 Oak Ave"
356
367
  })]
357
368
  }),
358
- /* @__PURE__ */ A("div", {
369
+ /* @__PURE__ */ C("div", {
359
370
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
360
- children: [/* @__PURE__ */ A("div", {
371
+ children: [/* @__PURE__ */ C("div", {
361
372
  className: "space-y-2",
362
- children: [/* @__PURE__ */ k(y, {
373
+ children: [/* @__PURE__ */ S(_, {
363
374
  htmlFor: "deliveryCity",
364
375
  children: "City"
365
- }), /* @__PURE__ */ k(v, {
376
+ }), /* @__PURE__ */ S(g, {
366
377
  id: "deliveryCity",
367
- value: U.deliveryAddress.city,
378
+ value: V.deliveryAddress.city,
368
379
  onChange: (e) => Z("deliveryAddress", "city", e.target.value),
369
380
  placeholder: "Los Angeles"
370
381
  })]
371
- }), /* @__PURE__ */ A("div", {
382
+ }), /* @__PURE__ */ C("div", {
372
383
  className: "space-y-2",
373
- children: [/* @__PURE__ */ k(y, {
384
+ children: [/* @__PURE__ */ S(_, {
374
385
  htmlFor: "deliveryState",
375
386
  children: "State"
376
- }), /* @__PURE__ */ k(v, {
387
+ }), /* @__PURE__ */ S(g, {
377
388
  id: "deliveryState",
378
- value: U.deliveryAddress.state,
389
+ value: V.deliveryAddress.state,
379
390
  onChange: (e) => Z("deliveryAddress", "state", e.target.value),
380
391
  placeholder: "CA"
381
392
  })]
382
393
  })]
383
394
  }),
384
- /* @__PURE__ */ A("div", {
395
+ /* @__PURE__ */ C("div", {
385
396
  className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
386
- children: [/* @__PURE__ */ A("div", {
397
+ children: [/* @__PURE__ */ C("div", {
387
398
  className: "space-y-2",
388
- children: [/* @__PURE__ */ k(y, {
399
+ children: [/* @__PURE__ */ S(_, {
389
400
  htmlFor: "deliveryPostal",
390
401
  children: "Postal Code"
391
- }), /* @__PURE__ */ k(v, {
402
+ }), /* @__PURE__ */ S(g, {
392
403
  id: "deliveryPostal",
393
- value: U.deliveryAddress.postalCode,
404
+ value: V.deliveryAddress.postalCode,
394
405
  onChange: (e) => Z("deliveryAddress", "postalCode", e.target.value),
395
406
  placeholder: "90210"
396
407
  })]
397
- }), /* @__PURE__ */ A("div", {
408
+ }), /* @__PURE__ */ C("div", {
398
409
  className: "space-y-2",
399
- children: [/* @__PURE__ */ k(y, {
410
+ children: [/* @__PURE__ */ S(_, {
400
411
  htmlFor: "deliveryCountry",
401
412
  children: "Country"
402
- }), /* @__PURE__ */ k(v, {
413
+ }), /* @__PURE__ */ S(g, {
403
414
  id: "deliveryCountry",
404
- value: U.deliveryAddress.country,
415
+ value: V.deliveryAddress.country,
405
416
  onChange: (e) => Z("deliveryAddress", "country", e.target.value),
406
417
  placeholder: "USA"
407
418
  })]
@@ -410,61 +421,61 @@ function F() {
410
421
  ]
411
422
  })] })]
412
423
  }),
413
- /* @__PURE__ */ A(m, { children: [/* @__PURE__ */ A(g, {
424
+ /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ C(m, {
414
425
  className: "flex flex-row items-center justify-between",
415
- children: [/* @__PURE__ */ k(_, { children: "Order Items" }), /* @__PURE__ */ A(p, {
426
+ children: [/* @__PURE__ */ S(h, { children: "Order Items" }), /* @__PURE__ */ C(d, {
416
427
  type: "button",
417
428
  variant: "outline",
418
429
  size: "sm",
419
430
  onClick: Q,
420
- children: [/* @__PURE__ */ k(i, { size: 16 }), "Add Item"]
431
+ children: [/* @__PURE__ */ S(i, { size: 16 }), "Add Item"]
421
432
  })]
422
- }), /* @__PURE__ */ k(h, { children: U.items.length === 0 ? /* @__PURE__ */ k(ne, {
433
+ }), /* @__PURE__ */ S(p, { children: V.items.length === 0 ? /* @__PURE__ */ S(le, {
423
434
  illustration: "empty-files",
424
435
  title: "No items added yet",
425
436
  description: "Add the products this order will ship — each with a name, SKU, quantity and value.",
426
- action: /* @__PURE__ */ A(p, {
437
+ action: /* @__PURE__ */ C(d, {
427
438
  type: "button",
428
439
  variant: "outline",
429
440
  onClick: Q,
430
- children: [/* @__PURE__ */ k(i, {
441
+ children: [/* @__PURE__ */ S(i, {
431
442
  size: 16,
432
443
  className: "mr-1.5"
433
444
  }), "Add your first item"]
434
445
  })
435
- }) : /* @__PURE__ */ k("div", {
446
+ }) : /* @__PURE__ */ S("div", {
436
447
  className: "space-y-4",
437
- children: U.items.map((e, t) => /* @__PURE__ */ A("div", { children: [t > 0 && /* @__PURE__ */ k(ee, { className: "my-4" }), /* @__PURE__ */ A("div", {
448
+ children: V.items.map((e, t) => /* @__PURE__ */ C("div", { children: [t > 0 && /* @__PURE__ */ S(se, { className: "my-4" }), /* @__PURE__ */ C("div", {
438
449
  className: "grid grid-cols-1 md:grid-cols-7 gap-4",
439
450
  children: [
440
- /* @__PURE__ */ A("div", {
451
+ /* @__PURE__ */ C("div", {
441
452
  className: "md:col-span-2 space-y-2",
442
- children: [/* @__PURE__ */ k(y, { children: "Item Name" }), /* @__PURE__ */ k(v, {
453
+ children: [/* @__PURE__ */ S(_, { children: "Item Name" }), /* @__PURE__ */ S(g, {
443
454
  value: e.name,
444
455
  onChange: (e) => $(t, "name", e.target.value),
445
456
  placeholder: "Product name"
446
457
  })]
447
458
  }),
448
- /* @__PURE__ */ A("div", {
459
+ /* @__PURE__ */ C("div", {
449
460
  className: "space-y-2",
450
- children: [/* @__PURE__ */ k(y, { children: "SKU" }), /* @__PURE__ */ k(v, {
461
+ children: [/* @__PURE__ */ S(_, { children: "SKU" }), /* @__PURE__ */ S(g, {
451
462
  value: e.sku,
452
463
  onChange: (e) => $(t, "sku", e.target.value),
453
464
  placeholder: "SKU-001"
454
465
  })]
455
466
  }),
456
- /* @__PURE__ */ A("div", {
467
+ /* @__PURE__ */ C("div", {
457
468
  className: "space-y-2",
458
- children: [/* @__PURE__ */ k(y, { children: "Quantity" }), /* @__PURE__ */ k(v, {
469
+ children: [/* @__PURE__ */ S(_, { children: "Quantity" }), /* @__PURE__ */ S(g, {
459
470
  type: "number",
460
471
  min: "1",
461
472
  value: e.quantity,
462
473
  onChange: (e) => $(t, "quantity", parseInt(e.target.value) || 1)
463
474
  })]
464
475
  }),
465
- /* @__PURE__ */ A("div", {
476
+ /* @__PURE__ */ C("div", {
466
477
  className: "space-y-2",
467
- children: [/* @__PURE__ */ k(y, { children: "Weight (kg)" }), /* @__PURE__ */ k(v, {
478
+ children: [/* @__PURE__ */ S(_, { children: "Weight (kg)" }), /* @__PURE__ */ S(g, {
468
479
  type: "number",
469
480
  min: "0",
470
481
  step: "0.1",
@@ -472,9 +483,9 @@ function F() {
472
483
  onChange: (e) => $(t, "weight", parseFloat(e.target.value) || 0)
473
484
  })]
474
485
  }),
475
- /* @__PURE__ */ A("div", {
486
+ /* @__PURE__ */ C("div", {
476
487
  className: "space-y-2",
477
- children: [/* @__PURE__ */ k(y, { children: "Value ($)" }), /* @__PURE__ */ k(v, {
488
+ children: [/* @__PURE__ */ S(_, { children: "Value ($)" }), /* @__PURE__ */ S(g, {
478
489
  type: "number",
479
490
  min: "0",
480
491
  step: "0.01",
@@ -482,52 +493,52 @@ function F() {
482
493
  onChange: (e) => $(t, "value", parseFloat(e.target.value) || 0)
483
494
  })]
484
495
  }),
485
- /* @__PURE__ */ k("div", {
496
+ /* @__PURE__ */ S("div", {
486
497
  className: "flex items-end",
487
- children: /* @__PURE__ */ k(p, {
498
+ children: /* @__PURE__ */ S(d, {
488
499
  type: "button",
489
500
  variant: "ghost",
490
501
  size: "icon",
491
502
  className: "text-status-error-text",
492
- onClick: () => oe(t),
493
- children: /* @__PURE__ */ k(o, { size: 16 })
503
+ onClick: () => Ce(t),
504
+ children: /* @__PURE__ */ S(ee, { size: 16 })
494
505
  })
495
506
  })
496
507
  ]
497
508
  })] }, e.id))
498
509
  }) })] }),
499
- /* @__PURE__ */ A(m, { children: [/* @__PURE__ */ k(g, { children: /* @__PURE__ */ k(_, { children: "Scheduling & Handling" }) }), /* @__PURE__ */ k(h, { children: /* @__PURE__ */ A("div", {
510
+ /* @__PURE__ */ C(f, { children: [/* @__PURE__ */ S(m, { children: /* @__PURE__ */ S(h, { children: "Scheduling & Handling" }) }), /* @__PURE__ */ S(p, { children: /* @__PURE__ */ C("div", {
500
511
  className: "grid grid-cols-1 md:grid-cols-3 gap-6",
501
- children: [/* @__PURE__ */ A("div", {
512
+ children: [/* @__PURE__ */ C("div", {
502
513
  className: "space-y-2",
503
514
  children: [
504
- /* @__PURE__ */ A(y, {
515
+ /* @__PURE__ */ C(_, {
505
516
  htmlFor: "scheduledDelivery",
506
517
  className: "flex items-center gap-1.5",
507
- children: [/* @__PURE__ */ k(t, {
518
+ children: [/* @__PURE__ */ S(t, {
508
519
  size: 14,
509
520
  className: "text-text-secondary"
510
521
  }), "Scheduled Delivery"]
511
522
  }),
512
- /* @__PURE__ */ k(v, {
523
+ /* @__PURE__ */ S(g, {
513
524
  id: "scheduledDelivery",
514
525
  type: "datetime-local",
515
- value: U.scheduledDelivery,
526
+ value: V.scheduledDelivery,
516
527
  onChange: (e) => X("scheduledDelivery", e.target.value)
517
528
  }),
518
- /* @__PURE__ */ k("p", {
529
+ /* @__PURE__ */ S("p", {
519
530
  className: "text-xs text-text-secondary",
520
531
  children: "The delivery window promised to the customer. Leave blank to dispatch as soon as a driver is free."
521
532
  })
522
533
  ]
523
- }), /* @__PURE__ */ A("div", {
534
+ }), /* @__PURE__ */ C("div", {
524
535
  className: "md:col-span-2 space-y-2",
525
- children: [/* @__PURE__ */ k(y, {
536
+ children: [/* @__PURE__ */ S(_, {
526
537
  htmlFor: "specialInstructions",
527
538
  children: "Special Instructions"
528
- }), /* @__PURE__ */ k(te, {
539
+ }), /* @__PURE__ */ S(ce, {
529
540
  id: "specialInstructions",
530
- value: U.specialInstructions,
541
+ value: V.specialInstructions,
531
542
  onChange: (e) => X("specialInstructions", e.target.value),
532
543
  placeholder: "Any special handling or delivery instructions...",
533
544
  rows: 4
@@ -540,4 +551,4 @@ function F() {
540
551
  });
541
552
  }
542
553
  //#endregion
543
- export { F as default };
554
+ export { T as default };