@burdenoff/microfe-healthybowl 2026.613.1 → 2026.614.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
1
  import { cn as e, formatCurrency as t, formatDate as n } from "../../utils/helpers.js";
2
2
  import { PageLayout as r } from "../../components/PageLayout.js";
3
3
  import { StatCard as i } from "../../components/StatCard.js";
4
- import { DataTable as ee } from "../../components/DataTable.js";
5
- import { StatusBadge as a } from "../../components/StatusBadge.js";
6
- import { EmptyState as o } from "../../components/EmptyState.js";
7
- import { ErrorState as s } from "../../components/ErrorState.js";
8
- import { FilterBar as c } from "../../components/FilterBar.js";
9
- import { ToastContainer as l } from "../../components/Toast.js";
10
- import { LoadingSkeleton as u } from "../../components/LoadingSkeleton.js";
11
- import { Modal as d } from "../../components/Modal.js";
4
+ import { DataTable as a } from "../../components/DataTable.js";
5
+ import { StatusBadge as o } from "../../components/StatusBadge.js";
6
+ import { EmptyState as ee } from "../../components/EmptyState.js";
7
+ import { ErrorState as te } from "../../components/ErrorState.js";
8
+ import { FilterBar as ne } from "../../components/FilterBar.js";
9
+ import { ToastContainer as s } from "../../components/Toast.js";
10
+ import { LoadingSkeleton as re } from "../../components/LoadingSkeleton.js";
11
+ import { Modal as c } from "../../components/Modal.js";
12
12
  import "../../components/index.js";
13
- import { useHealthyBowlData as te } from "../../hooks/useHealthyBowlData.js";
14
- import { useToast as ne } from "../../hooks/useToast.js";
15
- import { useMemo as f, useState as p } from "react";
16
- import { useI18n as re } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
- import { Calendar as m, DollarSign as h, Download as ie, Hash as g, Plus as _, TrendingDown as v, TrendingUp as y } from "lucide-react";
18
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
13
+ import { useHealthyBowlData as ie } from "../../hooks/useHealthyBowlData.js";
14
+ import { useToast as l } from "../../hooks/useToast.js";
15
+ import { useMemo as u, useState as d } from "react";
16
+ import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
+ import { Calendar as p, DollarSign as m, Download as ae, Edit as oe, Hash as se, Plus as ce, Trash2 as le, TrendingDown as h, TrendingUp as g } from "lucide-react";
18
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
19
19
  //#region src/healthybowl/pages/financial/TransactionsPage.tsx
