@burdenoff/microfe-brainyrich 2026.525.1 → 2026.706.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brainyrich/BrainyRichRoot.js +55 -90
- package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
- package/dist/brainyrich/BrainyRichRoutes.js +15 -35
- package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
- package/dist/brainyrich/components/ActorName.js +38 -0
- package/dist/brainyrich/components/ActorName.js.map +1 -0
- package/dist/brainyrich/components/ConfirmDialog.js +25 -0
- package/dist/brainyrich/components/ConfirmDialog.js.map +1 -0
- package/dist/brainyrich/components/LoadMore.js +24 -0
- package/dist/brainyrich/components/LoadMore.js.map +1 -0
- package/dist/brainyrich/components/index.js +5 -0
- package/dist/brainyrich/components/notify.js +38 -0
- package/dist/brainyrich/components/notify.js.map +1 -0
- package/dist/brainyrich/components/pickers.js +232 -0
- package/dist/brainyrich/components/pickers.js.map +1 -0
- package/dist/brainyrich/components/reuse/CommentThread.js +208 -0
- package/dist/brainyrich/components/reuse/CommentThread.js.map +1 -0
- package/dist/brainyrich/components/reuse/DocumentsPanel.js +237 -0
- package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -0
- package/dist/brainyrich/components/reuse/TagField.js +206 -0
- package/dist/brainyrich/components/reuse/TagField.js.map +1 -0
- package/dist/brainyrich/components/reuse/transport.js +24 -0
- package/dist/brainyrich/components/reuse/transport.js.map +1 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.js +815 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
- package/dist/brainyrich/index.js +0 -1
- package/dist/brainyrich/pages/AccountsPage.js +743 -160
- package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
- package/dist/brainyrich/pages/AiAssistantPage.js +556 -363
- package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
- package/dist/brainyrich/pages/AnalyticsPage.js +601 -268
- package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.js +375 -231
- package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
- package/dist/brainyrich/pages/FamilyPage.js +599 -337
- package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.js +810 -141
- package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
- package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
- package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
- package/dist/brainyrich/pages/PortfoliosPage.js +867 -156
- package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
- package/dist/brainyrich/pages/ReportsPage.js +421 -251
- package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
- package/dist/brainyrich/pages/RiskPage.js +557 -194
- package/dist/brainyrich/pages/RiskPage.js.map +1 -1
- package/dist/brainyrich/pages/TaxPage.js +655 -221
- package/dist/brainyrich/pages/TaxPage.js.map +1 -1
- package/dist/brainyrich/pages/_shared.js +222 -41
- package/dist/brainyrich/pages/_shared.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/node_modules/sonner/dist/index.js +163 -0
- package/dist/node_modules/sonner/dist/index.js.map +1 -0
- package/package.json +3 -2
- package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
- package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
- package/dist/brainyrich/pages/AssistantPage.js +0 -332
- package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
- package/dist/brainyrich/pages/EstatePage.js +0 -269
- package/dist/brainyrich/pages/EstatePage.js.map +0 -1
- package/dist/brainyrich/pages/InsurancePage.js +0 -181
- package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
- package/dist/brainyrich/pages/MarketplacePage.js +0 -450
- package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
- package/dist/brainyrich/store/brainyrichStore.js +0 -272
- package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
|
@@ -1,160 +1,829 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { useAccounts as t, useArchiveGoal as n, useCreateGoal as r, useGoal as i, useGoalFundings as a, useHouseholds as o, useLinkGoalFunding as s, usePagedGoals as c, useRecalcGoalProjection as l, useUnlinkGoalFunding as u, useUpdateGoal as ee } from "../hooks/useBrainyRichApi.js";
|
|
3
|
+
import { LoadMore as te } from "../components/LoadMore.js";
|
|
4
|
+
import { ConfirmDialog as ne } from "../components/ConfirmDialog.js";
|
|
5
|
+
import "../components/index.js";
|
|
6
|
+
import { EmptyState as re, ErrorState as ie, KpiGrid as d, LoadingState as ae, SectionShell as f, formatDate as oe, formatMoney as p, statusBadgeVariant as m } from "./_shared.js";
|
|
7
|
+
import { TagField as h } from "../components/reuse/TagField.js";
|
|
8
|
+
import { useMemo as g, useState as _ } from "react";
|
|
9
|
+
import { AlertTriangle as v, CalendarClock as y, Link2 as se, MoreHorizontal as b, Plus as ce, RefreshCw as le, Target as x, Trash2 as S, TrendingDown as C, TrendingUp as w, Unlink as ue } from "lucide-react";
|
|
10
|
+
import { useI18n as de } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
12
|
+
import { Badge as O, Button as k, Card as A, CardContent as j, CardDescription as M, CardHeader as N, CardTitle as fe, Dialog as P, DialogContent as F, DialogDescription as I, DialogFooter as L, DialogHeader as R, DialogTitle as z, DropdownMenu as pe, DropdownMenuContent as me, DropdownMenuItem as B, DropdownMenuSeparator as he, DropdownMenuTrigger as ge, Input as V, Label as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Sheet as J, SheetContent as Y, SheetDescription as X, SheetHeader as _e, SheetTitle as Z, Textarea as ve } from "@burdenoff/fe-libs/ui";
|
|
8
13
|
//#region src/brainyrich/pages/GoalsPage.tsx
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
var ye = [
|
|
15
|
+
"RETIREMENT",
|
|
16
|
+
"EDUCATION",
|
|
17
|
+
"HOME",
|
|
18
|
+
"EMERGENCY_FUND",
|
|
19
|
+
"MAJOR_PURCHASE",
|
|
20
|
+
"WEALTH_GROWTH",
|
|
21
|
+
"CUSTOM"
|
|
22
|
+
], be = [
|
|
23
|
+
"ACTIVE",
|
|
24
|
+
"ACHIEVED",
|
|
25
|
+
"ON_HOLD",
|
|
26
|
+
"ABANDONED"
|
|
27
|
+
];
|
|
28
|
+
function xe(e) {
|
|
29
|
+
switch (e) {
|
|
30
|
+
case "AHEAD":
|
|
31
|
+
case "ON_TRACK": return {
|
|
32
|
+
icon: w,
|
|
33
|
+
tone: "text-status-success-text"
|
|
34
|
+
};
|
|
35
|
+
case "BEHIND": return {
|
|
36
|
+
icon: C,
|
|
37
|
+
tone: "text-status-warning-text"
|
|
38
|
+
};
|
|
39
|
+
default: return {
|
|
40
|
+
icon: v,
|
|
41
|
+
tone: "text-status-error-text"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function Q(e) {
|
|
46
|
+
return e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
47
|
+
}
|
|
48
|
+
function Se(e) {
|
|
49
|
+
if (!e) return "";
|
|
50
|
+
let t = new Date(e);
|
|
51
|
+
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
52
|
+
}
|
|
53
|
+
function Ce() {
|
|
54
|
+
return {
|
|
55
|
+
name: "",
|
|
56
|
+
type: "CUSTOM",
|
|
57
|
+
status: "ACTIVE",
|
|
58
|
+
targetAmount: "",
|
|
59
|
+
targetDate: "",
|
|
60
|
+
monthlyContribution: "",
|
|
61
|
+
priority: "1",
|
|
62
|
+
currency: "USD",
|
|
63
|
+
householdId: "",
|
|
64
|
+
notes: ""
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function we(e) {
|
|
68
|
+
return {
|
|
69
|
+
name: e.name,
|
|
70
|
+
type: e.type,
|
|
71
|
+
status: e.status,
|
|
72
|
+
targetAmount: String(e.targetAmount),
|
|
73
|
+
targetDate: Se(e.targetDate),
|
|
74
|
+
monthlyContribution: String(e.monthlyContribution),
|
|
75
|
+
priority: String(e.priority),
|
|
76
|
+
currency: e.currency,
|
|
77
|
+
householdId: e.householdId ?? "",
|
|
78
|
+
notes: e.notes ?? ""
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var Te = "__none__";
|
|
82
|
+
function Ee() {
|
|
83
|
+
let { t } = de(), i = (n, r, i) => e(t, n, r, i), { items: a, hasMore: s, loadMore: l, isFetchingNextPage: u, isLoading: h, isError: v, refetch: C } = c(), { data: w } = o(), ue = r(), P = ee(), F = n(), [I, L] = _(!1), [R, z] = _(null), [V, H] = _(null), [U, W] = _(null), [G, K] = _(Ce), q = (e, t) => K((n) => ({
|
|
84
|
+
...n,
|
|
85
|
+
[e]: t
|
|
86
|
+
})), J = g(() => ({
|
|
87
|
+
totalTarget: a.reduce((e, t) => e + t.targetAmount, 0),
|
|
88
|
+
totalMonthly: a.reduce((e, t) => e + t.monthlyContribution, 0),
|
|
89
|
+
atRisk: a.filter((e) => e.projection === "AT_RISK" || e.projection === "BEHIND").length
|
|
90
|
+
}), [a]), Y = a[0]?.currency ?? "USD", X = () => {
|
|
91
|
+
K(Ce()), L(!0);
|
|
92
|
+
}, _e = (e) => {
|
|
93
|
+
K(we(e)), z(e);
|
|
94
|
+
}, Z = G.name.trim().length > 0 && Number(G.targetAmount) > 0 && G.targetDate.length > 0;
|
|
95
|
+
return /* @__PURE__ */ D(T, { children: [
|
|
96
|
+
/* @__PURE__ */ E(f, {
|
|
97
|
+
title: i("brainyrich.goals.title", "Financial Goals"),
|
|
98
|
+
description: i("brainyrich.goals.description", "Track progress toward your wealth milestones and life objectives"),
|
|
99
|
+
actionLabel: i("brainyrich.goals.actions.createGoal", "New goal"),
|
|
100
|
+
onAction: X,
|
|
101
|
+
children: h ? /* @__PURE__ */ E(ae, { rows: 4 }) : v ? /* @__PURE__ */ E(ie, {
|
|
102
|
+
title: i("brainyrich.goals.error.title", "Could not load goals"),
|
|
103
|
+
description: i("brainyrich.goals.error.description", "We could not reach the goals service. Please try again."),
|
|
104
|
+
onRetry: () => C()
|
|
105
|
+
}) : a.length === 0 ? /* @__PURE__ */ E(re, {
|
|
106
|
+
icon: /* @__PURE__ */ E(x, {
|
|
107
|
+
className: "size-6",
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
}),
|
|
110
|
+
title: i("brainyrich.goals.empty.title", "No financial goals yet"),
|
|
111
|
+
description: i("brainyrich.goals.empty.description", "Create your first goal to start tracking progress toward a milestone."),
|
|
112
|
+
action: /* @__PURE__ */ D(k, {
|
|
113
|
+
size: "sm",
|
|
114
|
+
onClick: X,
|
|
115
|
+
children: [/* @__PURE__ */ E(ce, {
|
|
116
|
+
className: "size-4",
|
|
117
|
+
"aria-hidden": "true"
|
|
118
|
+
}), i("brainyrich.goals.actions.createGoal", "New goal")]
|
|
119
|
+
})
|
|
120
|
+
}) : /* @__PURE__ */ D(T, { children: [
|
|
121
|
+
/* @__PURE__ */ E(d, { items: [
|
|
122
|
+
{
|
|
123
|
+
label: i("brainyrich.goals.metrics.activeGoals", "Goals"),
|
|
124
|
+
value: String(a.length),
|
|
125
|
+
trend: i("brainyrich.goals.metrics.activeGoalsTrend", "Being tracked")
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: i("brainyrich.goals.metrics.totalTarget", "Total target"),
|
|
129
|
+
value: p(J.totalTarget, Y)
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: i("brainyrich.goals.metrics.monthly", "Monthly contributions"),
|
|
133
|
+
value: p(J.totalMonthly, Y),
|
|
134
|
+
trend: i("brainyrich.goals.metrics.monthlyTrend", "Across all goals")
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
label: i("brainyrich.goals.metrics.atRisk", "Needs attention"),
|
|
138
|
+
value: String(J.atRisk),
|
|
139
|
+
trend: i("brainyrich.goals.metrics.atRiskTrend", "Behind or at risk"),
|
|
140
|
+
deltaTone: J.atRisk > 0 ? "negative" : "positive"
|
|
141
|
+
}
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ E("div", {
|
|
144
|
+
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
145
|
+
children: a.map((e) => {
|
|
146
|
+
let t = xe(e.projection), n = t.icon;
|
|
147
|
+
return /* @__PURE__ */ D(A, {
|
|
148
|
+
className: "flex flex-col",
|
|
149
|
+
children: [/* @__PURE__ */ E(N, {
|
|
150
|
+
className: "pb-3",
|
|
151
|
+
children: /* @__PURE__ */ D("div", {
|
|
152
|
+
className: "flex items-start justify-between gap-2",
|
|
153
|
+
children: [/* @__PURE__ */ D("div", {
|
|
154
|
+
className: "min-w-0",
|
|
155
|
+
children: [/* @__PURE__ */ D(fe, {
|
|
156
|
+
className: "flex items-center gap-2 text-base",
|
|
157
|
+
children: [/* @__PURE__ */ E(x, {
|
|
158
|
+
className: "size-4 shrink-0 text-text-secondary",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}), /* @__PURE__ */ E("span", {
|
|
161
|
+
className: "truncate",
|
|
162
|
+
children: e.name
|
|
163
|
+
})]
|
|
164
|
+
}), /* @__PURE__ */ D(M, {
|
|
165
|
+
className: "mt-1 flex flex-wrap items-center gap-2",
|
|
166
|
+
children: [/* @__PURE__ */ E(O, {
|
|
167
|
+
variant: "outline",
|
|
168
|
+
children: Q(e.type)
|
|
169
|
+
}), /* @__PURE__ */ E(O, {
|
|
170
|
+
variant: m(e.status),
|
|
171
|
+
children: Q(e.status)
|
|
172
|
+
})]
|
|
173
|
+
})]
|
|
174
|
+
}), /* @__PURE__ */ D(pe, { children: [/* @__PURE__ */ E(ge, {
|
|
175
|
+
asChild: !0,
|
|
176
|
+
children: /* @__PURE__ */ E(k, {
|
|
177
|
+
variant: "ghost",
|
|
178
|
+
size: "icon",
|
|
179
|
+
"aria-label": i("brainyrich.goals.actions.menu", "Goal actions"),
|
|
180
|
+
children: /* @__PURE__ */ E(b, {
|
|
181
|
+
className: "size-4",
|
|
182
|
+
"aria-hidden": "true"
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
}), /* @__PURE__ */ D(me, {
|
|
186
|
+
align: "end",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ D(B, {
|
|
189
|
+
onSelect: () => H(e.id),
|
|
190
|
+
children: [/* @__PURE__ */ E(se, {
|
|
191
|
+
className: "size-4",
|
|
192
|
+
"aria-hidden": "true"
|
|
193
|
+
}), i("brainyrich.goals.actions.manageFunding", "Manage funding")]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ D(B, {
|
|
196
|
+
onSelect: () => _e(e),
|
|
197
|
+
children: [/* @__PURE__ */ E(le, {
|
|
198
|
+
className: "size-4",
|
|
199
|
+
"aria-hidden": "true"
|
|
200
|
+
}), i("brainyrich.goals.actions.editGoal", "Edit goal")]
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ E(he, {}),
|
|
203
|
+
/* @__PURE__ */ D(B, {
|
|
204
|
+
className: "text-status-error-text focus:text-status-error-text",
|
|
205
|
+
onSelect: () => W(e),
|
|
206
|
+
children: [/* @__PURE__ */ E(S, {
|
|
207
|
+
className: "size-4",
|
|
208
|
+
"aria-hidden": "true"
|
|
209
|
+
}), i("brainyrich.goals.actions.archive", "Archive goal")]
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
})] })]
|
|
213
|
+
})
|
|
214
|
+
}), /* @__PURE__ */ D(j, {
|
|
215
|
+
className: "flex flex-1 flex-col gap-4",
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ D("div", { children: [
|
|
218
|
+
/* @__PURE__ */ E("p", {
|
|
219
|
+
className: "text-xs text-text-secondary",
|
|
220
|
+
children: i("brainyrich.goals.card.target", "Target amount")
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ E("p", {
|
|
223
|
+
className: "text-2xl font-semibold text-text-primary",
|
|
224
|
+
children: p(e.targetAmount, e.currency)
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ D("span", {
|
|
227
|
+
className: `mt-1 inline-flex items-center gap-1 text-xs font-medium ${t.tone}`,
|
|
228
|
+
children: [/* @__PURE__ */ E(n, {
|
|
229
|
+
className: "size-3.5",
|
|
230
|
+
"aria-hidden": "true"
|
|
231
|
+
}), Q(e.projection)]
|
|
232
|
+
})
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ D("dl", {
|
|
235
|
+
className: "grid grid-cols-2 gap-3 rounded-lg bg-bg-sunken p-3 text-sm",
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
|
|
238
|
+
className: "text-xs text-text-secondary",
|
|
239
|
+
children: i("brainyrich.goals.card.targetDate", "Target date")
|
|
240
|
+
}), /* @__PURE__ */ D("dd", {
|
|
241
|
+
className: "flex items-center gap-1 font-medium text-text-primary",
|
|
242
|
+
children: [/* @__PURE__ */ E(y, {
|
|
243
|
+
className: "size-3.5 text-text-secondary",
|
|
244
|
+
"aria-hidden": "true"
|
|
245
|
+
}), oe(e.targetDate)]
|
|
246
|
+
})] }),
|
|
247
|
+
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
|
|
248
|
+
className: "text-xs text-text-secondary",
|
|
249
|
+
children: i("brainyrich.goals.card.monthly", "Monthly")
|
|
250
|
+
}), /* @__PURE__ */ E("dd", {
|
|
251
|
+
className: "font-medium text-text-primary",
|
|
252
|
+
children: p(e.monthlyContribution, e.currency)
|
|
253
|
+
})] }),
|
|
254
|
+
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
|
|
255
|
+
className: "text-xs text-text-secondary",
|
|
256
|
+
children: i("brainyrich.goals.card.priority", "Priority")
|
|
257
|
+
}), /* @__PURE__ */ E("dd", {
|
|
258
|
+
className: "font-medium text-text-primary",
|
|
259
|
+
children: e.priority
|
|
260
|
+
})] }),
|
|
261
|
+
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("dt", {
|
|
262
|
+
className: "text-xs text-text-secondary",
|
|
263
|
+
children: i("brainyrich.goals.card.fundings", "Funding links")
|
|
264
|
+
}), /* @__PURE__ */ E("dd", {
|
|
265
|
+
className: "font-medium text-text-primary",
|
|
266
|
+
children: e.fundings.length
|
|
267
|
+
})] })
|
|
268
|
+
]
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ E("div", {
|
|
271
|
+
className: "mt-auto",
|
|
272
|
+
children: /* @__PURE__ */ E(k, {
|
|
273
|
+
variant: "outline",
|
|
274
|
+
size: "sm",
|
|
275
|
+
className: "w-full",
|
|
276
|
+
onClick: () => H(e.id),
|
|
277
|
+
children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})]
|
|
282
|
+
}, e.id);
|
|
283
|
+
})
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ E(te, {
|
|
286
|
+
hasMore: s,
|
|
287
|
+
loading: u,
|
|
288
|
+
onClick: l,
|
|
289
|
+
label: i("brainyrich.goals.actions.loadMore", "Load more goals"),
|
|
290
|
+
loadingLabel: i("brainyrich.goals.actions.loadingMore", "Loading…")
|
|
291
|
+
})
|
|
292
|
+
] })
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ E(De, {
|
|
295
|
+
open: I,
|
|
296
|
+
mode: "create",
|
|
297
|
+
form: G,
|
|
298
|
+
setField: q,
|
|
299
|
+
households: w.map((e) => ({
|
|
300
|
+
id: e.id,
|
|
301
|
+
name: e.name
|
|
302
|
+
})),
|
|
303
|
+
valid: Z,
|
|
304
|
+
pending: ue.isPending,
|
|
305
|
+
onSubmit: () => {
|
|
306
|
+
if (!Z) return;
|
|
307
|
+
let e = {
|
|
308
|
+
name: G.name.trim(),
|
|
309
|
+
type: G.type,
|
|
310
|
+
targetAmount: Number(G.targetAmount),
|
|
311
|
+
targetDate: new Date(G.targetDate).toISOString(),
|
|
312
|
+
monthlyContribution: Number(G.monthlyContribution) || 0,
|
|
313
|
+
priority: Number(G.priority) || 1,
|
|
314
|
+
currency: G.currency.trim() || "USD",
|
|
315
|
+
notes: G.notes.trim() || null,
|
|
316
|
+
tags: [],
|
|
317
|
+
...G.householdId ? { householdId: G.householdId } : {}
|
|
318
|
+
};
|
|
319
|
+
ue.mutate(e, { onSuccess: () => L(!1) });
|
|
320
|
+
},
|
|
321
|
+
onOpenChange: (e) => L(e),
|
|
322
|
+
translate: i
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ E(De, {
|
|
325
|
+
open: !!R,
|
|
326
|
+
mode: "edit",
|
|
327
|
+
goalId: R?.id,
|
|
328
|
+
form: G,
|
|
329
|
+
setField: q,
|
|
330
|
+
households: w.map((e) => ({
|
|
331
|
+
id: e.id,
|
|
332
|
+
name: e.name
|
|
333
|
+
})),
|
|
334
|
+
valid: Z,
|
|
335
|
+
pending: P.isPending,
|
|
336
|
+
onSubmit: () => {
|
|
337
|
+
if (!R || !Z) return;
|
|
338
|
+
let e = {
|
|
339
|
+
name: G.name.trim(),
|
|
340
|
+
type: G.type,
|
|
341
|
+
status: G.status,
|
|
342
|
+
targetAmount: Number(G.targetAmount),
|
|
343
|
+
targetDate: new Date(G.targetDate).toISOString(),
|
|
344
|
+
monthlyContribution: Number(G.monthlyContribution) || 0,
|
|
345
|
+
priority: Number(G.priority) || 1,
|
|
346
|
+
currency: G.currency.trim() || "USD",
|
|
347
|
+
notes: G.notes.trim() || null,
|
|
348
|
+
tags: R.tags
|
|
349
|
+
};
|
|
350
|
+
P.mutate({
|
|
351
|
+
id: R.id,
|
|
352
|
+
input: e
|
|
353
|
+
}, { onSuccess: () => z(null) });
|
|
22
354
|
},
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
value: i(C)
|
|
355
|
+
onOpenChange: (e) => {
|
|
356
|
+
e || z(null);
|
|
26
357
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
358
|
+
translate: i
|
|
359
|
+
}),
|
|
360
|
+
/* @__PURE__ */ E(Oe, {
|
|
361
|
+
goalId: V,
|
|
362
|
+
onClose: () => H(null),
|
|
363
|
+
translate: i
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ E(ne, {
|
|
366
|
+
open: !!U,
|
|
367
|
+
onOpenChange: (e) => {
|
|
368
|
+
e || W(null);
|
|
31
369
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
370
|
+
title: i("brainyrich.goals.archive.title", "Archive goal?"),
|
|
371
|
+
description: i("brainyrich.goals.archive.description", "This removes “{name}” from your active goals. You can no longer track its progress.", { name: U?.name ?? "" }),
|
|
372
|
+
confirmLabel: i("brainyrich.goals.archive.confirm", "Archive goal"),
|
|
373
|
+
pendingLabel: i("brainyrich.goals.archive.pending", "Archiving…"),
|
|
374
|
+
destructive: !0,
|
|
375
|
+
pending: F.isPending,
|
|
376
|
+
onConfirm: () => {
|
|
377
|
+
U && F.mutate(U.id, { onSuccess: () => W(null) });
|
|
36
378
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
variant: t >= 75 ? "default" : t >= 40 ? "secondary" : "destructive",
|
|
64
|
-
children: S("brainyrich.goals.progressComplete", "{pct}% complete", { pct: t })
|
|
379
|
+
})
|
|
380
|
+
] });
|
|
381
|
+
}
|
|
382
|
+
function De({ open: e, mode: t, goalId: n, form: r, setField: i, households: a, valid: o, pending: s, onSubmit: c, onOpenChange: l, translate: u }) {
|
|
383
|
+
return /* @__PURE__ */ E(P, {
|
|
384
|
+
open: e,
|
|
385
|
+
onOpenChange: l,
|
|
386
|
+
children: /* @__PURE__ */ D(F, {
|
|
387
|
+
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
388
|
+
children: [/* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(z, { children: t === "create" ? u("brainyrich.goals.form.createTitle", "New goal") : u("brainyrich.goals.form.editTitle", "Edit goal") }), /* @__PURE__ */ E(I, { children: u("brainyrich.goals.form.subtitle", "Define the milestone, target and contribution plan.") })] }), /* @__PURE__ */ D("form", {
|
|
389
|
+
className: "space-y-4",
|
|
390
|
+
onSubmit: (e) => {
|
|
391
|
+
e.preventDefault(), c();
|
|
392
|
+
},
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ D("div", {
|
|
395
|
+
className: "space-y-1.5",
|
|
396
|
+
children: [/* @__PURE__ */ E(H, {
|
|
397
|
+
htmlFor: "goal-name",
|
|
398
|
+
children: u("brainyrich.goals.form.name", "Name")
|
|
399
|
+
}), /* @__PURE__ */ E(V, {
|
|
400
|
+
id: "goal-name",
|
|
401
|
+
value: r.name,
|
|
402
|
+
onChange: (e) => i("name", e.target.value),
|
|
403
|
+
placeholder: u("brainyrich.goals.form.namePlaceholder", "e.g. Retirement fund"),
|
|
404
|
+
required: !0
|
|
65
405
|
})]
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
children:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ D("div", {
|
|
408
|
+
className: "grid grid-cols-2 gap-3",
|
|
409
|
+
children: [/* @__PURE__ */ D("div", {
|
|
410
|
+
className: "space-y-1.5",
|
|
411
|
+
children: [/* @__PURE__ */ E(H, {
|
|
412
|
+
htmlFor: "goal-type",
|
|
413
|
+
children: u("brainyrich.goals.form.type", "Type")
|
|
414
|
+
}), /* @__PURE__ */ D(U, {
|
|
415
|
+
value: r.type,
|
|
416
|
+
onValueChange: (e) => i("type", e),
|
|
417
|
+
children: [/* @__PURE__ */ E(K, {
|
|
418
|
+
id: "goal-type",
|
|
419
|
+
children: /* @__PURE__ */ E(q, {})
|
|
420
|
+
}), /* @__PURE__ */ E(W, { children: ye.map((e) => /* @__PURE__ */ E(G, {
|
|
421
|
+
value: e,
|
|
422
|
+
children: Q(e)
|
|
423
|
+
}, e)) })]
|
|
424
|
+
})]
|
|
425
|
+
}), t === "edit" ? /* @__PURE__ */ D("div", {
|
|
426
|
+
className: "space-y-1.5",
|
|
427
|
+
children: [/* @__PURE__ */ E(H, {
|
|
428
|
+
htmlFor: "goal-status",
|
|
429
|
+
children: u("brainyrich.goals.form.status", "Status")
|
|
430
|
+
}), /* @__PURE__ */ D(U, {
|
|
431
|
+
value: r.status,
|
|
432
|
+
onValueChange: (e) => i("status", e),
|
|
433
|
+
children: [/* @__PURE__ */ E(K, {
|
|
434
|
+
id: "goal-status",
|
|
435
|
+
children: /* @__PURE__ */ E(q, {})
|
|
436
|
+
}), /* @__PURE__ */ E(W, { children: be.map((e) => /* @__PURE__ */ E(G, {
|
|
437
|
+
value: e,
|
|
438
|
+
children: Q(e)
|
|
439
|
+
}, e)) })]
|
|
440
|
+
})]
|
|
441
|
+
}) : /* @__PURE__ */ D("div", {
|
|
442
|
+
className: "space-y-1.5",
|
|
443
|
+
children: [/* @__PURE__ */ E(H, {
|
|
444
|
+
htmlFor: "goal-priority",
|
|
445
|
+
children: u("brainyrich.goals.form.priority", "Priority")
|
|
446
|
+
}), /* @__PURE__ */ E(V, {
|
|
447
|
+
id: "goal-priority",
|
|
448
|
+
type: "number",
|
|
449
|
+
min: 1,
|
|
450
|
+
value: r.priority,
|
|
451
|
+
onChange: (e) => i("priority", e.target.value)
|
|
452
|
+
})]
|
|
453
|
+
})]
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ D("div", {
|
|
456
|
+
className: "grid grid-cols-2 gap-3",
|
|
457
|
+
children: [/* @__PURE__ */ D("div", {
|
|
458
|
+
className: "space-y-1.5",
|
|
459
|
+
children: [/* @__PURE__ */ E(H, {
|
|
460
|
+
htmlFor: "goal-target",
|
|
461
|
+
children: u("brainyrich.goals.form.targetAmount", "Target amount")
|
|
462
|
+
}), /* @__PURE__ */ E(V, {
|
|
463
|
+
id: "goal-target",
|
|
464
|
+
type: "number",
|
|
465
|
+
min: 0,
|
|
466
|
+
step: "0.01",
|
|
467
|
+
value: r.targetAmount,
|
|
468
|
+
onChange: (e) => i("targetAmount", e.target.value),
|
|
469
|
+
required: !0
|
|
470
|
+
})]
|
|
471
|
+
}), /* @__PURE__ */ D("div", {
|
|
472
|
+
className: "space-y-1.5",
|
|
473
|
+
children: [/* @__PURE__ */ E(H, {
|
|
474
|
+
htmlFor: "goal-date",
|
|
475
|
+
children: u("brainyrich.goals.form.targetDate", "Target date")
|
|
476
|
+
}), /* @__PURE__ */ E(V, {
|
|
477
|
+
id: "goal-date",
|
|
478
|
+
type: "date",
|
|
479
|
+
value: r.targetDate,
|
|
480
|
+
onChange: (e) => i("targetDate", e.target.value),
|
|
481
|
+
required: !0
|
|
482
|
+
})]
|
|
483
|
+
})]
|
|
484
|
+
}),
|
|
485
|
+
/* @__PURE__ */ D("div", {
|
|
486
|
+
className: "grid grid-cols-2 gap-3",
|
|
487
|
+
children: [/* @__PURE__ */ D("div", {
|
|
488
|
+
className: "space-y-1.5",
|
|
489
|
+
children: [/* @__PURE__ */ E(H, {
|
|
490
|
+
htmlFor: "goal-monthly",
|
|
491
|
+
children: u("brainyrich.goals.form.monthly", "Monthly contribution")
|
|
492
|
+
}), /* @__PURE__ */ E(V, {
|
|
493
|
+
id: "goal-monthly",
|
|
494
|
+
type: "number",
|
|
495
|
+
min: 0,
|
|
496
|
+
step: "0.01",
|
|
497
|
+
value: r.monthlyContribution,
|
|
498
|
+
onChange: (e) => i("monthlyContribution", e.target.value)
|
|
499
|
+
})]
|
|
500
|
+
}), /* @__PURE__ */ D("div", {
|
|
501
|
+
className: "space-y-1.5",
|
|
502
|
+
children: [/* @__PURE__ */ E(H, {
|
|
503
|
+
htmlFor: "goal-currency",
|
|
504
|
+
children: u("brainyrich.goals.form.currency", "Currency")
|
|
505
|
+
}), /* @__PURE__ */ E(V, {
|
|
506
|
+
id: "goal-currency",
|
|
507
|
+
value: r.currency,
|
|
508
|
+
onChange: (e) => i("currency", e.target.value.toUpperCase()),
|
|
509
|
+
maxLength: 3
|
|
510
|
+
})]
|
|
511
|
+
})]
|
|
512
|
+
}),
|
|
513
|
+
t === "edit" ? /* @__PURE__ */ D("div", {
|
|
514
|
+
className: "space-y-1.5",
|
|
515
|
+
children: [/* @__PURE__ */ E(H, {
|
|
516
|
+
htmlFor: "goal-priority-edit",
|
|
517
|
+
children: u("brainyrich.goals.form.priority", "Priority")
|
|
518
|
+
}), /* @__PURE__ */ E(V, {
|
|
519
|
+
id: "goal-priority-edit",
|
|
520
|
+
type: "number",
|
|
521
|
+
min: 1,
|
|
522
|
+
value: r.priority,
|
|
523
|
+
onChange: (e) => i("priority", e.target.value)
|
|
524
|
+
})]
|
|
525
|
+
}) : null,
|
|
526
|
+
/* @__PURE__ */ D("div", {
|
|
527
|
+
className: "space-y-1.5",
|
|
528
|
+
children: [/* @__PURE__ */ E(H, {
|
|
529
|
+
htmlFor: "goal-household",
|
|
530
|
+
children: u("brainyrich.goals.form.household", "Household (optional)")
|
|
531
|
+
}), /* @__PURE__ */ D(U, {
|
|
532
|
+
value: r.householdId || Te,
|
|
533
|
+
onValueChange: (e) => i("householdId", e === Te ? "" : e),
|
|
534
|
+
children: [/* @__PURE__ */ E(K, {
|
|
535
|
+
id: "goal-household",
|
|
536
|
+
children: /* @__PURE__ */ E(q, { placeholder: u("brainyrich.goals.form.householdNone", "None") })
|
|
537
|
+
}), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
|
|
538
|
+
value: Te,
|
|
539
|
+
children: u("brainyrich.goals.form.householdNone", "None")
|
|
540
|
+
}), a.map((e) => /* @__PURE__ */ E(G, {
|
|
541
|
+
value: e.id,
|
|
542
|
+
children: e.name
|
|
543
|
+
}, e.id))] })]
|
|
544
|
+
})]
|
|
545
|
+
}),
|
|
546
|
+
t === "edit" && n ? /* @__PURE__ */ E(h, {
|
|
547
|
+
entityType: "brainyrich-goal",
|
|
548
|
+
entityId: n,
|
|
549
|
+
label: u("brainyrich.goals.form.tags", "Tags")
|
|
550
|
+
}) : /* @__PURE__ */ D("div", {
|
|
551
|
+
className: "space-y-1.5",
|
|
552
|
+
children: [/* @__PURE__ */ E(H, { children: u("brainyrich.goals.form.tags", "Tags") }), /* @__PURE__ */ E("p", {
|
|
553
|
+
className: "text-sm text-text-secondary",
|
|
554
|
+
children: u("brainyrich.goals.form.tagsAfterCreate", "You can add tags after creating the goal.")
|
|
555
|
+
})]
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ D("div", {
|
|
558
|
+
className: "space-y-1.5",
|
|
559
|
+
children: [/* @__PURE__ */ E(H, {
|
|
560
|
+
htmlFor: "goal-notes",
|
|
561
|
+
children: u("brainyrich.goals.form.notes", "Notes")
|
|
562
|
+
}), /* @__PURE__ */ E(ve, {
|
|
563
|
+
id: "goal-notes",
|
|
564
|
+
value: r.notes,
|
|
565
|
+
onChange: (e) => i("notes", e.target.value),
|
|
566
|
+
rows: 3
|
|
567
|
+
})]
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
|
|
570
|
+
type: "button",
|
|
571
|
+
variant: "outline",
|
|
572
|
+
onClick: () => l(!1),
|
|
573
|
+
disabled: s,
|
|
574
|
+
children: u("brainyrich.goals.form.cancel", "Cancel")
|
|
575
|
+
}), /* @__PURE__ */ E(k, {
|
|
576
|
+
type: "submit",
|
|
577
|
+
disabled: !o || s,
|
|
578
|
+
children: s ? u("brainyrich.goals.form.saving", "Saving…") : t === "create" ? u("brainyrich.goals.form.create", "Create goal") : u("brainyrich.goals.form.save", "Save changes")
|
|
579
|
+
})] })
|
|
580
|
+
]
|
|
581
|
+
})]
|
|
582
|
+
})
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
function Oe({ goalId: e, onClose: n, translate: r }) {
|
|
586
|
+
let { data: o, isLoading: c, isError: ee, refetch: te } = i(e ?? void 0), { data: d } = a(e ?? void 0), { data: f } = t(), m = s(), h = u(), g = l(), [v, y] = _(""), [b, ce] = _("PERCENT"), [S, C] = _(""), [w, de] = _(""), [O, A] = _(null), j = d.reduce((e, t) => e + (t.fixedAmount ?? 0), 0), M = o?.currency ?? "USD", N = (e) => f.find((t) => t.id === e)?.name ?? e, fe = () => {
|
|
587
|
+
if (!e || !v) return;
|
|
588
|
+
let t = Number(S);
|
|
589
|
+
!Number.isFinite(t) || t <= 0 || m.mutate({
|
|
590
|
+
goalId: e,
|
|
591
|
+
accountId: v,
|
|
592
|
+
...b === "PERCENT" ? { allocationPct: t } : { fixedAmount: t }
|
|
593
|
+
}, { onSuccess: () => {
|
|
594
|
+
y(""), C("");
|
|
595
|
+
} });
|
|
596
|
+
}, P = () => {
|
|
597
|
+
if (!e) return;
|
|
598
|
+
let t = w === "" ? j : Number(w);
|
|
599
|
+
Number.isFinite(t) && g.mutate({
|
|
600
|
+
id: e,
|
|
601
|
+
fundedAmount: t
|
|
602
|
+
});
|
|
603
|
+
}, F = !!v && Number(S) > 0, I = O ? O.fixedAmount == null ? N(O.accountId) : p(O.fixedAmount, M) : "";
|
|
604
|
+
return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(J, {
|
|
605
|
+
open: !!e,
|
|
606
|
+
onOpenChange: (e) => {
|
|
607
|
+
e || n();
|
|
608
|
+
},
|
|
609
|
+
children: /* @__PURE__ */ D(Y, {
|
|
610
|
+
className: "flex w-full flex-col gap-0 overflow-y-auto sm:max-w-md",
|
|
611
|
+
children: [/* @__PURE__ */ D(_e, { children: [/* @__PURE__ */ E(Z, { children: o?.name ?? r("brainyrich.goals.detail.title", "Goal") }), /* @__PURE__ */ E(X, { children: r("brainyrich.goals.detail.subtitle", "Manage funding links and projection.") })] }), /* @__PURE__ */ E("div", {
|
|
612
|
+
className: "space-y-6 p-4",
|
|
613
|
+
children: c ? /* @__PURE__ */ E(ae, { rows: 3 }) : ee ? /* @__PURE__ */ E(ie, {
|
|
614
|
+
title: r("brainyrich.goals.detail.error", "Could not load goal"),
|
|
615
|
+
onRetry: () => te()
|
|
616
|
+
}) : o ? /* @__PURE__ */ D(T, { children: [
|
|
617
|
+
/* @__PURE__ */ D("div", {
|
|
618
|
+
className: "grid grid-cols-2 gap-3",
|
|
619
|
+
children: [
|
|
620
|
+
/* @__PURE__ */ E($, {
|
|
621
|
+
label: r("brainyrich.goals.detail.target", "Target"),
|
|
622
|
+
value: p(o.targetAmount, M)
|
|
80
623
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
624
|
+
/* @__PURE__ */ E($, {
|
|
625
|
+
label: r("brainyrich.goals.detail.funded", "Funded (fixed)"),
|
|
626
|
+
value: p(j, M)
|
|
627
|
+
}),
|
|
628
|
+
/* @__PURE__ */ E($, {
|
|
629
|
+
label: r("brainyrich.goals.detail.projection", "Projection"),
|
|
630
|
+
value: Q(o.projection),
|
|
631
|
+
tone: xe(o.projection).tone
|
|
87
632
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
className: "text-emerald-600 font-medium",
|
|
92
|
-
children: [t, "%"]
|
|
93
|
-
}), /* @__PURE__ */ u("span", { children: S("brainyrich.goals.remainingAmount", "{amount} remaining", { amount: i(n) }) })]
|
|
633
|
+
/* @__PURE__ */ E($, {
|
|
634
|
+
label: r("brainyrich.goals.detail.targetDate", "Target date"),
|
|
635
|
+
value: oe(o.targetDate)
|
|
94
636
|
})
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
637
|
+
]
|
|
638
|
+
}),
|
|
639
|
+
/* @__PURE__ */ D("section", {
|
|
640
|
+
className: "space-y-3",
|
|
641
|
+
children: [/* @__PURE__ */ E("h3", {
|
|
642
|
+
className: "text-sm font-semibold text-text-primary",
|
|
643
|
+
children: r("brainyrich.goals.detail.fundingLinks", "Funding links")
|
|
644
|
+
}), d.length === 0 ? /* @__PURE__ */ E("p", {
|
|
645
|
+
className: "rounded-lg border border-dashed border-border-subtle bg-bg-surface px-4 py-6 text-center text-sm text-text-secondary",
|
|
646
|
+
children: r("brainyrich.goals.detail.noFundings", "No accounts linked to fund this goal yet.")
|
|
647
|
+
}) : /* @__PURE__ */ E("ul", {
|
|
648
|
+
className: "space-y-2",
|
|
649
|
+
children: d.map((e) => /* @__PURE__ */ D("li", {
|
|
650
|
+
className: "flex items-center justify-between gap-2 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2",
|
|
651
|
+
children: [/* @__PURE__ */ D("div", {
|
|
652
|
+
className: "min-w-0",
|
|
653
|
+
children: [/* @__PURE__ */ E("p", {
|
|
654
|
+
className: "truncate text-sm font-medium text-text-primary",
|
|
655
|
+
children: N(e.accountId)
|
|
656
|
+
}), /* @__PURE__ */ E("p", {
|
|
657
|
+
className: "text-xs text-text-secondary",
|
|
658
|
+
children: e.fixedAmount == null ? r("brainyrich.goals.detail.pctOfAccount", "{pct}% of account", { pct: e.allocationPct }) : p(e.fixedAmount, M)
|
|
107
659
|
})]
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
660
|
+
}), /* @__PURE__ */ E(k, {
|
|
661
|
+
variant: "ghost",
|
|
662
|
+
size: "icon",
|
|
663
|
+
"aria-label": r("brainyrich.goals.detail.unlink", "Unlink funding"),
|
|
664
|
+
onClick: () => A(e),
|
|
665
|
+
children: /* @__PURE__ */ E(ue, {
|
|
666
|
+
className: "size-4",
|
|
667
|
+
"aria-hidden": "true"
|
|
668
|
+
})
|
|
669
|
+
})]
|
|
670
|
+
}, e.id))
|
|
671
|
+
})]
|
|
672
|
+
}),
|
|
673
|
+
/* @__PURE__ */ D("section", {
|
|
674
|
+
className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
675
|
+
children: [/* @__PURE__ */ E("h3", {
|
|
676
|
+
className: "text-sm font-semibold text-text-primary",
|
|
677
|
+
children: r("brainyrich.goals.detail.linkTitle", "Link an account")
|
|
678
|
+
}), f.length === 0 ? /* @__PURE__ */ E("p", {
|
|
679
|
+
className: "text-sm text-text-secondary",
|
|
680
|
+
children: r("brainyrich.goals.detail.noAccounts", "No accounts available to link.")
|
|
681
|
+
}) : /* @__PURE__ */ D(T, { children: [
|
|
682
|
+
/* @__PURE__ */ D("div", {
|
|
683
|
+
className: "space-y-1.5",
|
|
684
|
+
children: [/* @__PURE__ */ E(H, {
|
|
685
|
+
htmlFor: "funding-account",
|
|
686
|
+
children: r("brainyrich.goals.detail.account", "Account")
|
|
687
|
+
}), /* @__PURE__ */ D(U, {
|
|
688
|
+
value: v,
|
|
689
|
+
onValueChange: y,
|
|
690
|
+
children: [/* @__PURE__ */ E(K, {
|
|
691
|
+
id: "funding-account",
|
|
692
|
+
children: /* @__PURE__ */ E(q, { placeholder: r("brainyrich.goals.detail.selectAccount", "Select account") })
|
|
693
|
+
}), /* @__PURE__ */ E(W, { children: f.map((e) => /* @__PURE__ */ E(G, {
|
|
694
|
+
value: e.id,
|
|
695
|
+
children: e.name
|
|
696
|
+
}, e.id)) })]
|
|
697
|
+
})]
|
|
698
|
+
}),
|
|
699
|
+
/* @__PURE__ */ D("div", {
|
|
700
|
+
className: "grid grid-cols-2 gap-3",
|
|
701
|
+
children: [/* @__PURE__ */ D("div", {
|
|
702
|
+
className: "space-y-1.5",
|
|
703
|
+
children: [/* @__PURE__ */ E(H, {
|
|
704
|
+
htmlFor: "funding-mode",
|
|
705
|
+
children: r("brainyrich.goals.detail.mode", "Method")
|
|
706
|
+
}), /* @__PURE__ */ D(U, {
|
|
707
|
+
value: b,
|
|
708
|
+
onValueChange: (e) => ce(e),
|
|
709
|
+
children: [/* @__PURE__ */ E(K, {
|
|
710
|
+
id: "funding-mode",
|
|
711
|
+
children: /* @__PURE__ */ E(q, {})
|
|
712
|
+
}), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
|
|
713
|
+
value: "PERCENT",
|
|
714
|
+
children: r("brainyrich.goals.detail.percent", "Percentage")
|
|
715
|
+
}), /* @__PURE__ */ E(G, {
|
|
716
|
+
value: "FIXED",
|
|
717
|
+
children: r("brainyrich.goals.detail.fixed", "Fixed amount")
|
|
718
|
+
})] })]
|
|
117
719
|
})]
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
720
|
+
}), /* @__PURE__ */ D("div", {
|
|
721
|
+
className: "space-y-1.5",
|
|
722
|
+
children: [/* @__PURE__ */ E(H, {
|
|
723
|
+
htmlFor: "funding-value",
|
|
724
|
+
children: b === "PERCENT" ? r("brainyrich.goals.detail.pct", "Percent") : r("brainyrich.goals.detail.amount", "Amount")
|
|
725
|
+
}), /* @__PURE__ */ E(V, {
|
|
726
|
+
id: "funding-value",
|
|
727
|
+
type: "number",
|
|
728
|
+
min: 0,
|
|
729
|
+
step: "0.01",
|
|
730
|
+
value: S,
|
|
731
|
+
onChange: (e) => C(e.target.value)
|
|
127
732
|
})]
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
733
|
+
})]
|
|
734
|
+
}),
|
|
735
|
+
/* @__PURE__ */ D(k, {
|
|
736
|
+
size: "sm",
|
|
737
|
+
className: "w-full",
|
|
738
|
+
disabled: !F || m.isPending,
|
|
739
|
+
onClick: fe,
|
|
740
|
+
children: [/* @__PURE__ */ E(se, {
|
|
741
|
+
className: "size-4",
|
|
742
|
+
"aria-hidden": "true"
|
|
743
|
+
}), m.isPending ? r("brainyrich.goals.detail.linking", "Linking…") : r("brainyrich.goals.detail.link", "Link funding")]
|
|
744
|
+
})
|
|
745
|
+
] })]
|
|
746
|
+
}),
|
|
747
|
+
/* @__PURE__ */ D("section", {
|
|
748
|
+
className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
749
|
+
children: [
|
|
750
|
+
/* @__PURE__ */ E("h3", {
|
|
751
|
+
className: "text-sm font-semibold text-text-primary",
|
|
752
|
+
children: r("brainyrich.goals.detail.recalcTitle", "Recalculate projection")
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ D("div", {
|
|
755
|
+
className: "space-y-1.5",
|
|
756
|
+
children: [
|
|
757
|
+
/* @__PURE__ */ E(H, {
|
|
758
|
+
htmlFor: "recalc-funded",
|
|
759
|
+
children: r("brainyrich.goals.detail.fundedAmount", "Funded amount")
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ E(V, {
|
|
762
|
+
id: "recalc-funded",
|
|
763
|
+
type: "number",
|
|
764
|
+
min: 0,
|
|
765
|
+
step: "0.01",
|
|
766
|
+
value: w,
|
|
767
|
+
placeholder: String(j),
|
|
768
|
+
onChange: (e) => de(e.target.value)
|
|
769
|
+
}),
|
|
770
|
+
/* @__PURE__ */ E("p", {
|
|
771
|
+
className: "text-xs text-text-secondary",
|
|
772
|
+
children: r("brainyrich.goals.detail.recalcHint", "Defaults to the sum of fixed fundings when left blank.")
|
|
773
|
+
})
|
|
774
|
+
]
|
|
775
|
+
}),
|
|
776
|
+
/* @__PURE__ */ D(k, {
|
|
777
|
+
size: "sm",
|
|
778
|
+
variant: "outline",
|
|
779
|
+
className: "w-full",
|
|
780
|
+
disabled: g.isPending,
|
|
781
|
+
onClick: P,
|
|
782
|
+
children: [/* @__PURE__ */ E(le, {
|
|
783
|
+
className: "size-4",
|
|
784
|
+
"aria-hidden": "true"
|
|
785
|
+
}), g.isPending ? r("brainyrich.goals.detail.recalculating", "Recalculating…") : r("brainyrich.goals.detail.recalc", "Recalculate")]
|
|
786
|
+
})
|
|
787
|
+
]
|
|
788
|
+
})
|
|
789
|
+
] }) : /* @__PURE__ */ E(re, {
|
|
790
|
+
icon: /* @__PURE__ */ E(x, {
|
|
791
|
+
className: "size-6",
|
|
792
|
+
"aria-hidden": "true"
|
|
793
|
+
}),
|
|
794
|
+
title: r("brainyrich.goals.detail.notFound", "Goal not found")
|
|
795
|
+
})
|
|
796
|
+
})]
|
|
797
|
+
})
|
|
798
|
+
}), /* @__PURE__ */ E(ne, {
|
|
799
|
+
open: !!O,
|
|
800
|
+
onOpenChange: (e) => {
|
|
801
|
+
e || A(null);
|
|
802
|
+
},
|
|
803
|
+
title: r("brainyrich.goals.detail.unlinkTitle", "Unlink funding?"),
|
|
804
|
+
description: r("brainyrich.goals.detail.unlinkConfirm", "This removes the “{name}” funding link from this goal.", { name: I }),
|
|
805
|
+
confirmLabel: r("brainyrich.goals.detail.unlink", "Unlink funding"),
|
|
806
|
+
pendingLabel: r("brainyrich.goals.detail.unlinking", "Unlinking…"),
|
|
807
|
+
destructive: !0,
|
|
808
|
+
pending: h.isPending,
|
|
809
|
+
onConfirm: () => {
|
|
810
|
+
O && h.mutate(O.id, { onSuccess: () => A(null) });
|
|
811
|
+
}
|
|
812
|
+
})] });
|
|
813
|
+
}
|
|
814
|
+
function $({ label: e, value: t, tone: n }) {
|
|
815
|
+
return /* @__PURE__ */ D("div", {
|
|
816
|
+
className: "rounded-lg bg-bg-sunken p-3",
|
|
817
|
+
children: [/* @__PURE__ */ E("p", {
|
|
818
|
+
className: "text-xs text-text-secondary",
|
|
819
|
+
children: e
|
|
820
|
+
}), /* @__PURE__ */ E("p", {
|
|
821
|
+
className: `text-sm font-semibold ${n ?? "text-text-primary"}`,
|
|
822
|
+
children: t
|
|
154
823
|
})]
|
|
155
824
|
});
|
|
156
825
|
}
|
|
157
826
|
//#endregion
|
|
158
|
-
export {
|
|
827
|
+
export { Ee as GoalsPage };
|
|
159
828
|
|
|
160
829
|
//# sourceMappingURL=GoalsPage.js.map
|