@burdenoff/microfe-healthybowl 2026.1005.2 → 2026.1007.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.
- package/dist/healthybowl/components/BedLayoutGrid.js +128 -115
- package/dist/healthybowl/components/BedLayoutGrid.js.map +1 -1
- package/dist/healthybowl/components/CropPicker.js +37 -0
- package/dist/healthybowl/components/CropPicker.js.map +1 -0
- package/dist/healthybowl/components/DataTable.js +125 -108
- package/dist/healthybowl/components/DataTable.js.map +1 -1
- package/dist/healthybowl/components/FilterBar.js +9 -6
- package/dist/healthybowl/components/FilterBar.js.map +1 -1
- package/dist/healthybowl/components/PlantCatalogPicker.js +32 -0
- package/dist/healthybowl/components/PlantCatalogPicker.js.map +1 -0
- package/dist/healthybowl/components/WorkspaceRecordPicker.js +164 -0
- package/dist/healthybowl/components/WorkspaceRecordPicker.js.map +1 -0
- package/dist/healthybowl/components/index.js +3 -1
- package/dist/healthybowl/hooks/useCropPage.js +71 -0
- package/dist/healthybowl/hooks/useCropPage.js.map +1 -0
- package/dist/healthybowl/hooks/usePlantCatalog.js +133 -44
- package/dist/healthybowl/hooks/usePlantCatalog.js.map +1 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +6 -6
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -1
- package/dist/healthybowl/hooks/useWorkspaceRead.js +46 -0
- package/dist/healthybowl/hooks/useWorkspaceRead.js.map +1 -0
- package/dist/healthybowl/pages/HomePage.js +143 -142
- package/dist/healthybowl/pages/HomePage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +8 -8
- package/dist/healthybowl/pages/catalog/PlantCatalogPage.js +266 -192
- package/dist/healthybowl/pages/catalog/PlantCatalogPage.js.map +1 -1
- package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js +58 -0
- package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js.map +1 -0
- package/dist/healthybowl/pages/catalog/browsePagination.js +24 -0
- package/dist/healthybowl/pages/catalog/browsePagination.js.map +1 -0
- package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +6 -6
- package/dist/healthybowl/pages/crops/CropDetailsPage.js +340 -348
- package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +468 -434
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +633 -542
- package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +875 -800
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +459 -448
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/SuccessionCropLabel.js +21 -0
- package/dist/healthybowl/pages/crops/SuccessionCropLabel.js.map +1 -0
- package/dist/healthybowl/pages/crops/planningEdit.js +30 -0
- package/dist/healthybowl/pages/crops/planningEdit.js.map +1 -0
- package/dist/healthybowl/pages/fields/FieldMapPage.js +989 -941
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +6 -6
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +7 -7
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/TransactionsPage.js +541 -541
- package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +10 -10
- package/dist/healthybowl/pages/government-schemes/CommunicationPage.js +207 -207
- package/dist/healthybowl/pages/government-schemes/CommunicationPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js +38 -38
- package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js +15 -15
- package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +4 -4
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +4 -4
- package/dist/healthybowl/pages/livestock/FeedManagementPage.js +4 -4
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +16 -16
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +4 -4
- package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +4 -4
- package/dist/healthybowl/pages/market/MarketPricesPage.js +305 -305
- package/dist/healthybowl/pages/market/MarketPricesPage.js.map +1 -1
- package/dist/healthybowl/pages/network/CohortsPage.js +107 -107
- package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/CommunityPage.js +247 -247
- package/dist/healthybowl/pages/network/CommunityPage.js.map +1 -1
- package/dist/healthybowl/pages/network/EventsPage.js +16 -16
- package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +470 -470
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/MentorsPage.js +6 -6
- package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +8 -8
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +7 -7
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
- package/dist/healthybowl/pages/production/ProductionBatchesPage.js +7 -7
- package/dist/healthybowl/pages/production/RecipeManagementPage.js +5 -5
- package/dist/healthybowl/pages/production/ValueAddedProductsPage.js +7 -7
- package/dist/healthybowl/pages/soil/SoilTestsPage.js +6 -6
- package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
- package/dist/healthybowl/pages/suppliers/SuppliersPage.js +10 -10
- package/dist/healthybowl/pages/sustainability/CarbonCreditLedgerPage.js +6 -6
- package/dist/healthybowl/pages/terrace/PlantingFormModal.js +151 -131
- package/dist/healthybowl/pages/terrace/PlantingFormModal.js.map +1 -1
- package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +6 -6
- package/dist/healthybowl/utils/cropComparison.js +1 -1
- package/dist/healthybowl/utils/cropComparison.js.map +1 -1
- package/dist/healthybowl/utils/cropPicker.js +35 -0
- package/dist/healthybowl/utils/cropPicker.js.map +1 -0
- package/dist/healthybowl/utils/plantingCapacity.js +2 -2
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/healthybowl/utils/quotaLabels.js +8 -0
- package/dist/healthybowl/utils/quotaLabels.js.map +1 -0
- package/dist/healthybowl/utils/seedRate.js +1 -8
- package/dist/healthybowl/utils/seedRate.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,30 +2,30 @@ import { cn as e, formatCurrency as t, formatDate as n } from "../../utils/helpe
|
|
|
2
2
|
import { PageLayout as r } from "../../components/PageLayout.js";
|
|
3
3
|
import { StatCard as i } from "../../components/StatCard.js";
|
|
4
4
|
import { DataTable as a } from "../../components/DataTable.js";
|
|
5
|
-
import {
|
|
5
|
+
import { FilterBar as o } from "../../components/FilterBar.js";
|
|
6
|
+
import { StatusBadge as s } from "../../components/StatusBadge.js";
|
|
6
7
|
import { EmptyState as ee } from "../../components/EmptyState.js";
|
|
7
8
|
import { ErrorState as te } from "../../components/ErrorState.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { useToast as se } from "../../hooks/useToast.js";
|
|
9
|
+
import { ToastContainer as ne } from "../../components/Toast.js";
|
|
10
|
+
import { useConfirm as re } from "../../components/ConfirmDialog.js";
|
|
11
|
+
import { LoadingSkeleton as ie } from "../../components/LoadingSkeleton.js";
|
|
12
|
+
import { Modal as ae } from "../../components/Modal.js";
|
|
13
|
+
import { useToast as oe } from "../../hooks/useToast.js";
|
|
14
14
|
import "../../components/index.js";
|
|
15
|
-
import { useHealthyBowlData as
|
|
16
|
-
import { useHealthyBowlContacts as
|
|
17
|
-
import { humanizeEnum as
|
|
18
|
-
import { useHealthyBowlAccounting as
|
|
19
|
-
import { useMemo as
|
|
20
|
-
import { useI18n as
|
|
21
|
-
import { Calendar as
|
|
22
|
-
import { Fragment as
|
|
23
|
-
import { Button as
|
|
24
|
-
import { useSaveToFiles as
|
|
25
|
-
import { useAssistantPageControls as
|
|
26
|
-
import { enumFilter as
|
|
15
|
+
import { useHealthyBowlData as se } from "../../hooks/useHealthyBowlData.js";
|
|
16
|
+
import { useHealthyBowlContacts as ce } from "../../hooks/useHealthyBowlContacts.js";
|
|
17
|
+
import { humanizeEnum as le } from "../../utils/contracts.js";
|
|
18
|
+
import { useHealthyBowlAccounting as ue } from "../../hooks/useHealthyBowlAccounting.js";
|
|
19
|
+
import { useMemo as c, useRef as de, useState as l } from "react";
|
|
20
|
+
import { useI18n as fe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
21
|
+
import { Calendar as pe, DollarSign as me, Download as he, Edit as ge, ExternalLink as _e, Hash as ve, Paperclip as ye, Plus as be, Trash2 as xe, TrendingDown as Se, TrendingUp as Ce, Upload as we, X as Te } from "lucide-react";
|
|
22
|
+
import { Fragment as Ee, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
23
|
+
import { Button as f, Select as p, SelectContent as m, SelectItem as h, SelectTrigger as g, SelectValue as _ } from "@burdenoff/fe-libs/ui";
|
|
24
|
+
import { useSaveToFiles as De } from "@burdenoff/fe-libs/storage";
|
|
25
|
+
import { useAssistantPageControls as Oe } from "@burdenoff/fe-libs/shared/assistant/appControls/useAssistantControl";
|
|
26
|
+
import { enumFilter as v, filtersOf as ke, openersOf as Ae, searchOf as je } from "@burdenoff/fe-libs/shared/assistant/appControls/pageAdapters";
|
|
27
27
|
//#region src/healthybowl/pages/financial/TransactionsPage.tsx
|
|
28
|
-
var
|
|
28
|
+
var y = [
|
|
29
29
|
"crop_sales",
|
|
30
30
|
"livestock_sales",
|
|
31
31
|
"marketplace",
|
|
@@ -37,50 +37,50 @@ var v = [
|
|
|
37
37
|
"certification",
|
|
38
38
|
"equipment",
|
|
39
39
|
"other"
|
|
40
|
-
],
|
|
41
|
-
...
|
|
40
|
+
], Me = [
|
|
41
|
+
...y,
|
|
42
42
|
"contract_sale",
|
|
43
43
|
"contract_procurement",
|
|
44
44
|
"coop_settlement",
|
|
45
45
|
"coop_settlement_payout"
|
|
46
|
-
],
|
|
46
|
+
], Ne = [
|
|
47
47
|
"Bank Transfer",
|
|
48
48
|
"Credit Card",
|
|
49
49
|
"Cash",
|
|
50
50
|
"Check",
|
|
51
51
|
"Payment Gateway"
|
|
52
|
-
],
|
|
52
|
+
], b = "none", x = "none", S = "none", C = "none", w = BigInt(2 ** 53 - 1), Pe = 10 * 1024 * 1024, T = (e) => {
|
|
53
53
|
if (e.length === 0) return !1;
|
|
54
54
|
for (let t of e) if (t < "0" || t > "9") return !1;
|
|
55
55
|
return !0;
|
|
56
|
-
},
|
|
56
|
+
}, E = (e) => {
|
|
57
57
|
let t = e.trim();
|
|
58
58
|
if (!t || t.length > 21) return null;
|
|
59
59
|
let n = t.split(".");
|
|
60
60
|
if (n.length > 2) return null;
|
|
61
61
|
let r = n[0] ?? "", i = n[1];
|
|
62
|
-
if (!
|
|
62
|
+
if (!T(r) || r.length > 18 || i !== void 0 && (!T(i) || i.length > 2)) return null;
|
|
63
63
|
let a = (i ?? "").padEnd(2, "0"), o = BigInt(r) * 100n + BigInt(a || "0");
|
|
64
|
-
return o <=
|
|
65
|
-
},
|
|
64
|
+
return o <= w ? o : null;
|
|
65
|
+
}, D = (e) => {
|
|
66
66
|
let t = e < 0n ? "-" : "", n = e < 0n ? -e : e;
|
|
67
67
|
return `${t}${n / 100n}.${(n % 100n).toString().padStart(2, "0")}`;
|
|
68
|
-
},
|
|
69
|
-
let t = Number(
|
|
70
|
-
return Number.isFinite(t) &&
|
|
71
|
-
},
|
|
68
|
+
}, Fe = (e) => {
|
|
69
|
+
let t = Number(D(e));
|
|
70
|
+
return Number.isFinite(t) && E(t.toString()) === e ? t : null;
|
|
71
|
+
}, O = (e, t) => t.every((t, n) => e[n] === t), Ie = async (e) => {
|
|
72
72
|
let t = new Uint8Array(await e.slice(0, 12).arrayBuffer());
|
|
73
|
-
return
|
|
73
|
+
return O(t, [
|
|
74
74
|
37,
|
|
75
75
|
80,
|
|
76
76
|
68,
|
|
77
77
|
70,
|
|
78
78
|
45
|
|
79
|
-
]) ? "application/pdf" :
|
|
79
|
+
]) ? "application/pdf" : O(t, [
|
|
80
80
|
255,
|
|
81
81
|
216,
|
|
82
82
|
255
|
|
83
|
-
]) ? "image/jpeg" :
|
|
83
|
+
]) ? "image/jpeg" : O(t, [
|
|
84
84
|
137,
|
|
85
85
|
80,
|
|
86
86
|
78,
|
|
@@ -89,13 +89,13 @@ var v = [
|
|
|
89
89
|
10,
|
|
90
90
|
26,
|
|
91
91
|
10
|
|
92
|
-
]) ? "image/png" :
|
|
92
|
+
]) ? "image/png" : O(t, [
|
|
93
93
|
82,
|
|
94
94
|
73,
|
|
95
95
|
70,
|
|
96
96
|
70
|
|
97
97
|
]) && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80 ? "image/webp" : null;
|
|
98
|
-
},
|
|
98
|
+
}, Le = (e) => {
|
|
99
99
|
try {
|
|
100
100
|
let t = new URL(e), n = t.protocol === "http:" && [
|
|
101
101
|
"localhost",
|
|
@@ -106,12 +106,12 @@ var v = [
|
|
|
106
106
|
} catch {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, Re = (e, t = "", n = "") => ({
|
|
110
110
|
rowId: crypto.randomUUID(),
|
|
111
111
|
category: e,
|
|
112
112
|
amount: t,
|
|
113
113
|
costCenterId: n
|
|
114
|
-
}),
|
|
114
|
+
}), k = {
|
|
115
115
|
date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
116
116
|
type: "income",
|
|
117
117
|
category: "crop_sales",
|
|
@@ -127,21 +127,21 @@ var v = [
|
|
|
127
127
|
splits: [],
|
|
128
128
|
receiptFileId: "",
|
|
129
129
|
receiptFileName: ""
|
|
130
|
-
},
|
|
131
|
-
let { t:
|
|
130
|
+
}, ze = () => {
|
|
131
|
+
let { t: w } = fe(), { transactions: T, crops: O, fields: ze, createTransaction: Be, updateTransaction: Ve, deleteTransaction: He, getTransactionReceiptUrl: Ue, loading: We, errors: Ge } = se(), { costCenters: A } = ue({ costCenters: !0 }), j = c(() => A.filter((e) => e.isActive), [A]), { contacts: M } = ce({
|
|
132
132
|
list: !0,
|
|
133
133
|
type: "SUPPLIER"
|
|
134
|
-
}),
|
|
135
|
-
let e =
|
|
136
|
-
for (let e of
|
|
137
|
-
let r =
|
|
134
|
+
}), Ke = c(() => M.filter((e) => e.status === "ACTIVE"), [M]), { toasts: qe, toast: N, dismiss: Je } = oe(), Ye = re(), { save: Xe, isPending: P } = De(), F = de(null), [Ze, Qe] = l(null), [I, $e] = l(""), [L, et] = l("all"), [R, tt] = l("all"), [z, nt] = l("all"), [B, rt] = l("all"), [it, V] = l(!1), [at, ot] = l(!1), [H, U] = l(null), [st, ct] = l(null), [W, G] = l(k), K = c(() => H ? T.find((e) => e.id === H) ?? null : null, [H, T]), q = c(() => {
|
|
135
|
+
let e = E(W.amount), t = 0n, n = !0;
|
|
136
|
+
for (let e of W.splits) {
|
|
137
|
+
let r = E(e.amount);
|
|
138
138
|
if (r === null || r <= 0n) {
|
|
139
139
|
n = !1;
|
|
140
140
|
continue;
|
|
141
141
|
}
|
|
142
142
|
t += r;
|
|
143
143
|
}
|
|
144
|
-
let r =
|
|
144
|
+
let r = W.splits.length > 0;
|
|
145
145
|
return {
|
|
146
146
|
allocated: t,
|
|
147
147
|
hasSplits: r,
|
|
@@ -150,72 +150,72 @@ var v = [
|
|
|
150
150
|
splitAmountsValid: n,
|
|
151
151
|
total: e
|
|
152
152
|
};
|
|
153
|
-
}, [
|
|
154
|
-
let e = [...
|
|
155
|
-
if (
|
|
156
|
-
let t =
|
|
153
|
+
}, [W.amount, W.splits]), J = q.total === null ? null : Fe(q.total), lt = W.description.trim().length > 0 && q.total !== null && q.total > 0n && J !== null && q.matches && !P, ut = c(() => {
|
|
154
|
+
let e = [...j];
|
|
155
|
+
if (W.costCenterId && !e.some((e) => e.id === W.costCenterId)) {
|
|
156
|
+
let t = A.find((e) => e.id === W.costCenterId);
|
|
157
157
|
t && e.push(t);
|
|
158
158
|
}
|
|
159
159
|
return e;
|
|
160
160
|
}, [
|
|
161
|
+
j,
|
|
161
162
|
A,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let t = j.find((e) => e.id === U.contactId);
|
|
163
|
+
W.costCenterId
|
|
164
|
+
]), dt = c(() => {
|
|
165
|
+
let e = [...Ke];
|
|
166
|
+
if (W.contactId && !e.some((e) => e.id === W.contactId)) {
|
|
167
|
+
let t = M.find((e) => e.id === W.contactId);
|
|
168
168
|
t && e.push(t);
|
|
169
169
|
}
|
|
170
170
|
return e;
|
|
171
171
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
]),
|
|
176
|
-
let t =
|
|
172
|
+
Ke,
|
|
173
|
+
W.contactId,
|
|
174
|
+
M
|
|
175
|
+
]), ft = c(() => T.filter((e) => {
|
|
176
|
+
let t = I === "" || (e.description ?? "").toLowerCase().includes(I.toLowerCase()) || e.reference && (e.reference ?? "").toLowerCase().includes(I.toLowerCase()) || e.contactName && e.contactName.toLowerCase().includes(I.toLowerCase()), n = L === "all" || e.type === L, r = R === "all" || e.category === R, i = z === "all" || e.status === z, a = B === "all" || e.cropId === B;
|
|
177
177
|
return t && n && r && i && a;
|
|
178
178
|
}), [
|
|
179
|
-
|
|
180
|
-
F,
|
|
179
|
+
T,
|
|
181
180
|
I,
|
|
182
181
|
L,
|
|
183
182
|
R,
|
|
184
|
-
z
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
183
|
+
z,
|
|
184
|
+
B
|
|
185
|
+
]), pt = c(() => T.filter((e) => e.type === "income").reduce((e, t) => e + t.amount, 0), [T]), mt = c(() => T.filter((e) => e.type === "expense").reduce((e, t) => e + t.amount, 0), [T]), ht = pt - mt, Y = c(() => ({
|
|
186
|
+
income: w("healthybowl.financial.transactions.type.income", "Income"),
|
|
187
|
+
expense: w("healthybowl.financial.transactions.type.expense", "Expense")
|
|
188
|
+
}), [w]), X = c(() => ({
|
|
189
|
+
crop_sales: w("healthybowl.financial.transactions.category.cropSales", "Crop Sales"),
|
|
190
|
+
livestock_sales: w("healthybowl.financial.transactions.category.livestockSales", "Livestock Sales"),
|
|
191
|
+
marketplace: w("healthybowl.financial.transactions.category.marketplace", "Marketplace"),
|
|
192
|
+
seeds: w("healthybowl.financial.transactions.category.seeds", "Seeds"),
|
|
193
|
+
fertilizers: w("healthybowl.financial.transactions.category.fertilizers", "Fertilizers"),
|
|
194
|
+
labor: w("healthybowl.financial.transactions.category.labor", "Labor"),
|
|
195
|
+
irrigation: w("healthybowl.financial.transactions.category.irrigation", "Irrigation"),
|
|
196
|
+
pest_control: w("healthybowl.financial.transactions.category.pestControl", "Pest Control"),
|
|
197
|
+
certification: w("healthybowl.financial.transactions.category.certification", "Certification"),
|
|
198
|
+
equipment: w("healthybowl.financial.transactions.category.equipment", "Equipment"),
|
|
199
|
+
contract_sale: w("healthybowl.financial.transactions.category.contractSale", "Contract Sale"),
|
|
200
|
+
contract_procurement: w("healthybowl.financial.transactions.category.contractProcurement", "Contract Procurement"),
|
|
201
|
+
coop_settlement: w("healthybowl.financial.transactions.category.coopSettlement", "Co-op Settlement"),
|
|
202
|
+
coop_settlement_payout: w("healthybowl.financial.transactions.category.coopPayout", "Co-op Payout"),
|
|
203
|
+
other: w("healthybowl.financial.transactions.category.other", "Other")
|
|
204
|
+
}), [w]), Z = c(() => ({
|
|
205
|
+
completed: w("healthybowl.financial.transactions.status.completed", "Completed"),
|
|
206
|
+
pending: w("healthybowl.financial.transactions.status.pending", "Pending"),
|
|
207
|
+
failed: w("healthybowl.financial.transactions.status.failed", "Failed")
|
|
208
|
+
}), [w]);
|
|
209
|
+
Oe(c(() => ({
|
|
210
|
+
page: w("healthybowl.financial.transactions.assistant.page", "Transactions"),
|
|
211
|
+
filters: ke([
|
|
212
|
+
v({
|
|
213
213
|
id: "type",
|
|
214
|
-
label:
|
|
214
|
+
label: w("healthybowl.financial.transactions.assistant.type", "Type"),
|
|
215
215
|
options: [
|
|
216
216
|
{
|
|
217
217
|
value: "all",
|
|
218
|
-
label:
|
|
218
|
+
label: w("healthybowl.financial.transactions.filters.type.all", "All Types")
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
value: "income",
|
|
@@ -227,30 +227,30 @@ var v = [
|
|
|
227
227
|
}
|
|
228
228
|
],
|
|
229
229
|
neutral: "all",
|
|
230
|
-
value:
|
|
231
|
-
set:
|
|
230
|
+
value: L,
|
|
231
|
+
set: et
|
|
232
232
|
}),
|
|
233
|
-
|
|
233
|
+
v({
|
|
234
234
|
id: "category",
|
|
235
|
-
label:
|
|
235
|
+
label: w("healthybowl.financial.transactions.assistant.category", "Category"),
|
|
236
236
|
options: [{
|
|
237
237
|
value: "all",
|
|
238
|
-
label:
|
|
238
|
+
label: w("healthybowl.financial.transactions.filters.category.all", "All Categories")
|
|
239
239
|
}, ...Object.entries(X).map(([e, t]) => ({
|
|
240
240
|
value: e,
|
|
241
241
|
label: t
|
|
242
242
|
}))],
|
|
243
243
|
neutral: "all",
|
|
244
|
-
value:
|
|
245
|
-
set:
|
|
244
|
+
value: R,
|
|
245
|
+
set: tt
|
|
246
246
|
}),
|
|
247
|
-
|
|
247
|
+
v({
|
|
248
248
|
id: "status",
|
|
249
|
-
label:
|
|
249
|
+
label: w("healthybowl.financial.transactions.assistant.status", "Status"),
|
|
250
250
|
options: [
|
|
251
251
|
{
|
|
252
252
|
value: "all",
|
|
253
|
-
label:
|
|
253
|
+
label: w("healthybowl.financial.transactions.filters.status.all", "All Statuses")
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
value: "completed",
|
|
@@ -266,42 +266,42 @@ var v = [
|
|
|
266
266
|
}
|
|
267
267
|
],
|
|
268
268
|
neutral: "all",
|
|
269
|
-
value:
|
|
270
|
-
set:
|
|
269
|
+
value: z,
|
|
270
|
+
set: nt
|
|
271
271
|
})
|
|
272
272
|
]),
|
|
273
|
-
search:
|
|
274
|
-
openers:
|
|
273
|
+
search: je($e),
|
|
274
|
+
openers: Ae([{
|
|
275
275
|
id: "add-transaction",
|
|
276
|
-
label:
|
|
276
|
+
label: w("healthybowl.financial.transactions.assistant.addTransaction", "Add transaction"),
|
|
277
277
|
open: () => {
|
|
278
|
-
|
|
278
|
+
G(k), U(null), V(!0);
|
|
279
279
|
}
|
|
280
280
|
}])
|
|
281
281
|
}), [
|
|
282
|
-
|
|
282
|
+
w,
|
|
283
283
|
Y,
|
|
284
284
|
X,
|
|
285
285
|
Z,
|
|
286
|
-
I,
|
|
287
286
|
L,
|
|
288
|
-
R
|
|
287
|
+
R,
|
|
288
|
+
z
|
|
289
289
|
]));
|
|
290
|
-
let gt =
|
|
291
|
-
"Bank Transfer":
|
|
292
|
-
"Credit Card":
|
|
293
|
-
Cash:
|
|
294
|
-
Check:
|
|
295
|
-
"Payment Gateway":
|
|
296
|
-
}), [
|
|
297
|
-
|
|
290
|
+
let gt = c(() => ({
|
|
291
|
+
"Bank Transfer": w("healthybowl.financial.transactions.paymentMethod.bankTransfer", "Bank Transfer"),
|
|
292
|
+
"Credit Card": w("healthybowl.financial.transactions.paymentMethod.creditCard", "Credit Card"),
|
|
293
|
+
Cash: w("healthybowl.financial.transactions.paymentMethod.cash", "Cash"),
|
|
294
|
+
Check: w("healthybowl.financial.transactions.paymentMethod.check", "Check"),
|
|
295
|
+
"Payment Gateway": w("healthybowl.financial.transactions.paymentMethod.paymentGateway", "Payment Gateway")
|
|
296
|
+
}), [w]), _t = () => {
|
|
297
|
+
V(!1), U(null), G(k);
|
|
298
298
|
}, vt = () => {
|
|
299
|
-
|
|
299
|
+
G((e) => ({
|
|
300
300
|
...e,
|
|
301
|
-
splits: [...e.splits,
|
|
301
|
+
splits: [...e.splits, Re(e.category, e.splits.length === 0 && E(e.amount) !== null ? e.amount : "", e.costCenterId)]
|
|
302
302
|
}));
|
|
303
303
|
}, yt = (e, t) => {
|
|
304
|
-
|
|
304
|
+
G((n) => ({
|
|
305
305
|
...n,
|
|
306
306
|
splits: n.splits.map((n) => n.rowId === e ? {
|
|
307
307
|
...n,
|
|
@@ -309,17 +309,17 @@ var v = [
|
|
|
309
309
|
} : n)
|
|
310
310
|
}));
|
|
311
311
|
}, bt = (e) => {
|
|
312
|
-
|
|
312
|
+
G((t) => ({
|
|
313
313
|
...t,
|
|
314
314
|
splits: t.splits.filter((t) => t.rowId !== e)
|
|
315
315
|
}));
|
|
316
316
|
}, xt = async (e) => {
|
|
317
317
|
let t = e.target.files?.[0];
|
|
318
|
-
if (
|
|
319
|
-
if (t.size === 0 || t.size >
|
|
320
|
-
let e = await
|
|
321
|
-
if (!e) throw Error(
|
|
322
|
-
let n = await
|
|
318
|
+
if (F.current && (F.current.value = ""), t) try {
|
|
319
|
+
if (t.size === 0 || t.size > Pe) throw Error(w("healthybowl.financial.transactions.receipt.invalidSize", "Receipt files must be non-empty and no larger than 10 MB."));
|
|
320
|
+
let e = await Ie(t);
|
|
321
|
+
if (!e) throw Error(w("healthybowl.financial.transactions.receipt.invalidType", "Choose a PDF, JPEG, PNG, or WebP receipt file."));
|
|
322
|
+
let n = await Xe({
|
|
323
323
|
source: {
|
|
324
324
|
kind: "blob",
|
|
325
325
|
filename: t.name,
|
|
@@ -332,139 +332,139 @@ var v = [
|
|
|
332
332
|
},
|
|
333
333
|
folderPath: "/HealthyBowl/Receipts"
|
|
334
334
|
});
|
|
335
|
-
|
|
335
|
+
G((e) => ({
|
|
336
336
|
...e,
|
|
337
337
|
receiptFileId: n.id,
|
|
338
338
|
receiptFileName: n.name
|
|
339
|
-
})),
|
|
340
|
-
title:
|
|
339
|
+
})), N({
|
|
340
|
+
title: w("healthybowl.financial.transactions.receipt.uploaded", "Receipt uploaded"),
|
|
341
341
|
description: n.name,
|
|
342
342
|
variant: "success"
|
|
343
343
|
});
|
|
344
344
|
} catch (e) {
|
|
345
|
-
|
|
346
|
-
title:
|
|
347
|
-
description: e instanceof Error ? e.message :
|
|
345
|
+
N({
|
|
346
|
+
title: w("healthybowl.financial.transactions.receipt.uploadFailed", "Receipt upload failed"),
|
|
347
|
+
description: e instanceof Error ? e.message : w("healthybowl.financial.transactions.receipt.uploadFailedDescription", "Could not upload the receipt."),
|
|
348
348
|
variant: "error"
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
}, St = async (e) => {
|
|
352
352
|
let t = window.open("about:blank", "_blank");
|
|
353
353
|
if (!t) {
|
|
354
|
-
|
|
355
|
-
title:
|
|
356
|
-
description:
|
|
354
|
+
N({
|
|
355
|
+
title: w("healthybowl.financial.transactions.receipt.popupBlocked", "Receipt window blocked"),
|
|
356
|
+
description: w("healthybowl.financial.transactions.receipt.popupBlockedDescription", "Allow pop-ups for this app, then try again."),
|
|
357
357
|
variant: "warning"
|
|
358
358
|
});
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
|
-
t.opener = null,
|
|
361
|
+
t.opener = null, Qe(e.id);
|
|
362
362
|
try {
|
|
363
|
-
let n =
|
|
364
|
-
if (!n) throw Error(
|
|
363
|
+
let n = Le(await Ue(e.id));
|
|
364
|
+
if (!n) throw Error(w("healthybowl.financial.transactions.receipt.unsupportedUrl", "Files returned an unsupported receipt URL."));
|
|
365
365
|
t.closed || t.location.replace(n);
|
|
366
366
|
} catch (e) {
|
|
367
|
-
t.closed || t.close(),
|
|
368
|
-
title:
|
|
369
|
-
description: e instanceof Error ? e.message :
|
|
367
|
+
t.closed || t.close(), N({
|
|
368
|
+
title: w("healthybowl.financial.transactions.receipt.openFailed", "Receipt unavailable"),
|
|
369
|
+
description: e instanceof Error ? e.message : w("healthybowl.financial.transactions.receipt.openFailedDescription", "The receipt could not be opened."),
|
|
370
370
|
variant: "error"
|
|
371
371
|
});
|
|
372
372
|
} finally {
|
|
373
|
-
|
|
373
|
+
Qe(null);
|
|
374
374
|
}
|
|
375
375
|
}, Ct = async () => {
|
|
376
|
-
if (!
|
|
377
|
-
|
|
378
|
-
title:
|
|
379
|
-
description:
|
|
376
|
+
if (!W.description.trim() || q.total === null || q.total <= 0n) {
|
|
377
|
+
N({
|
|
378
|
+
title: w("healthybowl.financial.transactions.toast.validation.title", "Validation Error"),
|
|
379
|
+
description: w("healthybowl.financial.transactions.toast.validation.description", "Enter a description and an amount greater than 0 with no more than two decimal places."),
|
|
380
380
|
variant: "error"
|
|
381
381
|
});
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
title:
|
|
387
|
-
description:
|
|
388
|
-
total:
|
|
389
|
-
allocated:
|
|
384
|
+
if (q.hasSplits && (!q.splitAmountsValid || !q.matches)) {
|
|
385
|
+
N({
|
|
386
|
+
title: w("healthybowl.financial.transactions.splits.mismatchTitle", "Split allocation mismatch"),
|
|
387
|
+
description: w("healthybowl.financial.transactions.splits.mismatchDescription", "Transaction amount {{total}} does not match allocated split total {{allocated}}.", {
|
|
388
|
+
total: D(q.total),
|
|
389
|
+
allocated: D(q.allocated)
|
|
390
390
|
}),
|
|
391
391
|
variant: "error"
|
|
392
392
|
});
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
395
|
-
if (
|
|
396
|
-
|
|
397
|
-
title:
|
|
398
|
-
description:
|
|
395
|
+
if (J === null) {
|
|
396
|
+
N({
|
|
397
|
+
title: w("healthybowl.financial.transactions.toast.validation.title", "Validation Error"),
|
|
398
|
+
description: w("healthybowl.financial.transactions.toast.validation.amountTooLarge", "This amount is too large to save without changing its exact cents. Enter a smaller amount."),
|
|
399
399
|
variant: "error"
|
|
400
400
|
});
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
if (
|
|
404
|
-
let e =
|
|
403
|
+
if (P) return;
|
|
404
|
+
let e = W.splits.map((e) => ({
|
|
405
405
|
category: e.category,
|
|
406
406
|
amount: e.amount.trim(),
|
|
407
407
|
costCenterId: e.costCenterId || null
|
|
408
|
-
})), n =
|
|
409
|
-
|
|
408
|
+
})), n = J;
|
|
409
|
+
ot(!0);
|
|
410
410
|
try {
|
|
411
|
-
|
|
412
|
-
id:
|
|
411
|
+
H ? (await Ve({
|
|
412
|
+
id: H,
|
|
413
413
|
amount: n,
|
|
414
|
-
category:
|
|
415
|
-
date:
|
|
416
|
-
description:
|
|
417
|
-
status:
|
|
418
|
-
type:
|
|
419
|
-
paymentMethod:
|
|
420
|
-
reference:
|
|
421
|
-
costCenterId:
|
|
422
|
-
...
|
|
423
|
-
cropId:
|
|
424
|
-
fieldId:
|
|
414
|
+
category: W.category,
|
|
415
|
+
date: W.date,
|
|
416
|
+
description: W.description,
|
|
417
|
+
status: W.status,
|
|
418
|
+
type: W.type,
|
|
419
|
+
paymentMethod: W.paymentMethod,
|
|
420
|
+
reference: W.reference,
|
|
421
|
+
costCenterId: W.costCenterId || null,
|
|
422
|
+
...W.contactId === (K?.contactId ?? "") ? {} : { contactId: W.contactId || null },
|
|
423
|
+
cropId: W.cropId || null,
|
|
424
|
+
fieldId: W.fieldId || null,
|
|
425
425
|
splits: e,
|
|
426
|
-
receiptFileId:
|
|
427
|
-
}),
|
|
428
|
-
title:
|
|
429
|
-
description:
|
|
430
|
-
type: Y[
|
|
426
|
+
receiptFileId: W.receiptFileId || null
|
|
427
|
+
}), N({
|
|
428
|
+
title: w("healthybowl.financial.transactions.toast.updated.title", "Transaction Updated"),
|
|
429
|
+
description: w("healthybowl.financial.transactions.toast.updated.description", "{{type}} of {{amount}} updated", {
|
|
430
|
+
type: Y[W.type],
|
|
431
431
|
amount: t(n, "INR")
|
|
432
432
|
}),
|
|
433
433
|
variant: "success"
|
|
434
|
-
})) : (await
|
|
434
|
+
})) : (await Be({
|
|
435
435
|
amount: n,
|
|
436
|
-
category:
|
|
437
|
-
date:
|
|
438
|
-
description:
|
|
439
|
-
status:
|
|
440
|
-
type:
|
|
441
|
-
...
|
|
442
|
-
...
|
|
443
|
-
...
|
|
444
|
-
...
|
|
445
|
-
...
|
|
446
|
-
...
|
|
436
|
+
category: W.category,
|
|
437
|
+
date: W.date,
|
|
438
|
+
description: W.description,
|
|
439
|
+
status: W.status,
|
|
440
|
+
type: W.type,
|
|
441
|
+
...W.paymentMethod ? { paymentMethod: W.paymentMethod } : {},
|
|
442
|
+
...W.reference ? { reference: W.reference } : {},
|
|
443
|
+
...W.costCenterId ? { costCenterId: W.costCenterId } : {},
|
|
444
|
+
...W.type === "expense" && W.contactId ? { contactId: W.contactId } : {},
|
|
445
|
+
...W.cropId ? { cropId: W.cropId } : {},
|
|
446
|
+
...W.fieldId ? { fieldId: W.fieldId } : {},
|
|
447
447
|
...e.length > 0 ? { splits: e } : {},
|
|
448
|
-
...
|
|
449
|
-
}),
|
|
450
|
-
title:
|
|
451
|
-
description:
|
|
452
|
-
type: Y[
|
|
448
|
+
...W.receiptFileId ? { receiptFileId: W.receiptFileId } : {}
|
|
449
|
+
}), N({
|
|
450
|
+
title: w("healthybowl.financial.transactions.toast.added.title", "Transaction Added"),
|
|
451
|
+
description: w("healthybowl.financial.transactions.toast.added.description", "{{type}} of {{amount}} recorded", {
|
|
452
|
+
type: Y[W.type],
|
|
453
453
|
amount: t(n, "INR")
|
|
454
454
|
}),
|
|
455
455
|
variant: "success"
|
|
456
456
|
})), _t();
|
|
457
457
|
} catch (e) {
|
|
458
|
-
|
|
459
|
-
title:
|
|
458
|
+
N({
|
|
459
|
+
title: H ? w("healthybowl.financial.transactions.toast.updateFailed.title", "Update failed") : w("healthybowl.financial.transactions.toast.createFailed.title", "Create failed"),
|
|
460
460
|
description: e instanceof Error ? e.message : String(e),
|
|
461
461
|
variant: "error"
|
|
462
462
|
});
|
|
463
463
|
} finally {
|
|
464
|
-
|
|
464
|
+
ot(!1);
|
|
465
465
|
}
|
|
466
466
|
}, wt = (e) => {
|
|
467
|
-
|
|
467
|
+
G({
|
|
468
468
|
date: e.date,
|
|
469
469
|
type: e.type,
|
|
470
470
|
category: e.category,
|
|
@@ -485,24 +485,24 @@ var v = [
|
|
|
485
485
|
})),
|
|
486
486
|
receiptFileId: e.receiptFileId ?? "",
|
|
487
487
|
receiptFileName: ""
|
|
488
|
-
}),
|
|
488
|
+
}), U(e.id), V(!0);
|
|
489
489
|
}, Tt = async (e) => {
|
|
490
|
-
if (await
|
|
491
|
-
|
|
490
|
+
if (await Ye({ message: w("healthybowl.financial.transactions.deleteConfirm", "Delete this transaction ({{description}})? This cannot be undone.", { description: e.description ?? "" }) })) {
|
|
491
|
+
ct(e.id);
|
|
492
492
|
try {
|
|
493
|
-
await
|
|
494
|
-
title:
|
|
493
|
+
await He(e.id), N({
|
|
494
|
+
title: w("healthybowl.financial.transactions.toast.deleted.title", "Transaction Deleted"),
|
|
495
495
|
description: e.description,
|
|
496
496
|
variant: "success"
|
|
497
497
|
});
|
|
498
498
|
} catch (e) {
|
|
499
|
-
|
|
500
|
-
title:
|
|
501
|
-
description: e instanceof Error ? e.message :
|
|
499
|
+
N({
|
|
500
|
+
title: w("healthybowl.common.error", "Error"),
|
|
501
|
+
description: e instanceof Error ? e.message : w("healthybowl.financial.transactions.toast.deleteFailed", "Failed to delete transaction"),
|
|
502
502
|
variant: "error"
|
|
503
503
|
});
|
|
504
504
|
} finally {
|
|
505
|
-
|
|
505
|
+
ct(null);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
}, Et = () => {
|
|
@@ -519,7 +519,7 @@ var v = [
|
|
|
519
519
|
"Crop",
|
|
520
520
|
"Field",
|
|
521
521
|
"Status"
|
|
522
|
-
], t =
|
|
522
|
+
], t = ft.map((e) => [
|
|
523
523
|
e.date,
|
|
524
524
|
e.type,
|
|
525
525
|
e.category,
|
|
@@ -536,19 +536,19 @@ var v = [
|
|
|
536
536
|
let t = String(e ?? "");
|
|
537
537
|
return `"${(/^[=+\-@\t\r]/.test(t) ? `'${t}` : t).replace(/"/g, "\"\"")}"`;
|
|
538
538
|
}, r = [e, ...t].map((e) => e.map(n).join(",")).join("\n"), i = new Blob([r], { type: "text/csv" }), a = URL.createObjectURL(i), o = document.createElement("a");
|
|
539
|
-
o.href = a, o.download = "transactions.csv", o.click(), URL.revokeObjectURL(a),
|
|
540
|
-
title:
|
|
541
|
-
description:
|
|
539
|
+
o.href = a, o.download = "transactions.csv", o.click(), URL.revokeObjectURL(a), N({
|
|
540
|
+
title: w("healthybowl.financial.transactions.toast.exported.title", "Exported to CSV"),
|
|
541
|
+
description: w("healthybowl.financial.transactions.toast.exported.description", "{{count}} transactions exported", { count: ft.length }),
|
|
542
542
|
variant: "success"
|
|
543
543
|
});
|
|
544
544
|
}, Q = (e, t) => {
|
|
545
|
-
|
|
545
|
+
G((n) => ({
|
|
546
546
|
...n,
|
|
547
547
|
[e]: t
|
|
548
548
|
}));
|
|
549
549
|
}, Dt = (e) => {
|
|
550
550
|
let t = e === "expense" ? "expense" : "income";
|
|
551
|
-
|
|
551
|
+
G((e) => ({
|
|
552
552
|
...e,
|
|
553
553
|
type: t,
|
|
554
554
|
contactId: t === "expense" ? e.contactId : ""
|
|
@@ -556,20 +556,20 @@ var v = [
|
|
|
556
556
|
}, Ot = [
|
|
557
557
|
{
|
|
558
558
|
key: "date",
|
|
559
|
-
header:
|
|
560
|
-
render: (e) => /* @__PURE__ */
|
|
559
|
+
header: w("healthybowl.financial.transactions.table.headers.date", "Date"),
|
|
560
|
+
render: (e) => /* @__PURE__ */ d("span", {
|
|
561
561
|
className: "flex items-center gap-1.5 text-sm text-text-secondary",
|
|
562
|
-
children: [/* @__PURE__ */
|
|
562
|
+
children: [/* @__PURE__ */ u(pe, { className: "h-3 w-3" }), n(e.date)]
|
|
563
563
|
})
|
|
564
564
|
},
|
|
565
565
|
{
|
|
566
566
|
key: "type",
|
|
567
|
-
header:
|
|
567
|
+
header: w("healthybowl.financial.transactions.table.headers.type", "Type"),
|
|
568
568
|
render: (e) => {
|
|
569
569
|
let t = e.type === "income";
|
|
570
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ d("span", {
|
|
571
571
|
className: "flex items-center gap-1.5",
|
|
572
|
-
children: [t ? /* @__PURE__ */
|
|
572
|
+
children: [t ? /* @__PURE__ */ u(Ce, { className: "h-3.5 w-3.5 text-success" }) : /* @__PURE__ */ u(Se, { className: "h-3.5 w-3.5 text-status-error-text" }), /* @__PURE__ */ u(s, {
|
|
573
573
|
label: Y[e.type],
|
|
574
574
|
variant: t ? "success" : "error"
|
|
575
575
|
})]
|
|
@@ -578,60 +578,60 @@ var v = [
|
|
|
578
578
|
},
|
|
579
579
|
{
|
|
580
580
|
key: "category",
|
|
581
|
-
header:
|
|
582
|
-
render: (e) => /* @__PURE__ */
|
|
581
|
+
header: w("healthybowl.financial.transactions.table.headers.category", "Category"),
|
|
582
|
+
render: (e) => /* @__PURE__ */ u("span", {
|
|
583
583
|
className: "text-sm capitalize text-text-primary",
|
|
584
|
-
children: e.category ? X[e.category] ??
|
|
584
|
+
children: e.category ? X[e.category] ?? le(e.category) : ""
|
|
585
585
|
})
|
|
586
586
|
},
|
|
587
587
|
{
|
|
588
588
|
key: "description",
|
|
589
|
-
header:
|
|
590
|
-
render: (e) => /* @__PURE__ */
|
|
589
|
+
header: w("healthybowl.financial.transactions.table.headers.description", "Description"),
|
|
590
|
+
render: (e) => /* @__PURE__ */ u("span", {
|
|
591
591
|
className: "text-sm text-text-primary",
|
|
592
592
|
children: e.description
|
|
593
593
|
})
|
|
594
594
|
},
|
|
595
595
|
{
|
|
596
596
|
key: "contact",
|
|
597
|
-
header:
|
|
598
|
-
render: (e) => e.contactName ? /* @__PURE__ */
|
|
597
|
+
header: w("healthybowl.financial.transactions.table.headers.supplier", "Supplier"),
|
|
598
|
+
render: (e) => e.contactName ? /* @__PURE__ */ u("span", {
|
|
599
599
|
className: "text-sm text-text-primary",
|
|
600
600
|
children: e.contactName
|
|
601
|
-
}) : /* @__PURE__ */
|
|
601
|
+
}) : /* @__PURE__ */ u("span", {
|
|
602
602
|
className: "text-xs text-text-secondary",
|
|
603
603
|
children: "-"
|
|
604
604
|
})
|
|
605
605
|
},
|
|
606
606
|
{
|
|
607
607
|
key: "costCenter",
|
|
608
|
-
header:
|
|
609
|
-
render: (e) => e.costCenterLabel ? /* @__PURE__ */
|
|
608
|
+
header: w("healthybowl.financial.transactions.table.headers.costCenter", "Cost Center"),
|
|
609
|
+
render: (e) => e.costCenterLabel ? /* @__PURE__ */ u(s, {
|
|
610
610
|
label: e.costCenterLabel,
|
|
611
611
|
variant: "info"
|
|
612
|
-
}) : /* @__PURE__ */
|
|
612
|
+
}) : /* @__PURE__ */ u("span", {
|
|
613
613
|
className: "text-xs text-text-secondary",
|
|
614
614
|
children: "-"
|
|
615
615
|
})
|
|
616
616
|
},
|
|
617
617
|
{
|
|
618
618
|
key: "crop",
|
|
619
|
-
header:
|
|
620
|
-
render: (e) => e.cropName || e.fieldName ? /* @__PURE__ */
|
|
619
|
+
header: w("healthybowl.financial.transactions.table.headers.crop", "Crop / Field"),
|
|
620
|
+
render: (e) => e.cropName || e.fieldName ? /* @__PURE__ */ u("span", {
|
|
621
621
|
className: "text-sm text-text-primary",
|
|
622
622
|
children: [e.cropName, e.fieldName].filter(Boolean).join(" / ")
|
|
623
|
-
}) : /* @__PURE__ */
|
|
623
|
+
}) : /* @__PURE__ */ u("span", {
|
|
624
624
|
className: "text-xs text-text-secondary",
|
|
625
625
|
children: "-"
|
|
626
626
|
})
|
|
627
627
|
},
|
|
628
628
|
{
|
|
629
629
|
key: "amount",
|
|
630
|
-
header:
|
|
630
|
+
header: w("healthybowl.financial.transactions.table.headers.amount", "Amount"),
|
|
631
631
|
className: "text-end",
|
|
632
632
|
render: (n) => {
|
|
633
633
|
let r = n.type === "income";
|
|
634
|
-
return /* @__PURE__ */
|
|
634
|
+
return /* @__PURE__ */ d("span", {
|
|
635
635
|
className: e("text-sm font-semibold", r ? "text-success" : "text-status-error-text"),
|
|
636
636
|
children: [r ? "+" : "-", t(n.amount, "INR")]
|
|
637
637
|
});
|
|
@@ -639,24 +639,24 @@ var v = [
|
|
|
639
639
|
},
|
|
640
640
|
{
|
|
641
641
|
key: "paymentMethod",
|
|
642
|
-
header:
|
|
643
|
-
render: (e) => /* @__PURE__ */
|
|
642
|
+
header: w("healthybowl.financial.transactions.table.headers.payment", "Payment"),
|
|
643
|
+
render: (e) => /* @__PURE__ */ u("span", {
|
|
644
644
|
className: "text-xs text-text-secondary",
|
|
645
645
|
children: e.paymentMethod
|
|
646
646
|
})
|
|
647
647
|
},
|
|
648
648
|
{
|
|
649
649
|
key: "reference",
|
|
650
|
-
header:
|
|
651
|
-
render: (e) => /* @__PURE__ */
|
|
650
|
+
header: w("healthybowl.financial.transactions.table.headers.reference", "Reference"),
|
|
651
|
+
render: (e) => /* @__PURE__ */ u("span", {
|
|
652
652
|
className: "text-xs font-mono text-text-secondary",
|
|
653
653
|
children: e.reference || "-"
|
|
654
654
|
})
|
|
655
655
|
},
|
|
656
656
|
{
|
|
657
657
|
key: "status",
|
|
658
|
-
header:
|
|
659
|
-
render: (e) => /* @__PURE__ */
|
|
658
|
+
header: w("healthybowl.financial.transactions.table.headers.status", "Status"),
|
|
659
|
+
render: (e) => /* @__PURE__ */ u(s, {
|
|
660
660
|
label: Z[e.status],
|
|
661
661
|
variant: e.status === "completed" ? "success" : e.status === "pending" ? "warning" : "error",
|
|
662
662
|
dot: !0
|
|
@@ -664,469 +664,469 @@ var v = [
|
|
|
664
664
|
},
|
|
665
665
|
{
|
|
666
666
|
key: "actions",
|
|
667
|
-
header:
|
|
667
|
+
header: w("healthybowl.financial.transactions.table.headers.actions", "Actions"),
|
|
668
668
|
className: "text-end",
|
|
669
|
-
render: (e) => /* @__PURE__ */
|
|
669
|
+
render: (e) => /* @__PURE__ */ d("div", {
|
|
670
670
|
className: "flex items-center justify-end gap-1.5",
|
|
671
671
|
children: [
|
|
672
|
-
e.receiptFileId ? /* @__PURE__ */
|
|
672
|
+
e.receiptFileId ? /* @__PURE__ */ u(f, {
|
|
673
673
|
variant: "ghost",
|
|
674
674
|
size: "icon-sm",
|
|
675
675
|
onClick: () => void St(e),
|
|
676
|
-
disabled:
|
|
677
|
-
title:
|
|
678
|
-
"aria-label":
|
|
679
|
-
children: /* @__PURE__ */
|
|
676
|
+
disabled: Ze === e.id,
|
|
677
|
+
title: w("healthybowl.financial.transactions.actions.openReceipt", "Open receipt"),
|
|
678
|
+
"aria-label": w("healthybowl.financial.transactions.actions.openReceipt", "Open receipt"),
|
|
679
|
+
children: /* @__PURE__ */ u(ye, { className: "h-3.5 w-3.5" })
|
|
680
680
|
}) : null,
|
|
681
|
-
/* @__PURE__ */
|
|
681
|
+
/* @__PURE__ */ u(f, {
|
|
682
682
|
variant: "ghost",
|
|
683
683
|
size: "icon-sm",
|
|
684
684
|
onClick: () => wt(e),
|
|
685
|
-
title:
|
|
686
|
-
"aria-label":
|
|
687
|
-
children: /* @__PURE__ */
|
|
685
|
+
title: w("healthybowl.financial.transactions.actions.edit", "Edit Transaction"),
|
|
686
|
+
"aria-label": w("healthybowl.financial.transactions.actions.edit", "Edit Transaction"),
|
|
687
|
+
children: /* @__PURE__ */ u(ge, { className: "h-3.5 w-3.5" })
|
|
688
688
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ u(f, {
|
|
690
690
|
variant: "ghost",
|
|
691
691
|
size: "icon-sm",
|
|
692
692
|
onClick: () => Tt(e),
|
|
693
|
-
disabled:
|
|
693
|
+
disabled: st === e.id,
|
|
694
694
|
className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
|
|
695
|
-
title:
|
|
696
|
-
"aria-label":
|
|
697
|
-
children: /* @__PURE__ */
|
|
695
|
+
title: w("healthybowl.financial.transactions.actions.delete", "Delete Transaction"),
|
|
696
|
+
"aria-label": w("healthybowl.financial.transactions.actions.delete", "Delete Transaction"),
|
|
697
|
+
children: /* @__PURE__ */ u(xe, { className: "h-3.5 w-3.5" })
|
|
698
698
|
})
|
|
699
699
|
]
|
|
700
700
|
})
|
|
701
701
|
}
|
|
702
702
|
], $ = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]";
|
|
703
|
-
return /* @__PURE__ */
|
|
704
|
-
title:
|
|
705
|
-
description:
|
|
703
|
+
return /* @__PURE__ */ d(r, {
|
|
704
|
+
title: w("healthybowl.financial.transactions.title", "Transactions"),
|
|
705
|
+
description: w("healthybowl.financial.transactions.description", "All income and expense records"),
|
|
706
706
|
purpose: "Every rupee in and out of your farm, in one ledger. Record sales and costs here so your dashboard, budgets and reports stay accurate — and so you have a clean history come tax time.",
|
|
707
|
-
actions: /* @__PURE__ */
|
|
707
|
+
actions: /* @__PURE__ */ d("div", {
|
|
708
708
|
className: "flex items-center gap-2",
|
|
709
|
-
children: [/* @__PURE__ */
|
|
709
|
+
children: [/* @__PURE__ */ d(f, {
|
|
710
710
|
variant: "outline",
|
|
711
711
|
onClick: Et,
|
|
712
|
-
children: [/* @__PURE__ */
|
|
713
|
-
}), /* @__PURE__ */
|
|
712
|
+
children: [/* @__PURE__ */ u(he, { className: "h-3.5 w-3.5" }), w("healthybowl.financial.transactions.actions.exportCsv", "Export CSV")]
|
|
713
|
+
}), /* @__PURE__ */ d(f, {
|
|
714
714
|
onClick: () => {
|
|
715
|
-
|
|
715
|
+
G(k), U(null), V(!0);
|
|
716
716
|
},
|
|
717
|
-
children: [/* @__PURE__ */
|
|
717
|
+
children: [/* @__PURE__ */ u(be, { className: "h-3.5 w-3.5" }), w("healthybowl.financial.transactions.actions.add", "Add Transaction")]
|
|
718
718
|
})]
|
|
719
719
|
}),
|
|
720
720
|
children: [
|
|
721
|
-
|
|
721
|
+
We && T.length === 0 ? /* @__PURE__ */ u(ie, {
|
|
722
722
|
variant: "table",
|
|
723
723
|
count: 6
|
|
724
|
-
}) :
|
|
724
|
+
}) : T.length === 0 ? Ge.financial ? /* @__PURE__ */ u(te, {}) : /* @__PURE__ */ u(ee, {
|
|
725
725
|
illustration: "empty-data",
|
|
726
|
-
title:
|
|
727
|
-
description:
|
|
728
|
-
}) : /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
726
|
+
title: w("healthybowl.financial.transactions.emptyState.title", "No transactions yet"),
|
|
727
|
+
description: w("healthybowl.financial.transactions.emptyState.description", "Income and expense records will appear here once they're added.")
|
|
728
|
+
}) : /* @__PURE__ */ d(Ee, { children: [
|
|
729
|
+
/* @__PURE__ */ d("div", {
|
|
730
730
|
className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
|
|
731
731
|
children: [
|
|
732
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ u(i, {
|
|
733
733
|
hero: !0,
|
|
734
|
-
label:
|
|
734
|
+
label: w("healthybowl.financial.transactions.stats.totalIncome.label", "Total Income"),
|
|
735
735
|
value: pt,
|
|
736
736
|
currency: "INR",
|
|
737
|
-
icon: /* @__PURE__ */
|
|
737
|
+
icon: /* @__PURE__ */ u(Ce, { className: "h-4 w-4" })
|
|
738
738
|
}),
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
label:
|
|
739
|
+
/* @__PURE__ */ u(i, {
|
|
740
|
+
label: w("healthybowl.financial.transactions.stats.totalExpenses.label", "Total Expenses"),
|
|
741
741
|
value: mt,
|
|
742
742
|
currency: "INR",
|
|
743
|
-
icon: /* @__PURE__ */
|
|
743
|
+
icon: /* @__PURE__ */ u(Se, { className: "h-4 w-4" })
|
|
744
744
|
}),
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
label:
|
|
745
|
+
/* @__PURE__ */ u(i, {
|
|
746
|
+
label: w("healthybowl.financial.transactions.stats.netAmount.label", "Net Amount"),
|
|
747
747
|
value: ht,
|
|
748
748
|
currency: "INR",
|
|
749
|
-
icon: /* @__PURE__ */
|
|
749
|
+
icon: /* @__PURE__ */ u(me, { className: "h-4 w-4" })
|
|
750
750
|
}),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
label:
|
|
753
|
-
value:
|
|
754
|
-
icon: /* @__PURE__ */
|
|
751
|
+
/* @__PURE__ */ u(i, {
|
|
752
|
+
label: w("healthybowl.financial.transactions.stats.count.label", "Transaction Count"),
|
|
753
|
+
value: T.length,
|
|
754
|
+
icon: /* @__PURE__ */ u(ve, { className: "h-4 w-4" })
|
|
755
755
|
})
|
|
756
756
|
]
|
|
757
757
|
}),
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
searchValue:
|
|
760
|
-
onSearchChange:
|
|
761
|
-
searchPlaceholder:
|
|
762
|
-
filters: /* @__PURE__ */
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
value:
|
|
765
|
-
onValueChange: (e) =>
|
|
766
|
-
children: [/* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ u(o, {
|
|
759
|
+
searchValue: I,
|
|
760
|
+
onSearchChange: $e,
|
|
761
|
+
searchPlaceholder: w("healthybowl.financial.transactions.filters.searchPlaceholder", "Search by description or reference..."),
|
|
762
|
+
filters: /* @__PURE__ */ d(Ee, { children: [
|
|
763
|
+
/* @__PURE__ */ d(p, {
|
|
764
|
+
value: L,
|
|
765
|
+
onValueChange: (e) => et(e),
|
|
766
|
+
children: [/* @__PURE__ */ u(g, {
|
|
767
767
|
className: "h-9 w-auto",
|
|
768
|
-
children: /* @__PURE__ */
|
|
769
|
-
}), /* @__PURE__ */
|
|
770
|
-
/* @__PURE__ */
|
|
768
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.filters.type.all", "All Types") })
|
|
769
|
+
}), /* @__PURE__ */ d(m, { children: [
|
|
770
|
+
/* @__PURE__ */ u(h, {
|
|
771
771
|
value: "all",
|
|
772
|
-
children:
|
|
772
|
+
children: w("healthybowl.financial.transactions.filters.type.all", "All Types")
|
|
773
773
|
}),
|
|
774
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ u(h, {
|
|
775
775
|
value: "income",
|
|
776
776
|
children: Y.income
|
|
777
777
|
}),
|
|
778
|
-
/* @__PURE__ */
|
|
778
|
+
/* @__PURE__ */ u(h, {
|
|
779
779
|
value: "expense",
|
|
780
780
|
children: Y.expense
|
|
781
781
|
})
|
|
782
782
|
] })]
|
|
783
783
|
}),
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
value:
|
|
786
|
-
onValueChange:
|
|
787
|
-
children: [/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ d(p, {
|
|
785
|
+
value: R,
|
|
786
|
+
onValueChange: tt,
|
|
787
|
+
children: [/* @__PURE__ */ u(g, {
|
|
788
788
|
className: "h-9 w-auto",
|
|
789
|
-
children: /* @__PURE__ */
|
|
790
|
-
}), /* @__PURE__ */
|
|
789
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.filters.category.all", "All Categories") })
|
|
790
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
791
791
|
value: "all",
|
|
792
|
-
children:
|
|
793
|
-
}),
|
|
792
|
+
children: w("healthybowl.financial.transactions.filters.category.all", "All Categories")
|
|
793
|
+
}), y.map((e) => /* @__PURE__ */ u(h, {
|
|
794
794
|
value: e,
|
|
795
795
|
children: X[e]
|
|
796
796
|
}, e))] })]
|
|
797
797
|
}),
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
value:
|
|
800
|
-
onValueChange: (e) =>
|
|
801
|
-
children: [/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ d(p, {
|
|
799
|
+
value: z,
|
|
800
|
+
onValueChange: (e) => nt(e),
|
|
801
|
+
children: [/* @__PURE__ */ u(g, {
|
|
802
802
|
className: "h-9 w-auto",
|
|
803
|
-
children: /* @__PURE__ */
|
|
804
|
-
}), /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.filters.status.all", "All Statuses") })
|
|
804
|
+
}), /* @__PURE__ */ d(m, { children: [
|
|
805
|
+
/* @__PURE__ */ u(h, {
|
|
806
806
|
value: "all",
|
|
807
|
-
children:
|
|
807
|
+
children: w("healthybowl.financial.transactions.filters.status.all", "All Statuses")
|
|
808
808
|
}),
|
|
809
|
-
/* @__PURE__ */
|
|
809
|
+
/* @__PURE__ */ u(h, {
|
|
810
810
|
value: "completed",
|
|
811
811
|
children: Z.completed
|
|
812
812
|
}),
|
|
813
|
-
/* @__PURE__ */
|
|
813
|
+
/* @__PURE__ */ u(h, {
|
|
814
814
|
value: "pending",
|
|
815
815
|
children: Z.pending
|
|
816
816
|
}),
|
|
817
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ u(h, {
|
|
818
818
|
value: "failed",
|
|
819
819
|
children: Z.failed
|
|
820
820
|
})
|
|
821
821
|
] })]
|
|
822
822
|
}),
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
value:
|
|
825
|
-
onValueChange:
|
|
826
|
-
children: [/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ d(p, {
|
|
824
|
+
value: B,
|
|
825
|
+
onValueChange: rt,
|
|
826
|
+
children: [/* @__PURE__ */ u(g, {
|
|
827
827
|
className: "h-9 w-auto",
|
|
828
|
-
children: /* @__PURE__ */
|
|
829
|
-
}), /* @__PURE__ */
|
|
828
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.filters.crop.all", "All Crops") })
|
|
829
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
830
830
|
value: "all",
|
|
831
|
-
children:
|
|
832
|
-
}),
|
|
831
|
+
children: w("healthybowl.financial.transactions.filters.crop.all", "All Crops")
|
|
832
|
+
}), O.map((e) => /* @__PURE__ */ u(h, {
|
|
833
833
|
value: e.id,
|
|
834
834
|
children: e.name
|
|
835
835
|
}, e.id))] })]
|
|
836
836
|
})
|
|
837
837
|
] })
|
|
838
838
|
}),
|
|
839
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ u(a, {
|
|
840
840
|
columns: Ot,
|
|
841
|
-
data:
|
|
841
|
+
data: ft,
|
|
842
842
|
keyField: "id",
|
|
843
|
-
emptyMessage:
|
|
843
|
+
emptyMessage: w("healthybowl.financial.transactions.table.empty", "No transactions found.")
|
|
844
844
|
})
|
|
845
845
|
] }),
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
open:
|
|
846
|
+
/* @__PURE__ */ u(ae, {
|
|
847
|
+
open: it,
|
|
848
848
|
onClose: _t,
|
|
849
|
-
title:
|
|
850
|
-
description:
|
|
849
|
+
title: H ? w("healthybowl.financial.transactions.modal.editTitle", "Edit Transaction") : w("healthybowl.financial.transactions.modal.title", "Add Transaction"),
|
|
850
|
+
description: H ? w("healthybowl.financial.transactions.modal.editDescription", "Update this income or expense record") : w("healthybowl.financial.transactions.modal.description", "Record a new income or expense"),
|
|
851
851
|
size: "lg",
|
|
852
|
-
footer: /* @__PURE__ */
|
|
852
|
+
footer: /* @__PURE__ */ d(Ee, { children: [/* @__PURE__ */ u(f, {
|
|
853
853
|
variant: "outline",
|
|
854
854
|
onClick: _t,
|
|
855
|
-
children:
|
|
856
|
-
}), /* @__PURE__ */
|
|
855
|
+
children: w("healthybowl.common.cancel", "Cancel")
|
|
856
|
+
}), /* @__PURE__ */ u(f, {
|
|
857
857
|
onClick: Ct,
|
|
858
|
-
disabled:
|
|
859
|
-
children:
|
|
858
|
+
disabled: at || !lt,
|
|
859
|
+
children: P ? w("healthybowl.financial.transactions.receipt.uploading", "Uploading receipt...") : at ? H ? w("healthybowl.financial.transactions.modal.updating", "Saving...") : w("healthybowl.financial.transactions.modal.submitting", "Adding...") : H ? w("healthybowl.financial.transactions.modal.update", "Save Changes") : w("healthybowl.financial.transactions.actions.add", "Add Transaction")
|
|
860
860
|
})] }),
|
|
861
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ d("div", {
|
|
862
862
|
className: "grid gap-4 sm:grid-cols-2",
|
|
863
863
|
children: [
|
|
864
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
865
865
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
866
|
-
children:
|
|
867
|
-
}), /* @__PURE__ */
|
|
866
|
+
children: w("healthybowl.financial.transactions.form.fields.date.label", "Date *")
|
|
867
|
+
}), /* @__PURE__ */ u("input", {
|
|
868
868
|
type: "date",
|
|
869
|
-
value:
|
|
869
|
+
value: W.date,
|
|
870
870
|
onChange: (e) => Q("date", e.target.value),
|
|
871
871
|
className: $
|
|
872
872
|
})] }),
|
|
873
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
874
874
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
875
|
-
children:
|
|
876
|
-
}), /* @__PURE__ */
|
|
877
|
-
value:
|
|
875
|
+
children: w("healthybowl.financial.transactions.form.fields.type.label", "Type *")
|
|
876
|
+
}), /* @__PURE__ */ d(p, {
|
|
877
|
+
value: W.type,
|
|
878
878
|
onValueChange: Dt,
|
|
879
|
-
children: [/* @__PURE__ */
|
|
879
|
+
children: [/* @__PURE__ */ u(g, {
|
|
880
880
|
className: "w-full",
|
|
881
|
-
children: /* @__PURE__ */
|
|
882
|
-
}), /* @__PURE__ */
|
|
881
|
+
children: /* @__PURE__ */ u(_, {})
|
|
882
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
883
883
|
value: "income",
|
|
884
884
|
children: Y.income
|
|
885
|
-
}), /* @__PURE__ */
|
|
885
|
+
}), /* @__PURE__ */ u(h, {
|
|
886
886
|
value: "expense",
|
|
887
887
|
children: Y.expense
|
|
888
888
|
})] })]
|
|
889
889
|
})] }),
|
|
890
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
891
891
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
892
|
-
children:
|
|
893
|
-
}), /* @__PURE__ */
|
|
894
|
-
value:
|
|
892
|
+
children: w("healthybowl.financial.transactions.form.fields.category.label", "Category *")
|
|
893
|
+
}), /* @__PURE__ */ d(p, {
|
|
894
|
+
value: W.category,
|
|
895
895
|
onValueChange: (e) => Q("category", e),
|
|
896
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ u(g, {
|
|
897
897
|
className: "w-full",
|
|
898
|
-
children: /* @__PURE__ */
|
|
899
|
-
}), /* @__PURE__ */
|
|
898
|
+
children: /* @__PURE__ */ u(_, {})
|
|
899
|
+
}), /* @__PURE__ */ u(m, { children: y.map((e) => /* @__PURE__ */ u(h, {
|
|
900
900
|
value: e,
|
|
901
901
|
children: X[e]
|
|
902
902
|
}, e)) })]
|
|
903
903
|
})] }),
|
|
904
|
-
/* @__PURE__ */
|
|
904
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
905
905
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
906
|
-
children:
|
|
907
|
-
}), /* @__PURE__ */
|
|
906
|
+
children: w("healthybowl.financial.transactions.form.fields.amount.label", "Amount *")
|
|
907
|
+
}), /* @__PURE__ */ u("input", {
|
|
908
908
|
type: "text",
|
|
909
909
|
inputMode: "decimal",
|
|
910
|
-
value:
|
|
910
|
+
value: W.amount,
|
|
911
911
|
onChange: (e) => Q("amount", e.target.value),
|
|
912
912
|
placeholder: "0.00",
|
|
913
913
|
className: $,
|
|
914
|
-
"aria-describedby":
|
|
914
|
+
"aria-describedby": q.hasSplits ? "transaction-allocation-summary" : void 0
|
|
915
915
|
})] }),
|
|
916
|
-
/* @__PURE__ */
|
|
916
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
917
917
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
918
|
-
children:
|
|
919
|
-
}), /* @__PURE__ */
|
|
920
|
-
value:
|
|
918
|
+
children: w("healthybowl.financial.transactions.form.fields.status.label", "Status *")
|
|
919
|
+
}), /* @__PURE__ */ d(p, {
|
|
920
|
+
value: W.status,
|
|
921
921
|
onValueChange: (e) => Q("status", e),
|
|
922
|
-
children: [/* @__PURE__ */
|
|
922
|
+
children: [/* @__PURE__ */ u(g, {
|
|
923
923
|
className: "w-full",
|
|
924
|
-
children: /* @__PURE__ */
|
|
925
|
-
}), /* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
924
|
+
children: /* @__PURE__ */ u(_, {})
|
|
925
|
+
}), /* @__PURE__ */ d(m, { children: [
|
|
926
|
+
/* @__PURE__ */ u(h, {
|
|
927
927
|
value: "completed",
|
|
928
928
|
children: Z.completed
|
|
929
929
|
}),
|
|
930
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ u(h, {
|
|
931
931
|
value: "pending",
|
|
932
932
|
children: Z.pending
|
|
933
933
|
}),
|
|
934
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ u(h, {
|
|
935
935
|
value: "failed",
|
|
936
936
|
children: Z.failed
|
|
937
937
|
})
|
|
938
938
|
] })]
|
|
939
939
|
})] }),
|
|
940
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ d("div", {
|
|
941
941
|
className: "sm:col-span-2",
|
|
942
|
-
children: [/* @__PURE__ */
|
|
942
|
+
children: [/* @__PURE__ */ u("label", {
|
|
943
943
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
944
|
-
children:
|
|
945
|
-
}), /* @__PURE__ */
|
|
944
|
+
children: w("healthybowl.financial.transactions.form.fields.description.label", "Description *")
|
|
945
|
+
}), /* @__PURE__ */ u("input", {
|
|
946
946
|
type: "text",
|
|
947
|
-
value:
|
|
947
|
+
value: W.description,
|
|
948
948
|
onChange: (e) => Q("description", e.target.value),
|
|
949
|
-
placeholder:
|
|
949
|
+
placeholder: w("healthybowl.financial.transactions.form.fields.description.placeholder", "Transaction description"),
|
|
950
950
|
className: $
|
|
951
951
|
})]
|
|
952
952
|
}),
|
|
953
|
-
/* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
954
954
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
955
|
-
children:
|
|
956
|
-
}), /* @__PURE__ */
|
|
957
|
-
value:
|
|
955
|
+
children: w("healthybowl.financial.transactions.form.fields.paymentMethod.label", "Payment Method")
|
|
956
|
+
}), /* @__PURE__ */ d(p, {
|
|
957
|
+
value: W.paymentMethod,
|
|
958
958
|
onValueChange: (e) => Q("paymentMethod", e),
|
|
959
|
-
children: [/* @__PURE__ */
|
|
959
|
+
children: [/* @__PURE__ */ u(g, {
|
|
960
960
|
className: "w-full",
|
|
961
|
-
children: /* @__PURE__ */
|
|
962
|
-
}), /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ u(_, {})
|
|
962
|
+
}), /* @__PURE__ */ u(m, { children: Ne.map((e) => /* @__PURE__ */ u(h, {
|
|
963
963
|
value: e,
|
|
964
964
|
children: gt[e] ?? e
|
|
965
965
|
}, e)) })]
|
|
966
966
|
})] }),
|
|
967
|
-
/* @__PURE__ */
|
|
967
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
968
968
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
969
|
-
children:
|
|
970
|
-
}), /* @__PURE__ */
|
|
969
|
+
children: w("healthybowl.financial.transactions.form.fields.reference.label", "Reference")
|
|
970
|
+
}), /* @__PURE__ */ u("input", {
|
|
971
971
|
type: "text",
|
|
972
|
-
value:
|
|
972
|
+
value: W.reference,
|
|
973
973
|
onChange: (e) => Q("reference", e.target.value),
|
|
974
974
|
placeholder: "INV-2025-XXX",
|
|
975
975
|
className: $
|
|
976
976
|
})] }),
|
|
977
|
-
|
|
977
|
+
W.type === "expense" ? /* @__PURE__ */ d("div", {
|
|
978
978
|
className: "sm:col-span-2",
|
|
979
979
|
children: [
|
|
980
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ u("label", {
|
|
981
981
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
982
|
-
children:
|
|
982
|
+
children: w("healthybowl.financial.transactions.form.fields.supplier.label", "Supplier")
|
|
983
983
|
}),
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
value:
|
|
986
|
-
onValueChange: (e) => Q("contactId", e ===
|
|
987
|
-
children: [/* @__PURE__ */
|
|
984
|
+
/* @__PURE__ */ d(p, {
|
|
985
|
+
value: W.contactId === "" ? x : W.contactId,
|
|
986
|
+
onValueChange: (e) => Q("contactId", e === x ? "" : e),
|
|
987
|
+
children: [/* @__PURE__ */ u(g, {
|
|
988
988
|
className: "w-full",
|
|
989
|
-
children: /* @__PURE__ */
|
|
990
|
-
}), /* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
value:
|
|
993
|
-
children:
|
|
989
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.form.fields.supplier.none", "None") })
|
|
990
|
+
}), /* @__PURE__ */ d(m, { children: [
|
|
991
|
+
/* @__PURE__ */ u(h, {
|
|
992
|
+
value: x,
|
|
993
|
+
children: w("healthybowl.financial.transactions.form.fields.supplier.none", "None")
|
|
994
994
|
}),
|
|
995
|
-
|
|
996
|
-
value:
|
|
995
|
+
W.contactId && !dt.some((e) => e.id === W.contactId) ? /* @__PURE__ */ d(h, {
|
|
996
|
+
value: W.contactId,
|
|
997
997
|
children: [
|
|
998
|
-
|
|
998
|
+
K?.contactName ?? w("healthybowl.financial.transactions.form.fields.supplier.unavailable", "Linked supplier"),
|
|
999
999
|
" ",
|
|
1000
1000
|
"(",
|
|
1001
|
-
|
|
1001
|
+
w("healthybowl.common.unavailable", "unavailable"),
|
|
1002
1002
|
")"
|
|
1003
1003
|
]
|
|
1004
1004
|
}) : null,
|
|
1005
|
-
|
|
1005
|
+
dt.map((e) => /* @__PURE__ */ d(h, {
|
|
1006
1006
|
value: e.id,
|
|
1007
1007
|
children: [e.name, e.status === "ACTIVE" ? "" : " (inactive)"]
|
|
1008
1008
|
}, e.id))
|
|
1009
1009
|
] })]
|
|
1010
1010
|
}),
|
|
1011
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ u("p", {
|
|
1012
1012
|
className: "mt-1 text-xs text-text-secondary",
|
|
1013
|
-
children:
|
|
1013
|
+
children: w("healthybowl.financial.transactions.form.fields.supplier.hint", "Linked expenses are included in this supplier’s completed and pending spend totals.")
|
|
1014
1014
|
})
|
|
1015
1015
|
]
|
|
1016
1016
|
}) : null,
|
|
1017
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
1018
1018
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
1019
|
-
children:
|
|
1020
|
-
}), /* @__PURE__ */
|
|
1021
|
-
value:
|
|
1022
|
-
onValueChange: (e) => Q("cropId", e ===
|
|
1023
|
-
children: [/* @__PURE__ */
|
|
1019
|
+
children: w("healthybowl.financial.transactions.form.fields.crop.label", "Crop")
|
|
1020
|
+
}), /* @__PURE__ */ d(p, {
|
|
1021
|
+
value: W.cropId === "" ? S : W.cropId,
|
|
1022
|
+
onValueChange: (e) => Q("cropId", e === S ? "" : e),
|
|
1023
|
+
children: [/* @__PURE__ */ u(g, {
|
|
1024
1024
|
className: "w-full",
|
|
1025
|
-
children: /* @__PURE__ */
|
|
1026
|
-
}), /* @__PURE__ */
|
|
1027
|
-
value:
|
|
1028
|
-
children:
|
|
1029
|
-
}),
|
|
1025
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.form.fields.crop.placeholder", "Select crop...") })
|
|
1026
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
1027
|
+
value: S,
|
|
1028
|
+
children: w("healthybowl.financial.transactions.form.fields.crop.none", "None")
|
|
1029
|
+
}), O.map((e) => /* @__PURE__ */ u(h, {
|
|
1030
1030
|
value: e.id,
|
|
1031
1031
|
children: e.name
|
|
1032
1032
|
}, e.id))] })]
|
|
1033
1033
|
})] }),
|
|
1034
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
1035
1035
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
1036
|
-
children:
|
|
1037
|
-
}), /* @__PURE__ */
|
|
1038
|
-
value:
|
|
1039
|
-
onValueChange: (e) => Q("fieldId", e ===
|
|
1040
|
-
children: [/* @__PURE__ */
|
|
1036
|
+
children: w("healthybowl.financial.transactions.form.fields.field.label", "Field")
|
|
1037
|
+
}), /* @__PURE__ */ d(p, {
|
|
1038
|
+
value: W.fieldId === "" ? C : W.fieldId,
|
|
1039
|
+
onValueChange: (e) => Q("fieldId", e === C ? "" : e),
|
|
1040
|
+
children: [/* @__PURE__ */ u(g, {
|
|
1041
1041
|
className: "w-full",
|
|
1042
|
-
children: /* @__PURE__ */
|
|
1043
|
-
}), /* @__PURE__ */
|
|
1044
|
-
value:
|
|
1045
|
-
children:
|
|
1046
|
-
}),
|
|
1042
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.form.fields.field.placeholder", "Select field...") })
|
|
1043
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
1044
|
+
value: C,
|
|
1045
|
+
children: w("healthybowl.financial.transactions.form.fields.field.none", "None")
|
|
1046
|
+
}), ze.map((e) => /* @__PURE__ */ u(h, {
|
|
1047
1047
|
value: e.id,
|
|
1048
1048
|
children: e.name
|
|
1049
1049
|
}, e.id))] })]
|
|
1050
1050
|
})] }),
|
|
1051
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ d("div", {
|
|
1052
1052
|
className: "sm:col-span-2",
|
|
1053
1053
|
children: [
|
|
1054
|
-
/* @__PURE__ */
|
|
1054
|
+
/* @__PURE__ */ u("label", {
|
|
1055
1055
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
1056
|
-
children:
|
|
1056
|
+
children: w("healthybowl.financial.transactions.form.fields.costCenter.label", "Cost Center")
|
|
1057
1057
|
}),
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
value:
|
|
1060
|
-
onValueChange: (e) => Q("costCenterId", e ===
|
|
1061
|
-
children: [/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ d(p, {
|
|
1059
|
+
value: W.costCenterId === "" ? b : W.costCenterId,
|
|
1060
|
+
onValueChange: (e) => Q("costCenterId", e === b ? "" : e),
|
|
1061
|
+
children: [/* @__PURE__ */ u(g, {
|
|
1062
1062
|
className: "w-full",
|
|
1063
|
-
children: /* @__PURE__ */
|
|
1064
|
-
}), /* @__PURE__ */
|
|
1065
|
-
value:
|
|
1066
|
-
children:
|
|
1067
|
-
}),
|
|
1063
|
+
children: /* @__PURE__ */ u(_, { placeholder: w("healthybowl.financial.transactions.form.fields.costCenter.none", "None") })
|
|
1064
|
+
}), /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(h, {
|
|
1065
|
+
value: b,
|
|
1066
|
+
children: w("healthybowl.financial.transactions.form.fields.costCenter.none", "None")
|
|
1067
|
+
}), ut.map((e) => /* @__PURE__ */ d(h, {
|
|
1068
1068
|
value: e.id,
|
|
1069
1069
|
children: [e.label, e.isActive ? "" : " (inactive)"]
|
|
1070
1070
|
}, e.id))] })]
|
|
1071
1071
|
}),
|
|
1072
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ u("p", {
|
|
1073
1073
|
className: "mt-1 text-xs text-text-secondary",
|
|
1074
|
-
children:
|
|
1074
|
+
children: w("healthybowl.financial.transactions.form.fields.costCenter.hint", "Attribute this entry to a crop or animal so it appears in cost-by-crop and the P&L.")
|
|
1075
1075
|
})
|
|
1076
1076
|
]
|
|
1077
1077
|
}),
|
|
1078
|
-
/* @__PURE__ */
|
|
1078
|
+
/* @__PURE__ */ d("section", {
|
|
1079
1079
|
className: "sm:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
1080
|
-
children: [/* @__PURE__ */
|
|
1080
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1081
1081
|
className: "flex flex-wrap items-start justify-between gap-3",
|
|
1082
|
-
children: [/* @__PURE__ */
|
|
1082
|
+
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h3", {
|
|
1083
1083
|
className: "text-sm font-semibold text-text-primary",
|
|
1084
|
-
children:
|
|
1085
|
-
}), /* @__PURE__ */
|
|
1084
|
+
children: w("healthybowl.financial.transactions.splits.title", "Split allocation")
|
|
1085
|
+
}), /* @__PURE__ */ u("p", {
|
|
1086
1086
|
className: "mt-1 text-xs text-text-secondary",
|
|
1087
|
-
children:
|
|
1088
|
-
})] }), /* @__PURE__ */
|
|
1087
|
+
children: w("healthybowl.financial.transactions.splits.description", "Optionally allocate this transaction across categories and independent cost centers.")
|
|
1088
|
+
})] }), /* @__PURE__ */ d(f, {
|
|
1089
1089
|
type: "button",
|
|
1090
1090
|
variant: "outline",
|
|
1091
1091
|
size: "sm",
|
|
1092
1092
|
onClick: vt,
|
|
1093
|
-
disabled:
|
|
1094
|
-
children: [/* @__PURE__ */
|
|
1093
|
+
disabled: W.splits.length >= 100,
|
|
1094
|
+
children: [/* @__PURE__ */ u(be, { className: "h-3.5 w-3.5" }), w("healthybowl.financial.transactions.splits.add", "Add split")]
|
|
1095
1095
|
})]
|
|
1096
|
-
}),
|
|
1096
|
+
}), W.splits.length > 0 ? /* @__PURE__ */ d("div", {
|
|
1097
1097
|
className: "mt-4 space-y-3",
|
|
1098
|
-
children: [
|
|
1099
|
-
let n =
|
|
1100
|
-
return /* @__PURE__ */
|
|
1098
|
+
children: [W.splits.map((e, t) => {
|
|
1099
|
+
let n = A.find((t) => t.id === e.costCenterId), r = E(e.amount);
|
|
1100
|
+
return /* @__PURE__ */ d("fieldset", {
|
|
1101
1101
|
className: "rounded-md border border-border-subtle p-3",
|
|
1102
|
-
"aria-label":
|
|
1103
|
-
children: [/* @__PURE__ */
|
|
1102
|
+
"aria-label": w("healthybowl.financial.transactions.splits.rowLabel", "Split allocation {{number}}", { number: t + 1 }),
|
|
1103
|
+
children: [/* @__PURE__ */ u("legend", {
|
|
1104
1104
|
className: "sr-only",
|
|
1105
|
-
children:
|
|
1106
|
-
}), /* @__PURE__ */
|
|
1105
|
+
children: w("healthybowl.financial.transactions.splits.rowLegend", "Split {{number}}", { number: t + 1 })
|
|
1106
|
+
}), /* @__PURE__ */ d("div", {
|
|
1107
1107
|
className: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(7rem,0.6fr)_minmax(0,1fr)_auto] sm:items-end",
|
|
1108
1108
|
children: [
|
|
1109
|
-
/* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
1110
1110
|
htmlFor: `transaction-split-category-${e.rowId}`,
|
|
1111
1111
|
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
1112
|
-
children:
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1112
|
+
children: w("healthybowl.financial.transactions.splits.category", "Category")
|
|
1113
|
+
}), /* @__PURE__ */ d(p, {
|
|
1114
1114
|
value: e.category,
|
|
1115
1115
|
onValueChange: (t) => yt(e.rowId, { category: t }),
|
|
1116
|
-
children: [/* @__PURE__ */
|
|
1116
|
+
children: [/* @__PURE__ */ u(g, {
|
|
1117
1117
|
id: `transaction-split-category-${e.rowId}`,
|
|
1118
1118
|
className: "w-full",
|
|
1119
|
-
children: /* @__PURE__ */
|
|
1120
|
-
}), /* @__PURE__ */
|
|
1119
|
+
children: /* @__PURE__ */ u(_, {})
|
|
1120
|
+
}), /* @__PURE__ */ u(m, { children: Me.map((e) => /* @__PURE__ */ u(h, {
|
|
1121
1121
|
value: e,
|
|
1122
1122
|
children: X[e]
|
|
1123
1123
|
}, e)) })]
|
|
1124
1124
|
})] }),
|
|
1125
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
1126
1126
|
htmlFor: `transaction-split-amount-${e.rowId}`,
|
|
1127
1127
|
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
1128
|
-
children:
|
|
1129
|
-
}), /* @__PURE__ */
|
|
1128
|
+
children: w("healthybowl.financial.transactions.splits.amount", "Amount")
|
|
1129
|
+
}), /* @__PURE__ */ u("input", {
|
|
1130
1130
|
id: `transaction-split-amount-${e.rowId}`,
|
|
1131
1131
|
type: "text",
|
|
1132
1132
|
inputMode: "decimal",
|
|
@@ -1136,142 +1136,142 @@ var v = [
|
|
|
1136
1136
|
className: $,
|
|
1137
1137
|
"aria-invalid": r === null || r <= 0n
|
|
1138
1138
|
})] }),
|
|
1139
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
|
|
1140
1140
|
htmlFor: `transaction-split-cost-center-${e.rowId}`,
|
|
1141
1141
|
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
1142
|
-
children:
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1144
|
-
value: e.costCenterId ||
|
|
1145
|
-
onValueChange: (t) => yt(e.rowId, { costCenterId: t ===
|
|
1146
|
-
children: [/* @__PURE__ */
|
|
1142
|
+
children: w("healthybowl.financial.transactions.splits.costCenter", "Cost center")
|
|
1143
|
+
}), /* @__PURE__ */ d(p, {
|
|
1144
|
+
value: e.costCenterId || b,
|
|
1145
|
+
onValueChange: (t) => yt(e.rowId, { costCenterId: t === b ? "" : t }),
|
|
1146
|
+
children: [/* @__PURE__ */ u(g, {
|
|
1147
1147
|
id: `transaction-split-cost-center-${e.rowId}`,
|
|
1148
1148
|
className: "w-full",
|
|
1149
|
-
children: /* @__PURE__ */
|
|
1150
|
-
}), /* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
value:
|
|
1153
|
-
children:
|
|
1149
|
+
children: /* @__PURE__ */ u(_, {})
|
|
1150
|
+
}), /* @__PURE__ */ d(m, { children: [
|
|
1151
|
+
/* @__PURE__ */ u(h, {
|
|
1152
|
+
value: b,
|
|
1153
|
+
children: w("healthybowl.financial.transactions.form.fields.costCenter.none", "None")
|
|
1154
1154
|
}),
|
|
1155
|
-
n && !n.isActive ? /* @__PURE__ */
|
|
1155
|
+
n && !n.isActive ? /* @__PURE__ */ d(h, {
|
|
1156
1156
|
value: n.id,
|
|
1157
1157
|
children: [
|
|
1158
1158
|
n.label,
|
|
1159
1159
|
" (",
|
|
1160
|
-
|
|
1160
|
+
w("healthybowl.common.inactive", "inactive"),
|
|
1161
1161
|
")"
|
|
1162
1162
|
]
|
|
1163
1163
|
}) : null,
|
|
1164
|
-
|
|
1164
|
+
j.map((e) => /* @__PURE__ */ u(h, {
|
|
1165
1165
|
value: e.id,
|
|
1166
1166
|
children: e.label
|
|
1167
1167
|
}, e.id))
|
|
1168
1168
|
] })]
|
|
1169
1169
|
})] }),
|
|
1170
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ u(f, {
|
|
1171
1171
|
type: "button",
|
|
1172
1172
|
variant: "ghost",
|
|
1173
1173
|
size: "icon-sm",
|
|
1174
1174
|
onClick: () => bt(e.rowId),
|
|
1175
|
-
"aria-label":
|
|
1176
|
-
children: /* @__PURE__ */
|
|
1175
|
+
"aria-label": w("healthybowl.financial.transactions.splits.remove", "Remove split {{number}}", { number: t + 1 }),
|
|
1176
|
+
children: /* @__PURE__ */ u(xe, { className: "h-3.5 w-3.5" })
|
|
1177
1177
|
})
|
|
1178
1178
|
]
|
|
1179
1179
|
})]
|
|
1180
1180
|
}, e.rowId);
|
|
1181
|
-
}), /* @__PURE__ */
|
|
1181
|
+
}), /* @__PURE__ */ d("div", {
|
|
1182
1182
|
id: "transaction-allocation-summary",
|
|
1183
1183
|
className: "grid grid-cols-3 gap-3 rounded-md bg-bg-subtle p-3 text-sm",
|
|
1184
1184
|
"aria-live": "polite",
|
|
1185
1185
|
children: [
|
|
1186
|
-
/* @__PURE__ */
|
|
1186
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
1187
1187
|
className: "text-xs text-text-secondary",
|
|
1188
|
-
children:
|
|
1189
|
-
}), /* @__PURE__ */
|
|
1188
|
+
children: w("healthybowl.financial.transactions.splits.allocated", "Allocated")
|
|
1189
|
+
}), /* @__PURE__ */ u("p", {
|
|
1190
1190
|
className: "font-semibold text-text-primary",
|
|
1191
|
-
children:
|
|
1191
|
+
children: q.splitAmountsValid ? D(q.allocated) : "—"
|
|
1192
1192
|
})] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
1194
1194
|
className: "text-xs text-text-secondary",
|
|
1195
|
-
children:
|
|
1196
|
-
}), /* @__PURE__ */
|
|
1195
|
+
children: w("healthybowl.financial.transactions.splits.total", "Total")
|
|
1196
|
+
}), /* @__PURE__ */ u("p", {
|
|
1197
1197
|
className: "font-semibold text-text-primary",
|
|
1198
|
-
children:
|
|
1198
|
+
children: q.total === null ? "—" : D(q.total)
|
|
1199
1199
|
})] }),
|
|
1200
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
1201
1201
|
className: "text-xs text-text-secondary",
|
|
1202
|
-
children:
|
|
1203
|
-
}), /* @__PURE__ */
|
|
1204
|
-
className: e("font-semibold",
|
|
1205
|
-
children:
|
|
1202
|
+
children: w("healthybowl.financial.transactions.splits.remaining", "Remaining")
|
|
1203
|
+
}), /* @__PURE__ */ u("p", {
|
|
1204
|
+
className: e("font-semibold", q.matches ? "text-success" : "text-status-error-text"),
|
|
1205
|
+
children: q.remaining === null || !q.splitAmountsValid ? "—" : D(q.remaining)
|
|
1206
1206
|
})] }),
|
|
1207
|
-
|
|
1207
|
+
q.matches ? null : /* @__PURE__ */ u("p", {
|
|
1208
1208
|
className: "col-span-3 text-xs text-status-error-text",
|
|
1209
|
-
children:
|
|
1209
|
+
children: q.splitAmountsValid ? w("healthybowl.financial.transactions.splits.saveBlockedMismatch", "Allocated splits must exactly equal the transaction total before you can save.") : w("healthybowl.financial.transactions.splits.saveBlockedInvalid", "Every split must have an amount greater than 0 with no more than two decimal places.")
|
|
1210
1210
|
})
|
|
1211
1211
|
]
|
|
1212
1212
|
})]
|
|
1213
|
-
}) : /* @__PURE__ */
|
|
1213
|
+
}) : /* @__PURE__ */ u("p", {
|
|
1214
1214
|
className: "mt-3 text-xs text-text-secondary",
|
|
1215
|
-
children:
|
|
1215
|
+
children: w("healthybowl.financial.transactions.splits.unsplit", "No split rows: this transaction uses its header category and cost center.")
|
|
1216
1216
|
})]
|
|
1217
1217
|
}),
|
|
1218
|
-
/* @__PURE__ */
|
|
1218
|
+
/* @__PURE__ */ d("section", {
|
|
1219
1219
|
className: "sm:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
1220
|
-
children: [/* @__PURE__ */
|
|
1220
|
+
children: [/* @__PURE__ */ d("div", {
|
|
1221
1221
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
1222
1222
|
children: [
|
|
1223
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h3", {
|
|
1224
1224
|
className: "text-sm font-semibold text-text-primary",
|
|
1225
|
-
children:
|
|
1226
|
-
}), /* @__PURE__ */
|
|
1225
|
+
children: w("healthybowl.financial.transactions.receipt.title", "Receipt")
|
|
1226
|
+
}), /* @__PURE__ */ u("p", {
|
|
1227
1227
|
className: "mt-1 text-xs text-text-secondary",
|
|
1228
|
-
children:
|
|
1228
|
+
children: w("healthybowl.financial.transactions.receipt.description", "Attach a PDF, JPEG, PNG, or WebP receipt (up to 10 MB). The transaction stores only its Files record ID.")
|
|
1229
1229
|
})] }),
|
|
1230
|
-
/* @__PURE__ */
|
|
1231
|
-
ref:
|
|
1230
|
+
/* @__PURE__ */ u("input", {
|
|
1231
|
+
ref: F,
|
|
1232
1232
|
id: "transaction-receipt-input",
|
|
1233
1233
|
type: "file",
|
|
1234
1234
|
accept: ".pdf,.jpg,.jpeg,.png,.webp,application/pdf,image/jpeg,image/png,image/webp",
|
|
1235
1235
|
className: "sr-only",
|
|
1236
1236
|
onChange: (e) => void xt(e),
|
|
1237
|
-
disabled:
|
|
1237
|
+
disabled: P
|
|
1238
1238
|
}),
|
|
1239
|
-
/* @__PURE__ */
|
|
1239
|
+
/* @__PURE__ */ d(f, {
|
|
1240
1240
|
type: "button",
|
|
1241
1241
|
variant: "outline",
|
|
1242
1242
|
size: "sm",
|
|
1243
|
-
onClick: () =>
|
|
1244
|
-
disabled:
|
|
1245
|
-
children: [/* @__PURE__ */
|
|
1243
|
+
onClick: () => F.current?.click(),
|
|
1244
|
+
disabled: P,
|
|
1245
|
+
children: [/* @__PURE__ */ u(we, { className: "h-3.5 w-3.5" }), P ? w("healthybowl.financial.transactions.receipt.uploading", "Uploading receipt...") : W.receiptFileId ? w("healthybowl.financial.transactions.receipt.replace", "Replace receipt") : w("healthybowl.financial.transactions.receipt.upload", "Upload receipt")]
|
|
1246
1246
|
})
|
|
1247
1247
|
]
|
|
1248
|
-
}),
|
|
1248
|
+
}), W.receiptFileId ? /* @__PURE__ */ d("div", {
|
|
1249
1249
|
className: "mt-3 flex flex-wrap items-center justify-between gap-3 rounded-md bg-bg-subtle p-3",
|
|
1250
|
-
children: [/* @__PURE__ */
|
|
1250
|
+
children: [/* @__PURE__ */ d("p", {
|
|
1251
1251
|
className: "flex min-w-0 items-center gap-2 text-sm text-text-primary",
|
|
1252
|
-
children: [/* @__PURE__ */
|
|
1252
|
+
children: [/* @__PURE__ */ u(ye, { className: "h-4 w-4 shrink-0" }), /* @__PURE__ */ u("span", {
|
|
1253
1253
|
className: "truncate",
|
|
1254
|
-
children:
|
|
1254
|
+
children: W.receiptFileName || w("healthybowl.financial.transactions.receipt.attached", "Receipt attached")
|
|
1255
1255
|
})]
|
|
1256
|
-
}), /* @__PURE__ */
|
|
1256
|
+
}), /* @__PURE__ */ d("div", {
|
|
1257
1257
|
className: "flex items-center gap-1",
|
|
1258
|
-
children: [
|
|
1258
|
+
children: [K?.receiptFileId === W.receiptFileId ? /* @__PURE__ */ d(f, {
|
|
1259
1259
|
type: "button",
|
|
1260
1260
|
variant: "ghost",
|
|
1261
1261
|
size: "sm",
|
|
1262
|
-
onClick: () => void St(
|
|
1263
|
-
disabled:
|
|
1264
|
-
children: [/* @__PURE__ */
|
|
1265
|
-
}) : null, /* @__PURE__ */
|
|
1262
|
+
onClick: () => void St(K),
|
|
1263
|
+
disabled: Ze === K.id,
|
|
1264
|
+
children: [/* @__PURE__ */ u(_e, { className: "h-3.5 w-3.5" }), w("healthybowl.financial.transactions.receipt.open", "Open")]
|
|
1265
|
+
}) : null, /* @__PURE__ */ d(f, {
|
|
1266
1266
|
type: "button",
|
|
1267
1267
|
variant: "ghost",
|
|
1268
1268
|
size: "sm",
|
|
1269
|
-
onClick: () =>
|
|
1269
|
+
onClick: () => G((e) => ({
|
|
1270
1270
|
...e,
|
|
1271
1271
|
receiptFileId: "",
|
|
1272
1272
|
receiptFileName: ""
|
|
1273
1273
|
})),
|
|
1274
|
-
children: [/* @__PURE__ */
|
|
1274
|
+
children: [/* @__PURE__ */ u(Te, { className: "h-3.5 w-3.5" }), w("healthybowl.financial.transactions.receipt.clear", "Clear")]
|
|
1275
1275
|
})]
|
|
1276
1276
|
})]
|
|
1277
1277
|
}) : null]
|
|
@@ -1279,14 +1279,14 @@ var v = [
|
|
|
1279
1279
|
]
|
|
1280
1280
|
})
|
|
1281
1281
|
}),
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
toasts:
|
|
1284
|
-
onDismiss:
|
|
1282
|
+
/* @__PURE__ */ u(ne, {
|
|
1283
|
+
toasts: qe,
|
|
1284
|
+
onDismiss: Je
|
|
1285
1285
|
})
|
|
1286
1286
|
]
|
|
1287
1287
|
});
|
|
1288
1288
|
};
|
|
1289
1289
|
//#endregion
|
|
1290
|
-
export {
|
|
1290
|
+
export { ze as TransactionsPage };
|
|
1291
1291
|
|
|
1292
1292
|
//# sourceMappingURL=TransactionsPage.js.map
|