@burdenoff/microfe-healthybowl 2026.714.6 → 2026.714.8
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.
- package/dist/healthybowl/HealthyBowlRoutes.js +135 -95
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js +316 -0
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js.map +1 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +224 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js +297 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js +233 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js +365 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js +384 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js +32 -16
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +221 -0
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js +261 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js.map +1 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js +202 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js +258 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +255 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js +387 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js +313 -114
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +554 -213
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +457 -0
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -0
- package/dist/healthybowl/utils/download.js +11 -0
- package/dist/healthybowl/utils/download.js.map +1 -0
- package/dist/healthybowl/utils/helpers.js +11 -8
- package/dist/healthybowl/utils/helpers.js.map +1 -1
- package/dist/healthybowl/utils/period.js +15 -0
- package/dist/healthybowl/utils/period.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
|
+
import { formatCurrency as t, joinPath 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 { DataTable as a } from "../../components/DataTable.js";
|
|
6
|
+
import { EmptyState as o } from "../../components/EmptyState.js";
|
|
7
|
+
import { ErrorState as s } from "../../components/ErrorState.js";
|
|
8
|
+
import { ChartCard as c } from "../../components/ChartCard.js";
|
|
9
|
+
import { ToastContainer as l } from "../../components/Toast.js";
|
|
10
|
+
import { LoadingSkeleton as u } from "../../components/LoadingSkeleton.js";
|
|
11
|
+
import { useToast as d } from "../../hooks/useToast.js";
|
|
12
|
+
import "../../components/index.js";
|
|
13
|
+
import { useHealthyBowlAccounting as f } from "../../hooks/useHealthyBowlAccounting.js";
|
|
14
|
+
import { financialYearRange as p } from "../../utils/period.js";
|
|
15
|
+
import { downloadBase64 as m } from "../../utils/download.js";
|
|
16
|
+
import { JournalEntryModal as h } from "./JournalEntryModal.js";
|
|
17
|
+
import { useEffect as g, useMemo as _, useState as v } from "react";
|
|
18
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
|
+
import { Button as S } from "@burdenoff/fe-libs/ui";
|
|
20
|
+
//#region src/healthybowl/pages/financial/FarmAccountingPage.tsx
|
|
21
|
+
var C = [
|
|
22
|
+
{
|
|
23
|
+
key: "all",
|
|
24
|
+
label: "All Accounts",
|
|
25
|
+
type: null
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "asset",
|
|
29
|
+
label: "Assets",
|
|
30
|
+
type: "ASSET"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "liability",
|
|
34
|
+
label: "Liabilities",
|
|
35
|
+
type: "LIABILITY"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "income",
|
|
39
|
+
label: "Income",
|
|
40
|
+
type: "INCOME"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "expense",
|
|
44
|
+
label: "Expenses",
|
|
45
|
+
type: "EXPENSE"
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
function w() {
|
|
49
|
+
let { basePath: w, navigate: T } = e(), { toasts: E, toast: D, dismiss: O } = d(), k = _(() => p(), []), [A, j] = v(0), [M, N] = v(!1), [P, F] = v(!1), I = f({
|
|
50
|
+
profitAndLoss: !0,
|
|
51
|
+
pnlRange: k,
|
|
52
|
+
generalLedger: !0,
|
|
53
|
+
ledgerFilters: {
|
|
54
|
+
accountType: C[A]?.type ?? null,
|
|
55
|
+
startDate: k.startDate,
|
|
56
|
+
endDate: k.endDate,
|
|
57
|
+
limit: 12
|
|
58
|
+
},
|
|
59
|
+
costByCrop: !0,
|
|
60
|
+
costByCropParams: {
|
|
61
|
+
startDate: k.startDate,
|
|
62
|
+
endDate: k.endDate
|
|
63
|
+
},
|
|
64
|
+
integrations: !0,
|
|
65
|
+
chartOfAccounts: !0,
|
|
66
|
+
costCenters: !0
|
|
67
|
+
});
|
|
68
|
+
g(() => {
|
|
69
|
+
P || !I.loading && I.chartOfAccounts.length === 0 && !I.error && (F(!0), I.ensureChartOfAccounts().catch(() => void 0));
|
|
70
|
+
}, [I, P]);
|
|
71
|
+
let L = I.profitAndLoss, R = I.generalLedger, z = I.costByCrop, B = async (e) => {
|
|
72
|
+
try {
|
|
73
|
+
let t = await I.exportProfitAndLoss(k.startDate, k.endDate, e);
|
|
74
|
+
if (!t) throw Error("Export produced no content.");
|
|
75
|
+
m(t.contentBase64, t.filename, t.mimeType), D({
|
|
76
|
+
title: `P&L exported as ${e}`,
|
|
77
|
+
variant: "success"
|
|
78
|
+
});
|
|
79
|
+
} catch (e) {
|
|
80
|
+
D({
|
|
81
|
+
title: "Export failed",
|
|
82
|
+
description: e instanceof Error ? e.message : void 0,
|
|
83
|
+
variant: "error"
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, V = [
|
|
87
|
+
{
|
|
88
|
+
key: "date",
|
|
89
|
+
header: "Date",
|
|
90
|
+
render: (e) => new Date(e.date).toISOString().slice(0, 10)
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "account",
|
|
94
|
+
header: "Account",
|
|
95
|
+
render: (e) => `${e.accountCode} · ${e.accountName}`
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "description",
|
|
99
|
+
header: "Description",
|
|
100
|
+
render: (e) => e.description || e.costCenterLabel || "—"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "debit",
|
|
104
|
+
header: "Debit (₹)",
|
|
105
|
+
className: "text-right",
|
|
106
|
+
render: (e) => e.debit ? t(e.debit, "INR") : "—"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "credit",
|
|
110
|
+
header: "Credit (₹)",
|
|
111
|
+
className: "text-right",
|
|
112
|
+
render: (e) => e.credit ? t(e.credit, "INR") : "—"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
key: "runningBalance",
|
|
116
|
+
header: "Balance (₹)",
|
|
117
|
+
className: "text-right",
|
|
118
|
+
render: (e) => t(e.runningBalance, "INR")
|
|
119
|
+
}
|
|
120
|
+
], H = [
|
|
121
|
+
{
|
|
122
|
+
key: "label",
|
|
123
|
+
header: "Crop / Animal",
|
|
124
|
+
render: (e) => e.label
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: "costPerKg",
|
|
128
|
+
header: "Cost/kg (₹)",
|
|
129
|
+
className: "text-right",
|
|
130
|
+
render: (e) => e.costPerKg == null ? "—" : t(e.costPerKg, "INR")
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: "revenuePerKg",
|
|
134
|
+
header: "Revenue/kg (₹)",
|
|
135
|
+
className: "text-right",
|
|
136
|
+
render: (e) => e.revenuePerKg == null ? "—" : t(e.revenuePerKg, "INR")
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "grossMarginPct",
|
|
140
|
+
header: "Margin %",
|
|
141
|
+
className: "text-right",
|
|
142
|
+
render: (e) => e.grossMarginPct == null ? "—" : /* @__PURE__ */ x("span", {
|
|
143
|
+
className: e.grossMarginPct >= 0 ? "text-success" : "text-destructive",
|
|
144
|
+
children: [e.grossMarginPct, "%"]
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
], U = Math.max(1, ...(z?.rows ?? []).map((e) => Math.abs(e.grossMarginPct ?? 0)));
|
|
148
|
+
return /* @__PURE__ */ x(r, {
|
|
149
|
+
title: "Farm Accounting — General Ledger & Cost by Crop",
|
|
150
|
+
description: "Double-entry books, per-crop profitability, and one-click accounting-system sync.",
|
|
151
|
+
actions: /* @__PURE__ */ x("div", {
|
|
152
|
+
className: "flex flex-wrap gap-2",
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ b(S, {
|
|
155
|
+
variant: "outline",
|
|
156
|
+
onClick: () => T(n(w, "financial/chart-of-accounts")),
|
|
157
|
+
children: "Chart of Accounts"
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ b(S, {
|
|
160
|
+
variant: "outline",
|
|
161
|
+
onClick: () => T(n(w, "financial/ledger")),
|
|
162
|
+
children: "General Ledger"
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ b(S, {
|
|
165
|
+
onClick: () => N(!0),
|
|
166
|
+
children: "New Journal Entry"
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
}),
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ b(l, {
|
|
172
|
+
toasts: E,
|
|
173
|
+
onDismiss: O
|
|
174
|
+
}),
|
|
175
|
+
I.error && I.chartOfAccounts.length === 0 ? /* @__PURE__ */ b(s, {
|
|
176
|
+
title: "Could not load accounting data",
|
|
177
|
+
description: I.error.message
|
|
178
|
+
}) : I.loading && !L ? /* @__PURE__ */ b(u, {
|
|
179
|
+
variant: "table",
|
|
180
|
+
count: 6
|
|
181
|
+
}) : /* @__PURE__ */ x("div", {
|
|
182
|
+
className: "space-y-6",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ x("div", {
|
|
185
|
+
className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ b(i, {
|
|
188
|
+
hero: !0,
|
|
189
|
+
label: "Total Revenue",
|
|
190
|
+
value: t(L?.totalRevenue ?? 0, "INR")
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ b(i, {
|
|
193
|
+
label: "Total Expenses",
|
|
194
|
+
value: t(L?.totalExpenses ?? 0, "INR")
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ b(i, {
|
|
197
|
+
label: "Net Profit",
|
|
198
|
+
value: t(L?.netProfit ?? 0, "INR")
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ b(i, {
|
|
201
|
+
label: "Gross Margin",
|
|
202
|
+
value: `${L?.grossMarginPct ?? 0}%`
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ x("div", {
|
|
207
|
+
className: "grid grid-cols-1 gap-6 xl:grid-cols-2",
|
|
208
|
+
children: [/* @__PURE__ */ x(c, {
|
|
209
|
+
title: "General Ledger",
|
|
210
|
+
actions: /* @__PURE__ */ b(S, {
|
|
211
|
+
variant: "ghost",
|
|
212
|
+
size: "sm",
|
|
213
|
+
onClick: () => T(n(w, "financial/ledger")),
|
|
214
|
+
children: "View all"
|
|
215
|
+
}),
|
|
216
|
+
children: [/* @__PURE__ */ b("div", {
|
|
217
|
+
className: "mb-3 flex flex-wrap gap-1",
|
|
218
|
+
children: C.map((e, t) => /* @__PURE__ */ b("button", {
|
|
219
|
+
onClick: () => j(t),
|
|
220
|
+
className: `rounded-md px-3 py-1.5 text-sm ${t === A ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-bg-sunken/50"}`,
|
|
221
|
+
children: e.label
|
|
222
|
+
}, e.key))
|
|
223
|
+
}), R && R.rows.length > 0 ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(a, {
|
|
224
|
+
columns: V,
|
|
225
|
+
data: R.rows,
|
|
226
|
+
keyField: "id",
|
|
227
|
+
pageSize: 12
|
|
228
|
+
}), /* @__PURE__ */ x("div", {
|
|
229
|
+
className: "mt-2 flex justify-end gap-6 border-t border-border-subtle pt-2 text-sm",
|
|
230
|
+
children: [/* @__PURE__ */ x("span", {
|
|
231
|
+
className: "text-text-secondary",
|
|
232
|
+
children: [
|
|
233
|
+
"Total Debit",
|
|
234
|
+
" ",
|
|
235
|
+
/* @__PURE__ */ b("span", {
|
|
236
|
+
className: "font-semibold text-text-primary",
|
|
237
|
+
children: t(R.totalDebit, "INR")
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
}), /* @__PURE__ */ x("span", {
|
|
241
|
+
className: "text-text-secondary",
|
|
242
|
+
children: [
|
|
243
|
+
"Total Credit",
|
|
244
|
+
" ",
|
|
245
|
+
/* @__PURE__ */ b("span", {
|
|
246
|
+
className: "font-semibold text-text-primary",
|
|
247
|
+
children: t(R.totalCredit, "INR")
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
})]
|
|
251
|
+
})] }) : /* @__PURE__ */ b(o, {
|
|
252
|
+
title: "No posted entries yet",
|
|
253
|
+
description: "Post a journal entry to start your general ledger.",
|
|
254
|
+
action: /* @__PURE__ */ b(S, {
|
|
255
|
+
size: "sm",
|
|
256
|
+
onClick: () => N(!0),
|
|
257
|
+
children: "New Journal Entry"
|
|
258
|
+
})
|
|
259
|
+
})]
|
|
260
|
+
}), /* @__PURE__ */ b(c, {
|
|
261
|
+
title: "Cost by Crop / Per-Animal Profitability",
|
|
262
|
+
description: "Gross margin by crop",
|
|
263
|
+
actions: /* @__PURE__ */ b(S, {
|
|
264
|
+
variant: "ghost",
|
|
265
|
+
size: "sm",
|
|
266
|
+
onClick: () => T(n(w, "financial/cost-by-crop")),
|
|
267
|
+
children: "Details"
|
|
268
|
+
}),
|
|
269
|
+
children: z && z.rows.length > 0 ? /* @__PURE__ */ x("div", {
|
|
270
|
+
className: "space-y-4",
|
|
271
|
+
children: [/* @__PURE__ */ b("div", {
|
|
272
|
+
className: "space-y-2",
|
|
273
|
+
children: z.rows.slice(0, 6).map((e) => /* @__PURE__ */ x("div", {
|
|
274
|
+
className: "flex items-center gap-2 text-sm",
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ b("span", {
|
|
277
|
+
className: "w-28 shrink-0 truncate text-text-secondary",
|
|
278
|
+
children: e.label
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ b("div", {
|
|
281
|
+
className: "h-4 flex-1 overflow-hidden rounded bg-bg-sunken/60",
|
|
282
|
+
children: /* @__PURE__ */ b("div", {
|
|
283
|
+
className: "h-full rounded bg-[var(--color-accent-teal)]",
|
|
284
|
+
style: { width: `${Math.min(100, Math.abs(e.grossMarginPct ?? 0) / U * 100)}%` }
|
|
285
|
+
})
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ b("span", {
|
|
288
|
+
className: "w-12 shrink-0 text-right font-medium text-text-primary",
|
|
289
|
+
children: e.grossMarginPct == null ? "—" : `${e.grossMarginPct}%`
|
|
290
|
+
})
|
|
291
|
+
]
|
|
292
|
+
}, e.costCenterId))
|
|
293
|
+
}), /* @__PURE__ */ b(a, {
|
|
294
|
+
columns: H,
|
|
295
|
+
data: z.rows.slice(0, 6),
|
|
296
|
+
keyField: "costCenterId"
|
|
297
|
+
})]
|
|
298
|
+
}) : /* @__PURE__ */ b(o, {
|
|
299
|
+
title: "No cost allocations yet",
|
|
300
|
+
description: "Allocate journal-entry lines to a crop/animal cost center to see profitability.",
|
|
301
|
+
action: /* @__PURE__ */ b(S, {
|
|
302
|
+
size: "sm",
|
|
303
|
+
onClick: () => T(n(w, "financial/cost-by-crop")),
|
|
304
|
+
children: "Set up cost centers"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
})]
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ b(c, {
|
|
310
|
+
title: "Accounting Integrations",
|
|
311
|
+
actions: /* @__PURE__ */ x("div", {
|
|
312
|
+
className: "flex gap-2",
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ b(S, {
|
|
315
|
+
variant: "outline",
|
|
316
|
+
size: "sm",
|
|
317
|
+
onClick: () => B("CSV"),
|
|
318
|
+
children: "Export P&L (CSV)"
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ b(S, {
|
|
321
|
+
variant: "outline",
|
|
322
|
+
size: "sm",
|
|
323
|
+
onClick: () => B("PDF"),
|
|
324
|
+
children: "Export P&L (PDF)"
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ b(S, {
|
|
327
|
+
variant: "ghost",
|
|
328
|
+
size: "sm",
|
|
329
|
+
onClick: () => T(n(w, "financial/accounting-integrations")),
|
|
330
|
+
children: "Manage"
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
}),
|
|
334
|
+
children: /* @__PURE__ */ b("div", {
|
|
335
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
336
|
+
children: [
|
|
337
|
+
"TALLY",
|
|
338
|
+
"ZOHO_BOOKS",
|
|
339
|
+
"QUICKBOOKS"
|
|
340
|
+
].map((e) => {
|
|
341
|
+
let t = I.integrations?.integrations.find((t) => t.provider === e)?.status ?? "NOT_CONNECTED";
|
|
342
|
+
return /* @__PURE__ */ x("div", {
|
|
343
|
+
className: "flex items-center justify-between rounded-lg border border-border-subtle bg-bg-surface px-4 py-3",
|
|
344
|
+
children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("div", {
|
|
345
|
+
className: "text-sm font-semibold text-text-primary",
|
|
346
|
+
children: e === "ZOHO_BOOKS" ? "Zoho Books" : e === "QUICKBOOKS" ? "QuickBooks" : "Tally"
|
|
347
|
+
}), /* @__PURE__ */ b("div", {
|
|
348
|
+
className: `text-xs ${t === "CONNECTED" ? "text-success" : t === "SYNC_READY" ? "text-status-warning-text" : "text-text-secondary"}`,
|
|
349
|
+
children: t === "CONNECTED" ? "Connected" : t === "SYNC_READY" ? "Sync ready" : "Not connected"
|
|
350
|
+
})] }), /* @__PURE__ */ b(S, {
|
|
351
|
+
variant: "outline",
|
|
352
|
+
size: "sm",
|
|
353
|
+
onClick: () => T(n(w, "financial/accounting-integrations")),
|
|
354
|
+
children: t === "NOT_CONNECTED" ? "Connect" : "Manage"
|
|
355
|
+
})]
|
|
356
|
+
}, e);
|
|
357
|
+
})
|
|
358
|
+
})
|
|
359
|
+
})
|
|
360
|
+
]
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ b(h, {
|
|
363
|
+
open: M,
|
|
364
|
+
onClose: () => N(!1),
|
|
365
|
+
accounts: I.chartOfAccounts,
|
|
366
|
+
costCenters: I.costCenters,
|
|
367
|
+
onPost: I.postJournalEntry,
|
|
368
|
+
onSaveDraft: I.saveDraft,
|
|
369
|
+
onSuccess: (e) => D({
|
|
370
|
+
title: e,
|
|
371
|
+
variant: "success"
|
|
372
|
+
}),
|
|
373
|
+
onError: (e) => D({
|
|
374
|
+
title: e,
|
|
375
|
+
variant: "error"
|
|
376
|
+
})
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
export { w as FarmAccountingPage };
|
|
383
|
+
|
|
384
|
+
//# sourceMappingURL=FarmAccountingPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FarmAccountingPage.js","names":[],"sources":["../../../../src/healthybowl/pages/financial/FarmAccountingPage.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport {\n PageLayout,\n StatCard,\n DataTable,\n ChartCard,\n LoadingSkeleton,\n EmptyState,\n ErrorState,\n ToastContainer,\n} from '../../components';\nimport type { Column } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { formatCurrency, joinPath } from '../../utils/helpers';\nimport { downloadBase64 } from '../../utils/download';\nimport { financialYearRange } from '../../utils/period';\nimport { useHealthyBowlAccounting } from '../../hooks/useHealthyBowlAccounting';\nimport type { GeneralLedgerRow, CropProfitability } from '../../hooks/useHealthyBowlAccounting';\nimport { JournalEntryModal } from './JournalEntryModal';\n\nconst COA_TABS: Array<{ key: string; label: string; type: string | null }> = [\n { key: 'all', label: 'All Accounts', type: null },\n { key: 'asset', label: 'Assets', type: 'ASSET' },\n { key: 'liability', label: 'Liabilities', type: 'LIABILITY' },\n { key: 'income', label: 'Income', type: 'INCOME' },\n { key: 'expense', label: 'Expenses', type: 'EXPENSE' },\n];\n\nexport function FarmAccountingPage() {\n const { basePath, navigate } = useHealthyBowl();\n const { toasts, toast, dismiss } = useToast();\n const period = useMemo(() => financialYearRange(), []);\n const [coaTab, setCoaTab] = useState(0);\n const [modalOpen, setModalOpen] = useState(false);\n const [seeded, setSeeded] = useState(false);\n\n const acc = useHealthyBowlAccounting({\n profitAndLoss: true,\n pnlRange: period,\n generalLedger: true,\n ledgerFilters: {\n accountType: COA_TABS[coaTab]?.type ?? null,\n startDate: period.startDate,\n endDate: period.endDate,\n limit: 12,\n },\n costByCrop: true,\n costByCropParams: { startDate: period.startDate, endDate: period.endDate },\n integrations: true,\n chartOfAccounts: true,\n costCenters: true,\n });\n\n // First-time users get the default chart of accounts seeded automatically.\n useEffect(() => {\n if (seeded) return;\n if (!acc.loading && acc.chartOfAccounts.length === 0 && !acc.error) {\n setSeeded(true);\n acc.ensureChartOfAccounts().catch(() => undefined);\n }\n }, [acc, seeded]);\n\n const pnl = acc.profitAndLoss;\n const gl = acc.generalLedger;\n const cbc = acc.costByCrop;\n\n const exportPnl = async (format: 'CSV' | 'PDF') => {\n try {\n const out = await acc.exportProfitAndLoss(period.startDate, period.endDate, format);\n if (!out) throw new Error('Export produced no content.');\n downloadBase64(out.contentBase64, out.filename, out.mimeType);\n toast({ title: `P&L exported as ${format}`, variant: 'success' });\n } catch (err) {\n toast({ title: 'Export failed', description: err instanceof Error ? err.message : undefined, variant: 'error' });\n }\n };\n\n const glColumns: Column<GeneralLedgerRow>[] = [\n { key: 'date', header: 'Date', render: (r) => new Date(r.date).toISOString().slice(0, 10) },\n { key: 'account', header: 'Account', render: (r) => `${r.accountCode} · ${r.accountName}` },\n { key: 'description', header: 'Description', render: (r) => r.description || r.costCenterLabel || '—' },\n {\n key: 'debit',\n header: 'Debit (₹)',\n className: 'text-right',\n render: (r) => (r.debit ? formatCurrency(r.debit, 'INR') : '—'),\n },\n {\n key: 'credit',\n header: 'Credit (₹)',\n className: 'text-right',\n render: (r) => (r.credit ? formatCurrency(r.credit, 'INR') : '—'),\n },\n {\n key: 'runningBalance',\n header: 'Balance (₹)',\n className: 'text-right',\n render: (r) => formatCurrency(r.runningBalance, 'INR'),\n },\n ];\n\n const cropColumns: Column<CropProfitability>[] = [\n { key: 'label', header: 'Crop / Animal', render: (r) => r.label },\n {\n key: 'costPerKg',\n header: 'Cost/kg (₹)',\n className: 'text-right',\n render: (r) => (r.costPerKg == null ? '—' : formatCurrency(r.costPerKg, 'INR')),\n },\n {\n key: 'revenuePerKg',\n header: 'Revenue/kg (₹)',\n className: 'text-right',\n render: (r) => (r.revenuePerKg == null ? '—' : formatCurrency(r.revenuePerKg, 'INR')),\n },\n {\n key: 'grossMarginPct',\n header: 'Margin %',\n className: 'text-right',\n render: (r) =>\n r.grossMarginPct == null ? (\n '—'\n ) : (\n <span className={r.grossMarginPct >= 0 ? 'text-success' : 'text-destructive'}>{r.grossMarginPct}%</span>\n ),\n },\n ];\n\n const maxMargin = Math.max(1, ...(cbc?.rows ?? []).map((r) => Math.abs(r.grossMarginPct ?? 0)));\n\n return (\n <PageLayout\n title=\"Farm Accounting — General Ledger & Cost by Crop\"\n description=\"Double-entry books, per-crop profitability, and one-click accounting-system sync.\"\n actions={\n <div className=\"flex flex-wrap gap-2\">\n <Button variant=\"outline\" onClick={() => navigate(joinPath(basePath, 'financial/chart-of-accounts'))}>\n Chart of Accounts\n </Button>\n <Button variant=\"outline\" onClick={() => navigate(joinPath(basePath, 'financial/ledger'))}>\n General Ledger\n </Button>\n <Button onClick={() => setModalOpen(true)}>New Journal Entry</Button>\n </div>\n }\n >\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n\n {acc.error && acc.chartOfAccounts.length === 0 ? (\n <ErrorState title=\"Could not load accounting data\" description={acc.error.message} />\n ) : acc.loading && !pnl ? (\n <LoadingSkeleton variant=\"table\" count={6} />\n ) : (\n <div className=\"space-y-6\">\n {/* KPI cards */}\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n <StatCard hero label=\"Total Revenue\" value={formatCurrency(pnl?.totalRevenue ?? 0, 'INR')} />\n <StatCard label=\"Total Expenses\" value={formatCurrency(pnl?.totalExpenses ?? 0, 'INR')} />\n <StatCard label=\"Net Profit\" value={formatCurrency(pnl?.netProfit ?? 0, 'INR')} />\n <StatCard label=\"Gross Margin\" value={`${pnl?.grossMarginPct ?? 0}%`} />\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 xl:grid-cols-2\">\n {/* General Ledger */}\n <ChartCard\n title=\"General Ledger\"\n actions={\n <Button variant=\"ghost\" size=\"sm\" onClick={() => navigate(joinPath(basePath, 'financial/ledger'))}>\n View all\n </Button>\n }\n >\n <div className=\"mb-3 flex flex-wrap gap-1\">\n {COA_TABS.map((tab, i) => (\n <button\n key={tab.key}\n onClick={() => setCoaTab(i)}\n className={`rounded-md px-3 py-1.5 text-sm ${\n i === coaTab\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {tab.label}\n </button>\n ))}\n </div>\n {gl && gl.rows.length > 0 ? (\n <>\n <DataTable columns={glColumns} data={gl.rows} keyField=\"id\" pageSize={12} />\n <div className=\"mt-2 flex justify-end gap-6 border-t border-border-subtle pt-2 text-sm\">\n <span className=\"text-text-secondary\">\n Total Debit{' '}\n <span className=\"font-semibold text-text-primary\">{formatCurrency(gl.totalDebit, 'INR')}</span>\n </span>\n <span className=\"text-text-secondary\">\n Total Credit{' '}\n <span className=\"font-semibold text-text-primary\">{formatCurrency(gl.totalCredit, 'INR')}</span>\n </span>\n </div>\n </>\n ) : (\n <EmptyState\n title=\"No posted entries yet\"\n description=\"Post a journal entry to start your general ledger.\"\n action={\n <Button size=\"sm\" onClick={() => setModalOpen(true)}>\n New Journal Entry\n </Button>\n }\n />\n )}\n </ChartCard>\n\n {/* Cost by Crop / Per-Animal Profitability */}\n <ChartCard\n title=\"Cost by Crop / Per-Animal Profitability\"\n description=\"Gross margin by crop\"\n actions={\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(joinPath(basePath, 'financial/cost-by-crop'))}\n >\n Details\n </Button>\n }\n >\n {cbc && cbc.rows.length > 0 ? (\n <div className=\"space-y-4\">\n <div className=\"space-y-2\">\n {cbc.rows.slice(0, 6).map((r) => (\n <div key={r.costCenterId} className=\"flex items-center gap-2 text-sm\">\n <span className=\"w-28 shrink-0 truncate text-text-secondary\">{r.label}</span>\n <div className=\"h-4 flex-1 overflow-hidden rounded bg-bg-sunken/60\">\n <div\n className=\"h-full rounded bg-[var(--color-accent-teal)]\"\n style={{ width: `${Math.min(100, (Math.abs(r.grossMarginPct ?? 0) / maxMargin) * 100)}%` }}\n />\n </div>\n <span className=\"w-12 shrink-0 text-right font-medium text-text-primary\">\n {r.grossMarginPct == null ? '—' : `${r.grossMarginPct}%`}\n </span>\n </div>\n ))}\n </div>\n <DataTable columns={cropColumns} data={cbc.rows.slice(0, 6)} keyField=\"costCenterId\" />\n </div>\n ) : (\n <EmptyState\n title=\"No cost allocations yet\"\n description=\"Allocate journal-entry lines to a crop/animal cost center to see profitability.\"\n action={\n <Button size=\"sm\" onClick={() => navigate(joinPath(basePath, 'financial/cost-by-crop'))}>\n Set up cost centers\n </Button>\n }\n />\n )}\n </ChartCard>\n </div>\n\n {/* Accounting Integrations strip + Export */}\n <ChartCard\n title=\"Accounting Integrations\"\n actions={\n <div className=\"flex gap-2\">\n <Button variant=\"outline\" size=\"sm\" onClick={() => exportPnl('CSV')}>\n Export P&L (CSV)\n </Button>\n <Button variant=\"outline\" size=\"sm\" onClick={() => exportPnl('PDF')}>\n Export P&L (PDF)\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(joinPath(basePath, 'financial/accounting-integrations'))}\n >\n Manage\n </Button>\n </div>\n }\n >\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n {(['TALLY', 'ZOHO_BOOKS', 'QUICKBOOKS'] as const).map((provider) => {\n const found = acc.integrations?.integrations.find((i) => i.provider === provider);\n const status = found?.status ?? 'NOT_CONNECTED';\n const label =\n provider === 'ZOHO_BOOKS' ? 'Zoho Books' : provider === 'QUICKBOOKS' ? 'QuickBooks' : 'Tally';\n const statusLabel =\n status === 'CONNECTED' ? 'Connected' : status === 'SYNC_READY' ? 'Sync ready' : 'Not connected';\n const statusColor =\n status === 'CONNECTED'\n ? 'text-success'\n : status === 'SYNC_READY'\n ? 'text-status-warning-text'\n : 'text-text-secondary';\n return (\n <div\n key={provider}\n className=\"flex items-center justify-between rounded-lg border border-border-subtle bg-bg-surface px-4 py-3\"\n >\n <div>\n <div className=\"text-sm font-semibold text-text-primary\">{label}</div>\n <div className={`text-xs ${statusColor}`}>{statusLabel}</div>\n </div>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => navigate(joinPath(basePath, 'financial/accounting-integrations'))}\n >\n {status === 'NOT_CONNECTED' ? 'Connect' : 'Manage'}\n </Button>\n </div>\n );\n })}\n </div>\n </ChartCard>\n </div>\n )}\n\n <JournalEntryModal\n open={modalOpen}\n onClose={() => setModalOpen(false)}\n accounts={acc.chartOfAccounts}\n costCenters={acc.costCenters}\n onPost={acc.postJournalEntry}\n onSaveDraft={acc.saveDraft}\n onSuccess={(m) => toast({ title: m, variant: 'success' })}\n onError={(m) => toast({ title: m, variant: 'error' })}\n />\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,IAAM,IAAuE;CAC3E;EAAE,KAAK;EAAO,OAAO;EAAgB,MAAM;EAAM;CACjD;EAAE,KAAK;EAAS,OAAO;EAAU,MAAM;EAAS;CAChD;EAAE,KAAK;EAAa,OAAO;EAAe,MAAM;EAAa;CAC7D;EAAE,KAAK;EAAU,OAAO;EAAU,MAAM;EAAU;CAClD;EAAE,KAAK;EAAW,OAAO;EAAY,MAAM;EAAW;CACvD;AAED,SAAgB,IAAqB;CACnC,IAAM,EAAE,aAAU,gBAAa,GAAgB,EACzC,EAAE,WAAQ,UAAO,eAAY,GAAU,EACvC,IAAS,QAAc,GAAoB,EAAE,EAAE,CAAC,EAChD,CAAC,GAAQ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CACL;WAdC,EAcD;SAER;OACE,CAAA;MACI,CAAA;KACR;;GAGR,kBAAC,GAAD;IACE,MAAM;IACN,eAAe,EAAa,GAAM;IAClC,UAAU,EAAI;IACd,aAAa,EAAI;IACjB,QAAQ,EAAI;IACZ,aAAa,EAAI;IACjB,YAAY,MAAM,EAAM;KAAE,OAAO;KAAG,SAAS;KAAW,CAAC;IACzD,UAAU,MAAM,EAAM;KAAE,OAAO;KAAG,SAAS;KAAS,CAAC;IACrD,CAAA;GACS"}
|
|
@@ -134,26 +134,42 @@ var O = [
|
|
|
134
134
|
label: "Manage invoices",
|
|
135
135
|
description: "Raise and chase invoices to keep receivables current.",
|
|
136
136
|
onClick: () => I(L("financial/invoices"))
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "accounting",
|
|
140
|
+
label: "Farm Accounting — General Ledger & Cost by Crop",
|
|
141
|
+
description: "Double-entry books, per-crop profitability, P&L export and accounting-system sync.",
|
|
142
|
+
onClick: () => I(L("financial/accounting"))
|
|
137
143
|
}
|
|
138
144
|
],
|
|
139
145
|
actions: /* @__PURE__ */ E("div", {
|
|
140
146
|
className: "flex items-center gap-2",
|
|
141
|
-
children: [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ T(D, {
|
|
149
|
+
variant: "outline",
|
|
150
|
+
size: "sm",
|
|
151
|
+
onClick: () => I(L("financial/accounting")),
|
|
152
|
+
className: "text-text-secondary hover:text-text-primary",
|
|
153
|
+
children: "Farm Accounting"
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ E(D, {
|
|
156
|
+
variant: "outline",
|
|
157
|
+
size: "sm",
|
|
158
|
+
onClick: () => I(L("financial/financier-access")),
|
|
159
|
+
className: "text-text-secondary hover:text-text-primary",
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ T(v, { className: "h-4 w-4" }),
|
|
162
|
+
" ",
|
|
163
|
+
A("healthybowl.financial.dashboard.actions.financierAccess", "Financier Access")
|
|
164
|
+
]
|
|
165
|
+
}),
|
|
166
|
+
Object.keys($).map((t) => /* @__PURE__ */ T("button", {
|
|
167
|
+
type: "button",
|
|
168
|
+
onClick: () => ye(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))
|
|
172
|
+
]
|
|
157
173
|
}),
|
|
158
174
|
children: [Ce ? /* @__PURE__ */ T(te, {
|
|
159
175
|
variant: "card",
|