@burdenoff/microfe-healthybowl 2026.1018.2 → 2026.1018.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ var p = ({ inline: p, compact: m, className: h }) => {
17
17
  onClick: () => void T({ manual: !0 }),
18
18
  disabled: y || !v,
19
19
  title: v ? "Sync now" : "Reconnect to sync",
20
- className: `inline-flex shrink-0 items-center gap-1.5 rounded-lg bg-bg-surface px-2.5 py-1 text-xs font-semibold text-text-primary shadow-sm ring-1 ring-border-subtle transition hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50 ${m ? "hidden lg:inline-flex" : ""}`,
20
+ className: `shrink-0 items-center gap-1.5 rounded-lg bg-bg-surface px-2.5 py-1 text-xs font-semibold text-text-primary shadow-sm ring-1 ring-border-subtle transition hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50 ${m ? "hidden lg:inline-flex" : "inline-flex"}`,
21
21
  children: [/* @__PURE__ */ d(s, { className: `h-3.5 w-3.5 ${y ? "animate-spin" : ""}` }), "Sync Now"]
22
22
  });
23
23
  return m ? /* @__PURE__ */ f("div", {
@@ -1,575 +1,622 @@
1
- import { formatCurrency as e, formatDateOnly as t } from "../../utils/helpers.js";
2
- import { PageLayout as n } from "../../components/PageLayout.js";
3
- import { StatCard as r } from "../../components/StatCard.js";
4
- import { StatusBadge as i } from "../../components/StatusBadge.js";
5
- import { EmptyState as a } from "../../components/EmptyState.js";
1
+ import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
2
+ import { formatCurrency as t, formatDateOnly as n } from "../../utils/helpers.js";
3
+ import { PageLayout as r } from "../../components/PageLayout.js";
4
+ import { StatCard as i } from "../../components/StatCard.js";
5
+ import { StatusBadge as a } from "../../components/StatusBadge.js";
6
+ import { EmptyState as ee } from "../../components/EmptyState.js";
6
7
  import { ErrorState as o } from "../../components/ErrorState.js";
7
8
  import { useConfirm as s } from "../../components/ConfirmDialog.js";
8
9
  import { PageLoader as c } from "../../components/PageLoader.js";
9
10
  import { Modal as l } from "../../components/Modal.js";
10
- import { useToast as u } from "../../hooks/useToast.js";
11
+ import { useToast as te } from "../../hooks/useToast.js";
11
12
  import "../../components/index.js";
12
- import { useHealthyBowlContractDetail as d, useHealthyBowlContracts as f } from "../../hooks/useHealthyBowlContracts.js";
13
- import { assignmentStatusVariant as ee, contractStatusVariant as p, deliveryStatusVariant as te, formatQty as m, fulfilmentLabel as ne, healthLabel as re, healthVariant as ie, humanizeEnum as h } from "../../utils/contracts.js";
14
- import { gradedDeliveries as ae, parseGradeResult as oe, summariseGrade as g } from "../../utils/qualitySpec.js";
15
- import { CreateContractModal as se } from "./contract-forms/CreateContractModal.js";
16
- import { InviteFarmModal as ce } from "./contract-forms/InviteFarmModal.js";
17
- import { RecordDeliveryModal as _ } from "./contract-forms/RecordDeliveryModal.js";
18
- import { DeliveryActionModal as le } from "./contract-forms/DeliveryActionModal.js";
19
- import { DeliveryGrade as v } from "./DeliveryGrade.js";
20
- import { useMemo as ue, useState as y } from "react";
21
- import { useI18n as de } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
22
- import { BadgeIndianRupee as b, CheckCircle2 as x, ClipboardCheck as fe, FileSignature as S, Gauge as pe, Handshake as me, Inbox as he, Info as ge, Plus as C, Trash2 as w, Truck as T, UserPlus as E, Users as D, Wallet as O } from "lucide-react";
23
- import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
24
- import { Button as M } from "@burdenoff/fe-libs/ui";
13
+ import { useHealthyBowlContractDetail as ne, useHealthyBowlContracts as re } from "../../hooks/useHealthyBowlContracts.js";
14
+ import { assignmentStatusVariant as ie, contractStatusVariant as u, deliveryStatusVariant as ae, formatQty as d, fulfilmentLabel as oe, healthLabel as se, healthVariant as ce, humanizeEnum as f } from "../../utils/contracts.js";
15
+ import { gradedDeliveries as le, parseGradeResult as ue, summariseGrade as p } from "../../utils/qualitySpec.js";
16
+ import { CreateContractModal as de } from "./contract-forms/CreateContractModal.js";
17
+ import { InviteFarmModal as fe } from "./contract-forms/InviteFarmModal.js";
18
+ import { RecordDeliveryModal as pe } from "./contract-forms/RecordDeliveryModal.js";
19
+ import { DeliveryActionModal as me } from "./contract-forms/DeliveryActionModal.js";
20
+ import { DeliveryGrade as m } from "./DeliveryGrade.js";
21
+ import { useEffect as he, useMemo as ge, useRef as h, useState as g } from "react";
22
+ import { useI18n as _e } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
23
+ import { BadgeIndianRupee as _, CheckCircle2 as v, ClipboardCheck as ve, FileSignature as y, Gauge as ye, Handshake as be, Inbox as xe, Info as Se, Plus as b, Trash2 as Ce, Truck as we, UserPlus as Te, Users as Ee, Wallet as De } from "lucide-react";
24
+ import { Fragment as Oe, jsx as x, jsxs as S } from "react/jsx-runtime";
25
+ import { Button as C } from "@burdenoff/fe-libs/ui";
26
+ import { CombinedGraphQLErrors as w } from "@apollo/client";
27
+ import { PermissionProvider as T, usePermissions as ke } from "@burdenoff/fe-libs/shared/providers/shell/PermissionProvider";
25
28
  //#region src/healthybowl/pages/contracts/ContractsPage.tsx
26
- var N = "px-3 py-2 text-start text-xs font-medium uppercase tracking-wide text-text-secondary", P = "px-3 py-2 text-sm text-text-primary";
27
- function F() {
28
- let { t: F } = de(), { toast: I } = u(), L = s(), { dashboard: R, contracts: z, invitations: B, obligations: V, loading: _e, error: H, refetchAll: ve, createContract: ye, activateContract: be, inviteFarm: xe, acceptAssignment: Se, revokeAssignment: Ce, recordDelivery: we, gradeDelivery: Te, settleDelivery: Ee } = f(), [De, U] = y(!1), [Oe, W] = y(!1), [ke, G] = y(!1), [K, q] = y(null), [J, Y] = y(null), X = d(K), Z = ue(() => z.find((e) => e.id === K) ?? null, [z, K]), Q = (e) => I({
29
- title: F("healthybowl.common.error", "Something went wrong"),
29
+ var E = "px-3 py-2 text-start text-xs font-medium uppercase tracking-wide text-text-secondary", D = "px-3 py-2 text-sm text-text-primary";
30
+ function O() {
31
+ let { workspaceId: t, currentUser: n } = e();
32
+ return /* @__PURE__ */ x(T, {
33
+ scopeId: t || null,
34
+ gateway: "workspace",
35
+ children: /* @__PURE__ */ x(k, { workspaceId: t })
36
+ }, JSON.stringify([t, n?.id]));
37
+ }
38
+ function k({ workspaceId: e }) {
39
+ let { t: T } = _e(), { toast: O } = te(), k = s(), { hasPermission: A, isLoading: Ae, error: je, scopeId: Me } = ke(), j = !!e && Me === e && !Ae && !je, M = !!(j && A("healthybowl_contract_assignment:update")), N = !!(j && A("healthybowl_contract_assignment:delete")), P = h({
40
+ canAccept: M,
41
+ canRevoke: N
42
+ });
43
+ P.current = {
44
+ canAccept: M,
45
+ canRevoke: N
46
+ };
47
+ let F = h(!1);
48
+ he(() => (F.current = !0, () => {
49
+ F.current = !1;
50
+ }), []);
51
+ let { dashboard: I, contracts: L, invitations: R, obligations: z, loading: Ne, error: Pe, refetchAll: Fe, createContract: Ie, activateContract: Le, inviteFarm: Re, acceptAssignment: ze, revokeAssignment: Be, recordDelivery: Ve, gradeDelivery: He, settleDelivery: Ue } = re(), [We, B] = g(!1), [Ge, V] = g(!1), [Ke, H] = g(!1), [U, W] = g(null), [G, K] = g(null), q = ne(U), J = ge(() => L.find((e) => e.id === U) ?? null, [L, U]), Y = (e) => O({
52
+ title: T("healthybowl.common.error", "Something went wrong"),
30
53
  description: e instanceof Error ? e.message : void 0,
31
54
  variant: "error"
32
- }), Ae = async (e) => {
33
- await ye(e), I({
34
- title: F("healthybowl.contracts.toast.created", "Contract created"),
55
+ }), X = () => O({
56
+ title: T("healthybowl.contracts.permissionDenied.title", "Contract action not permitted"),
57
+ description: T("healthybowl.contracts.permissionDenied.description", "Your current permissions do not allow this action on this farm assignment. Ask your workspace administrator for access."),
58
+ variant: "error"
59
+ }), Z = (e) => {
60
+ w.is(e) && e.errors.some((e) => e.extensions?.code === "FORBIDDEN" && !e.extensions?.authFailure) ? X() : Y(e);
61
+ }, Q = async (e) => {
62
+ await Ie(e), O({
63
+ title: T("healthybowl.contracts.toast.created", "Contract created"),
35
64
  variant: "success"
36
65
  });
37
- }, je = async (e) => {
38
- K && (await xe({
66
+ }, qe = async (e) => {
67
+ U && (await Re({
39
68
  ...e,
40
- contractId: K
41
- }), await X.refetch(), I({
42
- title: F("healthybowl.contracts.toast.invited", "Farm invited"),
69
+ contractId: U
70
+ }), await q.refetch(), O({
71
+ title: T("healthybowl.contracts.toast.invited", "Farm invited"),
43
72
  variant: "success"
44
73
  }));
45
- }, Me = async (e) => {
46
- await we(e), await X.refetch(), I({
47
- title: F("healthybowl.contracts.toast.recorded", "Delivery recorded"),
74
+ }, Je = async (e) => {
75
+ await Ve(e), await q.refetch(), O({
76
+ title: T("healthybowl.contracts.toast.recorded", "Delivery recorded"),
48
77
  variant: "success"
49
78
  });
50
- }, Ne = async (e) => {
51
- J && (J.mode === "grade" ? (await Te(e), I({
52
- title: F("healthybowl.contracts.toast.graded", "Delivery graded"),
79
+ }, Ye = async (e) => {
80
+ G && (G.mode === "grade" ? (await He(e), O({
81
+ title: T("healthybowl.contracts.toast.graded", "Delivery graded"),
53
82
  variant: "success"
54
- })) : (await Ee(e), I({
55
- title: F("healthybowl.contracts.toast.settled", "Delivery settled"),
83
+ })) : (await Ue(e), O({
84
+ title: T("healthybowl.contracts.toast.settled", "Delivery settled"),
56
85
  variant: "success"
57
- })), await X.refetch());
58
- }, Pe = async (e) => {
86
+ })), await q.refetch());
87
+ }, Xe = async (e) => {
59
88
  try {
60
- await be(e.id), await X.refetch(), I({
61
- title: F("healthybowl.contracts.toast.activated", "Contract activated"),
89
+ await Le(e.id), await q.refetch(), O({
90
+ title: T("healthybowl.contracts.toast.activated", "Contract activated"),
62
91
  variant: "success"
63
92
  });
64
93
  } catch (e) {
65
- Q(e);
94
+ Y(e);
66
95
  }
67
- }, Fe = async (e) => {
68
- try {
69
- await Se(e), I({
70
- title: F("healthybowl.contracts.toast.accepted", "Invitation accepted"),
71
- variant: "success"
72
- });
73
- } catch (e) {
74
- Q(e);
96
+ }, Ze = async (e) => {
97
+ if (F.current) {
98
+ if (!P.current.canAccept) {
99
+ X();
100
+ return;
101
+ }
102
+ try {
103
+ await ze(e), O({
104
+ title: T("healthybowl.contracts.toast.accepted", "Invitation accepted"),
105
+ variant: "success"
106
+ });
107
+ } catch (e) {
108
+ Z(e);
109
+ }
75
110
  }
76
- }, Ie = async (e, t) => {
77
- if (await L({
78
- title: F("healthybowl.contracts.revoke.title", "Revoke assignment?"),
79
- message: F("healthybowl.contracts.revoke.body", "This immediately stops all data sharing with {{f}}.", { f: t }),
80
- okButtonTitle: F("healthybowl.common.remove", "Revoke"),
81
- destructive: !0
82
- })) try {
83
- await Ce(e), await X.refetch(), I({
84
- title: F("healthybowl.contracts.toast.revoked", "Assignment revoked"),
85
- variant: "success"
86
- });
87
- } catch (e) {
88
- Q(e);
111
+ }, Qe = async (e, t) => {
112
+ if (F.current) {
113
+ if (!P.current.canRevoke) {
114
+ X();
115
+ return;
116
+ }
117
+ if (!(!await k({
118
+ title: T("healthybowl.contracts.revoke.title", "Revoke assignment?"),
119
+ message: T("healthybowl.contracts.revoke.body", "This immediately stops all data sharing with {{f}}.", { f: t }),
120
+ okButtonTitle: T("healthybowl.common.remove", "Revoke"),
121
+ destructive: !0
122
+ }) || !F.current)) {
123
+ if (!P.current.canRevoke) {
124
+ X();
125
+ return;
126
+ }
127
+ try {
128
+ await Be(e), await q.refetch(), O({
129
+ title: T("healthybowl.contracts.toast.revoked", "Assignment revoked"),
130
+ variant: "success"
131
+ });
132
+ } catch (e) {
133
+ Z(e);
134
+ }
135
+ }
89
136
  }
90
- }, $ = B.length > 0 || V.length > 0, Le = z.length > 0 || !$, Re = /* @__PURE__ */ j(M, {
137
+ }, $ = R.length > 0 || z.length > 0, $e = L.length > 0 || !$, et = /* @__PURE__ */ S(C, {
91
138
  size: "sm",
92
- onClick: () => U(!0),
93
- children: [/* @__PURE__ */ A(C, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.newContract", "New contract")]
94
- }), ze = /* @__PURE__ */ j(k, { children: [
95
- /* @__PURE__ */ A(se, {
96
- open: De,
97
- onClose: () => U(!1),
98
- onSubmit: Ae
139
+ onClick: () => B(!0),
140
+ children: [/* @__PURE__ */ x(b, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.newContract", "New contract")]
141
+ }), tt = /* @__PURE__ */ S(Oe, { children: [
142
+ /* @__PURE__ */ x(de, {
143
+ open: We,
144
+ onClose: () => B(!1),
145
+ onSubmit: Q
99
146
  }),
100
- /* @__PURE__ */ A(ce, {
101
- open: Oe,
102
- onClose: () => W(!1),
103
- contractCrop: Z?.crop,
104
- onSubmit: je
147
+ /* @__PURE__ */ x(fe, {
148
+ open: Ge,
149
+ onClose: () => V(!1),
150
+ contractCrop: J?.crop,
151
+ onSubmit: qe
105
152
  }),
106
- /* @__PURE__ */ A(_, {
107
- open: ke,
108
- onClose: () => G(!1),
109
- contractId: K ?? "",
110
- assignments: X.assignments,
111
- onSubmit: Me
153
+ /* @__PURE__ */ x(pe, {
154
+ open: Ke,
155
+ onClose: () => H(!1),
156
+ contractId: U ?? "",
157
+ assignments: q.assignments,
158
+ onSubmit: Je
112
159
  }),
113
- /* @__PURE__ */ A(le, {
114
- open: J != null,
115
- mode: J?.mode ?? "grade",
116
- delivery: J?.delivery ?? null,
117
- agreedPrice: Z?.agreedPrice ?? 0,
118
- qualitySpec: Z?.qualitySpec ?? null,
119
- unit: Z?.unit,
120
- onClose: () => Y(null),
121
- onSubmit: Ne
160
+ /* @__PURE__ */ x(me, {
161
+ open: G != null,
162
+ mode: G?.mode ?? "grade",
163
+ delivery: G?.delivery ?? null,
164
+ agreedPrice: J?.agreedPrice ?? 0,
165
+ qualitySpec: J?.qualitySpec ?? null,
166
+ unit: J?.unit,
167
+ onClose: () => K(null),
168
+ onSubmit: Ye
122
169
  })
123
170
  ] });
124
- return /* @__PURE__ */ j(n, {
125
- title: F("healthybowl.contracts.title", "Contracts"),
126
- description: F("healthybowl.contracts.subtitle", "Contract & managed farming"),
171
+ return /* @__PURE__ */ S(r, {
172
+ title: T("healthybowl.contracts.title", "Contracts"),
173
+ description: T("healthybowl.contracts.subtitle", "Contract & managed farming"),
127
174
  purpose: "Run forward crop programmes across your contracted farms: agree a crop, quota, quality spec and price, invite farms (they accept from their own workspace before any data is shared), then track fulfilment as harvest is delivered, graded, and settled back to the farm — net of any input advance. Contracted farmers see their own quota, agreed price and payments received.",
128
- actions: Re,
129
- children: [_e && z.length === 0 && !$ ? /* @__PURE__ */ A(c, {}) : H && z.length === 0 && !$ ? /* @__PURE__ */ A(o, { onRetry: ve }) : /* @__PURE__ */ j("div", {
175
+ actions: et,
176
+ children: [Ne && L.length === 0 && !$ ? /* @__PURE__ */ x(c, {}) : Pe && L.length === 0 && !$ ? /* @__PURE__ */ x(o, { onRetry: Fe }) : /* @__PURE__ */ S("div", {
130
177
  className: "space-y-8",
131
178
  children: [
132
- Le ? /* @__PURE__ */ j("section", {
179
+ $e ? /* @__PURE__ */ S("section", {
133
180
  className: "space-y-4",
134
181
  children: [
135
- /* @__PURE__ */ j("div", {
182
+ /* @__PURE__ */ S("div", {
136
183
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
137
184
  children: [
138
- /* @__PURE__ */ A(r, {
185
+ /* @__PURE__ */ x(i, {
139
186
  hero: !0,
140
- label: F("healthybowl.contracts.kpi.active", "Active contracts"),
141
- value: R?.activeContracts ?? 0,
142
- icon: /* @__PURE__ */ A(me, { className: "h-4 w-4" })
187
+ label: T("healthybowl.contracts.kpi.active", "Active contracts"),
188
+ value: I?.activeContracts ?? 0,
189
+ icon: /* @__PURE__ */ x(be, { className: "h-4 w-4" })
143
190
  }),
144
- /* @__PURE__ */ A(r, {
145
- label: F("healthybowl.contracts.kpi.farms", "Contracted farms"),
146
- value: R?.contractedFarms ?? 0,
147
- icon: /* @__PURE__ */ A(D, { className: "h-4 w-4" })
191
+ /* @__PURE__ */ x(i, {
192
+ label: T("healthybowl.contracts.kpi.farms", "Contracted farms"),
193
+ value: I?.contractedFarms ?? 0,
194
+ icon: /* @__PURE__ */ x(Ee, { className: "h-4 w-4" })
148
195
  }),
149
- /* @__PURE__ */ A(r, {
150
- label: F("healthybowl.contracts.kpi.fulfilment", "Avg fulfilment %"),
151
- value: `${R?.avgFulfilmentPct ?? 0}%`,
152
- icon: /* @__PURE__ */ A(pe, { className: "h-4 w-4" })
196
+ /* @__PURE__ */ x(i, {
197
+ label: T("healthybowl.contracts.kpi.fulfilment", "Avg fulfilment %"),
198
+ value: `${I?.avgFulfilmentPct ?? 0}%`,
199
+ icon: /* @__PURE__ */ x(ye, { className: "h-4 w-4" })
153
200
  }),
154
- /* @__PURE__ */ A(r, {
155
- label: F("healthybowl.contracts.kpi.settlementDue", "Settlement due"),
156
- value: e(R?.settlementDue ?? 0, "INR"),
157
- icon: /* @__PURE__ */ A(O, { className: "h-4 w-4" })
201
+ /* @__PURE__ */ x(i, {
202
+ label: T("healthybowl.contracts.kpi.settlementDue", "Settlement due"),
203
+ value: t(I?.settlementDue ?? 0, "INR"),
204
+ icon: /* @__PURE__ */ x(De, { className: "h-4 w-4" })
158
205
  })
159
206
  ]
160
207
  }),
161
- /* @__PURE__ */ j("div", {
208
+ /* @__PURE__ */ S("div", {
162
209
  className: "flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken/40 p-3 text-xs text-text-secondary",
163
- children: [/* @__PURE__ */ A(ge, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ A("p", { children: F("healthybowl.contracts.dashboard.scopeNotice", "Fulfilment % and contracted-farm totals roll up delivered quantity across all farms on a contract. Delivery does not yet combine farms into one lot, order or shipment — each farm’s delivery creates its own order and shipment in its own workspace, so received produce is still reconciled per farm, one delivery at a time.") })]
210
+ children: [/* @__PURE__ */ x(Se, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ x("p", { children: T("healthybowl.contracts.dashboard.scopeNotice", "Fulfilment % and contracted-farm totals roll up delivered quantity across all farms on a contract. Delivery does not yet combine farms into one lot, order or shipment — each farm’s delivery creates its own order and shipment in its own workspace, so received produce is still reconciled per farm, one delivery at a time.") })]
164
211
  }),
165
- z.length === 0 ? /* @__PURE__ */ A(a, {
166
- icon: /* @__PURE__ */ A(S, { className: "h-8 w-8 text-success" }),
167
- title: F("healthybowl.contracts.empty.title", "No contracts yet"),
168
- description: F("healthybowl.contracts.empty.description", "Create a forward crop programme, invite your contracted farms, and track fulfilment and settlement here."),
169
- action: /* @__PURE__ */ j(M, {
170
- onClick: () => U(!0),
171
- children: [/* @__PURE__ */ A(C, { className: "h-4 w-4" }), F("healthybowl.contracts.newContract", "New contract")]
212
+ L.length === 0 ? /* @__PURE__ */ x(ee, {
213
+ icon: /* @__PURE__ */ x(y, { className: "h-8 w-8 text-success" }),
214
+ title: T("healthybowl.contracts.empty.title", "No contracts yet"),
215
+ description: T("healthybowl.contracts.empty.description", "Create a forward crop programme, invite your contracted farms, and track fulfilment and settlement here."),
216
+ action: /* @__PURE__ */ S(C, {
217
+ onClick: () => B(!0),
218
+ children: [/* @__PURE__ */ x(b, { className: "h-4 w-4" }), T("healthybowl.contracts.newContract", "New contract")]
172
219
  })
173
- }) : /* @__PURE__ */ A("div", {
220
+ }) : /* @__PURE__ */ x("div", {
174
221
  className: "overflow-x-auto rounded-lg border border-border-subtle",
175
- children: /* @__PURE__ */ j("table", {
222
+ children: /* @__PURE__ */ S("table", {
176
223
  className: "min-w-full divide-y divide-border-subtle",
177
- children: [/* @__PURE__ */ A("thead", {
224
+ children: [/* @__PURE__ */ x("thead", {
178
225
  className: "bg-bg-surface",
179
- children: /* @__PURE__ */ j("tr", { children: [
180
- /* @__PURE__ */ A("th", {
181
- className: N,
182
- children: F("healthybowl.contracts.col.crop", "Crop")
226
+ children: /* @__PURE__ */ S("tr", { children: [
227
+ /* @__PURE__ */ x("th", {
228
+ className: E,
229
+ children: T("healthybowl.contracts.col.crop", "Crop")
183
230
  }),
184
- /* @__PURE__ */ A("th", {
185
- className: N,
186
- children: F("healthybowl.contracts.col.status", "Status")
231
+ /* @__PURE__ */ x("th", {
232
+ className: E,
233
+ children: T("healthybowl.contracts.col.status", "Status")
187
234
  }),
188
- /* @__PURE__ */ A("th", {
189
- className: N,
190
- children: F("healthybowl.contracts.col.fulfilment", "Delivered / quota")
235
+ /* @__PURE__ */ x("th", {
236
+ className: E,
237
+ children: T("healthybowl.contracts.col.fulfilment", "Delivered / quota")
191
238
  }),
192
- /* @__PURE__ */ A("th", {
193
- className: N,
194
- children: F("healthybowl.contracts.col.pct", "Fulfilment")
239
+ /* @__PURE__ */ x("th", {
240
+ className: E,
241
+ children: T("healthybowl.contracts.col.pct", "Fulfilment")
195
242
  }),
196
- /* @__PURE__ */ A("th", {
197
- className: N,
198
- children: F("healthybowl.contracts.col.price", "Price")
243
+ /* @__PURE__ */ x("th", {
244
+ className: E,
245
+ children: T("healthybowl.contracts.col.price", "Price")
199
246
  }),
200
- /* @__PURE__ */ A("th", {
201
- className: N,
202
- children: F("healthybowl.contracts.col.farms", "Farms")
247
+ /* @__PURE__ */ x("th", {
248
+ className: E,
249
+ children: T("healthybowl.contracts.col.farms", "Farms")
203
250
  }),
204
- /* @__PURE__ */ A("th", {
205
- className: N,
206
- children: F("healthybowl.contracts.col.due", "Settlement due")
251
+ /* @__PURE__ */ x("th", {
252
+ className: E,
253
+ children: T("healthybowl.contracts.col.due", "Settlement due")
207
254
  }),
208
- /* @__PURE__ */ A("th", {
209
- className: N,
210
- children: F("healthybowl.contracts.col.health", "Health")
255
+ /* @__PURE__ */ x("th", {
256
+ className: E,
257
+ children: T("healthybowl.contracts.col.health", "Health")
211
258
  })
212
259
  ] })
213
- }), /* @__PURE__ */ A("tbody", {
260
+ }), /* @__PURE__ */ x("tbody", {
214
261
  className: "divide-y divide-border-subtle",
215
- children: z.map((t) => {
216
- let n = R?.contracts.find((e) => e.contractId === t.id);
217
- return /* @__PURE__ */ j("tr", {
262
+ children: L.map((e) => {
263
+ let n = I?.contracts.find((t) => t.contractId === e.id);
264
+ return /* @__PURE__ */ S("tr", {
218
265
  className: "cursor-pointer hover:bg-bg-surface",
219
- onClick: () => q(t.id),
266
+ onClick: () => W(e.id),
220
267
  children: [
221
- /* @__PURE__ */ j("td", {
222
- className: P,
223
- children: [/* @__PURE__ */ A("div", {
268
+ /* @__PURE__ */ S("td", {
269
+ className: D,
270
+ children: [/* @__PURE__ */ x("div", {
224
271
  className: "font-medium",
225
- children: t.crop
226
- }), t.variety ? /* @__PURE__ */ A("div", {
272
+ children: e.crop
273
+ }), e.variety ? /* @__PURE__ */ x("div", {
227
274
  className: "text-xs text-text-secondary",
228
- children: t.variety
275
+ children: e.variety
229
276
  }) : null]
230
277
  }),
231
- /* @__PURE__ */ A("td", {
232
- className: P,
233
- children: /* @__PURE__ */ A(i, {
234
- variant: p(t.status),
235
- label: h(t.status)
278
+ /* @__PURE__ */ x("td", {
279
+ className: D,
280
+ children: /* @__PURE__ */ x(a, {
281
+ variant: u(e.status),
282
+ label: f(e.status)
236
283
  })
237
284
  }),
238
- /* @__PURE__ */ A("td", {
239
- className: `${P} tabular-nums`,
240
- children: ne(n?.deliveredQty ?? 0, t.quotaQty, t.unit)
285
+ /* @__PURE__ */ x("td", {
286
+ className: `${D} tabular-nums`,
287
+ children: oe(n?.deliveredQty ?? 0, e.quotaQty, e.unit)
241
288
  }),
242
- /* @__PURE__ */ j("td", {
243
- className: `${P} tabular-nums`,
289
+ /* @__PURE__ */ S("td", {
290
+ className: `${D} tabular-nums`,
244
291
  children: [n?.fulfilmentPct ?? 0, "%"]
245
292
  }),
246
- /* @__PURE__ */ j("td", {
247
- className: `${P} tabular-nums`,
248
- children: [e(t.agreedPrice, "INR"), /* @__PURE__ */ j("span", {
293
+ /* @__PURE__ */ S("td", {
294
+ className: `${D} tabular-nums`,
295
+ children: [t(e.agreedPrice, "INR"), /* @__PURE__ */ S("span", {
249
296
  className: "text-xs text-text-secondary",
250
- children: ["/", t.unit]
297
+ children: ["/", e.unit]
251
298
  })]
252
299
  }),
253
- /* @__PURE__ */ A("td", {
254
- className: `${P} tabular-nums`,
255
- children: t.acceptedFarmCount
300
+ /* @__PURE__ */ x("td", {
301
+ className: `${D} tabular-nums`,
302
+ children: e.acceptedFarmCount
256
303
  }),
257
- /* @__PURE__ */ A("td", {
258
- className: `${P} tabular-nums`,
259
- children: e(n?.settlementDue ?? 0, "INR")
304
+ /* @__PURE__ */ x("td", {
305
+ className: `${D} tabular-nums`,
306
+ children: t(n?.settlementDue ?? 0, "INR")
260
307
  }),
261
- /* @__PURE__ */ A("td", {
262
- className: P,
263
- children: n ? /* @__PURE__ */ A(i, {
264
- variant: ie(n.health),
265
- label: re(n.health)
308
+ /* @__PURE__ */ x("td", {
309
+ className: D,
310
+ children: n ? /* @__PURE__ */ x(a, {
311
+ variant: ce(n.health),
312
+ label: se(n.health)
266
313
  }) : "—"
267
314
  })
268
315
  ]
269
- }, t.id);
316
+ }, e.id);
270
317
  })
271
318
  })]
272
319
  })
273
320
  })
274
321
  ]
275
322
  }) : null,
276
- B.length > 0 ? /* @__PURE__ */ j("section", {
323
+ R.length > 0 ? /* @__PURE__ */ S("section", {
277
324
  className: "space-y-3",
278
- children: [/* @__PURE__ */ j("h2", {
325
+ children: [/* @__PURE__ */ S("h2", {
279
326
  className: "flex items-center gap-2 text-lg font-semibold text-text-primary",
280
- children: [/* @__PURE__ */ A(he, { className: "h-5 w-5 text-info" }), F("healthybowl.contracts.invitations.title", "Contract invitations")]
281
- }), /* @__PURE__ */ A("ul", {
327
+ children: [/* @__PURE__ */ x(xe, { className: "h-5 w-5 text-info" }), T("healthybowl.contracts.invitations.title", "Contract invitations")]
328
+ }), /* @__PURE__ */ x("ul", {
282
329
  className: "space-y-2",
283
- children: B.map((e) => /* @__PURE__ */ j("li", {
330
+ children: R.map((e) => /* @__PURE__ */ S("li", {
284
331
  className: "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3",
285
- children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("div", {
332
+ children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
286
333
  className: "font-medium text-text-primary",
287
- children: [e.crop ?? F("healthybowl.contracts.aContract", "A contract"), e.allocationQty ? /* @__PURE__ */ j("span", {
334
+ children: [e.crop ?? T("healthybowl.contracts.aContract", "A contract"), e.allocationQty ? /* @__PURE__ */ S("span", {
288
335
  className: "ms-2 text-sm text-text-secondary",
289
336
  children: [
290
- m(e.allocationQty),
337
+ d(e.allocationQty),
291
338
  " ",
292
- F("healthybowl.contracts.allocated", "allocated")
339
+ T("healthybowl.contracts.allocated", "allocated")
293
340
  ]
294
341
  }) : null]
295
- }), /* @__PURE__ */ A("div", {
342
+ }), /* @__PURE__ */ x("div", {
296
343
  className: "text-xs text-text-secondary",
297
- children: F("healthybowl.contracts.invitedOn", "Invited {{d}}", { d: t(e.invitedAt) })
298
- })] }), /* @__PURE__ */ j(M, {
344
+ children: T("healthybowl.contracts.invitedOn", "Invited {{d}}", { d: n(e.invitedAt) })
345
+ })] }), M ? /* @__PURE__ */ S(C, {
299
346
  size: "sm",
300
- onClick: () => Fe(e.id),
301
- children: [/* @__PURE__ */ A(x, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.accept", "Accept")]
302
- })]
347
+ onClick: () => Ze(e.id),
348
+ children: [/* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.accept", "Accept")]
349
+ }) : null]
303
350
  }, e.id))
304
351
  })]
305
352
  }) : null,
306
- V.length > 0 ? /* @__PURE__ */ j("section", {
353
+ z.length > 0 ? /* @__PURE__ */ S("section", {
307
354
  className: "space-y-3",
308
- children: [/* @__PURE__ */ j("h2", {
355
+ children: [/* @__PURE__ */ S("h2", {
309
356
  className: "flex items-center gap-2 text-lg font-semibold text-text-primary",
310
- children: [/* @__PURE__ */ A(b, { className: "h-5 w-5 text-success" }), F("healthybowl.contracts.obligations.title", "My contract obligations")]
311
- }), /* @__PURE__ */ A("div", {
357
+ children: [/* @__PURE__ */ x(_, { className: "h-5 w-5 text-success" }), T("healthybowl.contracts.obligations.title", "My contract obligations")]
358
+ }), /* @__PURE__ */ x("div", {
312
359
  className: "grid grid-cols-1 gap-3 md:grid-cols-2",
313
- children: V.map((n) => {
314
- let r = ae(n.deliveries);
315
- return /* @__PURE__ */ j("div", {
360
+ children: z.map((e) => {
361
+ let r = le(e.deliveries);
362
+ return /* @__PURE__ */ S("div", {
316
363
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
317
364
  children: [
318
- /* @__PURE__ */ j("div", {
365
+ /* @__PURE__ */ S("div", {
319
366
  className: "flex items-center justify-between",
320
- children: [/* @__PURE__ */ A("div", {
367
+ children: [/* @__PURE__ */ x("div", {
321
368
  className: "font-semibold text-text-primary",
322
- children: n.crop
323
- }), /* @__PURE__ */ A(i, {
369
+ children: e.crop
370
+ }), /* @__PURE__ */ x(a, {
324
371
  variant: "success",
325
- label: F("healthybowl.contracts.status.active", "Active")
372
+ label: T("healthybowl.contracts.status.active", "Active")
326
373
  })]
327
374
  }),
328
- /* @__PURE__ */ j("dl", {
375
+ /* @__PURE__ */ S("dl", {
329
376
  className: "mt-3 grid grid-cols-2 gap-x-4 gap-y-2 text-sm",
330
377
  children: [
331
- /* @__PURE__ */ A("dt", {
378
+ /* @__PURE__ */ x("dt", {
332
379
  className: "text-text-secondary",
333
- children: F("healthybowl.contracts.obl.quota", "My quota")
380
+ children: T("healthybowl.contracts.obl.quota", "My quota")
334
381
  }),
335
- /* @__PURE__ */ A("dd", {
382
+ /* @__PURE__ */ x("dd", {
336
383
  className: "text-end tabular-nums text-text-primary",
337
- children: m(n.quotaQty, n.unit)
384
+ children: d(e.quotaQty, e.unit)
338
385
  }),
339
- /* @__PURE__ */ A("dt", {
386
+ /* @__PURE__ */ x("dt", {
340
387
  className: "text-text-secondary",
341
- children: F("healthybowl.contracts.obl.price", "Agreed price")
388
+ children: T("healthybowl.contracts.obl.price", "Agreed price")
342
389
  }),
343
- /* @__PURE__ */ j("dd", {
390
+ /* @__PURE__ */ S("dd", {
344
391
  className: "text-end tabular-nums text-text-primary",
345
392
  children: [
346
- e(n.agreedPrice, "INR"),
393
+ t(e.agreedPrice, "INR"),
347
394
  "/",
348
- n.unit
395
+ e.unit
349
396
  ]
350
397
  }),
351
- /* @__PURE__ */ A("dt", {
398
+ /* @__PURE__ */ x("dt", {
352
399
  className: "text-text-secondary",
353
- children: F("healthybowl.contracts.obl.delivered", "Delivered / accepted")
400
+ children: T("healthybowl.contracts.obl.delivered", "Delivered / accepted")
354
401
  }),
355
- /* @__PURE__ */ j("dd", {
402
+ /* @__PURE__ */ S("dd", {
356
403
  className: "text-end tabular-nums text-text-primary",
357
404
  children: [
358
- m(n.deliveredQty, n.unit),
405
+ d(e.deliveredQty, e.unit),
359
406
  " / ",
360
- m(n.acceptedQty, n.unit)
407
+ d(e.acceptedQty, e.unit)
361
408
  ]
362
409
  }),
363
- /* @__PURE__ */ A("dt", {
410
+ /* @__PURE__ */ x("dt", {
364
411
  className: "text-text-secondary",
365
- children: F("healthybowl.contracts.obl.paid", "Payments received")
412
+ children: T("healthybowl.contracts.obl.paid", "Payments received")
366
413
  }),
367
- /* @__PURE__ */ A("dd", {
414
+ /* @__PURE__ */ x("dd", {
368
415
  className: "text-end font-semibold tabular-nums text-success",
369
- children: e(n.paymentsReceived, "INR")
416
+ children: t(e.paymentsReceived, "INR")
370
417
  })
371
418
  ]
372
419
  }),
373
- r.length > 0 ? /* @__PURE__ */ j("div", {
420
+ r.length > 0 ? /* @__PURE__ */ S("div", {
374
421
  className: "mt-3 border-t border-border-subtle pt-3",
375
- children: [/* @__PURE__ */ A("div", {
422
+ children: [/* @__PURE__ */ x("div", {
376
423
  className: "text-xs font-medium text-text-secondary",
377
- children: F("healthybowl.contracts.obl.graded", "How your deliveries were graded")
378
- }), /* @__PURE__ */ A("ul", {
424
+ children: T("healthybowl.contracts.obl.graded", "How your deliveries were graded")
425
+ }), /* @__PURE__ */ x("ul", {
379
426
  className: "mt-2 space-y-2",
380
- children: r.map(({ delivery: e, grade: r }) => /* @__PURE__ */ j("li", { children: [/* @__PURE__ */ j("div", {
427
+ children: r.map(({ delivery: t, grade: r }) => /* @__PURE__ */ S("li", { children: [/* @__PURE__ */ S("div", {
381
428
  className: "flex flex-wrap items-baseline justify-between gap-x-3 text-xs text-text-secondary tabular-nums",
382
- children: [/* @__PURE__ */ A("span", {
429
+ children: [/* @__PURE__ */ x("span", {
383
430
  className: "text-text-primary",
384
- children: e.deliveryWindow || (e.windowDate ? t(e.windowDate) : "") || F("healthybowl.contracts.obl.aDelivery", "Delivery")
385
- }), /* @__PURE__ */ j("span", { children: [
386
- m(e.acceptedQty, n.unit),
431
+ children: t.deliveryWindow || (t.windowDate ? n(t.windowDate) : "") || T("healthybowl.contracts.obl.aDelivery", "Delivery")
432
+ }), /* @__PURE__ */ S("span", { children: [
433
+ d(t.acceptedQty, e.unit),
387
434
  " /",
388
435
  " ",
389
- m(e.deliveredQty, n.unit),
390
- e.rejectedQty > 0 ? /* @__PURE__ */ j("span", {
436
+ d(t.deliveredQty, e.unit),
437
+ t.rejectedQty > 0 ? /* @__PURE__ */ S("span", {
391
438
  className: "ms-2 text-status-error-text",
392
439
  children: [
393
- F("healthybowl.contracts.rejectedShort", "Rejected"),
440
+ T("healthybowl.contracts.rejectedShort", "Rejected"),
394
441
  ":",
395
442
  " ",
396
- m(e.rejectedQty, n.unit)
443
+ d(t.rejectedQty, e.unit)
397
444
  ]
398
445
  }) : null
399
446
  ] })]
400
- }), /* @__PURE__ */ A(v, {
447
+ }), /* @__PURE__ */ x(m, {
401
448
  grade: r,
402
- summary: g(r),
403
- t: F
404
- })] }, e.id))
449
+ summary: p(r),
450
+ t: T
451
+ })] }, t.id))
405
452
  })]
406
453
  }) : null
407
454
  ]
408
- }, n.assignmentId);
455
+ }, e.assignmentId);
409
456
  })
410
457
  })]
411
458
  }) : null,
412
- /* @__PURE__ */ A(l, {
413
- open: K != null,
414
- onClose: () => q(null),
415
- title: Z ? F("healthybowl.contracts.detail.title", "{{crop}} contract", { crop: Z.crop }) : F("healthybowl.contracts.detail.titleGeneric", "Contract"),
416
- description: Z ? `${h(Z.pricingModel)} · ${e(Z.agreedPrice, "INR")}/${Z.unit} · ${F("healthybowl.contracts.quota", "quota")} ${m(Z.quotaQty, Z.unit)}` : void 0,
459
+ /* @__PURE__ */ x(l, {
460
+ open: U != null,
461
+ onClose: () => W(null),
462
+ title: J ? T("healthybowl.contracts.detail.title", "{{crop}} contract", { crop: J.crop }) : T("healthybowl.contracts.detail.titleGeneric", "Contract"),
463
+ description: J ? `${f(J.pricingModel)} · ${t(J.agreedPrice, "INR")}/${J.unit} · ${T("healthybowl.contracts.quota", "quota")} ${d(J.quotaQty, J.unit)}` : void 0,
417
464
  size: "xl",
418
- footer: Z && String(Z.status).toLowerCase() === "draft" ? /* @__PURE__ */ j(M, {
419
- onClick: () => Pe(Z),
420
- disabled: Z.acceptedFarmCount < 1,
421
- title: Z.acceptedFarmCount < 1 ? F("healthybowl.contracts.activateHint", "At least one farm must accept before activating") : void 0,
422
- children: [/* @__PURE__ */ A(x, { className: "h-4 w-4" }), F("healthybowl.contracts.activate", "Activate contract")]
465
+ footer: J && String(J.status).toLowerCase() === "draft" ? /* @__PURE__ */ S(C, {
466
+ onClick: () => Xe(J),
467
+ disabled: J.acceptedFarmCount < 1,
468
+ title: J.acceptedFarmCount < 1 ? T("healthybowl.contracts.activateHint", "At least one farm must accept before activating") : void 0,
469
+ children: [/* @__PURE__ */ x(v, { className: "h-4 w-4" }), T("healthybowl.contracts.activate", "Activate contract")]
423
470
  }) : null,
424
- children: Z ? /* @__PURE__ */ j("div", {
471
+ children: J ? /* @__PURE__ */ S("div", {
425
472
  className: "space-y-6",
426
473
  children: [
427
- /* @__PURE__ */ j("div", {
474
+ /* @__PURE__ */ S("div", {
428
475
  className: "flex items-center gap-2",
429
- children: [/* @__PURE__ */ A(i, {
430
- variant: p(Z.status),
431
- label: h(Z.status)
432
- }), Z.documentFileId ? /* @__PURE__ */ j("span", {
476
+ children: [/* @__PURE__ */ x(a, {
477
+ variant: u(J.status),
478
+ label: f(J.status)
479
+ }), J.documentFileId ? /* @__PURE__ */ S("span", {
433
480
  className: "inline-flex items-center gap-1 text-xs text-text-secondary",
434
- children: [/* @__PURE__ */ A(S, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.signedDoc", "Signed document attached")]
481
+ children: [/* @__PURE__ */ x(y, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.signedDoc", "Signed document attached")]
435
482
  }) : null]
436
483
  }),
437
- /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("div", {
484
+ /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
438
485
  className: "mb-2 flex items-center justify-between",
439
- children: [/* @__PURE__ */ A("h3", {
486
+ children: [/* @__PURE__ */ x("h3", {
440
487
  className: "text-sm font-semibold text-text-primary",
441
- children: F("healthybowl.contracts.assignments", "Farms")
442
- }), /* @__PURE__ */ j(M, {
488
+ children: T("healthybowl.contracts.assignments", "Farms")
489
+ }), /* @__PURE__ */ S(C, {
443
490
  variant: "outline",
444
491
  size: "sm",
445
- onClick: () => W(!0),
446
- children: [/* @__PURE__ */ A(E, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.inviteFarm", "Invite farm")]
492
+ onClick: () => V(!0),
493
+ children: [/* @__PURE__ */ x(Te, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.inviteFarm", "Invite farm")]
447
494
  })]
448
- }), X.assignments.length === 0 ? /* @__PURE__ */ A("p", {
495
+ }), q.assignments.length === 0 ? /* @__PURE__ */ x("p", {
449
496
  className: "text-sm text-text-secondary",
450
- children: F("healthybowl.contracts.noFarms", "No farms invited yet.")
451
- }) : /* @__PURE__ */ A("ul", {
497
+ children: T("healthybowl.contracts.noFarms", "No farms invited yet.")
498
+ }) : /* @__PURE__ */ x("ul", {
452
499
  className: "space-y-2",
453
- children: X.assignments.map((e) => /* @__PURE__ */ j("li", {
500
+ children: q.assignments.map((e) => /* @__PURE__ */ S("li", {
454
501
  className: "flex items-center justify-between gap-3 rounded-md border border-border-subtle px-3 py-2",
455
- children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("span", {
502
+ children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("span", {
456
503
  className: "text-sm font-medium text-text-primary",
457
504
  children: e.farmName || e.farmWorkspaceId
458
- }), e.allocationQty ? /* @__PURE__ */ A("span", {
505
+ }), e.allocationQty ? /* @__PURE__ */ x("span", {
459
506
  className: "ms-2 text-xs text-text-secondary",
460
- children: m(e.allocationQty)
461
- }) : null] }), /* @__PURE__ */ j("div", {
507
+ children: d(e.allocationQty)
508
+ }) : null] }), /* @__PURE__ */ S("div", {
462
509
  className: "flex items-center gap-2",
463
- children: [/* @__PURE__ */ A(i, {
464
- variant: ee(e.status),
465
- label: h(e.status)
466
- }), String(e.status).toLowerCase() === "revoked" ? null : /* @__PURE__ */ A(M, {
510
+ children: [/* @__PURE__ */ x(a, {
511
+ variant: ie(e.status),
512
+ label: f(e.status)
513
+ }), N && String(e.status).toLowerCase() !== "revoked" ? /* @__PURE__ */ x(C, {
467
514
  variant: "ghost",
468
515
  size: "icon-sm",
469
- onClick: () => Ie(e.id, e.farmName || e.farmWorkspaceId),
470
- title: F("healthybowl.common.remove", "Revoke"),
471
- children: /* @__PURE__ */ A(w, { className: "h-3.5 w-3.5" })
472
- })]
516
+ onClick: () => Qe(e.id, e.farmName || e.farmWorkspaceId),
517
+ title: T("healthybowl.common.remove", "Revoke"),
518
+ children: /* @__PURE__ */ x(Ce, { className: "h-3.5 w-3.5" })
519
+ }) : null]
473
520
  })]
474
521
  }, e.id))
475
522
  })] }),
476
- /* @__PURE__ */ j("div", { children: [
477
- /* @__PURE__ */ j("div", {
523
+ /* @__PURE__ */ S("div", { children: [
524
+ /* @__PURE__ */ S("div", {
478
525
  className: "mb-2 flex items-center justify-between",
479
- children: [/* @__PURE__ */ A("h3", {
526
+ children: [/* @__PURE__ */ x("h3", {
480
527
  className: "text-sm font-semibold text-text-primary",
481
- children: F("healthybowl.contracts.deliveries", "Deliveries")
482
- }), /* @__PURE__ */ j(M, {
528
+ children: T("healthybowl.contracts.deliveries", "Deliveries")
529
+ }), /* @__PURE__ */ S(C, {
483
530
  variant: "outline",
484
531
  size: "sm",
485
- onClick: () => G(!0),
486
- disabled: X.assignments.filter((e) => String(e.status).toLowerCase() === "accepted").length === 0,
487
- children: [/* @__PURE__ */ A(T, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.recordDelivery", "Record delivery")]
532
+ onClick: () => H(!0),
533
+ disabled: q.assignments.filter((e) => String(e.status).toLowerCase() === "accepted").length === 0,
534
+ children: [/* @__PURE__ */ x(we, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.recordDelivery", "Record delivery")]
488
535
  })]
489
536
  }),
490
- /* @__PURE__ */ A("p", {
537
+ /* @__PURE__ */ x("p", {
491
538
  className: "mb-2 text-xs text-text-secondary",
492
- children: F("healthybowl.contracts.deliveriesScopeNote", "Each delivery is per farm — it creates its own order and shipment in that farm’s workspace. There is no combined cross-farm lot or shipment yet.")
539
+ children: T("healthybowl.contracts.deliveriesScopeNote", "Each delivery is per farm — it creates its own order and shipment in that farm’s workspace. There is no combined cross-farm lot or shipment yet.")
493
540
  }),
494
- X.deliveries.length === 0 ? /* @__PURE__ */ A("p", {
541
+ q.deliveries.length === 0 ? /* @__PURE__ */ x("p", {
495
542
  className: "text-sm text-text-secondary",
496
- children: F("healthybowl.contracts.noDeliveries", "No deliveries recorded yet.")
497
- }) : /* @__PURE__ */ A("ul", {
543
+ children: T("healthybowl.contracts.noDeliveries", "No deliveries recorded yet.")
544
+ }) : /* @__PURE__ */ x("ul", {
498
545
  className: "space-y-2",
499
- children: X.deliveries.map((t) => {
500
- let n = String(t.status).toLowerCase(), r = oe(t.gradeResult), a = g(r);
501
- return /* @__PURE__ */ j("li", {
546
+ children: q.deliveries.map((e) => {
547
+ let n = String(e.status).toLowerCase(), r = ue(e.gradeResult), i = p(r);
548
+ return /* @__PURE__ */ S("li", {
502
549
  className: "rounded-md border border-border-subtle px-3 py-2",
503
550
  children: [
504
- /* @__PURE__ */ j("div", {
551
+ /* @__PURE__ */ S("div", {
505
552
  className: "flex flex-wrap items-center justify-between gap-2",
506
- children: [/* @__PURE__ */ j("div", {
553
+ children: [/* @__PURE__ */ S("div", {
507
554
  className: "text-sm text-text-primary",
508
- children: [/* @__PURE__ */ A("span", {
555
+ children: [/* @__PURE__ */ x("span", {
509
556
  className: "font-medium",
510
- children: t.farmName || t.farmWorkspaceId
511
- }), t.deliveryWindow ? /* @__PURE__ */ A("span", {
557
+ children: e.farmName || e.farmWorkspaceId
558
+ }), e.deliveryWindow ? /* @__PURE__ */ x("span", {
512
559
  className: "ms-2 text-xs text-text-secondary",
513
- children: t.deliveryWindow
560
+ children: e.deliveryWindow
514
561
  }) : null]
515
- }), /* @__PURE__ */ A(i, {
516
- variant: te(t.status),
517
- label: h(t.status)
562
+ }), /* @__PURE__ */ x(a, {
563
+ variant: ae(e.status),
564
+ label: f(e.status)
518
565
  })]
519
566
  }),
520
- /* @__PURE__ */ j("div", {
567
+ /* @__PURE__ */ S("div", {
521
568
  className: "mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-secondary tabular-nums",
522
569
  children: [
523
- /* @__PURE__ */ j("span", { children: [
524
- F("healthybowl.contracts.delivered", "Delivered"),
570
+ /* @__PURE__ */ S("span", { children: [
571
+ T("healthybowl.contracts.delivered", "Delivered"),
525
572
  ":",
526
573
  " ",
527
- m(t.deliveredQty, Z.unit)
574
+ d(e.deliveredQty, J.unit)
528
575
  ] }),
529
- t.acceptedQty > 0 || n !== "scheduled" ? /* @__PURE__ */ j("span", { children: [
530
- F("healthybowl.contracts.acceptedShort", "Accepted"),
576
+ e.acceptedQty > 0 || n !== "scheduled" ? /* @__PURE__ */ S("span", { children: [
577
+ T("healthybowl.contracts.acceptedShort", "Accepted"),
531
578
  ":",
532
579
  " ",
533
- m(t.acceptedQty, Z.unit)
580
+ d(e.acceptedQty, J.unit)
534
581
  ] }) : null,
535
- t.rejectedQty > 0 ? /* @__PURE__ */ j("span", {
582
+ e.rejectedQty > 0 ? /* @__PURE__ */ S("span", {
536
583
  className: "text-status-error-text",
537
584
  children: [
538
- F("healthybowl.contracts.rejectedShort", "Rejected"),
585
+ T("healthybowl.contracts.rejectedShort", "Rejected"),
539
586
  ":",
540
587
  " ",
541
- m(t.rejectedQty, Z.unit)
588
+ d(e.rejectedQty, J.unit)
542
589
  ]
543
590
  }) : null,
544
- t.valuedAmount > 0 ? /* @__PURE__ */ A("span", { children: e(t.valuedAmount, "INR") }) : null
591
+ e.valuedAmount > 0 ? /* @__PURE__ */ x("span", { children: t(e.valuedAmount, "INR") }) : null
545
592
  ]
546
593
  }),
547
- r ? /* @__PURE__ */ A(v, {
594
+ r ? /* @__PURE__ */ x(m, {
548
595
  grade: r,
549
- summary: a,
550
- t: F
596
+ summary: i,
597
+ t: T
551
598
  }) : null,
552
- /* @__PURE__ */ j("div", {
599
+ /* @__PURE__ */ S("div", {
553
600
  className: "mt-2 flex items-center gap-2",
554
- children: [n === "scheduled" || n === "partial" || n === "accepted" ? /* @__PURE__ */ j(M, {
601
+ children: [n === "scheduled" || n === "partial" || n === "accepted" ? /* @__PURE__ */ S(C, {
555
602
  variant: "outline",
556
603
  size: "sm",
557
- onClick: () => Y({
604
+ onClick: () => K({
558
605
  mode: "grade",
559
- delivery: t
606
+ delivery: e
560
607
  }),
561
- children: [/* @__PURE__ */ A(fe, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.grade", "Grade")]
562
- }) : null, n === "accepted" || n === "partial" ? /* @__PURE__ */ j(M, {
608
+ children: [/* @__PURE__ */ x(ve, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.grade", "Grade")]
609
+ }) : null, n === "accepted" || n === "partial" ? /* @__PURE__ */ S(C, {
563
610
  size: "sm",
564
- onClick: () => Y({
611
+ onClick: () => K({
565
612
  mode: "settle",
566
- delivery: t
613
+ delivery: e
567
614
  }),
568
- children: [/* @__PURE__ */ A(b, { className: "h-3.5 w-3.5" }), F("healthybowl.contracts.settle", "Settle")]
615
+ children: [/* @__PURE__ */ x(_, { className: "h-3.5 w-3.5" }), T("healthybowl.contracts.settle", "Settle")]
569
616
  }) : null]
570
617
  })
571
618
  ]
572
- }, t.id);
619
+ }, e.id);
573
620
  })
574
621
  })
575
622
  ] })
@@ -577,8 +624,8 @@ function F() {
577
624
  }) : null
578
625
  })
579
626
  ]
580
- }), ze]
627
+ }), tt]
581
628
  });
582
629
  }
583
630
  //#endregion
584
- export { F as ContractsPage };
631
+ export { O as ContractsPage };
@@ -87,7 +87,7 @@ var y = (e) => {
87
87
  category: N.category
88
88
  }),
89
89
  actions: /* @__PURE__ */ g("div", {
90
- className: "flex items-center gap-2",
90
+ className: "flex flex-wrap items-center gap-2",
91
91
  children: [
92
92
  /* @__PURE__ */ h(ce, {
93
93
  entityType: "CROP",
@@ -416,7 +416,7 @@ var xt = 1440 * 60 * 1e3, St = 52, Ct = (e) => {
416
416
  soilType: D.soilType
417
417
  }),
418
418
  actions: /* @__PURE__ */ h("div", {
419
- className: "flex items-center gap-2",
419
+ className: "flex flex-wrap items-center gap-2",
420
420
  children: [
421
421
  /* @__PURE__ */ m(_e, {
422
422
  entityType: "FIELD",
@@ -143,7 +143,7 @@ var O = [
143
143
  }
144
144
  ],
145
145
  actions: /* @__PURE__ */ E("div", {
146
- className: "flex items-center gap-2",
146
+ className: "flex flex-wrap items-center gap-2",
147
147
  children: [
148
148
  /* @__PURE__ */ T(D, {
149
149
  variant: "outline",
@@ -163,12 +163,15 @@ var O = [
163
163
  A("healthybowl.financial.dashboard.actions.financierAccess", "Financier Access")
164
164
  ]
165
165
  }),
166
- Object.keys($).map((t) => /* @__PURE__ */ T("button", {
167
- type: "button",
168
- onClick: () => be(t),
169
- className: e("rounded-md px-3 py-1.5 text-xs font-medium transition-colors", R === t ? "bg-foreground text-background" : "border border-border-subtle text-text-secondary hover:text-text-primary"),
170
- children: $[t]
171
- }, t))
166
+ /* @__PURE__ */ T("div", {
167
+ className: "flex items-center gap-2",
168
+ children: Object.keys($).map((t) => /* @__PURE__ */ T("button", {
169
+ type: "button",
170
+ onClick: () => be(t),
171
+ className: e("rounded-md px-3 py-1.5 text-xs font-medium transition-colors", R === t ? "bg-foreground text-background" : "border border-border-subtle text-text-secondary hover:text-text-primary"),
172
+ children: $[t]
173
+ }, t))
174
+ })
172
175
  ]
173
176
  }),
174
177
  children: [we ? /* @__PURE__ */ T(ne, {
@@ -175,7 +175,7 @@ var be = (e) => {
175
175
  description: E("healthybowl.livestock.healthRecords.description", "Track and manage animal health history"),
176
176
  purpose: "Keep each animal's medical history in one place — illnesses, treatments, vet visits. Good records help you spot health patterns, prove humane care, and stay compliant with organic livestock rules.",
177
177
  actions: /* @__PURE__ */ h("div", {
178
- className: "flex items-center gap-2",
178
+ className: "flex flex-wrap items-center gap-2",
179
179
  children: [
180
180
  /* @__PURE__ */ h(g, {
181
181
  variant: "outline",
@@ -314,7 +314,7 @@ var v = (e) => {
314
314
  description: y("healthybowl.livestock.vaccinationSchedule.description", "Manage and track all vaccination schedules"),
315
315
  purpose: "Stay on top of which animals need which shots and when. Keeping vaccinations on schedule protects your herd from preventable disease and gives you the records vets and certifiers expect to see.",
316
316
  actions: /* @__PURE__ */ d("div", {
317
- className: "flex items-center gap-2",
317
+ className: "flex flex-wrap items-center gap-2",
318
318
  children: [
319
319
  /* @__PURE__ */ d(f, {
320
320
  variant: "outline",
@@ -304,7 +304,7 @@ var x = () => {
304
304
  description: S("healthybowl.marketplace.description", "Browse organic products from verified sellers"),
305
305
  purpose: "Buy organic inputs and produce from verified sellers — seeds, supplies and goods from other farms. Browse, compare and order what your farm needs, with sellers vetted so you can buy with confidence.",
306
306
  actions: /* @__PURE__ */ v("div", {
307
- className: "flex items-center gap-2",
307
+ className: "flex flex-wrap items-center gap-2",
308
308
  children: [
309
309
  /* @__PURE__ */ v(y, {
310
310
  variant: "outline",
@@ -40,7 +40,7 @@ var O = () => {
40
40
  titleAccent: O("healthybowl.storage.titleAccent", "Storage"),
41
41
  description: O("healthybowl.storage.description", "Warehouses, cold-stores and bins — where each batch of produce and milk is stored, and its in/out history."),
42
42
  actions: /* @__PURE__ */ E("div", {
43
- className: "flex items-center gap-2",
43
+ className: "flex flex-wrap items-center gap-2",
44
44
  children: [
45
45
  /* @__PURE__ */ E(D, {
46
46
  variant: "outline",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.1018.2",
3
+ "version": "2026.1018.4",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [