@burdenoff/microfe-kadaikodi 2026.802.1 → 2026.830.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 (58) hide show
  1. package/dist/kadaikodi/KadaikodiRoot.d.ts.map +1 -1
  2. package/dist/kadaikodi/KadaikodiRoot.js +69 -72
  3. package/dist/kadaikodi/KadaikodiRoot.js.map +1 -1
  4. package/dist/kadaikodi/components/InvestmentCard.d.ts.map +1 -1
  5. package/dist/kadaikodi/components/InvestmentCard.js +58 -54
  6. package/dist/kadaikodi/components/InvestmentCard.js.map +1 -1
  7. package/dist/kadaikodi/components/OrderCard.d.ts.map +1 -1
  8. package/dist/kadaikodi/components/StatusBadge.d.ts.map +1 -1
  9. package/dist/kadaikodi/components/StatusBadge.js +25 -14
  10. package/dist/kadaikodi/components/StatusBadge.js.map +1 -1
  11. package/dist/kadaikodi/hooks/useKadaikodiApi.d.ts +24 -0
  12. package/dist/kadaikodi/hooks/useKadaikodiApi.d.ts.map +1 -1
  13. package/dist/kadaikodi/hooks/useKadaikodiApi.js +177 -132
  14. package/dist/kadaikodi/hooks/useKadaikodiApi.js.map +1 -1
  15. package/dist/kadaikodi/pages/HomePage.d.ts.map +1 -1
  16. package/dist/kadaikodi/pages/HomePage.js +284 -282
  17. package/dist/kadaikodi/pages/HomePage.js.map +1 -1
  18. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.d.ts +7 -2
  19. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.d.ts.map +1 -1
  20. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.js +319 -228
  21. package/dist/kadaikodi/pages/admin/AdminAnalyticsPage.js.map +1 -1
  22. package/dist/kadaikodi/pages/admin/AdminOrdersPage.js +1 -1
  23. package/dist/kadaikodi/pages/admin/AdminOrdersPage.js.map +1 -1
  24. package/dist/kadaikodi/pages/admin/CartManagementPage.d.ts +10 -4
  25. package/dist/kadaikodi/pages/admin/CartManagementPage.d.ts.map +1 -1
  26. package/dist/kadaikodi/pages/admin/CartManagementPage.js +320 -279
  27. package/dist/kadaikodi/pages/admin/CartManagementPage.js.map +1 -1
  28. package/dist/kadaikodi/pages/cart-owner/MerchantOnboardingPage.d.ts.map +1 -1
  29. package/dist/kadaikodi/pages/cart-owner/MerchantOnboardingPage.js +365 -292
  30. package/dist/kadaikodi/pages/cart-owner/MerchantOnboardingPage.js.map +1 -1
  31. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.d.ts +7 -2
  32. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.d.ts.map +1 -1
  33. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.js +300 -158
  34. package/dist/kadaikodi/pages/cart-owner/StaffManagementPage.js.map +1 -1
  35. package/dist/kadaikodi/pages/common/SettingsPage.js +286 -286
  36. package/dist/kadaikodi/pages/common/SettingsPage.js.map +1 -1
  37. package/dist/kadaikodi/pages/customer/CartDetailPage.d.ts.map +1 -1
  38. package/dist/kadaikodi/pages/customer/CartDetailPage.js +3 -3
  39. package/dist/kadaikodi/pages/customer/CartDetailPage.js.map +1 -1
  40. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.d.ts +13 -3
  41. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.d.ts.map +1 -1
  42. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.js +270 -220
  43. package/dist/kadaikodi/pages/customer/CartDiscoveryPage.js.map +1 -1
  44. package/dist/kadaikodi/pages/customer/CustomerDashboard.js +97 -97
  45. package/dist/kadaikodi/pages/customer/OrderTrackingPage.d.ts.map +1 -1
  46. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js +1 -1
  47. package/dist/kadaikodi/pages/customer/OrderTrackingPage.js.map +1 -1
  48. package/dist/kadaikodi/pages/worker/TaskDetailsPage.d.ts +5 -3
  49. package/dist/kadaikodi/pages/worker/TaskDetailsPage.d.ts.map +1 -1
  50. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js +286 -199
  51. package/dist/kadaikodi/pages/worker/TaskDetailsPage.js.map +1 -1
  52. package/dist/kadaikodi/types/index.d.ts +46 -2
  53. package/dist/kadaikodi/types/index.d.ts.map +1 -1
  54. package/dist/shared/hooks/useTr.d.ts +2 -0
  55. package/dist/shared/hooks/useTr.d.ts.map +1 -0
  56. package/dist/shared/hooks/useTr.js +14 -0
  57. package/dist/shared/hooks/useTr.js.map +1 -0
  58. package/package.json +2 -2
