@burdenoff/microfe-healthybowl 2026.821.1 → 2026.822.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.
@@ -11,349 +11,353 @@ import { Breadcrumbs as u } from "../../components/Breadcrumbs.js";
11
11
  import { PageLoader as d } from "../../components/PageLoader.js";
12
12
  import { useToast as ee } from "../../hooks/useToast.js";
13
13
  import "../../components/index.js";
14
- import { GET_CSA_MEMBERSHIPS as f, GET_CSA_PLAN as p, useHealthyBowlDistribution as te } from "../../hooks/useHealthyBowlDistribution.js";
15
- import { useHealthyBowlCsaPickup as ne } from "../../hooks/useHealthyBowlCsaPickup.js";
16
- import { DistributionNav as m } from "./DistributionNav.js";
17
- import { EnrollMemberModal as h } from "./EnrollMemberModal.js";
18
- import { billingStatusVariant as g, dayName as _, membershipStatusVariant as v, planStatusVariant as y } from "./labels.js";
19
- import { useState as b } from "react";
20
- import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
21
- import { CalendarClock as S, PauseCircle as C, PlayCircle as w, RefreshCw as T, UserPlus as E, XCircle as D } from "lucide-react";
22
- import { useParams as O } from "react-router";
23
- import { jsx as k, jsxs as A } from "react/jsx-runtime";
24
- import { Button as j } from "@burdenoff/fe-libs/ui";
25
- import { useQuery as M } from "@apollo/client/react";
14
+ import { GET_CSA_MEMBERSHIPS as te, GET_CSA_PLAN as f, useHealthyBowlDistribution as p } from "../../hooks/useHealthyBowlDistribution.js";
15
+ import { useHealthyBowlCsaPickup as m } from "../../hooks/useHealthyBowlCsaPickup.js";
16
+ import { DistributionNav as h } from "./DistributionNav.js";
17
+ import { EnrollMemberModal as g } from "./EnrollMemberModal.js";
18
+ import { billingStatusVariant as _, dayName as v, membershipStatusVariant as y, planStatusVariant as b } from "./labels.js";
19
+ import { useState as x } from "react";
20
+ import { useI18n as ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
21
+ import { CalendarClock as S, PauseCircle as C, PlayCircle as w, RefreshCw as T, UserPlus as E, XCircle as re } from "lucide-react";
22
+ import { useParams as ie } from "react-router";
23
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
24
+ import { Button as k } from "@burdenoff/fe-libs/ui";
25
+ import { useQuery as A } from "@apollo/client/react";
26
26
  //#region src/healthybowl/pages/distribution/CsaPlanDetailPage.tsx
27
- var N = () => {
28
- let { t: N } = x(), { planId: P } = O(), { buildPath: F } = r(), { toast: I } = ee(), L = l(), { context: R, enrollMember: z, updateMembership: B, cancelMembership: V, renewMembership: H } = te({}), { locations: U, assignPickupLocation: W } = ne({ locations: !0 }), G = M(p, {
27
+ function j(e, t) {
28
+ return `${e}: ${t}`;
29
+ }
30
+ var M = () => {
31
+ let { t: M } = ne(), { planId: N } = ie(), { buildPath: P } = r(), { toast: F } = ee(), I = l(), { context: L, enrollMember: R, updateMembership: z, cancelMembership: B, renewMembership: V } = p({}), { locations: H, assignPickupLocation: U } = m({ locations: !0 }), W = A(f, {
29
32
  variables: {
30
- context: R,
31
- id: P ?? ""
33
+ context: L,
34
+ id: N ?? ""
32
35
  },
33
- skip: !P,
36
+ skip: !N,
34
37
  fetchPolicy: "cache-and-network"
35
- }), K = M(f, {
38
+ }), G = A(te, {
36
39
  variables: {
37
- context: R,
38
- csaPlanId: P ?? "",
40
+ context: L,
41
+ csaPlanId: N ?? "",
39
42
  status: null,
40
43
  limit: 100,
41
44
  offset: 0
42
45
  },
43
- skip: !P,
46
+ skip: !N,
44
47
  fetchPolicy: "cache-and-network"
45
- }), [q, J] = b(!1), [Y, X] = b(null), Z = G.data?.getHealthyBowlCsaPlan ?? null, Q = K.data?.getHealthyBowlCsaMemberships ?? [], $ = async () => {
46
- await Promise.all([G.refetch().catch(() => void 0), K.refetch().catch(() => void 0)]);
47
- }, re = async (e) => {
48
+ }), [K, q] = x(!1), [J, Y] = x(null), X = W.data?.getHealthyBowlCsaPlan ?? null, Z = G.data?.getHealthyBowlCsaMemberships ?? [], Q = async () => {
49
+ await Promise.all([W.refetch().catch(() => void 0), G.refetch().catch(() => void 0)]);
50
+ }, ae = async (e) => {
48
51
  try {
49
- await z({
52
+ await R({
50
53
  ...e,
51
- csaPlanId: P
54
+ csaPlanId: N
52
55
  });
53
56
  } catch (t) {
54
57
  let n = t instanceof Error ? t.message : String(t);
55
- if (!/is at capacity/i.test(n) || !await L({
56
- title: N("healthybowl.distribution.detail.confirmPlanOverCapacity.title", "This plan is full"),
57
- message: N("healthybowl.distribution.detail.confirmPlanOverCapacity.message", "{{error}} Enroll {{member}} anyway? The plan will show as over capacity.", {
58
+ if (!/is at capacity/i.test(n) || !await I({
59
+ title: M("healthybowl.distribution.detail.confirmPlanOverCapacity.title", "This plan is full"),
60
+ message: M("healthybowl.distribution.detail.confirmPlanOverCapacity.message", "{{error}} Enroll {{member}} anyway? The plan will show as over capacity.", {
58
61
  error: n,
59
62
  member: String(e.memberName ?? "")
60
63
  }),
61
- okButtonTitle: N("healthybowl.distribution.detail.confirmPlanOverCapacity.confirm", "Enroll anyway")
64
+ okButtonTitle: M("healthybowl.distribution.detail.confirmPlanOverCapacity.confirm", "Enroll anyway")
62
65
  })) throw t;
63
- await z({
66
+ await R({
64
67
  ...e,
65
- csaPlanId: P,
68
+ csaPlanId: N,
66
69
  allowOverCapacity: !0
67
70
  });
68
71
  }
69
- await $(), I({
70
- title: N("healthybowl.distribution.detail.toast.enrolled", "Member enrolled"),
72
+ await Q(), F({
73
+ title: M("healthybowl.distribution.detail.toast.enrolled", "Member enrolled"),
71
74
  description: String(e.memberName ?? ""),
72
75
  variant: "success"
73
76
  });
74
- }, ie = async (e, t) => {
75
- let n = U.find((e) => e.id === t), r = !1;
77
+ }, oe = async (e, t) => {
78
+ let n = H.find((e) => e.id === t), r = !1;
76
79
  if (n?.atCapacity) {
77
- if (!await L({
78
- title: N("healthybowl.distribution.detail.confirmOverCapacity.title", "This collection point is full"),
79
- message: N("healthybowl.distribution.detail.confirmOverCapacity.message", "{{name}} has no places left. Assigning {{member}} anyway over-subscribes it — the shortfall will show on the collection points list.", {
80
+ if (!await I({
81
+ title: M("healthybowl.distribution.detail.confirmOverCapacity.title", "This collection point is full"),
82
+ message: M("healthybowl.distribution.detail.confirmOverCapacity.message", "{{name}} has no places left. Assigning {{member}} anyway over-subscribes it — the shortfall will show on the collection points list.", {
80
83
  name: n.name,
81
84
  member: e.memberName
82
85
  }),
83
- okButtonTitle: N("healthybowl.distribution.detail.confirmOverCapacity.confirm", "Assign anyway")
86
+ okButtonTitle: M("healthybowl.distribution.detail.confirmOverCapacity.confirm", "Assign anyway")
84
87
  })) return;
85
88
  r = !0;
86
89
  }
87
- X(e.id);
90
+ Y(e.id);
88
91
  try {
89
- await W(e.id, t, r), await $(), I({
90
- title: t ? N("healthybowl.distribution.detail.toast.pickupAssigned", "{{member}} now collects from {{name}}.", {
92
+ await U(e.id, t, r), await Q(), F({
93
+ title: t ? M("healthybowl.distribution.detail.toast.pickupAssigned", "{{member}} now collects from {{name}}.", {
91
94
  member: e.memberName,
92
95
  name: n?.name ?? ""
93
- }) : N("healthybowl.distribution.detail.toast.pickupCleared", "{{member}} moved back to home delivery.", { member: e.memberName }),
96
+ }) : M("healthybowl.distribution.detail.toast.pickupCleared", "{{member}} moved back to home delivery.", { member: e.memberName }),
94
97
  variant: "success"
95
98
  });
96
99
  } catch (e) {
97
- I({
98
- title: N("healthybowl.distribution.detail.toast.pickupFailed", "Could not change the collection point"),
100
+ F({
101
+ title: M("healthybowl.distribution.detail.toast.pickupFailed", "Could not change the collection point"),
99
102
  description: e instanceof Error ? e.message : String(e),
100
103
  variant: "error"
101
104
  });
102
105
  } finally {
103
- X((t) => t === e.id ? null : t);
106
+ Y((t) => t === e.id ? null : t);
104
107
  }
105
- }, ae = async (e) => {
108
+ }, se = async (e) => {
106
109
  let t = e.status === "PAUSED" ? "ACTIVE" : "PAUSED";
107
- X(e.id);
110
+ Y(e.id);
108
111
  try {
109
- await B({
112
+ await z({
110
113
  id: e.id,
111
114
  status: t
112
- }), await $(), I({
113
- title: t === "ACTIVE" ? N("healthybowl.distribution.detail.toast.resumed", "Membership resumed") : N("healthybowl.distribution.detail.toast.paused", "Membership paused"),
115
+ }), await Q(), F({
116
+ title: t === "ACTIVE" ? M("healthybowl.distribution.detail.toast.resumed", "Membership resumed") : M("healthybowl.distribution.detail.toast.paused", "Membership paused"),
114
117
  description: e.memberName,
115
118
  variant: "success"
116
119
  });
117
120
  } catch (e) {
118
- I({
119
- title: N("healthybowl.distribution.detail.toast.updateFailed", "Update failed"),
121
+ F({
122
+ title: M("healthybowl.distribution.detail.toast.updateFailed", "Update failed"),
120
123
  description: e instanceof Error ? e.message : String(e),
121
124
  variant: "error"
122
125
  });
123
126
  } finally {
124
- X(null);
127
+ Y(null);
125
128
  }
126
- }, oe = async (e) => {
127
- X(e.id);
129
+ }, ce = async (e) => {
130
+ Y(e.id);
128
131
  try {
129
- let t = await H(e.id);
130
- await $(), I({
131
- title: N("healthybowl.distribution.detail.toast.renewed", "Membership renewed"),
132
- description: t ? N("healthybowl.distribution.detail.toast.renewedCycle", "{{name}} advanced to cycle {{cycle}}.", {
132
+ let t = await V(e.id);
133
+ await Q(), F({
134
+ title: M("healthybowl.distribution.detail.toast.renewed", "Membership renewed"),
135
+ description: t ? M("healthybowl.distribution.detail.toast.renewedCycle", "{{name}} advanced to cycle {{cycle}}.", {
133
136
  name: e.memberName,
134
137
  cycle: t.cycleCount
135
138
  }) : e.memberName,
136
139
  variant: "success"
137
140
  });
138
141
  } catch (e) {
139
- I({
140
- title: N("healthybowl.distribution.detail.toast.renewFailed", "Renewal failed"),
142
+ F({
143
+ title: M("healthybowl.distribution.detail.toast.renewFailed", "Renewal failed"),
141
144
  description: e instanceof Error ? e.message : String(e),
142
145
  variant: "error"
143
146
  });
144
147
  } finally {
145
- X(null);
148
+ Y(null);
146
149
  }
147
- }, se = async (e) => {
148
- if (await L({
149
- title: N("healthybowl.distribution.detail.confirm.cancelTitle", "Cancel membership?"),
150
- message: N("healthybowl.distribution.detail.confirm.cancel", "Cancel {{name}}’s membership? This stops future deliveries and billing.", { name: e.memberName })
150
+ }, le = async (e) => {
151
+ if (await I({
152
+ title: M("healthybowl.distribution.detail.confirm.cancelTitle", "Cancel membership?"),
153
+ message: M("healthybowl.distribution.detail.confirm.cancel", "Cancel {{name}}’s membership? This stops future deliveries and billing.", { name: e.memberName })
151
154
  })) {
152
- X(e.id);
155
+ Y(e.id);
153
156
  try {
154
- await V(e.id), await $(), I({
155
- title: N("healthybowl.distribution.detail.toast.cancelled", "Membership cancelled"),
157
+ await B(e.id), await Q(), F({
158
+ title: M("healthybowl.distribution.detail.toast.cancelled", "Membership cancelled"),
156
159
  description: e.memberName,
157
160
  variant: "success"
158
161
  });
159
162
  } catch (e) {
160
- I({
161
- title: N("healthybowl.distribution.detail.toast.cancelFailed", "Could not cancel"),
163
+ F({
164
+ title: M("healthybowl.distribution.detail.toast.cancelFailed", "Could not cancel"),
162
165
  description: e instanceof Error ? e.message : String(e),
163
166
  variant: "error"
164
167
  });
165
168
  } finally {
166
- X(null);
169
+ Y(null);
167
170
  }
168
171
  }
169
- }, ce = [
172
+ }, $ = [
170
173
  {
171
174
  key: "member",
172
- header: N("healthybowl.distribution.detail.table.member", "Member"),
173
- render: (e) => /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("div", {
175
+ header: M("healthybowl.distribution.detail.table.member", "Member"),
176
+ render: (e) => /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("div", {
174
177
  className: "font-medium text-text-primary",
175
178
  children: e.memberName
176
- }), /* @__PURE__ */ k("div", {
179
+ }), /* @__PURE__ */ D("div", {
177
180
  className: "text-xs text-text-secondary",
178
181
  children: e.memberEmail ?? e.memberPhone ?? "—"
179
182
  })] })
180
183
  },
181
184
  {
182
185
  key: "status",
183
- header: N("healthybowl.distribution.detail.table.status", "Status"),
184
- render: (e) => /* @__PURE__ */ k(o, {
185
- variant: v(e.status),
186
+ header: M("healthybowl.distribution.detail.table.status", "Status"),
187
+ render: (e) => /* @__PURE__ */ D(o, {
188
+ variant: y(e.status),
186
189
  label: e.status,
187
190
  dot: !0
188
191
  })
189
192
  },
190
193
  {
191
194
  key: "fulfilment",
192
- header: N("healthybowl.distribution.detail.table.fulfilment", "Collection"),
193
- render: (e) => /* @__PURE__ */ A("select", {
195
+ header: M("healthybowl.distribution.detail.table.fulfilment", "Collection"),
196
+ render: (e) => /* @__PURE__ */ O("select", {
197
+ "aria-label": j(M("healthybowl.distribution.detail.collectionPointForMember", "Collection point"), e.memberName),
194
198
  value: e.pickupLocationId ?? "",
195
- disabled: Y === e.id,
196
- onChange: (t) => void ie(e, t.target.value || null),
199
+ disabled: J === e.id,
200
+ onChange: (t) => void oe(e, t.target.value || null),
197
201
  className: "rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary disabled:opacity-60",
198
- children: [/* @__PURE__ */ k("option", {
202
+ children: [/* @__PURE__ */ D("option", {
199
203
  value: "",
200
- children: N("healthybowl.distribution.detail.homeDelivery", "Home delivery")
201
- }), U.filter((e) => e.status === "ACTIVE").map((e) => /* @__PURE__ */ A("option", {
204
+ children: M("healthybowl.distribution.detail.homeDelivery", "Home delivery")
205
+ }), H.filter((e) => e.status === "ACTIVE").map((e) => /* @__PURE__ */ O("option", {
202
206
  value: e.id,
203
- children: [e.name, e.atCapacity ? ` ${N("healthybowl.distribution.detail.full", "(full)")}` : ""]
207
+ children: [e.name, e.atCapacity ? ` ${M("healthybowl.distribution.detail.full", "(full)")}` : ""]
204
208
  }, e.id))]
205
209
  })
206
210
  },
207
211
  {
208
212
  key: "nextDelivery",
209
- header: N("healthybowl.distribution.detail.table.nextDelivery", "Next delivery"),
213
+ header: M("healthybowl.distribution.detail.table.nextDelivery", "Next delivery"),
210
214
  render: (e) => e.nextDeliveryDate ? t(e.nextDeliveryDate) : "—"
211
215
  },
212
216
  {
213
217
  key: "cycles",
214
- header: N("healthybowl.distribution.detail.table.cycles", "Cycles"),
215
- render: (e) => /* @__PURE__ */ k("span", {
218
+ header: M("healthybowl.distribution.detail.table.cycles", "Cycles"),
219
+ render: (e) => /* @__PURE__ */ D("span", {
216
220
  className: "tabular-nums",
217
221
  children: e.cycleCount
218
222
  })
219
223
  },
220
224
  {
221
225
  key: "billing",
222
- header: N("healthybowl.distribution.detail.table.billing", "Billing"),
223
- render: (e) => /* @__PURE__ */ k(o, {
224
- variant: g(e.billingSyncStatus),
226
+ header: M("healthybowl.distribution.detail.table.billing", "Billing"),
227
+ render: (e) => /* @__PURE__ */ D(o, {
228
+ variant: _(e.billingSyncStatus),
225
229
  label: e.billingSyncStatus
226
230
  })
227
231
  },
228
232
  {
229
233
  key: "actions",
230
234
  header: "",
231
- render: (e) => e.status === "CANCELLED" ? /* @__PURE__ */ k("span", {
235
+ render: (e) => e.status === "CANCELLED" ? /* @__PURE__ */ D("span", {
232
236
  className: "text-xs text-text-secondary",
233
- children: N("healthybowl.distribution.detail.table.ended", "Ended")
234
- }) : /* @__PURE__ */ A("div", {
237
+ children: M("healthybowl.distribution.detail.table.ended", "Ended")
238
+ }) : /* @__PURE__ */ O("div", {
235
239
  className: "flex items-center justify-end gap-1",
236
240
  children: [
237
- /* @__PURE__ */ k(j, {
241
+ /* @__PURE__ */ D(k, {
238
242
  variant: "ghost",
239
243
  size: "icon-sm",
240
- disabled: Y === e.id,
244
+ disabled: J === e.id,
241
245
  onClick: (t) => {
242
- t.stopPropagation(), ae(e);
246
+ t.stopPropagation(), se(e);
243
247
  },
244
- "aria-label": e.status === "PAUSED" ? N("healthybowl.distribution.detail.actions.resume", "Resume") : N("healthybowl.distribution.detail.actions.pause", "Pause"),
245
- title: e.status === "PAUSED" ? N("healthybowl.distribution.detail.actions.resume", "Resume") : N("healthybowl.distribution.detail.actions.pause", "Pause"),
246
- children: e.status === "PAUSED" ? /* @__PURE__ */ k(w, { className: "h-4 w-4" }) : /* @__PURE__ */ k(C, { className: "h-4 w-4" })
248
+ "aria-label": e.status === "PAUSED" ? M("healthybowl.distribution.detail.actions.resume", "Resume") : M("healthybowl.distribution.detail.actions.pause", "Pause"),
249
+ title: e.status === "PAUSED" ? M("healthybowl.distribution.detail.actions.resume", "Resume") : M("healthybowl.distribution.detail.actions.pause", "Pause"),
250
+ children: e.status === "PAUSED" ? /* @__PURE__ */ D(w, { className: "h-4 w-4" }) : /* @__PURE__ */ D(C, { className: "h-4 w-4" })
247
251
  }),
248
- /* @__PURE__ */ k(j, {
252
+ /* @__PURE__ */ D(k, {
249
253
  variant: "ghost",
250
254
  size: "icon-sm",
251
- disabled: Y === e.id,
255
+ disabled: J === e.id,
252
256
  onClick: (t) => {
253
- t.stopPropagation(), oe(e);
257
+ t.stopPropagation(), ce(e);
254
258
  },
255
- "aria-label": N("healthybowl.distribution.detail.actions.renew", "Renew (next cycle)"),
256
- title: N("healthybowl.distribution.detail.actions.renew", "Renew (next cycle)"),
257
- children: /* @__PURE__ */ k(T, { className: "h-4 w-4" })
259
+ "aria-label": M("healthybowl.distribution.detail.actions.renew", "Renew (next cycle)"),
260
+ title: M("healthybowl.distribution.detail.actions.renew", "Renew (next cycle)"),
261
+ children: /* @__PURE__ */ D(T, { className: "h-4 w-4" })
258
262
  }),
259
- /* @__PURE__ */ k(j, {
263
+ /* @__PURE__ */ D(k, {
260
264
  variant: "ghost",
261
265
  size: "icon-sm",
262
- disabled: Y === e.id,
266
+ disabled: J === e.id,
263
267
  onClick: (t) => {
264
- t.stopPropagation(), se(e);
268
+ t.stopPropagation(), le(e);
265
269
  },
266
- "aria-label": N("healthybowl.distribution.detail.actions.cancel", "Cancel"),
267
- title: N("healthybowl.distribution.detail.actions.cancel", "Cancel"),
270
+ "aria-label": M("healthybowl.distribution.detail.actions.cancel", "Cancel"),
271
+ title: M("healthybowl.distribution.detail.actions.cancel", "Cancel"),
268
272
  className: "text-text-secondary hover:text-status-error-text",
269
- children: /* @__PURE__ */ k(D, { className: "h-4 w-4" })
273
+ children: /* @__PURE__ */ D(re, { className: "h-4 w-4" })
270
274
  })
271
275
  ]
272
276
  })
273
277
  }
274
278
  ];
275
- if (G.loading && !Z) return /* @__PURE__ */ k(d, {});
276
- if (G.error && !Z) return /* @__PURE__ */ A(n, {
277
- title: N("healthybowl.distribution.detail.title", "CSA plan"),
278
- children: [/* @__PURE__ */ k(m, {}), /* @__PURE__ */ k(c, {
279
- description: G.error.message,
280
- onRetry: () => void G.refetch()
279
+ if (W.loading && !X) return /* @__PURE__ */ D(d, {});
280
+ if (W.error && !X) return /* @__PURE__ */ O(n, {
281
+ title: M("healthybowl.distribution.detail.title", "CSA plan"),
282
+ children: [/* @__PURE__ */ D(h, {}), /* @__PURE__ */ D(c, {
283
+ description: W.error.message,
284
+ onRetry: () => void W.refetch()
281
285
  })]
282
286
  });
283
- if (!Z) return /* @__PURE__ */ A(n, {
284
- title: N("healthybowl.distribution.detail.title", "CSA plan"),
285
- children: [/* @__PURE__ */ k(m, {}), /* @__PURE__ */ k(s, {
286
- title: N("healthybowl.distribution.detail.notFound.title", "Plan not found"),
287
- description: N("healthybowl.distribution.detail.notFound.description", "This CSA plan no longer exists.")
287
+ if (!X) return /* @__PURE__ */ O(n, {
288
+ title: M("healthybowl.distribution.detail.title", "CSA plan"),
289
+ children: [/* @__PURE__ */ D(h, {}), /* @__PURE__ */ D(s, {
290
+ title: M("healthybowl.distribution.detail.notFound.title", "Plan not found"),
291
+ description: M("healthybowl.distribution.detail.notFound.description", "This CSA plan no longer exists.")
288
292
  })]
289
293
  });
290
- let le = Q.filter((e) => e.status === "ACTIVE").length, ue = Q.filter((e) => e.status === "PAUSED").length, de = Z.capacityRemaining === null ? Z.capacityReason === "CAPACITY_ZERO" ? N("healthybowl.distribution.detail.stats.noPlaces", "No places") : N("healthybowl.distribution.detail.stats.noLimit", "No limit") : Z.capacityRemaining < 0 ? N("healthybowl.distribution.detail.stats.overCapacity", "{{n}} over capacity", { n: Math.abs(Z.capacityRemaining) }) : N("healthybowl.distribution.detail.stats.left", "{{n}} left", { n: Z.capacityRemaining });
291
- return /* @__PURE__ */ A(n, {
292
- title: Z.name,
293
- description: Z.description ?? void 0,
294
- actions: /* @__PURE__ */ A(j, {
295
- onClick: () => J(!0),
296
- children: [/* @__PURE__ */ k(E, { className: "h-4 w-4" }), N("healthybowl.distribution.detail.actions.enroll", "Enroll member")]
294
+ let ue = Z.filter((e) => e.status === "ACTIVE").length, de = Z.filter((e) => e.status === "PAUSED").length, fe = X.capacityRemaining === null ? X.capacityReason === "CAPACITY_ZERO" ? M("healthybowl.distribution.detail.stats.noPlaces", "No places") : M("healthybowl.distribution.detail.stats.noLimit", "No limit") : X.capacityRemaining < 0 ? M("healthybowl.distribution.detail.stats.overCapacity", "{{n}} over capacity", { n: Math.abs(X.capacityRemaining) }) : M("healthybowl.distribution.detail.stats.left", "{{n}} left", { n: X.capacityRemaining });
295
+ return /* @__PURE__ */ O(n, {
296
+ title: X.name,
297
+ description: X.description ?? void 0,
298
+ actions: /* @__PURE__ */ O(k, {
299
+ onClick: () => q(!0),
300
+ children: [/* @__PURE__ */ D(E, { className: "h-4 w-4" }), M("healthybowl.distribution.detail.actions.enroll", "Enroll member")]
297
301
  }),
298
302
  children: [
299
- /* @__PURE__ */ k(u, { items: [{
300
- label: N("healthybowl.distribution.nav.csa", "CSA Boxes"),
301
- href: F("distribution/csa")
302
- }, { label: Z.name }] }),
303
- /* @__PURE__ */ A("div", {
303
+ /* @__PURE__ */ D(u, { items: [{
304
+ label: M("healthybowl.distribution.nav.csa", "CSA Boxes"),
305
+ href: P("distribution/csa")
306
+ }, { label: X.name }] }),
307
+ /* @__PURE__ */ O("div", {
304
308
  className: "flex flex-wrap items-center gap-2",
305
309
  children: [
306
- /* @__PURE__ */ k(o, {
307
- variant: y(Z.status),
308
- label: Z.status,
310
+ /* @__PURE__ */ D(o, {
311
+ variant: b(X.status),
312
+ label: X.status,
309
313
  dot: !0
310
314
  }),
311
- /* @__PURE__ */ k(o, {
315
+ /* @__PURE__ */ D(o, {
312
316
  variant: "info",
313
- label: `${Z.boxSize} · ${Z.frequency}`
317
+ label: `${X.boxSize} · ${X.frequency}`
314
318
  }),
315
- /* @__PURE__ */ A("span", {
319
+ /* @__PURE__ */ O("span", {
316
320
  className: "inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary",
317
- children: [/* @__PURE__ */ k(S, { className: "h-3.5 w-3.5" }), N("healthybowl.distribution.detail.deliveryDay", "Delivers {{day}}", { day: _(Z.deliveryDayOfWeek) })]
321
+ children: [/* @__PURE__ */ D(S, { className: "h-3.5 w-3.5" }), M("healthybowl.distribution.detail.deliveryDay", "Delivers {{day}}", { day: v(X.deliveryDayOfWeek) })]
318
322
  }),
319
- /* @__PURE__ */ k(o, {
320
- variant: g(Z.billingSyncStatus),
321
- label: `Billing: ${Z.billingSyncStatus}`
323
+ /* @__PURE__ */ D(o, {
324
+ variant: _(X.billingSyncStatus),
325
+ label: `Billing: ${X.billingSyncStatus}`
322
326
  })
323
327
  ]
324
328
  }),
325
- /* @__PURE__ */ A("div", {
329
+ /* @__PURE__ */ O("div", {
326
330
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
327
331
  children: [
328
- /* @__PURE__ */ k(i, {
329
- label: N("healthybowl.distribution.detail.stats.price", "Price per box"),
330
- value: e(Z.price, Z.currency || "INR"),
332
+ /* @__PURE__ */ D(i, {
333
+ label: M("healthybowl.distribution.detail.stats.price", "Price per box"),
334
+ value: e(X.price, X.currency || "INR"),
331
335
  hero: !0
332
336
  }),
333
- /* @__PURE__ */ k(i, {
334
- label: N("healthybowl.distribution.detail.stats.active", "Active members"),
335
- value: le
336
- }),
337
- /* @__PURE__ */ k(i, {
338
- label: N("healthybowl.distribution.detail.stats.paused", "Paused"),
337
+ /* @__PURE__ */ D(i, {
338
+ label: M("healthybowl.distribution.detail.stats.active", "Active members"),
339
339
  value: ue
340
340
  }),
341
- /* @__PURE__ */ k(i, {
342
- label: N("healthybowl.distribution.detail.stats.capacity", "Capacity"),
341
+ /* @__PURE__ */ D(i, {
342
+ label: M("healthybowl.distribution.detail.stats.paused", "Paused"),
343
343
  value: de
344
+ }),
345
+ /* @__PURE__ */ D(i, {
346
+ label: M("healthybowl.distribution.detail.stats.capacity", "Capacity"),
347
+ value: fe
344
348
  })
345
349
  ]
346
350
  }),
347
- Z.contents.length > 0 && /* @__PURE__ */ A("div", {
351
+ X.contents.length > 0 && /* @__PURE__ */ O("div", {
348
352
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
349
- children: [/* @__PURE__ */ k("h3", {
353
+ children: [/* @__PURE__ */ D("h3", {
350
354
  className: "mb-2 text-sm font-semibold text-text-primary",
351
- children: N("healthybowl.distribution.detail.contents", "Box contents")
352
- }), /* @__PURE__ */ k("div", {
355
+ children: M("healthybowl.distribution.detail.contents", "Box contents")
356
+ }), /* @__PURE__ */ D("div", {
353
357
  className: "flex flex-wrap gap-2",
354
- children: Z.contents.map((e, t) => /* @__PURE__ */ A("span", {
358
+ children: X.contents.map((e, t) => /* @__PURE__ */ O("span", {
355
359
  className: "inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary",
356
- children: [e.productName, /* @__PURE__ */ A("span", {
360
+ children: [e.productName, /* @__PURE__ */ O("span", {
357
361
  className: "text-text-primary",
358
362
  children: [
359
363
  e.quantity,
@@ -364,36 +368,36 @@ var N = () => {
364
368
  }, `${e.productName}-${t}`))
365
369
  })]
366
370
  }),
367
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h2", {
371
+ /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("h2", {
368
372
  className: "mb-3 text-lg font-semibold text-text-primary",
369
- children: N("healthybowl.distribution.detail.membersTitle", "Members")
370
- }), K.loading && Q.length === 0 ? /* @__PURE__ */ k(d, {}) : K.error && Q.length === 0 ? /* @__PURE__ */ k(c, {
371
- description: K.error.message,
372
- onRetry: () => void K.refetch()
373
- }) : Q.length === 0 ? /* @__PURE__ */ k(s, {
374
- icon: /* @__PURE__ */ k(E, { className: "h-8 w-8 text-text-secondary" }),
375
- title: N("healthybowl.distribution.detail.empty.title", "No members yet"),
376
- description: N("healthybowl.distribution.detail.empty.description", "Enroll members to start scheduling their recurring boxes."),
377
- action: /* @__PURE__ */ A(j, {
378
- onClick: () => J(!0),
379
- children: [/* @__PURE__ */ k(E, { className: "h-4 w-4" }), N("healthybowl.distribution.detail.actions.enroll", "Enroll member")]
373
+ children: M("healthybowl.distribution.detail.membersTitle", "Members")
374
+ }), G.loading && Z.length === 0 ? /* @__PURE__ */ D(d, {}) : G.error && Z.length === 0 ? /* @__PURE__ */ D(c, {
375
+ description: G.error.message,
376
+ onRetry: () => void G.refetch()
377
+ }) : Z.length === 0 ? /* @__PURE__ */ D(s, {
378
+ icon: /* @__PURE__ */ D(E, { className: "h-8 w-8 text-text-secondary" }),
379
+ title: M("healthybowl.distribution.detail.empty.title", "No members yet"),
380
+ description: M("healthybowl.distribution.detail.empty.description", "Enroll members to start scheduling their recurring boxes."),
381
+ action: /* @__PURE__ */ O(k, {
382
+ onClick: () => q(!0),
383
+ children: [/* @__PURE__ */ D(E, { className: "h-4 w-4" }), M("healthybowl.distribution.detail.actions.enroll", "Enroll member")]
380
384
  })
381
- }) : /* @__PURE__ */ k(a, {
382
- columns: ce,
383
- data: Q,
385
+ }) : /* @__PURE__ */ D(a, {
386
+ columns: $,
387
+ data: Z,
384
388
  keyField: "id",
385
389
  pageSize: 10
386
390
  })] }),
387
- /* @__PURE__ */ k(h, {
388
- open: q,
389
- onClose: () => J(!1),
390
- planName: Z.name,
391
- onSubmit: re
391
+ /* @__PURE__ */ D(g, {
392
+ open: K,
393
+ onClose: () => q(!1),
394
+ planName: X.name,
395
+ onSubmit: ae
392
396
  })
393
397
  ]
394
398
  });
395
399
  };
396
400
  //#endregion
397
- export { N as CsaPlanDetailPage };
401
+ export { M as CsaPlanDetailPage };
398
402
 
399
403
  //# sourceMappingURL=CsaPlanDetailPage.js.map