20
- var C = [
20
+ var b = [
21
21
  "crop_sales",
22
22
  "livestock_sales",
23
23
  "marketplace",
@@ -29,13 +29,13 @@ var C = [
29
29
  "certification",
30
30
  "equipment",
31
31
  "other"
32
- ], ae = [
32
+ ], ue = [
33
33
  "Bank Transfer",
34
34
  "Credit Card",
35
35
  "Cash",
36
36
  "Check",
37
37
  "Payment Gateway"
38
- ], w = {
38
+ ], x = {
39
39
  date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
40
40
  type: "income",
41
41
  category: "crop_sales",
@@ -44,79 +44,128 @@ var C = [
44
44
  status: "completed",
45
45
  paymentMethod: "Bank Transfer",
46
46
  reference: ""
47
- }, T = () => {
48
- let { t: T } = re(), { transactions: E, createTransaction: D, loading: O, errors: oe } = te(), { toasts: se, toast: k, dismiss: A } = ne(), [j, M] = p(""), [N, P] = p("all"), [F, I] = p("all"), [L, R] = p("all"), [z, B] = p(!1), [V, H] = p(!1), [U, W] = p(w), G = f(() => E.filter((e) => {
49
- let t = j === "" || (e.description ?? "").toLowerCase().includes(j.toLowerCase()) || e.reference && (e.reference ?? "").toLowerCase().includes(j.toLowerCase()), n = N === "all" || e.type === N, r = F === "all" || e.category === F, i = L === "all" || e.status === L;
47
+ }, S = () => {
48
+ let { t: S } = f(), { transactions: C, createTransaction: w, updateTransaction: T, deleteTransaction: de, loading: fe, errors: pe } = ie(), { toasts: me, toast: E, dismiss: he } = l(), [D, O] = d(""), [k, A] = d("all"), [j, M] = d("all"), [N, P] = d("all"), [F, I] = d(!1), [L, R] = d(!1), [z, B] = d(null), [ge, V] = d(null), [H, U] = d(x), W = u(() => C.filter((e) => {
49
+ let t = D === "" || (e.description ?? "").toLowerCase().includes(D.toLowerCase()) || e.reference && (e.reference ?? "").toLowerCase().includes(D.toLowerCase()), n = k === "all" || e.type === k, r = j === "all" || e.category === j, i = N === "all" || e.status === N;
50
50
  return t && n && r && i;
51
51
  }), [
52
- E,
52
+ C,
53
+ D,
54
+ k,
53
55
  j,
54
- N,
55
- F,
56
- L
57
- ]), K = f(() => E.filter((e) => e.type === "income").reduce((e, t) => e + t.amount, 0), [E]), q = f(() => E.filter((e) => e.type === "expense").reduce((e, t) => e + t.amount, 0), [E]), ce = K - q, J = f(() => ({
58
- income: T("healthybowl.financial.transactions.type.income", "Income"),
59
- expense: T("healthybowl.financial.transactions.type.expense", "Expense")
60
- }), [T]), Y = f(() => ({
61
- crop_sales: T("healthybowl.financial.transactions.category.cropSales", "Crop Sales"),
62
- livestock_sales: T("healthybowl.financial.transactions.category.livestockSales", "Livestock Sales"),
63
- marketplace: T("healthybowl.financial.transactions.category.marketplace", "Marketplace"),
64
- seeds: T("healthybowl.financial.transactions.category.seeds", "Seeds"),
65
- fertilizers: T("healthybowl.financial.transactions.category.fertilizers", "Fertilizers"),
66
- labor: T("healthybowl.financial.transactions.category.labor", "Labor"),
67
- irrigation: T("healthybowl.financial.transactions.category.irrigation", "Irrigation"),
68
- pest_control: T("healthybowl.financial.transactions.category.pestControl", "Pest Control"),
69
- certification: T("healthybowl.financial.transactions.category.certification", "Certification"),
70
- equipment: T("healthybowl.financial.transactions.category.equipment", "Equipment"),
71
- other: T("healthybowl.financial.transactions.category.other", "Other")
72
- }), [T]), X = f(() => ({
73
- completed: T("healthybowl.financial.transactions.status.completed", "Completed"),
74
- pending: T("healthybowl.financial.transactions.status.pending", "Pending"),
75
- failed: T("healthybowl.financial.transactions.status.failed", "Failed")
76
- }), [T]), le = f(() => ({
77
- "Bank Transfer": T("healthybowl.financial.transactions.paymentMethod.bankTransfer", "Bank Transfer"),
78
- "Credit Card": T("healthybowl.financial.transactions.paymentMethod.creditCard", "Credit Card"),
79
- Cash: T("healthybowl.financial.transactions.paymentMethod.cash", "Cash"),
80
- Check: T("healthybowl.financial.transactions.paymentMethod.check", "Check"),
81
- "Payment Gateway": T("healthybowl.financial.transactions.paymentMethod.paymentGateway", "Payment Gateway")
82
- }), [T]), ue = async () => {
83
- if (!U.description || !U.amount) {
84
- k({
85
- title: T("healthybowl.financial.transactions.toast.validation.title", "Validation Error"),
86
- description: T("healthybowl.financial.transactions.toast.validation.description", "Please fill in all required fields"),
56
+ N
57
+ ]), G = u(() => C.filter((e) => e.type === "income").reduce((e, t) => e + t.amount, 0), [C]), K = u(() => C.filter((e) => e.type === "expense").reduce((e, t) => e + t.amount, 0), [C]), _e = G - K, q = u(() => ({
58
+ income: S("healthybowl.financial.transactions.type.income", "Income"),
59
+ expense: S("healthybowl.financial.transactions.type.expense", "Expense")
60
+ }), [S]), J = u(() => ({
61
+ crop_sales: S("healthybowl.financial.transactions.category.cropSales", "Crop Sales"),
62
+ livestock_sales: S("healthybowl.financial.transactions.category.livestockSales", "Livestock Sales"),
63
+ marketplace: S("healthybowl.financial.transactions.category.marketplace", "Marketplace"),
64
+ seeds: S("healthybowl.financial.transactions.category.seeds", "Seeds"),
65
+ fertilizers: S("healthybowl.financial.transactions.category.fertilizers", "Fertilizers"),
66
+ labor: S("healthybowl.financial.transactions.category.labor", "Labor"),
67
+ irrigation: S("healthybowl.financial.transactions.category.irrigation", "Irrigation"),
68
+ pest_control: S("healthybowl.financial.transactions.category.pestControl", "Pest Control"),
69
+ certification: S("healthybowl.financial.transactions.category.certification", "Certification"),
70
+ equipment: S("healthybowl.financial.transactions.category.equipment", "Equipment"),
71
+ other: S("healthybowl.financial.transactions.category.other", "Other")
72
+ }), [S]), Y = u(() => ({
73
+ completed: S("healthybowl.financial.transactions.status.completed", "Completed"),
74
+ pending: S("healthybowl.financial.transactions.status.pending", "Pending"),
75
+ failed: S("healthybowl.financial.transactions.status.failed", "Failed")
76
+ }), [S]), ve = u(() => ({
77
+ "Bank Transfer": S("healthybowl.financial.transactions.paymentMethod.bankTransfer", "Bank Transfer"),
78
+ "Credit Card": S("healthybowl.financial.transactions.paymentMethod.creditCard", "Credit Card"),
79
+ Cash: S("healthybowl.financial.transactions.paymentMethod.cash", "Cash"),
80
+ Check: S("healthybowl.financial.transactions.paymentMethod.check", "Check"),
81
+ "Payment Gateway": S("healthybowl.financial.transactions.paymentMethod.paymentGateway", "Payment Gateway")
82
+ }), [S]), X = () => {
83
+ I(!1), B(null), U(x);
84
+ }, ye = async () => {
85
+ if (!H.description || !H.amount) {
86
+ E({
87
+ title: S("healthybowl.financial.transactions.toast.validation.title", "Validation Error"),
88
+ description: S("healthybowl.financial.transactions.toast.validation.description", "Please fill in all required fields"),
87
89
  variant: "error"
88
90
  });
89
91
  return;
90
92
  }
91
- H(!0);
93
+ R(!0);
92
94
  try {
93
- await D({
94
- amount: Number(U.amount),
95
- category: U.category,
96
- date: U.date,
97
- description: U.description,
98
- status: U.status,
99
- type: U.type,
100
- ...U.paymentMethod ? { paymentMethod: U.paymentMethod } : {},
101
- ...U.reference ? { reference: U.reference } : {}
102
- }), k({
103
- title: T("healthybowl.financial.transactions.toast.added.title", "Transaction Added"),
104
- description: T("healthybowl.financial.transactions.toast.added.description", "{{type}} of {{amount}} recorded", {
105
- type: J[U.type],
106
- amount: t(Number(U.amount))
95
+ z ? (await T({
96
+ id: z,
97
+ amount: Number(H.amount),
98
+ category: H.category,
99
+ date: H.date,
100
+ description: H.description,
101
+ status: H.status,
102
+ type: H.type,
103
+ paymentMethod: H.paymentMethod,
104
+ reference: H.reference
105
+ }), E({
106
+ title: S("healthybowl.financial.transactions.toast.updated.title", "Transaction Updated"),
107
+ description: S("healthybowl.financial.transactions.toast.updated.description", "{{type}} of {{amount}} updated", {
108
+ type: q[H.type],
109
+ amount: t(Number(H.amount))
107
110
  }),
108
111
  variant: "success"
109
- }), B(!1), W(w);
112
+ })) : (await w({
113
+ amount: Number(H.amount),
114
+ category: H.category,
115
+ date: H.date,
116
+ description: H.description,
117
+ status: H.status,
118
+ type: H.type,
119
+ ...H.paymentMethod ? { paymentMethod: H.paymentMethod } : {},
120
+ ...H.reference ? { reference: H.reference } : {}
121
+ }), E({
122
+ title: S("healthybowl.financial.transactions.toast.added.title", "Transaction Added"),
123
+ description: S("healthybowl.financial.transactions.toast.added.description", "{{type}} of {{amount}} recorded", {
124
+ type: q[H.type],
125
+ amount: t(Number(H.amount))
126
+ }),
127
+ variant: "success"
128
+ })), X();
110
129
  } catch (e) {
111
- k({
112
- title: T("healthybowl.financial.transactions.toast.createFailed.title", "Create failed"),
113
- description: String(e),
130
+ E({
131
+ title: z ? S("healthybowl.financial.transactions.toast.updateFailed.title", "Update failed") : S("healthybowl.financial.transactions.toast.createFailed.title", "Create failed"),
132
+ description: e instanceof Error ? e.message : String(e),
114
133
  variant: "error"
115
134
  });
116
135
  } finally {
117
- H(!1);
136
+ R(!1);
118
137
  }
119
- }, de = () => {
138
+ }, be = (e) => {
139
+ U({
140
+ date: e.date,
141
+ type: e.type,
142
+ category: e.category,
143
+ description: e.description ?? "",
144
+ amount: String(e.amount),
145
+ status: e.status,
146
+ paymentMethod: e.paymentMethod ?? "Bank Transfer",
147
+ reference: e.reference ?? ""
148
+ }), B(e.id), I(!0);
149
+ }, xe = async (e) => {
150
+ if (window.confirm(S("healthybowl.financial.transactions.deleteConfirm", "Delete this transaction ({{description}})? This cannot be undone.", { description: e.description ?? "" }))) {
151
+ V(e.id);
152
+ try {
153
+ await de(e.id), E({
154
+ title: S("healthybowl.financial.transactions.toast.deleted.title", "Transaction Deleted"),
155
+ description: e.description,
156
+ variant: "success"
157
+ });
158
+ } catch (e) {
159
+ E({
160
+ title: S("healthybowl.common.error", "Error"),
161
+ description: e instanceof Error ? e.message : S("healthybowl.financial.transactions.toast.deleteFailed", "Failed to delete transaction"),
162
+ variant: "error"
163
+ });
164
+ } finally {
165
+ V(null);
166
+ }
167
+ }
168
+ }, Se = () => {
120
169
  let e = [[
121
170
  "Date",
122
171
  "Type",
@@ -126,7 +175,7 @@ var C = [
126
175
  "Payment Method",
127
176
  "Reference",
128
177
  "Status"
129
- ], ...G.map((e) => [
178
+ ], ...W.map((e) => [
130
179
  e.date,
131
180
  e.type,
132
181
  e.category,
@@ -136,34 +185,34 @@ var C = [
136
185
  e.reference ?? "",
137
186
  e.status
138
187
  ])].map((e) => e.map((e) => `"${e}"`).join(",")).join("\n"), t = new Blob([e], { type: "text/csv" }), n = URL.createObjectURL(t), r = document.createElement("a");
139
- r.href = n, r.download = "transactions.csv", r.click(), URL.revokeObjectURL(n), k({
140
- title: T("healthybowl.financial.transactions.toast.exported.title", "Exported to CSV"),
141
- description: T("healthybowl.financial.transactions.toast.exported.description", "{{count}} transactions exported", { count: G.length }),
188
+ r.href = n, r.download = "transactions.csv", r.click(), URL.revokeObjectURL(n), E({
189
+ title: S("healthybowl.financial.transactions.toast.exported.title", "Exported to CSV"),
190
+ description: S("healthybowl.financial.transactions.toast.exported.description", "{{count}} transactions exported", { count: W.length }),
142
191
  variant: "success"
143
192
  });
144
193
  }, Z = (e, t) => {
145
- W((n) => ({
194
+ U((n) => ({
146
195
  ...n,
147
196
  [e]: t
148
197
  }));
149
- }, fe = [
198
+ }, Ce = [
150
199
  {
151
200
  key: "date",
152
- header: T("healthybowl.financial.transactions.table.headers.date", "Date"),
153
- render: (e) => /* @__PURE__ */ S("span", {
201
+ header: S("healthybowl.financial.transactions.table.headers.date", "Date"),
202
+ render: (e) => /* @__PURE__ */ y("span", {
154
203
  className: "flex items-center gap-1.5 text-sm text-muted-foreground",
155
- children: [/* @__PURE__ */ x(m, { className: "h-3 w-3" }), n(e.date)]
204
+ children: [/* @__PURE__ */ v(p, { className: "h-3 w-3" }), n(e.date)]
156
205
  })
157
206
  },
158
207
  {
159
208
  key: "type",
160
- header: T("healthybowl.financial.transactions.table.headers.type", "Type"),
209
+ header: S("healthybowl.financial.transactions.table.headers.type", "Type"),
161
210
  render: (e) => {
162
211
  let t = e.type === "income";
163
- return /* @__PURE__ */ S("span", {
212
+ return /* @__PURE__ */ y("span", {
164
213
  className: "flex items-center gap-1.5",
165
- children: [t ? /* @__PURE__ */ x(y, { className: "h-3.5 w-3.5 text-success" }) : /* @__PURE__ */ x(v, { className: "h-3.5 w-3.5 text-destructive" }), /* @__PURE__ */ x(a, {
166
- label: J[e.type],
214
+ children: [t ? /* @__PURE__ */ v(g, { className: "h-3.5 w-3.5 text-success" }) : /* @__PURE__ */ v(h, { className: "h-3.5 w-3.5 text-destructive" }), /* @__PURE__ */ v(o, {
215
+ label: q[e.type],
167
216
  variant: t ? "success" : "error"
168
217
  })]
169
218
  });
@@ -171,27 +220,27 @@ var C = [
171
220
  },
172
221
  {
173
222
  key: "category",
174
- header: T("healthybowl.financial.transactions.table.headers.category", "Category"),
175
- render: (e) => /* @__PURE__ */ x("span", {
223
+ header: S("healthybowl.financial.transactions.table.headers.category", "Category"),
224
+ render: (e) => /* @__PURE__ */ v("span", {
176
225
  className: "text-sm capitalize text-foreground",
177
- children: e.category ? Y[e.category] : ""
226
+ children: e.category ? J[e.category] : ""
178
227
  })
179
228
  },
180
229
  {
181
230
  key: "description",
182
- header: T("healthybowl.financial.transactions.table.headers.description", "Description"),
183
- render: (e) => /* @__PURE__ */ x("span", {
231
+ header: S("healthybowl.financial.transactions.table.headers.description", "Description"),
232
+ render: (e) => /* @__PURE__ */ v("span", {
184
233
  className: "text-sm text-foreground",
185
234
  children: e.description
186
235
  })
187
236
  },
188
237
  {
189
238
  key: "amount",
190
- header: T("healthybowl.financial.transactions.table.headers.amount", "Amount"),
239
+ header: S("healthybowl.financial.transactions.table.headers.amount", "Amount"),
191
240
  className: "text-right",
192
241
  render: (n) => {
193
242
  let r = n.type === "income";
194
- return /* @__PURE__ */ S("span", {
243
+ return /* @__PURE__ */ y("span", {
195
244
  className: e("text-sm font-semibold", r ? "text-success" : "text-destructive"),
196
245
  children: [r ? "+" : "-", t(n.amount)]
197
246
  });
@@ -199,274 +248,292 @@ var C = [
199
248
  },
200
249
  {
201
250
  key: "paymentMethod",
202
- header: T("healthybowl.financial.transactions.table.headers.payment", "Payment"),
203
- render: (e) => /* @__PURE__ */ x("span", {
251
+ header: S("healthybowl.financial.transactions.table.headers.payment", "Payment"),
252
+ render: (e) => /* @__PURE__ */ v("span", {
204
253
  className: "text-xs text-muted-foreground",
205
254
  children: e.paymentMethod
206
255
  })
207
256
  },
208
257
  {
209
258
  key: "reference",
210
- header: T("healthybowl.financial.transactions.table.headers.reference", "Reference"),
211
- render: (e) => /* @__PURE__ */ x("span", {
259
+ header: S("healthybowl.financial.transactions.table.headers.reference", "Reference"),
260
+ render: (e) => /* @__PURE__ */ v("span", {
212
261
  className: "text-xs font-mono text-muted-foreground",
213
262
  children: e.reference || "-"
214
263
  })
215
264
  },
216
265
  {
217
266
  key: "status",
218
- header: T("healthybowl.financial.transactions.table.headers.status", "Status"),
219
- render: (e) => /* @__PURE__ */ x(a, {
220
- label: X[e.status],
267
+ header: S("healthybowl.financial.transactions.table.headers.status", "Status"),
268
+ render: (e) => /* @__PURE__ */ v(o, {
269
+ label: Y[e.status],
221
270
  variant: e.status === "completed" ? "success" : e.status === "pending" ? "warning" : "error",
222
271
  dot: !0
223
272
  })
273
+ },
274
+ {
275
+ key: "actions",
276
+ header: S("healthybowl.financial.transactions.table.headers.actions", "Actions"),
277
+ className: "text-right",
278
+ render: (e) => /* @__PURE__ */ y("div", {
279
+ className: "flex items-center justify-end gap-1.5",
280
+ children: [/* @__PURE__ */ v("button", {
281
+ onClick: () => be(e),
282
+ className: "rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
283
+ title: S("healthybowl.financial.transactions.actions.edit", "Edit Transaction"),
284
+ children: /* @__PURE__ */ v(oe, { className: "h-3.5 w-3.5" })
285
+ }), /* @__PURE__ */ v("button", {
286
+ onClick: () => xe(e),
287
+ disabled: ge === e.id,
288
+ className: "rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-destructive disabled:opacity-50",
289
+ title: S("healthybowl.financial.transactions.actions.delete", "Delete Transaction"),
290
+ children: /* @__PURE__ */ v(le, { className: "h-3.5 w-3.5" })
291
+ })]
292
+ })
224
293
  }
225
294
  ], Q = "h-9 rounded-md border border-border bg-background px-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring", $ = "h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring";
226
- return /* @__PURE__ */ S(r, {
227
- title: T("healthybowl.financial.transactions.title", "Transactions"),
228
- description: T("healthybowl.financial.transactions.description", "All income and expense records"),
229
- actions: /* @__PURE__ */ S("div", {
295
+ return /* @__PURE__ */ y(r, {
296
+ title: S("healthybowl.financial.transactions.title", "Transactions"),
297
+ description: S("healthybowl.financial.transactions.description", "All income and expense records"),
298
+ actions: /* @__PURE__ */ y("div", {
230
299
  className: "flex items-center gap-2",
231
- children: [/* @__PURE__ */ S("button", {
232
- onClick: de,
300
+ children: [/* @__PURE__ */ y("button", {
301
+ onClick: Se,
233
302
  className: "flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-muted",
234
- children: [/* @__PURE__ */ x(ie, { className: "h-3.5 w-3.5" }), T("healthybowl.financial.transactions.actions.exportCsv", "Export CSV")]
235
- }), /* @__PURE__ */ S("button", {
236
- onClick: () => B(!0),
303
+ children: [/* @__PURE__ */ v(ae, { className: "h-3.5 w-3.5" }), S("healthybowl.financial.transactions.actions.exportCsv", "Export CSV")]
304
+ }), /* @__PURE__ */ y("button", {
305
+ onClick: () => {
306
+ U(x), B(null), I(!0);
307
+ },
237
308
  className: "flex items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs font-medium text-background transition-opacity hover:opacity-90",
238
- children: [/* @__PURE__ */ x(_, { className: "h-3.5 w-3.5" }), T("healthybowl.financial.transactions.actions.add", "Add Transaction")]
309
+ children: [/* @__PURE__ */ v(ce, { className: "h-3.5 w-3.5" }), S("healthybowl.financial.transactions.actions.add", "Add Transaction")]
239
310
  })]
240
311
  }),
241
312
  children: [
242
- O && E.length === 0 ? /* @__PURE__ */ x(u, {
313
+ fe && C.length === 0 ? /* @__PURE__ */ v(re, {
243
314
  variant: "table",
244
315
  count: 6
245
- }) : E.length === 0 ? oe.financial ? /* @__PURE__ */ x(s, {}) : /* @__PURE__ */ x(o, {
246
- icon: /* @__PURE__ */ x(h, { className: "h-6 w-6" }),
247
- title: T("healthybowl.financial.transactions.emptyState.title", "No transactions yet"),
248
- description: T("healthybowl.financial.transactions.emptyState.description", "Income and expense records will appear here once they're added.")
249
- }) : /* @__PURE__ */ S(b, { children: [
250
- /* @__PURE__ */ S("div", {
316
+ }) : C.length === 0 ? pe.financial ? /* @__PURE__ */ v(te, {}) : /* @__PURE__ */ v(ee, {
317
+ icon: /* @__PURE__ */ v(m, { className: "h-6 w-6" }),
318
+ title: S("healthybowl.financial.transactions.emptyState.title", "No transactions yet"),
319
+ description: S("healthybowl.financial.transactions.emptyState.description", "Income and expense records will appear here once they're added.")
320
+ }) : /* @__PURE__ */ y(_, { children: [
321
+ /* @__PURE__ */ y("div", {
251
322
  className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
252
323
  children: [
253
- /* @__PURE__ */ x(i, {
254
- label: T("healthybowl.financial.transactions.stats.totalIncome.label", "Total Income"),
255
- value: K,
324
+ /* @__PURE__ */ v(i, {
325
+ label: S("healthybowl.financial.transactions.stats.totalIncome.label", "Total Income"),
326
+ value: G,
256
327
  prefix: "$",
257
- icon: /* @__PURE__ */ x(y, { className: "h-4 w-4" })
328
+ icon: /* @__PURE__ */ v(g, { className: "h-4 w-4" })
258
329
  }),
259
- /* @__PURE__ */ x(i, {
260
- label: T("healthybowl.financial.transactions.stats.totalExpenses.label", "Total Expenses"),
261
- value: q,
330
+ /* @__PURE__ */ v(i, {
331
+ label: S("healthybowl.financial.transactions.stats.totalExpenses.label", "Total Expenses"),
332
+ value: K,
262
333
  prefix: "$",
263
- icon: /* @__PURE__ */ x(v, { className: "h-4 w-4" })
334
+ icon: /* @__PURE__ */ v(h, { className: "h-4 w-4" })
264
335
  }),
265
- /* @__PURE__ */ x(i, {
266
- label: T("healthybowl.financial.transactions.stats.netAmount.label", "Net Amount"),
267
- value: ce,
336
+ /* @__PURE__ */ v(i, {
337
+ label: S("healthybowl.financial.transactions.stats.netAmount.label", "Net Amount"),
338
+ value: _e,
268
339
  prefix: "$",
269
- icon: /* @__PURE__ */ x(h, { className: "h-4 w-4" })
340
+ icon: /* @__PURE__ */ v(m, { className: "h-4 w-4" })
270
341
  }),
271
- /* @__PURE__ */ x(i, {
272
- label: T("healthybowl.financial.transactions.stats.count.label", "Transaction Count"),
273
- value: E.length,
274
- icon: /* @__PURE__ */ x(g, { className: "h-4 w-4" })
342
+ /* @__PURE__ */ v(i, {
343
+ label: S("healthybowl.financial.transactions.stats.count.label", "Transaction Count"),
344
+ value: C.length,
345
+ icon: /* @__PURE__ */ v(se, { className: "h-4 w-4" })
275
346
  })
276
347
  ]
277
348
  }),
278
- /* @__PURE__ */ x(c, {
279
- searchValue: j,
280
- onSearchChange: M,
281
- searchPlaceholder: T("healthybowl.financial.transactions.filters.searchPlaceholder", "Search by description or reference..."),
282
- filters: /* @__PURE__ */ S(b, { children: [
283
- /* @__PURE__ */ S("select", {
284
- value: N,
285
- onChange: (e) => P(e.target.value),
349
+ /* @__PURE__ */ v(ne, {
350
+ searchValue: D,
351
+ onSearchChange: O,
352
+ searchPlaceholder: S("healthybowl.financial.transactions.filters.searchPlaceholder", "Search by description or reference..."),
353
+ filters: /* @__PURE__ */ y(_, { children: [
354
+ /* @__PURE__ */ y("select", {
355
+ value: k,
356
+ onChange: (e) => A(e.target.value),
286
357
  className: Q,
287
358
  children: [
288
- /* @__PURE__ */ x("option", {
359
+ /* @__PURE__ */ v("option", {
289
360
  value: "all",
290
- children: T("healthybowl.financial.transactions.filters.type.all", "All Types")
361
+ children: S("healthybowl.financial.transactions.filters.type.all", "All Types")
291
362
  }),
292
- /* @__PURE__ */ x("option", {
363
+ /* @__PURE__ */ v("option", {
293
364
  value: "income",
294
- children: J.income
365
+ children: q.income
295
366
  }),
296
- /* @__PURE__ */ x("option", {
367
+ /* @__PURE__ */ v("option", {
297
368
  value: "expense",
298
- children: J.expense
369
+ children: q.expense
299
370
  })
300
371
  ]
301
372
  }),
302
- /* @__PURE__ */ S("select", {
303
- value: F,
304
- onChange: (e) => I(e.target.value),
373
+ /* @__PURE__ */ y("select", {
374
+ value: j,
375
+ onChange: (e) => M(e.target.value),
305
376
  className: Q,
306
- children: [/* @__PURE__ */ x("option", {
377
+ children: [/* @__PURE__ */ v("option", {
307
378
  value: "all",
308
- children: T("healthybowl.financial.transactions.filters.category.all", "All Categories")
309
- }), C.map((e) => /* @__PURE__ */ x("option", {
379
+ children: S("healthybowl.financial.transactions.filters.category.all", "All Categories")
380
+ }), b.map((e) => /* @__PURE__ */ v("option", {
310
381
  value: e,
311
- children: Y[e]
382
+ children: J[e]
312
383
  }, e))]
313
384
  }),
314
- /* @__PURE__ */ S("select", {
315
- value: L,
316
- onChange: (e) => R(e.target.value),
385
+ /* @__PURE__ */ y("select", {
386
+ value: N,
387
+ onChange: (e) => P(e.target.value),
317
388
  className: Q,
318
389
  children: [
319
- /* @__PURE__ */ x("option", {
390
+ /* @__PURE__ */ v("option", {
320
391
  value: "all",
321
- children: T("healthybowl.financial.transactions.filters.status.all", "All Statuses")
392
+ children: S("healthybowl.financial.transactions.filters.status.all", "All Statuses")
322
393
  }),
323
- /* @__PURE__ */ x("option", {
394
+ /* @__PURE__ */ v("option", {
324
395
  value: "completed",
325
- children: X.completed
396
+ children: Y.completed
326
397
  }),
327
- /* @__PURE__ */ x("option", {
398
+ /* @__PURE__ */ v("option", {
328
399
  value: "pending",
329
- children: X.pending
400
+ children: Y.pending
330
401
  }),
331
- /* @__PURE__ */ x("option", {
402
+ /* @__PURE__ */ v("option", {
332
403
  value: "failed",
333
- children: X.failed
404
+ children: Y.failed
334
405
  })
335
406
  ]
336
407
  })
337
408
  ] })
338
409
  }),
339
- /* @__PURE__ */ x(ee, {
340
- columns: fe,
341
- data: G,
410
+ /* @__PURE__ */ v(a, {
411
+ columns: Ce,
412
+ data: W,
342
413
  keyField: "id",
343
- emptyMessage: T("healthybowl.financial.transactions.table.empty", "No transactions found.")
414
+ emptyMessage: S("healthybowl.financial.transactions.table.empty", "No transactions found.")
344
415
  })
345
416
  ] }),
346
- /* @__PURE__ */ x(d, {
347
- open: z,
348
- onClose: () => {
349
- B(!1), W(w);
350
- },
351
- title: T("healthybowl.financial.transactions.modal.title", "Add Transaction"),
352
- description: T("healthybowl.financial.transactions.modal.description", "Record a new income or expense"),
417
+ /* @__PURE__ */ v(c, {
418
+ open: F,
419
+ onClose: X,
420
+ title: z ? S("healthybowl.financial.transactions.modal.editTitle", "Edit Transaction") : S("healthybowl.financial.transactions.modal.title", "Add Transaction"),
421
+ description: z ? S("healthybowl.financial.transactions.modal.editDescription", "Update this income or expense record") : S("healthybowl.financial.transactions.modal.description", "Record a new income or expense"),
353
422
  size: "lg",
354
- footer: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("button", {
355
- onClick: () => {
356
- B(!1), W(w);
357
- },
423
+ footer: /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("button", {
424
+ onClick: X,
358
425
  className: "rounded-md border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted",
359
- children: T("healthybowl.common.cancel", "Cancel")
360
- }), /* @__PURE__ */ x("button", {
361
- onClick: ue,
362
- disabled: V,
426
+ children: S("healthybowl.common.cancel", "Cancel")
427
+ }), /* @__PURE__ */ v("button", {
428
+ onClick: ye,
429
+ disabled: L,
363
430
  className: "rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-60",
364
- children: V ? T("healthybowl.financial.transactions.modal.submitting", "Adding...") : T("healthybowl.financial.transactions.actions.add", "Add Transaction")
431
+ children: L ? z ? S("healthybowl.financial.transactions.modal.updating", "Saving...") : S("healthybowl.financial.transactions.modal.submitting", "Adding...") : z ? S("healthybowl.financial.transactions.modal.update", "Save Changes") : S("healthybowl.financial.transactions.actions.add", "Add Transaction")
365
432
  })] }),
366
- children: /* @__PURE__ */ S("div", {
433
+ children: /* @__PURE__ */ y("div", {
367
434
  className: "grid gap-4 sm:grid-cols-2",
368
435
  children: [
369
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
436
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
370
437
  className: "mb-1 block text-sm font-medium text-foreground",
371
- children: T("healthybowl.financial.transactions.form.fields.date.label", "Date *")
372
- }), /* @__PURE__ */ x("input", {
438
+ children: S("healthybowl.financial.transactions.form.fields.date.label", "Date *")
439
+ }), /* @__PURE__ */ v("input", {
373
440
  type: "date",
374
- value: U.date,
441
+ value: H.date,
375
442
  onChange: (e) => Z("date", e.target.value),
376
443
  className: $
377
444
  })] }),
378
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
445
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
379
446
  className: "mb-1 block text-sm font-medium text-foreground",
380
- children: T("healthybowl.financial.transactions.form.fields.type.label", "Type *")
381
- }), /* @__PURE__ */ S("select", {
382
- value: U.type,
447
+ children: S("healthybowl.financial.transactions.form.fields.type.label", "Type *")
448
+ }), /* @__PURE__ */ y("select", {
449
+ value: H.type,
383
450
  onChange: (e) => Z("type", e.target.value),
384
451
  className: e($, "cursor-pointer"),
385
- children: [/* @__PURE__ */ x("option", {
452
+ children: [/* @__PURE__ */ v("option", {
386
453
  value: "income",
387
- children: J.income
388
- }), /* @__PURE__ */ x("option", {
454
+ children: q.income
455
+ }), /* @__PURE__ */ v("option", {
389
456
  value: "expense",
390
- children: J.expense
457
+ children: q.expense
391
458
  })]
392
459
  })] }),
393
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
460
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
394
461
  className: "mb-1 block text-sm font-medium text-foreground",
395
- children: T("healthybowl.financial.transactions.form.fields.category.label", "Category *")
396
- }), /* @__PURE__ */ x("select", {
397
- value: U.category,
462
+ children: S("healthybowl.financial.transactions.form.fields.category.label", "Category *")
463
+ }), /* @__PURE__ */ v("select", {
464
+ value: H.category,
398
465
  onChange: (e) => Z("category", e.target.value),
399
466
  className: e($, "cursor-pointer"),
400
- children: C.map((e) => /* @__PURE__ */ x("option", {
467
+ children: b.map((e) => /* @__PURE__ */ v("option", {
401
468
  value: e,
402
- children: Y[e]
469
+ children: J[e]
403
470
  }, e))
404
471
  })] }),
405
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
472
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
406
473
  className: "mb-1 block text-sm font-medium text-foreground",
407
- children: T("healthybowl.financial.transactions.form.fields.amount.label", "Amount *")
408
- }), /* @__PURE__ */ x("input", {
474
+ children: S("healthybowl.financial.transactions.form.fields.amount.label", "Amount *")
475
+ }), /* @__PURE__ */ v("input", {
409
476
  type: "number",
410
- value: U.amount,
477
+ value: H.amount,
411
478
  onChange: (e) => Z("amount", e.target.value),
412
479
  placeholder: "0.00",
413
480
  className: $,
414
481
  min: "0",
415
482
  step: "0.01"
416
483
  })] }),
417
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
484
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
418
485
  className: "mb-1 block text-sm font-medium text-foreground",
419
- children: T("healthybowl.financial.transactions.form.fields.status.label", "Status *")
420
- }), /* @__PURE__ */ S("select", {
421
- value: U.status,
486
+ children: S("healthybowl.financial.transactions.form.fields.status.label", "Status *")
487
+ }), /* @__PURE__ */ y("select", {
488
+ value: H.status,
422
489
  onChange: (e) => Z("status", e.target.value),
423
490
  className: e($, "cursor-pointer"),
424
491
  children: [
425
- /* @__PURE__ */ x("option", {
492
+ /* @__PURE__ */ v("option", {
426
493
  value: "completed",
427
- children: X.completed
494
+ children: Y.completed
428
495
  }),
429
- /* @__PURE__ */ x("option", {
496
+ /* @__PURE__ */ v("option", {
430
497
  value: "pending",
431
- children: X.pending
498
+ children: Y.pending
432
499
  }),
433
- /* @__PURE__ */ x("option", {
500
+ /* @__PURE__ */ v("option", {
434
501
  value: "failed",
435
- children: X.failed
502
+ children: Y.failed
436
503
  })
437
504
  ]
438
505
  })] }),
439
- /* @__PURE__ */ S("div", {
506
+ /* @__PURE__ */ y("div", {
440
507
  className: "sm:col-span-2",
441
- children: [/* @__PURE__ */ x("label", {
508
+ children: [/* @__PURE__ */ v("label", {
442
509
  className: "mb-1 block text-sm font-medium text-foreground",
443
- children: T("healthybowl.financial.transactions.form.fields.description.label", "Description *")
444
- }), /* @__PURE__ */ x("input", {
510
+ children: S("healthybowl.financial.transactions.form.fields.description.label", "Description *")
511
+ }), /* @__PURE__ */ v("input", {
445
512
  type: "text",
446
- value: U.description,
513
+ value: H.description,
447
514
  onChange: (e) => Z("description", e.target.value),
448
- placeholder: T("healthybowl.financial.transactions.form.fields.description.placeholder", "Transaction description"),
515
+ placeholder: S("healthybowl.financial.transactions.form.fields.description.placeholder", "Transaction description"),
449
516
  className: $
450
517
  })]
451
518
  }),
452
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
519
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
453
520
  className: "mb-1 block text-sm font-medium text-foreground",
454
- children: T("healthybowl.financial.transactions.form.fields.paymentMethod.label", "Payment Method")
455
- }), /* @__PURE__ */ x("select", {
456
- value: U.paymentMethod,
521
+ children: S("healthybowl.financial.transactions.form.fields.paymentMethod.label", "Payment Method")
522
+ }), /* @__PURE__ */ v("select", {
523
+ value: H.paymentMethod,
457
524
  onChange: (e) => Z("paymentMethod", e.target.value),
458
525
  className: e($, "cursor-pointer"),
459
- children: ae.map((e) => /* @__PURE__ */ x("option", {
526
+ children: ue.map((e) => /* @__PURE__ */ v("option", {
460
527
  value: e,
461
- children: le[e] ?? e
528
+ children: ve[e] ?? e
462
529
  }, e))
463
530
  })] }),
464
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
531
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
465
532
  className: "mb-1 block text-sm font-medium text-foreground",
466
- children: T("healthybowl.financial.transactions.form.fields.reference.label", "Reference")
467
- }), /* @__PURE__ */ x("input", {
533
+ children: S("healthybowl.financial.transactions.form.fields.reference.label", "Reference")
534
+ }), /* @__PURE__ */ v("input", {
468
535
  type: "text",
469
- value: U.reference,
536
+ value: H.reference,
470
537
  onChange: (e) => Z("reference", e.target.value),
471
538
  placeholder: "INV-2025-XXX",
472
539
  className: $
@@ -474,14 +541,14 @@ var C = [
474
541
  ]
475
542
  })
476
543
  }),
477
- /* @__PURE__ */ x(l, {
478
- toasts: se,
479
- onDismiss: A
544
+ /* @__PURE__ */ v(s, {
545
+ toasts: me,
546
+ onDismiss: he
480
547
  })
481
548
  ]
482
549
  });
483
550
  };
484
551
  //#endregion
485
- export { T as TransactionsPage };
552
+ export { S as TransactionsPage };
486
553
 
487
554
  //# sourceMappingURL=TransactionsPage.js.map