@@ -2,380 +2,522 @@ 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 { useCreateProviderWorker as i, useProviderWorkers as a, useProviders as o } from "../../hooks/useKadaikodiApi.js";
5
+ import { useCreateProviderWorker as i, useProviderWorkers as a, useProviders as o, useUpdateProviderWorker as ee } from "../../hooks/useKadaikodiApi.js";
6
6
  import { StatCard as s } from "../../components/viz/StatCard.js";
7
7
  import { AvatarStack as c } from "../../components/viz/AvatarStack.js";
8
8
  import "../../components/viz/index.js";
9
9
  import { useMemo as l, useState as u } from "react";
10
- import { AlertCircle as d, Briefcase as f, CheckCircle2 as p, Clock as m, Mail as h, Phone as g, Search as _, UserPlus as v, Users as y, X as b } from "lucide-react";
11
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
12
- import { EmphasisPanel as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
10
+ import { AlertCircle as d, Briefcase as te, CheckCircle2 as f, ClipboardList as p, Clock as ne, Mail as m, Pencil as h, Phone as g, Search as re, UserPlus as _, Users as v, X as y } from "lucide-react";
11
+ import { Fragment as ie, jsx as b, jsxs as x } from "react/jsx-runtime";
12
+ import { EmphasisPanel as ae, PagePurpose as oe } from "@burdenoff/fe-libs/ui";
13
13
  //#region src/kadaikodi/pages/cart-owner/StaffManagementPage.tsx
14
- var ee = [
14
+ var S = [
15
15
  "MANAGER",
16
16
  "CHEF",
17
17
  "SERVER",
18
18
  "DELIVERY",
19
19
  "CASHIER"
20
- ], E = (e) => e.replace(/_/g, " ").toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()), D = (e) => {
20
+ ], C = (e) => e.replace(/_/g, " ").toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()), w = (e) => {
21
21
  let t = e.toUpperCase();
22
22
  return t === "ACTIVE" ? {
23
- label: E(e),
23
+ label: C(e),
24
24
  color: "text-status-success-text",
25
25
  dot: "bg-status-success-text"
26
26
  } : t === "ON_LEAVE" || t === "ON-LEAVE" ? {
27
- label: E(e),
27
+ label: C(e),
28
28
  color: "text-status-warning-text",
29
29
  dot: "bg-status-warning-text"
30
30
  } : {
31
- label: E(e),
31
+ label: C(e),
32
32
  color: "text-text-secondary",
33
33
  dot: "bg-muted-foreground"
34
34
  };
35
- }, O = (e) => {
35
+ }, T = (e) => {
36
36
  if (!e || typeof e != "object") return {};
37
37
  let t = e;
38
38
  return {
39
39
  email: typeof t.email == "string" ? t.email : void 0,
40
40
  phone: typeof t.phone == "string" ? t.phone : void 0
41
41
  };
42
- }, k = {
42
+ }, E = {
43
43
  name: "",
44
44
  email: "",
45
45
  phone: "",
46
46
  role: "SERVER"
47
- }, A = () => {
48
- let { currentUser: A } = e(), { data: j = [], isLoading: M } = o(), N = l(() => j.find((e) => e.ownerId === A?.id) ?? j[0], [j, A?.id]), P = N?.id, { data: F = [], isLoading: I } = a(P), L = i(), [R, z] = u(""), [B, V] = u(""), [H, U] = u(""), [W, G] = u(!1), [K, q] = u(k), [J, Y] = u(null), X = (e, t) => {
49
- Y({
47
+ }, D = (e, t) => {
48
+ if (!e) return !1;
49
+ let n = new Date(e);
50
+ return Number.isNaN(n.getTime()) ? !1 : n.getFullYear() === t.getFullYear() && n.getMonth() === t.getMonth() && n.getDate() === t.getDate();
51
+ }, O = (e, t) => {
52
+ let n = e.tasks ?? [];
53
+ return {
54
+ assignedToday: n.filter((e) => D(e.assignedAt, t)).length,
55
+ truncated: n.length >= 100,
56
+ open: n.filter((e) => {
57
+ let t = e.status.toUpperCase();
58
+ return t !== "COMPLETED" && t !== "CANCELLED";
59
+ }).length
60
+ };
61
+ }, k = () => {
62
+ let { currentUser: D } = e(), { data: k = [], isLoading: se } = o(), A = l(() => k.find((e) => e.ownerId === D?.id) ?? k[0], [k, D?.id]), j = A?.id, { data: M = [], isLoading: ce } = a(j), N = i(), P = ee(), [F, I] = u(""), [L, R] = u(""), [z, B] = u(""), [V, H] = u(!1), [U, W] = u(E), [G, K] = u(null), [q, J] = u(null), Y = (e, t) => {
63
+ J({
50
64
  text: e,
51
65
  type: t
52
- }), setTimeout(() => Y(null), 3e3);
53
- }, Z = l(() => [...new Set(F.map((e) => e.role))].sort(), [F]), te = l(() => [...new Set(F.map((e) => e.status))].sort(), [F]), ne = F.filter((e) => e.status.toUpperCase() === "ACTIVE").length, re = F.filter((e) => {
66
+ }), setTimeout(() => J(null), 3e3);
67
+ }, X = l(() => [...new Set(M.map((e) => e.role))].sort(), [M]), le = l(() => [...new Set(M.map((e) => e.status))].sort(), [M]), ue = M.filter((e) => e.status.toUpperCase() === "ACTIVE").length, de = M.filter((e) => {
54
68
  let t = e.status.toUpperCase();
55
69
  return t === "ON_LEAVE" || t === "ON-LEAVE";
56
- }).length, Q = l(() => {
57
- let e = [...F];
58
- if (R) {
59
- let t = R.toLowerCase();
70
+ }).length, Z = l(() => {
71
+ let e = /* @__PURE__ */ new Date();
72
+ return new Map(M.map((t) => [t.id, O(t, e)]));
73
+ }, [M]), fe = l(() => [...Z.values()].reduce((e, t) => e + t.assignedToday, 0), [Z]), pe = l(() => [...Z.values()].some((e) => e.truncated), [Z]), Q = l(() => {
74
+ let e = [...M];
75
+ if (F) {
76
+ let t = F.toLowerCase();
60
77
  e = e.filter((e) => {
61
- let n = O(e.metadata);
78
+ let n = T(e.metadata);
62
79
  return e.name.toLowerCase().includes(t) || e.role.toLowerCase().includes(t) || (n.email ?? "").toLowerCase().includes(t) || (n.phone ?? "").includes(t);
63
80
  });
64
81
  }
65
- return B && (e = e.filter((e) => e.role === B)), H && (e = e.filter((e) => e.status === H)), e.sort((e, t) => e.name.localeCompare(t.name)), e;
82
+ return L && (e = e.filter((e) => e.role === L)), z && (e = e.filter((e) => e.status === z)), e.sort((e, t) => e.name.localeCompare(t.name)), e;
66
83
  }, [
84
+ M,
67
85
  F,
68
- R,
69
- B,
70
- H
71
- ]), $ = !!(R || B || H);
72
- return /* @__PURE__ */ C(n, {
86
+ L,
87
+ z
88
+ ]), $ = !!(F || L || z);
89
+ return /* @__PURE__ */ x(n, {
73
90
  title: "Staff Management",
74
91
  description: "Manage your workers and delivery partners",
75
- actions: /* @__PURE__ */ C("button", {
92
+ actions: /* @__PURE__ */ x("button", {
76
93
  type: "button",
77
94
  onClick: () => {
78
- q(k), G(!0);
95
+ W(E), H(!0);
79
96
  },
80
- disabled: !P,
81
- className: t("inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors", P ? "bg-accent text-text-primary hover:bg-accent/80" : "bg-bg-sunken text-text-secondary cursor-not-allowed"),
82
- children: [/* @__PURE__ */ S(v, { className: "h-4 w-4" }), "Add Staff"]
97
+ disabled: !j,
98
+ className: t("inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors", j ? "bg-accent text-text-primary hover:bg-accent/80" : "bg-bg-sunken text-text-secondary cursor-not-allowed"),
99
+ children: [/* @__PURE__ */ b(_, { className: "h-4 w-4" }), "Add Staff"]
83
100
  }),
84
101
  children: [
85
- /* @__PURE__ */ S(T, {
102
+ /* @__PURE__ */ b(oe, {
86
103
  className: "mb-6",
87
104
  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."
88
105
  }),
89
- /* @__PURE__ */ C("div", {
106
+ /* @__PURE__ */ x("div", {
90
107
  className: "space-y-4",
91
- children: [J && /* @__PURE__ */ C("div", {
92
- className: t("flex items-center gap-2 rounded-lg border p-3", J.type === "success" ? "border-status-success-text/30 bg-status-success-bg-subtle" : "border-status-error-text/30 bg-status-error-bg-subtle"),
93
- children: [J.type === "success" ? /* @__PURE__ */ S(p, { className: "h-4 w-4 text-status-success-text" }) : /* @__PURE__ */ S(d, { className: "h-4 w-4 text-status-error-text" }), /* @__PURE__ */ S("span", {
94
- className: t("text-sm font-medium", J.type === "success" ? "text-status-success-text" : "text-status-error-text"),
95
- children: J.text
108
+ children: [q && /* @__PURE__ */ x("div", {
109
+ className: t("flex items-center gap-2 rounded-lg border p-3", q.type === "success" ? "border-status-success-text/30 bg-status-success-bg-subtle" : "border-status-error-text/30 bg-status-error-bg-subtle"),
110
+ children: [q.type === "success" ? /* @__PURE__ */ b(f, { className: "h-4 w-4 text-status-success-text" }) : /* @__PURE__ */ b(d, { className: "h-4 w-4 text-status-error-text" }), /* @__PURE__ */ b("span", {
111
+ className: t("text-sm font-medium", q.type === "success" ? "text-status-success-text" : "text-status-error-text"),
112
+ children: q.text
96
113
  })]
97
- }), M ? /* @__PURE__ */ S("div", {
114
+ }), se ? /* @__PURE__ */ b("div", {
98
115
  className: "flex items-center justify-center py-24",
99
- children: /* @__PURE__ */ S("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
100
- }) : N ? /* @__PURE__ */ C(x, { children: [
101
- /* @__PURE__ */ C(w, { children: [/* @__PURE__ */ C("div", {
116
+ children: /* @__PURE__ */ b("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
117
+ }) : A ? /* @__PURE__ */ x(ie, { children: [
118
+ /* @__PURE__ */ x(ae, { children: [/* @__PURE__ */ x("div", {
102
119
  className: "mb-4 flex items-center justify-between gap-3",
103
- children: [/* @__PURE__ */ S("h2", {
120
+ children: [/* @__PURE__ */ b("h2", {
104
121
  className: "text-base font-semibold text-text-primary",
105
122
  children: "Team Overview"
106
- }), F.length > 0 && /* @__PURE__ */ S(c, {
107
- people: F.map((e) => ({
123
+ }), M.length > 0 && /* @__PURE__ */ b(c, {
124
+ people: M.map((e) => ({
108
125
  name: e.name,
109
126
  role: e.role
110
127
  })),
111
128
  max: 6,
112
129
  size: 30
113
130
  })]
114
- }), /* @__PURE__ */ C("div", {
115
- className: "grid grid-cols-2 sm:grid-cols-4 gap-3",
131
+ }), /* @__PURE__ */ x("div", {
132
+ className: "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",
116
133
  children: [
117
- /* @__PURE__ */ S(s, {
134
+ /* @__PURE__ */ b(s, {
118
135
  label: "Total Staff",
119
- value: F.length,
120
- icon: /* @__PURE__ */ S(y, { className: "h-4 w-4" })
136
+ value: M.length,
137
+ icon: /* @__PURE__ */ b(v, { className: "h-4 w-4" })
121
138
  }),
122
- /* @__PURE__ */ S(s, {
139
+ /* @__PURE__ */ b(s, {
123
140
  label: "Active",
124
- value: /* @__PURE__ */ S("span", {
141
+ value: /* @__PURE__ */ b("span", {
125
142
  className: "text-status-success-text",
126
- children: ne
143
+ children: ue
127
144
  }),
128
- icon: /* @__PURE__ */ S(p, { className: "h-4 w-4" })
145
+ icon: /* @__PURE__ */ b(f, { className: "h-4 w-4" })
129
146
  }),
130
- /* @__PURE__ */ S(s, {
147
+ /* @__PURE__ */ b(s, {
131
148
  label: "On Leave",
132
- value: /* @__PURE__ */ S("span", {
149
+ value: /* @__PURE__ */ b("span", {
133
150
  className: "text-status-warning-text",
134
- children: re
151
+ children: de
135
152
  }),
136
- icon: /* @__PURE__ */ S(m, { className: "h-4 w-4" })
153
+ icon: /* @__PURE__ */ b(ne, { className: "h-4 w-4" })
154
+ }),
155
+ /* @__PURE__ */ b(s, {
156
+ label: "Assigned Today",
157
+ value: `${fe}${pe ? "+" : ""}`,
158
+ icon: /* @__PURE__ */ b(p, { className: "h-4 w-4" })
137
159
  }),
138
- /* @__PURE__ */ S(s, {
160
+ /* @__PURE__ */ b(s, {
139
161
  label: "Roles",
140
- value: Z.length,
141
- icon: /* @__PURE__ */ S(f, { className: "h-4 w-4" })
162
+ value: X.length,
163
+ icon: /* @__PURE__ */ b(te, { className: "h-4 w-4" })
142
164
  })
143
165
  ]
144
166
  })] }),
145
- /* @__PURE__ */ S("div", {
167
+ /* @__PURE__ */ b("div", {
146
168
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm",
147
- children: /* @__PURE__ */ C("div", {
169
+ children: /* @__PURE__ */ x("div", {
148
170
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",
149
171
  children: [
150
- /* @__PURE__ */ C("div", {
172
+ /* @__PURE__ */ x("div", {
151
173
  className: "relative",
152
- children: [/* @__PURE__ */ S(_, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ S("input", {
174
+ children: [/* @__PURE__ */ b(re, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ b("input", {
153
175
  type: "text",
154
176
  placeholder: "Search staff...",
155
- value: R,
156
- onChange: (e) => z(e.target.value),
177
+ value: F,
178
+ onChange: (e) => I(e.target.value),
157
179
  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)]"
158
180
  })]
159
181
  }),
160
- /* @__PURE__ */ C("select", {
161
- value: B,
162
- onChange: (e) => V(e.target.value),
182
+ /* @__PURE__ */ x("select", {
183
+ value: L,
184
+ onChange: (e) => R(e.target.value),
163
185
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
164
- children: [/* @__PURE__ */ S("option", {
186
+ children: [/* @__PURE__ */ b("option", {
165
187
  value: "",
166
188
  children: "All Roles"
167
- }), Z.map((e) => /* @__PURE__ */ S("option", {
189
+ }), X.map((e) => /* @__PURE__ */ b("option", {
168
190
  value: e,
169
- children: E(e)
191
+ children: C(e)
170
192
  }, e))]
171
193
  }),
172
- /* @__PURE__ */ C("select", {
173
- value: H,
174
- onChange: (e) => U(e.target.value),
194
+ /* @__PURE__ */ x("select", {
195
+ value: z,
196
+ onChange: (e) => B(e.target.value),
175
197
  className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
176
- children: [/* @__PURE__ */ S("option", {
198
+ children: [/* @__PURE__ */ b("option", {
177
199
  value: "",
178
200
  children: "All Status"
179
- }), te.map((e) => /* @__PURE__ */ S("option", {
201
+ }), le.map((e) => /* @__PURE__ */ b("option", {
180
202
  value: e,
181
- children: E(e)
203
+ children: C(e)
182
204
  }, e))]
183
205
  })
184
206
  ]
185
207
  })
186
208
  }),
187
- I ? /* @__PURE__ */ S("div", {
209
+ ce ? /* @__PURE__ */ b("div", {
188
210
  className: "flex items-center justify-center py-16",
189
- children: /* @__PURE__ */ S("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
190
- }) : Q.length === 0 ? /* @__PURE__ */ S(r, {
211
+ children: /* @__PURE__ */ b("div", { className: "h-10 w-10 animate-spin rounded-full border-b-2 border-foreground" })
212
+ }) : Q.length === 0 ? /* @__PURE__ */ b(r, {
191
213
  illustration: $ ? "empty-search" : "empty-people",
192
214
  title: "No staff members found",
193
215
  description: $ ? "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.",
194
- action: $ ? /* @__PURE__ */ S("button", {
216
+ action: $ ? /* @__PURE__ */ b("button", {
195
217
  type: "button",
196
218
  onClick: () => {
197
- z(""), V(""), U("");
219
+ I(""), R(""), B("");
198
220
  },
199
221
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm text-text-primary hover:bg-bg-sunken",
200
222
  children: "Clear filters"
201
- }) : /* @__PURE__ */ C("button", {
223
+ }) : /* @__PURE__ */ x("button", {
202
224
  type: "button",
203
225
  onClick: () => {
204
- q(k), G(!0);
226
+ W(E), H(!0);
205
227
  },
206
228
  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",
207
- children: [/* @__PURE__ */ S(v, { className: "h-4 w-4" }), "Add Staff"]
229
+ children: [/* @__PURE__ */ b(_, { className: "h-4 w-4" }), "Add Staff"]
208
230
  })
209
- }) : /* @__PURE__ */ S("div", {
231
+ }) : /* @__PURE__ */ b("div", {
210
232
  className: "rounded-lg border border-border-subtle bg-bg-surface shadow-sm divide-y divide-border",
211
233
  children: Q.map((e) => {
212
- let n = D(e.status), r = O(e.metadata);
213
- return /* @__PURE__ */ S("div", {
234
+ let n = w(e.status), r = T(e.metadata), i = Z.get(e.id);
235
+ return /* @__PURE__ */ b("div", {
214
236
  className: "p-4 sm:p-5 hover:bg-bg-sunken/30 transition-colors",
215
- children: /* @__PURE__ */ S("div", {
237
+ children: /* @__PURE__ */ x("div", {
216
238
  className: "flex flex-col sm:flex-row sm:items-center gap-4",
217
- children: /* @__PURE__ */ C("div", {
239
+ children: [/* @__PURE__ */ x("div", {
218
240
  className: "flex items-center gap-4 flex-1 min-w-0",
219
- children: [/* @__PURE__ */ C("div", {
241
+ children: [/* @__PURE__ */ x("div", {
220
242
  className: "relative shrink-0",
221
- children: [/* @__PURE__ */ S("div", {
243
+ children: [/* @__PURE__ */ b("div", {
222
244
  className: "flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken text-sm font-semibold text-text-primary",
223
245
  children: e.name.split(" ").map((e) => e[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "?"
224
- }), /* @__PURE__ */ S("span", { className: t("absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full border-2 border-card", n.dot) })]
225
- }), /* @__PURE__ */ C("div", {
246
+ }), /* @__PURE__ */ b("span", { className: t("absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full border-2 border-card", n.dot) })]
247
+ }), /* @__PURE__ */ x("div", {
226
248
  className: "flex-1 min-w-0",
227
- children: [/* @__PURE__ */ C("div", {
249
+ children: [/* @__PURE__ */ x("div", {
228
250
  className: "flex items-center gap-2 flex-wrap",
229
251
  children: [
230
- /* @__PURE__ */ S("p", {
252
+ /* @__PURE__ */ b("p", {
231
253
  className: "text-sm font-medium text-text-primary",
232
254
  children: e.name
233
255
  }),
234
- /* @__PURE__ */ S("span", {
256
+ /* @__PURE__ */ b("span", {
235
257
  className: "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium bg-[var(--color-accent-soft)] text-text-primary",
236
- children: E(e.role)
258
+ children: C(e.role)
237
259
  }),
238
- /* @__PURE__ */ S("span", {
260
+ /* @__PURE__ */ b("span", {
239
261
  className: t("text-xs", n.color),
240
262
  children: n.label
241
263
  })
242
264
  ]
243
- }), (r.email || r.phone) && /* @__PURE__ */ C("div", {
265
+ }), (r.email || r.phone) && /* @__PURE__ */ x("div", {
244
266
  className: "flex items-center gap-3 mt-1 text-xs text-text-secondary flex-wrap",
245
- children: [r.email && /* @__PURE__ */ C("span", {
267
+ children: [r.email && /* @__PURE__ */ x("span", {
246
268
  className: "flex items-center gap-1",
247
- children: [/* @__PURE__ */ S(h, { className: "h-3 w-3" }), r.email]
248
- }), r.phone && /* @__PURE__ */ C("span", {
269
+ children: [/* @__PURE__ */ b(m, { className: "h-3 w-3" }), r.email]
270
+ }), r.phone && /* @__PURE__ */ x("span", {
249
271
  className: "flex items-center gap-1",
250
- children: [/* @__PURE__ */ S(g, { className: "h-3 w-3" }), r.phone]
272
+ children: [/* @__PURE__ */ b(g, { className: "h-3 w-3" }), r.phone]
251
273
  })]
252
274
  })]
253
275
  })]
254
- })
276
+ }), /* @__PURE__ */ x("div", {
277
+ className: "flex items-center gap-4 sm:justify-end",
278
+ children: [i && /* @__PURE__ */ x("div", {
279
+ className: "text-xs text-text-secondary",
280
+ children: [/* @__PURE__ */ x("p", {
281
+ className: "flex items-center gap-1",
282
+ children: [
283
+ /* @__PURE__ */ b(p, { className: "h-3 w-3" }),
284
+ /* @__PURE__ */ x("span", {
285
+ className: "tabular-nums text-text-primary",
286
+ children: [i.assignedToday, i.truncated ? "+" : ""]
287
+ }),
288
+ "assigned today"
289
+ ]
290
+ }), /* @__PURE__ */ x("p", {
291
+ className: "mt-0.5",
292
+ children: [/* @__PURE__ */ b("span", {
293
+ className: "tabular-nums",
294
+ children: i.open
295
+ }), " open"]
296
+ })]
297
+ }), /* @__PURE__ */ b("button", {
298
+ type: "button",
299
+ onClick: () => K({
300
+ id: e.id,
301
+ name: e.name,
302
+ email: r.email ?? "",
303
+ phone: r.phone ?? ""
304
+ }),
305
+ "aria-label": `Edit contact details for ${e.name}`,
306
+ className: "rounded-md border border-border-subtle p-2 text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary",
307
+ children: /* @__PURE__ */ b(h, { className: "h-4 w-4" })
308
+ })]
309
+ })]
255
310
  })
256
311
  }, e.id);
257
312
  })
258
313
  })
259
- ] }) : /* @__PURE__ */ S(r, {
314
+ ] }) : /* @__PURE__ */ b(r, {
260
315
  illustration: "empty-people",
261
316
  title: "Create your cart first",
262
317
  description: "You need a service provider before you can add staff. Set up your cart to get started."
263
318
  })]
264
319
  }),
265
- W && /* @__PURE__ */ S("div", {
320
+ G && /* @__PURE__ */ b("div", {
321
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
322
+ children: /* @__PURE__ */ b("div", {
323
+ className: "w-full max-w-md rounded-lg border border-border-subtle bg-bg-surface shadow-xl",
324
+ children: /* @__PURE__ */ x("div", {
325
+ className: "p-6",
326
+ children: [
327
+ /* @__PURE__ */ x("div", {
328
+ className: "flex items-center justify-between mb-1",
329
+ children: [/* @__PURE__ */ b("h3", {
330
+ className: "text-lg font-semibold text-text-primary",
331
+ children: "Edit contact details"
332
+ }), /* @__PURE__ */ b("button", {
333
+ type: "button",
334
+ onClick: () => K(null),
335
+ className: "rounded p-1.5 text-text-secondary hover:text-text-primary hover:bg-bg-sunken",
336
+ children: /* @__PURE__ */ b(y, { className: "h-5 w-5" })
337
+ })]
338
+ }),
339
+ /* @__PURE__ */ b("p", {
340
+ className: "mb-4 text-sm text-text-secondary",
341
+ children: G.name
342
+ }),
343
+ /* @__PURE__ */ x("div", {
344
+ className: "space-y-4",
345
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
346
+ className: "block text-sm font-medium text-text-primary mb-1",
347
+ children: "Email"
348
+ }), /* @__PURE__ */ b("input", {
349
+ type: "email",
350
+ value: G.email,
351
+ onChange: (e) => K((t) => t && {
352
+ ...t,
353
+ email: e.target.value
354
+ }),
355
+ className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
356
+ })] }), /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
357
+ className: "block text-sm font-medium text-text-primary mb-1",
358
+ children: "Phone"
359
+ }), /* @__PURE__ */ b("input", {
360
+ type: "tel",
361
+ value: G.phone,
362
+ onChange: (e) => K((t) => t && {
363
+ ...t,
364
+ phone: e.target.value
365
+ }),
366
+ className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
367
+ })] })]
368
+ }),
369
+ /* @__PURE__ */ b("p", {
370
+ className: "mt-3 text-xs text-text-muted",
371
+ children: "Name, role and employment status are set when a worker is added and cannot be changed here."
372
+ }),
373
+ /* @__PURE__ */ x("div", {
374
+ className: "flex gap-3 mt-6",
375
+ children: [/* @__PURE__ */ b("button", {
376
+ type: "button",
377
+ onClick: () => K(null),
378
+ className: "flex-1 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
379
+ children: "Cancel"
380
+ }), /* @__PURE__ */ b("button", {
381
+ type: "button",
382
+ onClick: () => {
383
+ if (!G) return;
384
+ let e = G.email.trim(), t = G.phone.trim();
385
+ P.mutate({
386
+ id: G.id,
387
+ metadata: {
388
+ email: e,
389
+ phone: t
390
+ }
391
+ }, {
392
+ onSuccess: () => {
393
+ K(null), Y("Contact details updated", "success");
394
+ },
395
+ onError: () => Y("Could not update contact details. Please try again.", "error")
396
+ });
397
+ },
398
+ disabled: P.isPending,
399
+ className: t("flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors", P.isPending ? "bg-bg-sunken text-text-secondary cursor-not-allowed" : "bg-accent text-text-primary hover:bg-accent/80"),
400
+ children: P.isPending ? "Saving..." : "Save"
401
+ })]
402
+ })
403
+ ]
404
+ })
405
+ })
406
+ }),
407
+ V && /* @__PURE__ */ b("div", {
266
408
  className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
267
- children: /* @__PURE__ */ S("div", {
409
+ children: /* @__PURE__ */ b("div", {
268
410
  className: "w-full max-w-lg rounded-lg border border-border-subtle bg-bg-surface shadow-xl",
269
- children: /* @__PURE__ */ C("div", {
411
+ children: /* @__PURE__ */ x("div", {
270
412
  className: "p-6",
271
413
  children: [
272
- /* @__PURE__ */ C("div", {
414
+ /* @__PURE__ */ x("div", {
273
415
  className: "flex items-center justify-between mb-4",
274
- children: [/* @__PURE__ */ S("h3", {
416
+ children: [/* @__PURE__ */ b("h3", {
275
417
  className: "text-lg font-semibold text-text-primary",
276
418
  children: "Add Staff Member"
277
- }), /* @__PURE__ */ S("button", {
419
+ }), /* @__PURE__ */ b("button", {
278
420
  type: "button",
279
- onClick: () => G(!1),
421
+ onClick: () => H(!1),
280
422
  className: "rounded p-1.5 text-text-secondary hover:text-text-primary hover:bg-bg-sunken",
281
- children: /* @__PURE__ */ S(b, { className: "h-5 w-5" })
423
+ children: /* @__PURE__ */ b(y, { className: "h-5 w-5" })
282
424
  })]
283
425
  }),
284
- /* @__PURE__ */ C("div", {
426
+ /* @__PURE__ */ x("div", {
285
427
  className: "space-y-4",
286
428
  children: [
287
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
429
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
288
430
  className: "block text-sm font-medium text-text-primary mb-1",
289
431
  children: "Full Name *"
290
- }), /* @__PURE__ */ S("input", {
432
+ }), /* @__PURE__ */ b("input", {
291
433
  type: "text",
292
- value: K.name,
293
- onChange: (e) => q((t) => ({
434
+ value: U.name,
435
+ onChange: (e) => W((t) => ({
294
436
  ...t,
295
437
  name: e.target.value
296
438
  })),
297
439
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
298
440
  })] }),
299
- /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
441
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
300
442
  className: "block text-sm font-medium text-text-primary mb-1",
301
443
  children: "Email"
302
- }), /* @__PURE__ */ S("input", {
444
+ }), /* @__PURE__ */ b("input", {
303
445
  type: "email",
304
- value: K.email,
305
- onChange: (e) => q((t) => ({
446
+ value: U.email,
447
+ onChange: (e) => W((t) => ({
306
448
  ...t,
307
449
  email: e.target.value
308
450
  })),
309
451
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
310
452
  })] }),
311
- /* @__PURE__ */ C("div", {
453
+ /* @__PURE__ */ x("div", {
312
454
  className: "grid grid-cols-2 gap-4",
313
- children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
455
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
314
456
  className: "block text-sm font-medium text-text-primary mb-1",
315
457
  children: "Phone"
316
- }), /* @__PURE__ */ S("input", {
458
+ }), /* @__PURE__ */ b("input", {
317
459
  type: "tel",
318
- value: K.phone,
319
- onChange: (e) => q((t) => ({
460
+ value: U.phone,
461
+ onChange: (e) => W((t) => ({
320
462
  ...t,
321
463
  phone: e.target.value
322
464
  })),
323
465
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary"
324
- })] }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
466
+ })] }), /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
325
467
  className: "block text-sm font-medium text-text-primary mb-1",
326
468
  children: "Role *"
327
- }), /* @__PURE__ */ S("select", {
328
- value: K.role,
329
- onChange: (e) => q((t) => ({
469
+ }), /* @__PURE__ */ b("select", {
470
+ value: U.role,
471
+ onChange: (e) => W((t) => ({
330
472
  ...t,
331
473
  role: e.target.value
332
474
  })),
333
475
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary",
334
- children: ee.map((e) => /* @__PURE__ */ S("option", {
476
+ children: S.map((e) => /* @__PURE__ */ b("option", {
335
477
  value: e,
336
- children: E(e)
478
+ children: C(e)
337
479
  }, e))
338
480
  })] })]
339
481
  })
340
482
  ]
341
483
  }),
342
- /* @__PURE__ */ C("div", {
484
+ /* @__PURE__ */ x("div", {
343
485
  className: "flex gap-3 mt-6",
344
- children: [/* @__PURE__ */ S("button", {
486
+ children: [/* @__PURE__ */ b("button", {
345
487
  type: "button",
346
- onClick: () => G(!1),
488
+ onClick: () => H(!1),
347
489
  className: "flex-1 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
348
490
  children: "Cancel"
349
- }), /* @__PURE__ */ S("button", {
491
+ }), /* @__PURE__ */ b("button", {
350
492
  type: "button",
351
493
  onClick: () => {
352
- if (!K.name.trim() || !K.role) {
353
- X("Please provide a name and role", "error");
494
+ if (!U.name.trim() || !U.role) {
495
+ Y("Please provide a name and role", "error");
354
496
  return;
355
497
  }
356
- if (!P) {
357
- X("No cart found to add staff to", "error");
498
+ if (!j) {
499
+ Y("No cart found to add staff to", "error");
358
500
  return;
359
501
  }
360
- L.mutate({
361
- providerId: P,
362
- name: K.name.trim(),
363
- role: K.role,
364
- workerId: K.email.trim() || K.name.trim(),
502
+ N.mutate({
503
+ providerId: j,
504
+ name: U.name.trim(),
505
+ role: U.role,
506
+ workerId: U.email.trim() || U.name.trim(),
365
507
  metadata: {
366
- email: K.email.trim() || void 0,
367
- phone: K.phone.trim() || void 0
508
+ email: U.email.trim() || void 0,
509
+ phone: U.phone.trim() || void 0
368
510
  }
369
511
  }, {
370
512
  onSuccess: () => {
371
- G(!1), q(k), X("Staff member added successfully", "success");
513
+ H(!1), W(E), Y("Staff member added successfully", "success");
372
514
  },
373
- onError: () => X("Could not add staff member. Please try again.", "error")
515
+ onError: () => Y("Could not add staff member. Please try again.", "error")
374
516
  });
375
517
  },
376
- disabled: L.isPending,
377
- className: t("flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors", L.isPending ? "bg-bg-sunken text-text-secondary cursor-not-allowed" : "bg-accent text-text-primary hover:bg-accent/80"),
378
- children: L.isPending ? "Adding..." : "Add Staff"
518
+ disabled: N.isPending,
519
+ 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"),
520
+ children: N.isPending ? "Adding..." : "Add Staff"
379
521
  })]
380
522
  })
381
523
  ]
@@ -386,6 +528,6 @@ var ee = [
386
528
  });
387
529
  };
388
530
  //#endregion
389
- export { A as StaffManagementPage };
531
+ export { k as StaffManagementPage };
390
532
 
391
533
  //# sourceMappingURL=StaffManagementPage.js.map