@burdenoff/microfe-kadaikodi 2026.626.2 → 2026.704.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.
Files changed (96) hide show
  1. package/dist/kadaikodi/hooks/useKadaikodiApi.js +260 -105
  2. package/dist/kadaikodi/hooks/useKadaikodiApi.js.map +1 -1
  3. package/dist/kadaikodi/pages/HomePage.js +4 -4
  4. package/dist/kadaikodi/pages/HomePage.js.map +1 -1
  5. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.js +341 -461
  6. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.js.map +1 -1
  7. package/dist/kadaikodi/pages/admin/AdminDashboard.js +115 -399
  8. package/dist/kadaikodi/pages/admin/AdminDashboard.js.map +1 -1
  9. package/dist/kadaikodi/pages/admin/AdminFinancialPage.js +140 -283
  10. package/dist/kadaikodi/pages/admin/AdminFinancialPage.js.map +1 -1
  11. package/dist/kadaikodi/pages/admin/AdminOrdersPage.js +282 -453
  12. package/dist/kadaikodi/pages/admin/AdminOrdersPage.js.map +1 -1
  13. package/dist/kadaikodi/pages/admin/AdminProfilePage.js +115 -242
  14. package/dist/kadaikodi/pages/admin/AdminProfilePage.js.map +1 -1
  15. package/dist/kadaikodi/pages/admin/AdminSettingsPage.js +2 -2
  16. package/dist/kadaikodi/pages/admin/AdminSettingsPage.js.map +1 -1
  17. package/dist/kadaikodi/pages/admin/CartManagementPage.js +279 -333
  18. package/dist/kadaikodi/pages/admin/CartManagementPage.js.map +1 -1
  19. package/dist/kadaikodi/pages/admin/UserManagementPage.js +299 -372
  20. package/dist/kadaikodi/pages/admin/UserManagementPage.js.map +1 -1
  21. package/dist/kadaikodi/pages/cart-owner/AnalyticsDashboard.js +503 -627
  22. package/dist/kadaikodi/pages/cart-owner/AnalyticsDashboard.js.map +1 -1
  23. package/dist/kadaikodi/pages/cart-owner/BusinessSettingsPage.js +339 -282
  24. package/dist/kadaikodi/pages/cart-owner/BusinessSettingsPage.js.map +1 -1
  25. package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js +329 -432
  26. package/dist/kadaikodi/pages/cart-owner/CartOwnerDashboard.js.map +1 -1
  27. package/dist/kadaikodi/pages/cart-owner/CartOwnerProfilePage.js +374 -384
  28. package/dist/kadaikodi/pages/cart-owner/CartOwnerProfilePage.js.map +1 -1
  29. package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js +249 -208
  30. package/dist/kadaikodi/pages/cart-owner/CartServiceConfigPage.js.map +1 -1
  31. package/dist/kadaikodi/pages/cart-owner/InventoryManagementPage.js +276 -279
  32. package/dist/kadaikodi/pages/cart-owner/InventoryManagementPage.js.map +1 -1
  33. package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js +229 -447
  34. package/dist/kadaikodi/pages/cart-owner/OrderManagementPage.js.map +1 -1
  35. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.js +171 -627
  36. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.js.map +1 -1
  37. package/dist/kadaikodi/pages/common/HelpSupportPage.js +331 -415
  38. package/dist/kadaikodi/pages/common/HelpSupportPage.js.map +1 -1
  39. package/dist/kadaikodi/pages/common/NotificationCenterPage.js +18 -670
  40. package/dist/kadaikodi/pages/common/NotificationCenterPage.js.map +1 -1
  41. package/dist/kadaikodi/pages/common/SettingsPage.js +34 -46
  42. package/dist/kadaikodi/pages/common/SettingsPage.js.map +1 -1
  43. package/dist/kadaikodi/pages/customer/BookingDetailsPage.js +193 -447
  44. package/dist/kadaikodi/pages/customer/BookingDetailsPage.js.map +1 -1
  45. package/dist/kadaikodi/pages/customer/CartDetailPage.js +6 -6
  46. package/dist/kadaikodi/pages/customer/CartDetailPage.js.map +1 -1
  47. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.js +2 -2
  48. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.js.map +1 -1
  49. package/dist/kadaikodi/pages/customer/CheckoutPage.js +4 -2
  50. package/dist/kadaikodi/pages/customer/CheckoutPage.js.map +1 -1
  51. package/dist/kadaikodi/pages/customer/CustomerDashboard.js +191 -369
  52. package/dist/kadaikodi/pages/customer/CustomerDashboard.js.map +1 -1
  53. package/dist/kadaikodi/pages/customer/CustomerProfilePage.js +233 -389
  54. package/dist/kadaikodi/pages/customer/CustomerProfilePage.js.map +1 -1
  55. package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js +255 -215
  56. package/dist/kadaikodi/pages/customer/DirectServiceBookingPage.js.map +1 -1
  57. package/dist/kadaikodi/pages/customer/FavoritesPage.js +141 -178
  58. package/dist/kadaikodi/pages/customer/FavoritesPage.js.map +1 -1
  59. package/dist/kadaikodi/pages/customer/OrderHistoryPage.js.map +1 -1
  60. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js +155 -161
  61. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js.map +1 -1
  62. package/dist/kadaikodi/pages/customer/PaymentMethodsPage.js +76 -118
  63. package/dist/kadaikodi/pages/customer/PaymentMethodsPage.js.map +1 -1
  64. package/dist/kadaikodi/pages/customer/ReviewsPage.js +14 -140
  65. package/dist/kadaikodi/pages/customer/ReviewsPage.js.map +1 -1
  66. package/dist/kadaikodi/pages/customer/SavedAddressesPage.js +135 -213
  67. package/dist/kadaikodi/pages/customer/SavedAddressesPage.js.map +1 -1
  68. package/dist/kadaikodi/pages/investor/InvestmentDetailsPage.js +272 -774
  69. package/dist/kadaikodi/pages/investor/InvestmentDetailsPage.js.map +1 -1
  70. package/dist/kadaikodi/pages/investor/InvestmentOpportunitiesPage.js +258 -523
  71. package/dist/kadaikodi/pages/investor/InvestmentOpportunitiesPage.js.map +1 -1
  72. package/dist/kadaikodi/pages/investor/InvestorAnalyticsPage.js +112 -600
  73. package/dist/kadaikodi/pages/investor/InvestorAnalyticsPage.js.map +1 -1
  74. package/dist/kadaikodi/pages/investor/InvestorDashboard.js +128 -295
  75. package/dist/kadaikodi/pages/investor/InvestorDashboard.js.map +1 -1
  76. package/dist/kadaikodi/pages/investor/InvestorInvestmentsPage.js +205 -291
  77. package/dist/kadaikodi/pages/investor/InvestorInvestmentsPage.js.map +1 -1
  78. package/dist/kadaikodi/pages/investor/InvestorPortfolioPage.js +159 -500
  79. package/dist/kadaikodi/pages/investor/InvestorPortfolioPage.js.map +1 -1
  80. package/dist/kadaikodi/pages/investor/InvestorProfilePage.js +426 -514
  81. package/dist/kadaikodi/pages/investor/InvestorProfilePage.js.map +1 -1
  82. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js +231 -225
  83. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js.map +1 -1
  84. package/dist/kadaikodi/pages/worker/WorkerDashboard.js +197 -301
  85. package/dist/kadaikodi/pages/worker/WorkerDashboard.js.map +1 -1
  86. package/dist/kadaikodi/pages/worker/WorkerOrdersPage.js +247 -399
  87. package/dist/kadaikodi/pages/worker/WorkerOrdersPage.js.map +1 -1
  88. package/dist/kadaikodi/pages/worker/WorkerProfilePage.js +294 -327
  89. package/dist/kadaikodi/pages/worker/WorkerProfilePage.js.map +1 -1
  90. package/dist/kadaikodi/pages/worker/WorkerSchedulePage.js +179 -397
  91. package/dist/kadaikodi/pages/worker/WorkerSchedulePage.js.map +1 -1
  92. package/package.json +1 -1
  93. package/dist/kadaikodi/mocks/data.js +0 -1517
  94. package/dist/kadaikodi/mocks/data.js.map +0 -1
  95. package/dist/kadaikodi/mocks/users.js +0 -34
  96. package/dist/kadaikodi/mocks/users.js.map +0 -1
@@ -2,308 +2,99 @@ import { useKadaikodi as e } from "../../context/KadaikodiContext.js";
2
2
  import { cn as t } from "../../utils/cn.js";
3
3
  import { PageLayout as n } from "../../components/PageLayout.js";
4
4
  import { EmptyState as r } from "../../components/EmptyState.js";
5
- import { useMemo as i, useState as a } from "react";
6
- import { AlertCircle as o, CheckCircle2 as s, Clock as c, Edit2 as l, Mail as u, Phone as d, Search as f, Star as p, Trash2 as m, UserPlus as h, X as g } from "lucide-react";
7
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
5
+ import { useCreateProviderWorker as i, useProviderWorkers as a, useProviders as o } from "../../hooks/useKadaikodiApi.js";
6
+ import { useMemo as s, useState as c } from "react";
7
+ import { AlertCircle as l, CheckCircle2 as u, Mail as d, Phone as f, Search as p, UserPlus as m, X as h } from "lucide-react";
8
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
8
9
  import { EmphasisPanel as y, PagePurpose as b } from "@burdenoff/fe-libs/ui";
9
10
  //#region src/kadaikodi/pages/cart-owner/StaffManagementPage.tsx
10
11
  var x = [
11
- {
12
- id: "staff-001",
13
- firstName: "Ravi",
14
- lastName: "Kumar",
15
- email: "ravi@dosaexpress.in",
16
- phone: "+91-9876543210",
17
- role: "delivery",
18
- status: "active",
19
- dateJoined: "2023-06-15",
20
- lastActive: "2024-01-16T10:00:00Z",
21
- hourlyRate: 200,
22
- hoursWorked: 160,
23
- totalEarnings: 32e3,
24
- performance: {
25
- rating: 4.8,
26
- tasksCompleted: 245,
27
- customerRating: 4.7,
28
- punctuality: 95
29
- },
30
- currentShift: "09:00 - 17:00",
31
- shiftsThisWeek: 5
32
- },
33
- {
34
- id: "staff-002",
35
- firstName: "Suresh",
36
- lastName: "Worker",
37
- email: "suresh@dosaexpress.in",
38
- phone: "+91-9876543211",
39
- role: "chef",
40
- status: "active",
41
- dateJoined: "2023-08-20",
42
- lastActive: "2024-01-16T09:30:00Z",
43
- hourlyRate: 250,
44
- hoursWorked: 148,
45
- totalEarnings: 37e3,
46
- performance: {
47
- rating: 4.6,
48
- tasksCompleted: 312,
49
- customerRating: 4.5,
50
- punctuality: 90
51
- },
52
- currentShift: "10:00 - 18:00",
53
- shiftsThisWeek: 4
54
- },
55
- {
56
- id: "staff-003",
57
- firstName: "Amit",
58
- lastName: "Sharma",
59
- email: "amit@dosaexpress.in",
60
- phone: "+91-9876543212",
61
- role: "delivery",
62
- status: "on-leave",
63
- dateJoined: "2023-10-01",
64
- hourlyRate: 180,
65
- hoursWorked: 120,
66
- totalEarnings: 21600,
67
- performance: {
68
- rating: 4.4,
69
- tasksCompleted: 178,
70
- customerRating: 4.3,
71
- punctuality: 85
72
- },
73
- shiftsThisWeek: 0
74
- },
75
- {
76
- id: "staff-004",
77
- firstName: "Priya",
78
- lastName: "Helper",
79
- email: "priya@dosaexpress.in",
80
- phone: "+91-9876543213",
81
- role: "server",
82
- status: "inactive",
83
- dateJoined: "2024-01-05",
84
- hourlyRate: 150,
85
- hoursWorked: 40,
86
- totalEarnings: 6e3,
87
- performance: {
88
- rating: 4.7,
89
- tasksCompleted: 56,
90
- customerRating: 4.8,
91
- punctuality: 98
92
- },
93
- shiftsThisWeek: 0
94
- },
95
- {
96
- id: "staff-005",
97
- firstName: "Kiran",
98
- lastName: "B.",
99
- email: "kiran@dosaexpress.in",
100
- phone: "+91-9876543214",
101
- role: "cashier",
102
- status: "active",
103
- dateJoined: "2023-12-10",
104
- lastActive: "2024-01-16T11:00:00Z",
105
- hourlyRate: 175,
106
- hoursWorked: 80,
107
- totalEarnings: 14e3,
108
- performance: {
109
- rating: 4.3,
110
- tasksCompleted: 134,
111
- customerRating: 4.2,
112
- punctuality: 88
113
- },
114
- currentShift: "11:00 - 19:00",
115
- shiftsThisWeek: 5
116
- },
117
- {
118
- id: "staff-006",
119
- firstName: "Meera",
120
- lastName: "Devi",
121
- email: "meera@dosaexpress.in",
122
- phone: "+91-9876543215",
123
- role: "manager",
124
- status: "active",
125
- dateJoined: "2023-04-01",
126
- lastActive: "2024-01-16T08:00:00Z",
127
- hourlyRate: 350,
128
- hoursWorked: 168,
129
- totalEarnings: 58800,
130
- performance: {
131
- rating: 4.9,
132
- tasksCompleted: 420,
133
- customerRating: 4.9,
134
- punctuality: 99
135
- },
136
- currentShift: "08:00 - 16:00",
137
- shiftsThisWeek: 6
138
- }
139
- ], S = {
140
- active: {
141
- label: "Active",
12
+ "MANAGER",
13
+ "CHEF",
14
+ "SERVER",
15
+ "DELIVERY",
16
+ "CASHIER"
17
+ ], S = (e) => e.replace(/_/g, " ").toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()), C = (e) => {
18
+ let t = e.toUpperCase();
19
+ return t === "ACTIVE" ? {
20
+ label: S(e),
142
21
  color: "text-status-success-text",
143
22
  dot: "bg-status-success-text"
144
- },
145
- inactive: {
146
- label: "Inactive",
147
- color: "text-text-secondary",
148
- dot: "bg-muted-foreground"
149
- },
150
- "on-leave": {
151
- label: "On Leave",
23
+ } : t === "ON_LEAVE" || t === "ON-LEAVE" ? {
24
+ label: S(e),
152
25
  color: "text-status-warning-text",
153
26
  dot: "bg-status-warning-text"
154
- },
155
- terminated: {
156
- label: "Terminated",
157
- color: "text-status-error-text",
158
- dot: "bg-status-error-text"
159
- }
160
- }, C = {
161
- manager: {
162
- label: "Manager",
163
- color: "bg-accent-purple-subtle text-text-primary"
164
- },
165
- chef: {
166
- label: "Chef",
167
- color: "bg-status-warning-bg-subtle text-status-warning-text"
168
- },
169
- server: {
170
- label: "Server",
171
- color: "bg-[var(--color-accent-soft)] text-text-primary"
172
- },
173
- delivery: {
174
- label: "Delivery",
175
- color: "bg-status-success-bg-subtle text-status-success-text"
176
- },
177
- cashier: {
178
- label: "Cashier",
179
- color: "bg-[var(--color-accent-soft)] text-text-primary"
180
- }
181
- }, w = {
27
+ } : {
28
+ label: S(e),
29
+ color: "text-text-secondary",
30
+ dot: "bg-muted-foreground"
31
+ };
32
+ }, w = (e) => {
33
+ if (!e || typeof e != "object") return {};
34
+ let t = e;
35
+ return {
36
+ email: typeof t.email == "string" ? t.email : void 0,
37
+ phone: typeof t.phone == "string" ? t.phone : void 0
38
+ };
39
+ }, T = {
40
+ name: "",
182
41
  email: "",
183
- firstName: "",
184
- lastName: "",
185
42
  phone: "",
186
- role: "server",
187
- hourlyRate: 150
188
- }, T = () => {
189
- let { navigateTo: T } = e(), [E, D] = a(x), [O, k] = a(""), [A, j] = a(""), [M, N] = a(""), [P, F] = a("name"), [I, L] = a(!1), [R, z] = a(!1), [B, V] = a(null), [H, U] = a(w), [W, G] = a({
190
- firstName: "",
191
- lastName: "",
192
- email: "",
193
- phone: "",
194
- role: "server",
195
- hourlyRate: 150,
196
- status: "active"
197
- }), [K, q] = a(null), J = (e, t) => {
198
- q({
43
+ role: "SERVER"
44
+ }, E = () => {
45
+ let { currentUser: E } = e(), { data: D = [], isLoading: O } = o(), k = s(() => D.find((e) => e.ownerId === E?.id) ?? D[0], [D, E?.id]), A = k?.id, { data: j = [], isLoading: M } = a(A), N = i(), [P, F] = c(""), [I, L] = c(""), [R, z] = c(""), [B, V] = c(!1), [H, U] = c(T), [W, G] = c(null), K = (e, t) => {
46
+ G({
199
47
  text: e,
200
48
  type: t
201
- }), setTimeout(() => q(null), 3e3);
202
- }, Y = E.filter((e) => e.status === "active").length, X = E.filter((e) => e.status === "on-leave").length, Z = E.length > 0 ? (E.reduce((e, t) => e + t.performance.rating, 0) / E.length).toFixed(1) : "0";
203
- E.reduce((e, t) => e + t.totalEarnings, 0);
204
- let Q = i(() => {
205
- let e = [...E];
206
- if (O) {
207
- let t = O.toLowerCase();
208
- e = e.filter((e) => `${e.firstName} ${e.lastName}`.toLowerCase().includes(t) || e.email.toLowerCase().includes(t) || e.phone.includes(t));
49
+ }), setTimeout(() => G(null), 3e3);
50
+ }, q = s(() => [...new Set(j.map((e) => e.role))].sort(), [j]), J = s(() => [...new Set(j.map((e) => e.status))].sort(), [j]), Y = j.filter((e) => e.status.toUpperCase() === "ACTIVE").length, X = j.filter((e) => {
51
+ let t = e.status.toUpperCase();
52
+ return t === "ON_LEAVE" || t === "ON-LEAVE";
53
+ }).length, Z = s(() => {
54
+ let e = [...j];
55
+ if (P) {
56
+ let t = P.toLowerCase();
57
+ e = e.filter((e) => {
58
+ let n = w(e.metadata);
59
+ return e.name.toLowerCase().includes(t) || e.role.toLowerCase().includes(t) || (n.email ?? "").toLowerCase().includes(t) || (n.phone ?? "").includes(t);
60
+ });
209
61
  }
210
- switch (A && (e = e.filter((e) => e.role === A)), M && (e = e.filter((e) => e.status === M)), P) {
211
- case "name":
212
- e.sort((e, t) => `${e.firstName} ${e.lastName}`.localeCompare(`${t.firstName} ${t.lastName}`));
213
- break;
214
- case "rating":
215
- e.sort((e, t) => t.performance.rating - e.performance.rating);
216
- break;
217
- case "hours":
218
- e.sort((e, t) => t.hoursWorked - e.hoursWorked);
219
- break;
220
- case "joined":
221
- e.sort((e, t) => new Date(t.dateJoined).getTime() - new Date(e.dateJoined).getTime());
222
- break;
223
- }
224
- return e;
62
+ return I && (e = e.filter((e) => e.role === I)), R && (e = e.filter((e) => e.status === R)), e.sort((e, t) => e.name.localeCompare(t.name)), e;
225
63
  }, [
226
- E,
227
- O,
228
- A,
229
- M,
230
- P
231
- ]), $ = () => {
232
- if (!H.email || !H.firstName || !H.lastName) {
233
- J("Please fill in all required fields", "error");
234
- return;
235
- }
236
- let e = {
237
- id: `staff-${Date.now()}`,
238
- ...H,
239
- status: "active",
240
- dateJoined: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
241
- hoursWorked: 0,
242
- totalEarnings: 0,
243
- performance: {
244
- rating: 0,
245
- tasksCompleted: 0,
246
- customerRating: 0,
247
- punctuality: 0
248
- },
249
- shiftsThisWeek: 0
250
- };
251
- D((t) => [...t, e]), L(!1), U(w), J("Staff member invited successfully", "success");
252
- }, ee = (e) => {
253
- V(e), G({
254
- firstName: e.firstName,
255
- lastName: e.lastName,
256
- email: e.email,
257
- phone: e.phone,
258
- role: e.role,
259
- hourlyRate: e.hourlyRate,
260
- status: e.status
261
- }), z(!0);
262
- }, te = () => {
263
- B && (D((e) => e.map((e) => e.id === B.id ? {
264
- ...e,
265
- ...W
266
- } : e)), z(!1), J("Staff member updated successfully", "success"));
267
- }, ne = (e) => {
268
- D((t) => t.map((t) => {
269
- if (t.id === e) {
270
- let e = t.status === "active" ? "inactive" : "active";
271
- return {
272
- ...t,
273
- status: e
274
- };
275
- }
276
- return t;
277
- })), J("Staff status updated", "success");
278
- }, re = (e) => {
279
- confirm("Are you sure you want to remove this staff member?") && (D((t) => t.filter((t) => t.id !== e)), J("Staff member removed", "success"));
280
- };
64
+ j,
65
+ P,
66
+ I,
67
+ R
68
+ ]), Q = !!(P || I || R);
281
69
  return /* @__PURE__ */ v(n, {
282
70
  title: "Staff Management",
283
- description: "Manage your workers, delivery partners, and shifts",
71
+ description: "Manage your workers and delivery partners",
284
72
  actions: /* @__PURE__ */ v("button", {
285
73
  type: "button",
286
74
  onClick: () => {
287
- U(w), L(!0);
75
+ U(T), V(!0);
288
76
  },
289
- className: "inline-flex items-center gap-2 rounded-md bg-accent px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent/80 transition-colors",
290
- children: [/* @__PURE__ */ _(h, { className: "h-4 w-4" }), "Invite Staff"]
77
+ disabled: !A,
78
+ className: t("inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors", A ? "bg-accent text-text-primary hover:bg-accent/80" : "bg-bg-sunken text-text-secondary cursor-not-allowed"),
79
+ children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), "Add Staff"]
291
80
  }),
292
81
  children: [
293
82
  /* @__PURE__ */ _(b, {
294
83
  className: "mb-6",
295
- children: "Your team in one place. Use this page to invite workers and delivery partners, see who's active or on leave right now, manage roles and ratings, and keep shifts covered so orders go out on time. Invite new staff and review performance to build a reliable crew around your cart."
84
+ children: "Your team in one place. Use this page to add workers and delivery partners to your cart, see who's active, and keep your roster organised so orders go out on time. Build a reliable crew around your cart."
296
85
  }),
297
86
  /* @__PURE__ */ v("div", {
298
87
  className: "space-y-4",
299
- children: [
300
- K && /* @__PURE__ */ v("div", {
301
- className: t("flex items-center gap-2 rounded-lg border p-3", K.type === "success" ? "border-status-success-text/30 bg-status-success-bg-subtle" : "border-status-error-text/30 bg-status-error-bg-subtle"),
302
- children: [K.type === "success" ? /* @__PURE__ */ _(s, { className: "h-4 w-4 text-status-success-text" }) : /* @__PURE__ */ _(o, { className: "h-4 w-4 text-status-error-text" }), /* @__PURE__ */ _("span", {
303
- className: t("text-sm font-medium", K.type === "success" ? "text-status-success-text" : "text-status-error-text"),
304
- children: K.text
305
- })]
306
- }),
88
+ children: [W && /* @__PURE__ */ v("div", {
89
+ className: t("flex items-center gap-2 rounded-lg border p-3", W.type === "success" ? "border-status-success-text/30 bg-status-success-bg-subtle" : "border-status-error-text/30 bg-status-error-bg-subtle"),
90
+ children: [W.type === "success" ? /* @__PURE__ */ _(u, { className: "h-4 w-4 text-status-success-text" }) : /* @__PURE__ */ _(l, { className: "h-4 w-4 text-status-error-text" }), /* @__PURE__ */ _("span", {
91
+ className: t("text-sm font-medium", W.type === "success" ? "text-status-success-text" : "text-status-error-text"),
92
+ children: W.text
93
+ })]
94
+ }), O ? /* @__PURE__ */ _("div", {
95
+ className: "flex items-center justify-center py-24",
96
+ children: /* @__PURE__ */ _("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
97
+ }) : k ? /* @__PURE__ */ v(g, { children: [
307
98
  /* @__PURE__ */ v(y, { children: [/* @__PURE__ */ _("h2", {
308
99
  className: "mb-4 text-base font-semibold text-text-primary",
309
100
  children: "Team Overview"
@@ -314,7 +105,7 @@ var x = [
314
105
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
315
106
  children: [/* @__PURE__ */ _("p", {
316
107
  className: "text-2xl font-bold text-text-primary",
317
- children: E.length
108
+ children: j.length
318
109
  }), /* @__PURE__ */ _("p", {
319
110
  className: "text-xs text-text-secondary",
320
111
  children: "Total Staff"
@@ -327,7 +118,7 @@ var x = [
327
118
  children: Y
328
119
  }), /* @__PURE__ */ _("p", {
329
120
  className: "text-xs text-text-secondary",
330
- children: "Active Now"
121
+ children: "Active"
331
122
  })]
332
123
  }),
333
124
  /* @__PURE__ */ v("div", {
@@ -344,10 +135,10 @@ var x = [
344
135
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
345
136
  children: [/* @__PURE__ */ _("p", {
346
137
  className: "text-2xl font-bold text-text-primary",
347
- children: Z
138
+ children: q.length
348
139
  }), /* @__PURE__ */ _("p", {
349
140
  className: "text-xs text-text-secondary",
350
- children: "Avg. Rating"
141
+ children: "Roles"
351
142
  })]
352
143
  })
353
144
  ]
@@ -355,231 +146,124 @@ var x = [
355
146
  /* @__PURE__ */ _("div", {
356
147
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
357
148
  children: /* @__PURE__ */ v("div", {
358
- className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",
149
+ className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",
359
150
  children: [
360
151
  /* @__PURE__ */ v("div", {
361
152
  className: "relative",
362
- children: [/* @__PURE__ */ _(f, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ _("input", {
153
+ children: [/* @__PURE__ */ _(p, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ _("input", {
363
154
  type: "text",
364
155
  placeholder: "Search staff...",
365
- value: O,
366
- onChange: (e) => k(e.target.value),
156
+ value: P,
157
+ onChange: (e) => F(e.target.value),
367
158
  className: "w-full rounded-md border border-border-subtle bg-bg-surface pl-10 pr-4 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
368
159
  })]
369
160
  }),
370
161
  /* @__PURE__ */ v("select", {
371
- value: A,
372
- onChange: (e) => j(e.target.value),
162
+ value: I,
163
+ onChange: (e) => L(e.target.value),
373
164
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
374
165
  children: [/* @__PURE__ */ _("option", {
375
166
  value: "",
376
167
  children: "All Roles"
377
- }), Object.entries(C).map(([e, t]) => /* @__PURE__ */ _("option", {
168
+ }), q.map((e) => /* @__PURE__ */ _("option", {
378
169
  value: e,
379
- children: t.label
170
+ children: S(e)
380
171
  }, e))]
381
172
  }),
382
173
  /* @__PURE__ */ v("select", {
383
- value: M,
384
- onChange: (e) => N(e.target.value),
174
+ value: R,
175
+ onChange: (e) => z(e.target.value),
385
176
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
386
177
  children: [/* @__PURE__ */ _("option", {
387
178
  value: "",
388
179
  children: "All Status"
389
- }), Object.entries(S).map(([e, t]) => /* @__PURE__ */ _("option", {
180
+ }), J.map((e) => /* @__PURE__ */ _("option", {
390
181
  value: e,
391
- children: t.label
182
+ children: S(e)
392
183
  }, e))]
393
- }),
394
- /* @__PURE__ */ v("select", {
395
- value: P,
396
- onChange: (e) => F(e.target.value),
397
- className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
398
- children: [
399
- /* @__PURE__ */ _("option", {
400
- value: "name",
401
- children: "Name A-Z"
402
- }),
403
- /* @__PURE__ */ _("option", {
404
- value: "rating",
405
- children: "Rating: High to Low"
406
- }),
407
- /* @__PURE__ */ _("option", {
408
- value: "hours",
409
- children: "Hours: Most Worked"
410
- }),
411
- /* @__PURE__ */ _("option", {
412
- value: "joined",
413
- children: "Recently Joined"
414
- })
415
- ]
416
184
  })
417
185
  ]
418
186
  })
419
187
  }),
420
- Q.length === 0 ? /* @__PURE__ */ _(r, {
421
- illustration: O || A || M ? "empty-search" : "empty-people",
188
+ M ? /* @__PURE__ */ _("div", {
189
+ className: "flex items-center justify-center py-16",
190
+ children: /* @__PURE__ */ _("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
191
+ }) : Z.length === 0 ? /* @__PURE__ */ _(r, {
192
+ illustration: Q ? "empty-search" : "empty-people",
422
193
  title: "No staff members found",
423
- description: O || A || M ? "No team members match your current filters. Try clearing them or searching for a different name." : "You have no staff yet. Invite your first worker or delivery partner to start building your team.",
424
- action: O || A || M ? /* @__PURE__ */ _("button", {
194
+ description: Q ? "No team members match your current filters. Try clearing them or searching for a different name." : "You have no staff yet. Add your first worker or delivery partner to start building your team.",
195
+ action: Q ? /* @__PURE__ */ _("button", {
425
196
  type: "button",
426
197
  onClick: () => {
427
- k(""), j(""), N(""), F("name");
198
+ F(""), L(""), z("");
428
199
  },
429
200
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm text-text-primary hover:bg-bg-sunken",
430
201
  children: "Clear filters"
431
202
  }) : /* @__PURE__ */ v("button", {
432
203
  type: "button",
433
204
  onClick: () => {
434
- U(w), L(!0);
205
+ U(T), V(!0);
435
206
  },
436
207
  className: "inline-flex items-center gap-2 rounded-md bg-accent px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent/80",
437
- children: [/* @__PURE__ */ _(h, { className: "h-4 w-4" }), "Invite Staff"]
208
+ children: [/* @__PURE__ */ _(m, { className: "h-4 w-4" }), "Add Staff"]
438
209
  })
439
210
  }) : /* @__PURE__ */ _("div", {
440
211
  className: "rounded-lg border border-border-subtle bg-bg-surface shadow-sm divide-y divide-border",
441
- children: Q.map((e) => {
442
- let n = S[e.status], r = C[e.role];
443
- return /* @__PURE__ */ v("div", {
212
+ children: Z.map((e) => {
213
+ let n = C(e.status), r = w(e.metadata);
214
+ return /* @__PURE__ */ _("div", {
444
215
  className: "p-4 sm:p-5 hover:bg-bg-sunken/30 transition-colors",
445
- children: [/* @__PURE__ */ v("div", {
216
+ children: /* @__PURE__ */ _("div", {
446
217
  className: "flex flex-col sm:flex-row sm:items-center gap-4",
447
- children: [/* @__PURE__ */ v("div", {
218
+ children: /* @__PURE__ */ v("div", {
448
219
  className: "flex items-center gap-4 flex-1 min-w-0",
449
220
  children: [/* @__PURE__ */ v("div", {
450
221
  className: "relative shrink-0",
451
222
  children: [/* @__PURE__ */ _("div", {
452
223
  className: "flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-primary",
453
- children: `${e.firstName[0]}${e.lastName[0]}`
224
+ children: e.name.split(" ").map((e) => e[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?"
454
225
  }), /* @__PURE__ */ _("span", { className: t("absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full border-2 border-card", n.dot) })]
455
226
  }), /* @__PURE__ */ v("div", {
456
227
  className: "flex-1 min-w-0",
457
228
  children: [/* @__PURE__ */ v("div", {
458
229
  className: "flex items-center gap-2 flex-wrap",
459
230
  children: [
460
- /* @__PURE__ */ v("p", {
231
+ /* @__PURE__ */ _("p", {
461
232
  className: "text-sm font-medium text-text-primary",
462
- children: [
463
- e.firstName,
464
- " ",
465
- e.lastName
466
- ]
233
+ children: e.name
467
234
  }),
468
235
  /* @__PURE__ */ _("span", {
469
- className: t("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium", r.color),
470
- children: r.label
236
+ className: "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium bg-[var(--color-accent-soft)] text-text-primary",
237
+ children: S(e.role)
471
238
  }),
472
239
  /* @__PURE__ */ _("span", {
473
240
  className: t("text-xs", n.color),
474
241
  children: n.label
475
242
  })
476
243
  ]
477
- }), /* @__PURE__ */ v("div", {
244
+ }), (r.email || r.phone) && /* @__PURE__ */ v("div", {
478
245
  className: "flex items-center gap-3 mt-1 text-xs text-text-secondary flex-wrap",
479
- children: [/* @__PURE__ */ v("span", {
246
+ children: [r.email && /* @__PURE__ */ v("span", {
480
247
  className: "flex items-center gap-1",
481
- children: [/* @__PURE__ */ _(u, { className: "h-3 w-3" }), e.email]
482
- }), /* @__PURE__ */ v("span", {
248
+ children: [/* @__PURE__ */ _(d, { className: "h-3 w-3" }), r.email]
249
+ }), r.phone && /* @__PURE__ */ v("span", {
483
250
  className: "flex items-center gap-1",
484
- children: [/* @__PURE__ */ _(d, { className: "h-3 w-3" }), e.phone]
251
+ children: [/* @__PURE__ */ _(f, { className: "h-3 w-3" }), r.phone]
485
252
  })]
486
253
  })]
487
254
  })]
488
- }), /* @__PURE__ */ v("div", {
489
- className: "flex items-center gap-4 sm:gap-6",
490
- children: [/* @__PURE__ */ v("div", {
491
- className: "hidden md:flex items-center gap-4 text-xs",
492
- children: [
493
- /* @__PURE__ */ v("div", {
494
- className: "text-center",
495
- children: [/* @__PURE__ */ v("p", {
496
- className: "font-bold text-text-primary flex items-center gap-0.5 justify-center",
497
- children: [/* @__PURE__ */ _(p, { className: "h-3 w-3 fill-status-warning-text text-status-warning-text" }), e.performance.rating]
498
- }), /* @__PURE__ */ _("p", {
499
- className: "text-text-secondary",
500
- children: "Rating"
501
- })]
502
- }),
503
- /* @__PURE__ */ v("div", {
504
- className: "text-center",
505
- children: [/* @__PURE__ */ _("p", {
506
- className: "font-bold text-text-primary",
507
- children: e.performance.tasksCompleted
508
- }), /* @__PURE__ */ _("p", {
509
- className: "text-text-secondary",
510
- children: "Tasks"
511
- })]
512
- }),
513
- /* @__PURE__ */ v("div", {
514
- className: "text-center",
515
- children: [/* @__PURE__ */ v("p", {
516
- className: "font-bold text-text-primary",
517
- children: [e.performance.punctuality, "%"]
518
- }), /* @__PURE__ */ _("p", {
519
- className: "text-text-secondary",
520
- children: "On Time"
521
- })]
522
- }),
523
- e.currentShift && /* @__PURE__ */ v("div", {
524
- className: "text-center",
525
- children: [/* @__PURE__ */ v("p", {
526
- className: "font-bold text-text-primary flex items-center gap-0.5 justify-center",
527
- children: [/* @__PURE__ */ _(c, { className: "h-3 w-3 text-text-secondary" }), e.currentShift]
528
- }), /* @__PURE__ */ _("p", {
529
- className: "text-text-secondary",
530
- children: "Shift"
531
- })]
532
- })
533
- ]
534
- }), /* @__PURE__ */ v("div", {
535
- className: "flex items-center gap-1",
536
- children: [
537
- /* @__PURE__ */ _("button", {
538
- type: "button",
539
- onClick: () => ne(e.id),
540
- className: t("h-6 w-11 rounded-full transition-colors relative", e.status === "active" ? "bg-status-success-text" : "bg-muted-foreground/30"),
541
- title: e.status === "active" ? "Deactivate" : "Activate",
542
- children: /* @__PURE__ */ _("div", { className: t("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform", e.status === "active" ? "translate-x-5" : "translate-x-0.5") })
543
- }),
544
- /* @__PURE__ */ _("button", {
545
- type: "button",
546
- onClick: () => ee(e),
547
- className: "rounded p-1.5 text-text-secondary hover:bg-bg-sunken hover:text-text-primary transition-colors",
548
- title: "Edit",
549
- children: /* @__PURE__ */ _(l, { className: "h-4 w-4" })
550
- }),
551
- /* @__PURE__ */ _("button", {
552
- type: "button",
553
- onClick: () => re(e.id),
554
- className: "rounded p-1.5 text-text-secondary hover:bg-status-error-bg-subtle hover:text-status-error-text transition-colors",
555
- title: "Remove",
556
- children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
557
- })
558
- ]
559
- })]
560
- })]
561
- }), /* @__PURE__ */ v("div", {
562
- className: "md:hidden flex items-center gap-4 mt-3 text-xs text-text-secondary",
563
- children: [
564
- /* @__PURE__ */ v("span", {
565
- className: "flex items-center gap-0.5",
566
- children: [/* @__PURE__ */ _(p, { className: "h-3 w-3 fill-status-warning-text text-status-warning-text" }), e.performance.rating]
567
- }),
568
- /* @__PURE__ */ v("span", { children: [e.performance.tasksCompleted, " tasks"] }),
569
- /* @__PURE__ */ v("span", { children: [e.performance.punctuality, "% on time"] }),
570
- e.currentShift && /* @__PURE__ */ v("span", {
571
- className: "flex items-center gap-0.5",
572
- children: [/* @__PURE__ */ _(c, { className: "h-3 w-3" }), e.currentShift]
573
- }),
574
- /* @__PURE__ */ v("span", { children: [e.shiftsThisWeek, " shifts/wk"] })
575
- ]
576
- })]
255
+ })
256
+ })
577
257
  }, e.id);
578
258
  })
579
259
  })
580
- ]
260
+ ] }) : /* @__PURE__ */ _(r, {
261
+ illustration: "empty-people",
262
+ title: "Create your cart first",
263
+ description: "You need a service provider before you can add staff. Set up your cart to get started."
264
+ })]
581
265
  }),
582
- I && /* @__PURE__ */ _("div", {
266
+ B && /* @__PURE__ */ _("div", {
583
267
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
584
268
  children: /* @__PURE__ */ _("div", {
585
269
  className: "w-full max-w-lg rounded-lg border border-border-subtle bg-bg-surface shadow-xl",
@@ -590,64 +274,38 @@ var x = [
590
274
  className: "flex items-center justify-between mb-4",
591
275
  children: [/* @__PURE__ */ _("h3", {
592
276
  className: "text-lg font-semibold text-text-primary",
593
- children: "Invite Staff Member"
277
+ children: "Add Staff Member"
594
278
  }), /* @__PURE__ */ _("button", {
595
279
  type: "button",
596
- onClick: () => L(!1),
280
+ onClick: () => V(!1),
597
281
  className: "rounded p-1.5 text-text-secondary hover:text-text-primary hover:bg-bg-sunken",
598
- children: /* @__PURE__ */ _(g, { className: "h-5 w-5" })
282
+ children: /* @__PURE__ */ _(h, { className: "h-5 w-5" })
599
283
  })]
600
284
  }),
601
285
  /* @__PURE__ */ v("div", {
602
286
  className: "space-y-4",
603
287
  children: [
604
- /* @__PURE__ */ v("div", {
605
- className: "grid grid-cols-2 gap-4",
606
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
607
- className: "block text-sm font-medium text-text-primary mb-1",
608
- children: "First Name *"
609
- }), /* @__PURE__ */ _("input", {
610
- type: "text",
611
- value: H.firstName,
612
- onChange: (e) => U((t) => ({
613
- ...t,
614
- firstName: e.target.value
615
- })),
616
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
617
- })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
618
- className: "block text-sm font-medium text-text-primary mb-1",
619
- children: "Last Name *"
620
- }), /* @__PURE__ */ _("input", {
621
- type: "text",
622
- value: H.lastName,
623
- onChange: (e) => U((t) => ({
624
- ...t,
625
- lastName: e.target.value
626
- })),
627
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
628
- })] })]
629
- }),
630
288
  /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
631
289
  className: "block text-sm font-medium text-text-primary mb-1",
632
- children: "Email *"
290
+ children: "Full Name *"
633
291
  }), /* @__PURE__ */ _("input", {
634
- type: "email",
635
- value: H.email,
292
+ type: "text",
293
+ value: H.name,
636
294
  onChange: (e) => U((t) => ({
637
295
  ...t,
638
- email: e.target.value
296
+ name: e.target.value
639
297
  })),
640
298
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
641
299
  })] }),
642
300
  /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
643
301
  className: "block text-sm font-medium text-text-primary mb-1",
644
- children: "Phone"
302
+ children: "Email"
645
303
  }), /* @__PURE__ */ _("input", {
646
- type: "tel",
647
- value: H.phone,
304
+ type: "email",
305
+ value: H.email,
648
306
  onChange: (e) => U((t) => ({
649
307
  ...t,
650
- phone: e.target.value
308
+ email: e.target.value
651
309
  })),
652
310
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
653
311
  })] }),
@@ -655,169 +313,30 @@ var x = [
655
313
  className: "grid grid-cols-2 gap-4",
656
314
  children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
657
315
  className: "block text-sm font-medium text-text-primary mb-1",
658
- children: "Role"
659
- }), /* @__PURE__ */ _("select", {
660
- value: H.role,
661
- onChange: (e) => U((t) => ({
662
- ...t,
663
- role: e.target.value
664
- })),
665
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
666
- children: Object.entries(C).map(([e, t]) => /* @__PURE__ */ _("option", {
667
- value: e,
668
- children: t.label
669
- }, e))
670
- })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
671
- className: "block text-sm font-medium text-text-primary mb-1",
672
- children: "Hourly Rate (₹)"
316
+ children: "Phone"
673
317
  }), /* @__PURE__ */ _("input", {
674
- type: "number",
675
- value: H.hourlyRate,
318
+ type: "tel",
319
+ value: H.phone,
676
320
  onChange: (e) => U((t) => ({
677
321
  ...t,
678
- hourlyRate: parseInt(e.target.value) || 0
679
- })),
680
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
681
- })] })]
682
- })
683
- ]
684
- }),
685
- /* @__PURE__ */ v("div", {
686
- className: "flex gap-3 mt-6",
687
- children: [/* @__PURE__ */ _("button", {
688
- type: "button",
689
- onClick: () => L(!1),
690
- className: "flex-1 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
691
- children: "Cancel"
692
- }), /* @__PURE__ */ _("button", {
693
- type: "button",
694
- onClick: $,
695
- className: "flex-1 rounded-md bg-accent px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent/80",
696
- children: "Send Invite"
697
- })]
698
- })
699
- ]
700
- })
701
- })
702
- }),
703
- R && B && /* @__PURE__ */ _("div", {
704
- className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
705
- children: /* @__PURE__ */ _("div", {
706
- className: "w-full max-w-lg rounded-lg border border-border-subtle bg-bg-surface shadow-xl",
707
- children: /* @__PURE__ */ v("div", {
708
- className: "p-6",
709
- children: [
710
- /* @__PURE__ */ v("div", {
711
- className: "flex items-center justify-between mb-4",
712
- children: [/* @__PURE__ */ _("h3", {
713
- className: "text-lg font-semibold text-text-primary",
714
- children: "Edit Staff Member"
715
- }), /* @__PURE__ */ _("button", {
716
- type: "button",
717
- onClick: () => z(!1),
718
- className: "rounded p-1.5 text-text-secondary hover:text-text-primary hover:bg-bg-sunken",
719
- children: /* @__PURE__ */ _(g, { className: "h-5 w-5" })
720
- })]
721
- }),
722
- /* @__PURE__ */ v("div", {
723
- className: "space-y-4",
724
- children: [
725
- /* @__PURE__ */ v("div", {
726
- className: "grid grid-cols-2 gap-4",
727
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
728
- className: "block text-sm font-medium text-text-primary mb-1",
729
- children: "First Name"
730
- }), /* @__PURE__ */ _("input", {
731
- type: "text",
732
- value: W.firstName,
733
- onChange: (e) => G((t) => ({
734
- ...t,
735
- firstName: e.target.value
322
+ phone: e.target.value
736
323
  })),
737
324
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
738
325
  })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
739
326
  className: "block text-sm font-medium text-text-primary mb-1",
740
- children: "Last Name"
741
- }), /* @__PURE__ */ _("input", {
742
- type: "text",
743
- value: W.lastName,
744
- onChange: (e) => G((t) => ({
327
+ children: "Role *"
328
+ }), /* @__PURE__ */ _("select", {
329
+ value: H.role,
330
+ onChange: (e) => U((t) => ({
745
331
  ...t,
746
- lastName: e.target.value
332
+ role: e.target.value
747
333
  })),
748
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
334
+ className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
335
+ children: x.map((e) => /* @__PURE__ */ _("option", {
336
+ value: e,
337
+ children: S(e)
338
+ }, e))
749
339
  })] })]
750
- }),
751
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
752
- className: "block text-sm font-medium text-text-primary mb-1",
753
- children: "Email"
754
- }), /* @__PURE__ */ _("input", {
755
- type: "email",
756
- value: W.email,
757
- onChange: (e) => G((t) => ({
758
- ...t,
759
- email: e.target.value
760
- })),
761
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
762
- })] }),
763
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
764
- className: "block text-sm font-medium text-text-primary mb-1",
765
- children: "Phone"
766
- }), /* @__PURE__ */ _("input", {
767
- type: "tel",
768
- value: W.phone,
769
- onChange: (e) => G((t) => ({
770
- ...t,
771
- phone: e.target.value
772
- })),
773
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
774
- })] }),
775
- /* @__PURE__ */ v("div", {
776
- className: "grid grid-cols-3 gap-4",
777
- children: [
778
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
779
- className: "block text-sm font-medium text-text-primary mb-1",
780
- children: "Role"
781
- }), /* @__PURE__ */ _("select", {
782
- value: W.role,
783
- onChange: (e) => G((t) => ({
784
- ...t,
785
- role: e.target.value
786
- })),
787
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
788
- children: Object.entries(C).map(([e, t]) => /* @__PURE__ */ _("option", {
789
- value: e,
790
- children: t.label
791
- }, e))
792
- })] }),
793
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
794
- className: "block text-sm font-medium text-text-primary mb-1",
795
- children: "Rate (₹/hr)"
796
- }), /* @__PURE__ */ _("input", {
797
- type: "number",
798
- value: W.hourlyRate,
799
- onChange: (e) => G((t) => ({
800
- ...t,
801
- hourlyRate: parseInt(e.target.value) || 0
802
- })),
803
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
804
- })] }),
805
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
806
- className: "block text-sm font-medium text-text-primary mb-1",
807
- children: "Status"
808
- }), /* @__PURE__ */ _("select", {
809
- value: W.status,
810
- onChange: (e) => G((t) => ({
811
- ...t,
812
- status: e.target.value
813
- })),
814
- className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
815
- children: Object.entries(S).map(([e, t]) => /* @__PURE__ */ _("option", {
816
- value: e,
817
- children: t.label
818
- }, e))
819
- })] })
820
- ]
821
340
  })
822
341
  ]
823
342
  }),
@@ -825,14 +344,39 @@ var x = [
825
344
  className: "flex gap-3 mt-6",
826
345
  children: [/* @__PURE__ */ _("button", {
827
346
  type: "button",
828
- onClick: () => z(!1),
347
+ onClick: () => V(!1),
829
348
  className: "flex-1 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
830
349
  children: "Cancel"
831
350
  }), /* @__PURE__ */ _("button", {
832
351
  type: "button",
833
- onClick: te,
834
- className: "flex-1 rounded-md bg-accent px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent/80",
835
- children: "Save Changes"
352
+ onClick: () => {
353
+ if (!H.name.trim() || !H.role) {
354
+ K("Please provide a name and role", "error");
355
+ return;
356
+ }
357
+ if (!A) {
358
+ K("No cart found to add staff to", "error");
359
+ return;
360
+ }
361
+ N.mutate({
362
+ providerId: A,
363
+ name: H.name.trim(),
364
+ role: H.role,
365
+ workerId: H.email.trim() || H.name.trim(),
366
+ metadata: {
367
+ email: H.email.trim() || void 0,
368
+ phone: H.phone.trim() || void 0
369
+ }
370
+ }, {
371
+ onSuccess: () => {
372
+ V(!1), U(T), K("Staff member added successfully", "success");
373
+ },
374
+ onError: () => K("Could not add staff member. Please try again.", "error")
375
+ });
376
+ },
377
+ disabled: N.isPending,
378
+ className: t("flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors", N.isPending ? "bg-bg-sunken text-text-secondary cursor-not-allowed" : "bg-accent text-text-primary hover:bg-accent/80"),
379
+ children: N.isPending ? "Adding..." : "Add Staff"
836
380
  })]
837
381
  })
838
382
  ]
@@ -843,6 +387,6 @@ var x = [
843
387
  });
844
388
  };
845
389
  //#endregion
846
- export { T as StaffManagementPage };
390
+ export { E as StaffManagementPage };
847
391
 
848
392
  //# sourceMappingURL=StaffManagementPage.js.map