@burdenoff/microfe-brainyrich 2026.1101.2 → 2026.1101.3
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.d.ts.map +1 -1
- package/dist/brainyrich/BrainyRichRoot.js +22 -107
- package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
- package/dist/brainyrich/BrainyRichRoutes.d.ts.map +1 -1
- package/dist/brainyrich/BrainyRichRoutes.js +65 -46
- package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
- package/dist/brainyrich/components/mobile/MobilePage.d.ts +44 -0
- package/dist/brainyrich/components/mobile/MobilePage.d.ts.map +1 -0
- package/dist/brainyrich/components/mobile/MobilePage.js +45 -0
- package/dist/brainyrich/components/mobile/MobilePage.js.map +1 -0
- package/dist/brainyrich/components/mobile/MobileTabBar.d.ts +20 -0
- package/dist/brainyrich/components/mobile/MobileTabBar.d.ts.map +1 -0
- package/dist/brainyrich/components/mobile/MobileTabBar.js +139 -0
- package/dist/brainyrich/components/mobile/MobileTabBar.js.map +1 -0
- package/dist/brainyrich/components/mobile/index.d.ts +8 -0
- package/dist/brainyrich/components/mobile/index.d.ts.map +1 -0
- package/dist/brainyrich/components/mobile/index.js +2 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.d.ts +48 -12
- package/dist/brainyrich/hooks/useBrainyRichApi.d.ts.map +1 -1
- package/dist/brainyrich/hooks/useBrainyRichApi.js +120 -108
- package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -1
- package/dist/brainyrich/hooks/useIsMobileViewport.d.ts +14 -0
- package/dist/brainyrich/hooks/useIsMobileViewport.d.ts.map +1 -0
- package/dist/brainyrich/hooks/useIsMobileViewport.js +23 -0
- package/dist/brainyrich/hooks/useIsMobileViewport.js.map +1 -0
- package/dist/brainyrich/navItems.d.ts +36 -0
- package/dist/brainyrich/navItems.d.ts.map +1 -0
- package/dist/brainyrich/navItems.js +54 -0
- package/dist/brainyrich/navItems.js.map +1 -0
- package/dist/brainyrich/pages/AccountsPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/AccountsPage.js +411 -390
- package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.js +220 -174
- package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.js +560 -551
- package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
- package/dist/brainyrich/pages/mobile/MobileAccountsView.d.ts +28 -0
- package/dist/brainyrich/pages/mobile/MobileAccountsView.d.ts.map +1 -0
- package/dist/brainyrich/pages/mobile/MobileAccountsView.js +139 -0
- package/dist/brainyrich/pages/mobile/MobileAccountsView.js.map +1 -0
- package/dist/brainyrich/pages/mobile/MobileDashboardView.d.ts +24 -0
- package/dist/brainyrich/pages/mobile/MobileDashboardView.d.ts.map +1 -0
- package/dist/brainyrich/pages/mobile/MobileDashboardView.js +245 -0
- package/dist/brainyrich/pages/mobile/MobileDashboardView.js.map +1 -0
- package/dist/brainyrich/pages/mobile/MobileGoalsView.d.ts +30 -0
- package/dist/brainyrich/pages/mobile/MobileGoalsView.d.ts.map +1 -0
- package/dist/brainyrich/pages/mobile/MobileGoalsView.js +180 -0
- package/dist/brainyrich/pages/mobile/MobileGoalsView.js.map +1 -0
- package/dist/brainyrich/pages/mobile/mobileShared.d.ts +24 -0
- package/dist/brainyrich/pages/mobile/mobileShared.d.ts.map +1 -0
- package/dist/brainyrich/pages/mobile/mobileShared.js +25 -0
- package/dist/brainyrich/pages/mobile/mobileShared.js.map +1 -0
- package/dist/brainyrich/utils/cn.js +10 -0
- package/dist/brainyrich/utils/cn.js.map +1 -0
- package/dist/brainyrich/utils/goalMetrics.d.ts +13 -0
- package/dist/brainyrich/utils/goalMetrics.d.ts.map +1 -0
- package/dist/brainyrich/utils/goalMetrics.js +20 -0
- package/dist/brainyrich/utils/goalMetrics.js.map +1 -0
- package/dist/test/brainyrichFixtures.d.ts +7 -0
- package/dist/test/brainyrichFixtures.d.ts.map +1 -0
- package/dist/test/viewport.d.ts +8 -0
- package/dist/test/viewport.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -4,17 +4,22 @@ import { LoadMore as te } from "../components/LoadMore.js";
|
|
|
4
4
|
import { ConfirmDialog as ne } from "../components/ConfirmDialog.js";
|
|
5
5
|
import { FadeIn as d, GlassCard as re, MiniAreaChart as ie, ProgressRing as ae, StatTile as f } from "../components/viz.js";
|
|
6
6
|
import "../components/index.js";
|
|
7
|
-
import { EmptyState as oe, ErrorState as se, LoadingState as ce, SectionShell as p, formatCompact as
|
|
7
|
+
import { EmptyState as oe, ErrorState as se, LoadingState as ce, SectionShell as p, formatCompact as m, formatDate as le, formatMoney as h, formatPct as ue, statusBadgeVariant as de } from "./_shared.js";
|
|
8
8
|
import { hapticSuccess as g, showToast as _ } from "../utils/nativeControls.js";
|
|
9
9
|
import { useTrackBrainyRichPageView as v } from "../hooks/useBrainyRichAnalytics.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
10
|
+
import { useIsMobileViewport as y } from "../hooks/useIsMobileViewport.js";
|
|
11
|
+
import { GOAL_DETAIL_PARAM as b } from "../navItems.js";
|
|
12
|
+
import { fundedPercent as fe, goalTone as pe } from "../utils/goalMetrics.js";
|
|
13
|
+
import { TagField as x } from "../components/reuse/TagField.js";
|
|
14
|
+
import { MobileGoalsView as S } from "./mobile/MobileGoalsView.js";
|
|
15
|
+
import { useMemo as me, useState as C } from "react";
|
|
16
|
+
import { AlertTriangle as w, CalendarClock as he, Coins as ge, LineChart as _e, Link2 as ve, MoreHorizontal as ye, PiggyBank as T, Plus as be, RefreshCw as xe, Target as E, Trash2 as D, TrendingDown as O, TrendingUp as k, Unlink as Se, Wallet as A } from "lucide-react";
|
|
17
|
+
import { useI18n as j } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
18
|
+
import { useSearchParams as Ce } from "react-router";
|
|
19
|
+
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
20
|
+
import { Badge as F, Button as I, Card as we, CardContent as Te, CardDescription as Ee, CardHeader as De, CardTitle as Oe, DropdownMenu as ke, DropdownMenuContent as Ae, DropdownMenuItem as L, DropdownMenuSeparator as je, DropdownMenuTrigger as Me, Input as R, Label as z, ResponsiveDialog as B, ResponsiveDialogContent as Ne, ResponsiveDialogDescription as Pe, ResponsiveDialogFooter as V, ResponsiveDialogHeader as Fe, ResponsiveDialogTitle 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 Ie, SheetHeader as X, SheetTitle as Le, Table as Re, TableBody as ze, TableCell as Z, TableHead as Q, TableHeader as Be, TableRow as Ve, Textarea as He } from "@burdenoff/fe-libs/ui";
|
|
16
21
|
//#region src/brainyrich/pages/GoalsPage.tsx
|
|
17
|
-
var
|
|
22
|
+
var Ue = [
|
|
18
23
|
"RETIREMENT",
|
|
19
24
|
"EDUCATION",
|
|
20
25
|
"HOME",
|
|
@@ -22,25 +27,25 @@ var Le = [
|
|
|
22
27
|
"MAJOR_PURCHASE",
|
|
23
28
|
"WEALTH_GROWTH",
|
|
24
29
|
"CUSTOM"
|
|
25
|
-
],
|
|
30
|
+
], We = [
|
|
26
31
|
"ACTIVE",
|
|
27
32
|
"ACHIEVED",
|
|
28
33
|
"ON_HOLD",
|
|
29
34
|
"ABANDONED"
|
|
30
35
|
];
|
|
31
|
-
function
|
|
36
|
+
function Ge(e) {
|
|
32
37
|
switch (e) {
|
|
33
38
|
case "AHEAD":
|
|
34
39
|
case "ON_TRACK": return {
|
|
35
|
-
icon:
|
|
40
|
+
icon: k,
|
|
36
41
|
tone: "text-status-success-text"
|
|
37
42
|
};
|
|
38
43
|
case "BEHIND": return {
|
|
39
|
-
icon:
|
|
44
|
+
icon: O,
|
|
40
45
|
tone: "text-status-warning-text"
|
|
41
46
|
};
|
|
42
47
|
default: return {
|
|
43
|
-
icon:
|
|
48
|
+
icon: w,
|
|
44
49
|
tone: "text-status-error-text"
|
|
45
50
|
};
|
|
46
51
|
}
|
|
@@ -48,22 +53,7 @@ function ze(e) {
|
|
|
48
53
|
function $(e) {
|
|
49
54
|
return e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
50
55
|
}
|
|
51
|
-
function
|
|
52
|
-
return (e.fundings ?? []).reduce((e, t) => e + (t.fixedAmount ?? 0), 0);
|
|
53
|
-
}
|
|
54
|
-
function Ve(e) {
|
|
55
|
-
return e.status === "ACHIEVED" ? 100 : e.targetAmount > 0 ? Math.max(0, Math.min(100, Be(e) / e.targetAmount * 100)) : 0;
|
|
56
|
-
}
|
|
57
|
-
function He(e, t) {
|
|
58
|
-
if (e === "ACHIEVED") return "success";
|
|
59
|
-
switch (t) {
|
|
60
|
-
case "AHEAD":
|
|
61
|
-
case "ON_TRACK": return "brand";
|
|
62
|
-
case "BEHIND": return "warning";
|
|
63
|
-
default: return "error";
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function Ue(e, t, n) {
|
|
56
|
+
function Ke(e, t, n) {
|
|
67
57
|
if (!n) return [];
|
|
68
58
|
let r = new Date(n);
|
|
69
59
|
if (Number.isNaN(r.getTime())) return [];
|
|
@@ -82,12 +72,12 @@ function Ue(e, t, n) {
|
|
|
82
72
|
}
|
|
83
73
|
return c;
|
|
84
74
|
}
|
|
85
|
-
function
|
|
75
|
+
function qe(e) {
|
|
86
76
|
if (!e) return "";
|
|
87
77
|
let t = new Date(e);
|
|
88
78
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
89
79
|
}
|
|
90
|
-
function
|
|
80
|
+
function Je() {
|
|
91
81
|
return {
|
|
92
82
|
name: "",
|
|
93
83
|
type: "CUSTOM",
|
|
@@ -101,13 +91,13 @@ function Ge() {
|
|
|
101
91
|
notes: ""
|
|
102
92
|
};
|
|
103
93
|
}
|
|
104
|
-
function
|
|
94
|
+
function Ye(e) {
|
|
105
95
|
return {
|
|
106
96
|
name: e.name,
|
|
107
97
|
type: e.type,
|
|
108
98
|
status: e.status,
|
|
109
99
|
targetAmount: String(e.targetAmount),
|
|
110
|
-
targetDate:
|
|
100
|
+
targetDate: qe(e.targetDate),
|
|
111
101
|
monthlyContribution: String(e.monthlyContribution),
|
|
112
102
|
priority: String(e.priority),
|
|
113
103
|
currency: e.currency,
|
|
@@ -115,381 +105,400 @@ function Ke(e) {
|
|
|
115
105
|
notes: e.notes ?? ""
|
|
116
106
|
};
|
|
117
107
|
}
|
|
118
|
-
var
|
|
119
|
-
function
|
|
120
|
-
let { t } =
|
|
108
|
+
var Xe = "__none__";
|
|
109
|
+
function Ze() {
|
|
110
|
+
let { t } = j(), i = (n, r, i) => e(t, n, r, i);
|
|
121
111
|
v("brainyrich.goals.viewed");
|
|
122
|
-
let { items:
|
|
112
|
+
let a = y(), { items: s, hasMore: l, loadMore: u, isFetchingNextPage: re, isLoading: ie, isError: m, refetch: ue } = c(), { data: x } = o(), _e = r(), O = ee(), k = n(), [Se, A] = C(!1), [R, z] = C(null), [B, Ne] = Ce(), [Pe, V] = C(() => B.get(b)), Fe = () => {
|
|
113
|
+
if (V(null), B.has("goal")) {
|
|
114
|
+
let e = new URLSearchParams(B);
|
|
115
|
+
e.delete(b), Ne(e, { replace: !0 });
|
|
116
|
+
}
|
|
117
|
+
}, [H, U] = C(null), [W, G] = C(Je), K = (e, t) => G((n) => ({
|
|
123
118
|
...n,
|
|
124
119
|
[e]: t
|
|
125
|
-
})),
|
|
126
|
-
totalTarget:
|
|
127
|
-
totalMonthly:
|
|
128
|
-
atRisk:
|
|
129
|
-
}), [
|
|
130
|
-
G(
|
|
131
|
-
},
|
|
132
|
-
G(
|
|
133
|
-
}, X = W.name.trim().length > 0 && Number(W.targetAmount) > 0 && W.targetDate.length > 0
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
120
|
+
})), q = me(() => ({
|
|
121
|
+
totalTarget: s.reduce((e, t) => e + t.targetAmount, 0),
|
|
122
|
+
totalMonthly: s.reduce((e, t) => e + t.monthlyContribution, 0),
|
|
123
|
+
atRisk: s.filter((e) => e.projection === "AT_RISK" || e.projection === "BEHIND").length
|
|
124
|
+
}), [s]), J = s[0]?.currency ?? "USD", Y = () => {
|
|
125
|
+
G(Je()), A(!0);
|
|
126
|
+
}, Ie = (e) => {
|
|
127
|
+
G(Ye(e)), z(e);
|
|
128
|
+
}, X = W.name.trim().length > 0 && Number(W.targetAmount) > 0 && W.targetDate.length > 0, Le = () => {
|
|
129
|
+
if (!X) return;
|
|
130
|
+
let e = {
|
|
131
|
+
name: W.name.trim(),
|
|
132
|
+
type: W.type,
|
|
133
|
+
targetAmount: Number(W.targetAmount),
|
|
134
|
+
targetDate: new Date(W.targetDate).toISOString(),
|
|
135
|
+
monthlyContribution: Number(W.monthlyContribution) || 0,
|
|
136
|
+
priority: Number(W.priority) || 1,
|
|
137
|
+
currency: W.currency.trim() || "USD",
|
|
138
|
+
notes: W.notes.trim() || null,
|
|
139
|
+
tags: [],
|
|
140
|
+
...W.householdId ? { householdId: W.householdId } : {}
|
|
141
|
+
};
|
|
142
|
+
_e.mutate(e, { onSuccess: () => {
|
|
143
|
+
g(), _(i("brainyrich.goals.created", "Goal created")), A(!1);
|
|
144
|
+
} });
|
|
145
|
+
}, Re = () => {
|
|
146
|
+
if (!R || !X) return;
|
|
147
|
+
let e = {
|
|
148
|
+
name: W.name.trim(),
|
|
149
|
+
type: W.type,
|
|
150
|
+
status: W.status,
|
|
151
|
+
targetAmount: Number(W.targetAmount),
|
|
152
|
+
targetDate: new Date(W.targetDate).toISOString(),
|
|
153
|
+
monthlyContribution: Number(W.monthlyContribution) || 0,
|
|
154
|
+
priority: Number(W.priority) || 1,
|
|
155
|
+
currency: W.currency.trim() || "USD",
|
|
156
|
+
notes: W.notes.trim() || null,
|
|
157
|
+
tags: R.tags
|
|
158
|
+
};
|
|
159
|
+
O.mutate({
|
|
160
|
+
id: R.id,
|
|
161
|
+
input: e
|
|
162
|
+
}, { onSuccess: () => {
|
|
163
|
+
g(), _(i("brainyrich.goals.saved", "Goal saved")), z(null);
|
|
164
|
+
} });
|
|
165
|
+
}, ze = () => ie ? /* @__PURE__ */ N(ce, { rows: 4 }) : m ? /* @__PURE__ */ N(se, {
|
|
166
|
+
title: i("brainyrich.goals.error.title", "Could not load goals"),
|
|
167
|
+
description: i("brainyrich.goals.error.description", "We could not reach the goals service. Please try again."),
|
|
168
|
+
onRetry: () => ue()
|
|
169
|
+
}) : s.length === 0 ? /* @__PURE__ */ N(oe, {
|
|
170
|
+
icon: /* @__PURE__ */ N(E, {
|
|
171
|
+
className: "size-6",
|
|
172
|
+
"aria-hidden": "true"
|
|
173
|
+
}),
|
|
174
|
+
title: i("brainyrich.goals.empty.title", "No financial goals yet"),
|
|
175
|
+
description: i("brainyrich.goals.empty.description", "Create your first goal to start tracking progress toward a milestone."),
|
|
176
|
+
action: /* @__PURE__ */ P(I, {
|
|
177
|
+
size: "sm",
|
|
178
|
+
onClick: Y,
|
|
179
|
+
children: [/* @__PURE__ */ N(be, {
|
|
180
|
+
className: "size-4",
|
|
181
|
+
"aria-hidden": "true"
|
|
182
|
+
}), i("brainyrich.goals.actions.createGoal", "New goal")]
|
|
183
|
+
})
|
|
184
|
+
}) : /* @__PURE__ */ P(M, { children: [
|
|
185
|
+
/* @__PURE__ */ P("div", {
|
|
186
|
+
className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-4",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ N(d, {
|
|
189
|
+
index: 0,
|
|
190
|
+
children: /* @__PURE__ */ N(f, {
|
|
191
|
+
glow: !0,
|
|
192
|
+
icon: /* @__PURE__ */ N(E, {
|
|
158
193
|
className: "size-4",
|
|
159
194
|
"aria-hidden": "true"
|
|
160
|
-
}),
|
|
195
|
+
}),
|
|
196
|
+
label: i("brainyrich.goals.metrics.activeGoals", "Goals"),
|
|
197
|
+
value: String(s.length)
|
|
161
198
|
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
className: "
|
|
224
|
-
children: /* @__PURE__ */
|
|
225
|
-
|
|
226
|
-
children:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}),
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
/* @__PURE__ */ M(R, {
|
|
269
|
-
onSelect: () => Y(e),
|
|
270
|
-
children: [/* @__PURE__ */ j(_e, {
|
|
271
|
-
className: "size-4",
|
|
272
|
-
"aria-hidden": "true"
|
|
273
|
-
}), i("brainyrich.goals.actions.editGoal", "Edit goal")]
|
|
274
|
-
}),
|
|
275
|
-
/* @__PURE__ */ j(we, {}),
|
|
276
|
-
/* @__PURE__ */ M(R, {
|
|
277
|
-
className: "text-status-error-text focus:text-status-error-text",
|
|
278
|
-
onSelect: () => U(e),
|
|
279
|
-
children: [/* @__PURE__ */ j(ve, {
|
|
280
|
-
className: "size-4",
|
|
281
|
-
"aria-hidden": "true"
|
|
282
|
-
}), i("brainyrich.goals.actions.archive", "Archive goal")]
|
|
283
|
-
})
|
|
284
|
-
]
|
|
285
|
-
})] })]
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ N(d, {
|
|
201
|
+
index: 1,
|
|
202
|
+
children: /* @__PURE__ */ N(f, {
|
|
203
|
+
icon: /* @__PURE__ */ N(T, {
|
|
204
|
+
className: "size-4",
|
|
205
|
+
"aria-hidden": "true"
|
|
206
|
+
}),
|
|
207
|
+
label: i("brainyrich.goals.metrics.totalTarget", "Total target"),
|
|
208
|
+
value: h(q.totalTarget, J)
|
|
209
|
+
})
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ N(d, {
|
|
212
|
+
index: 2,
|
|
213
|
+
children: /* @__PURE__ */ N(f, {
|
|
214
|
+
icon: /* @__PURE__ */ N(ge, {
|
|
215
|
+
className: "size-4",
|
|
216
|
+
"aria-hidden": "true"
|
|
217
|
+
}),
|
|
218
|
+
label: i("brainyrich.goals.metrics.monthly", "Monthly contributions"),
|
|
219
|
+
value: h(q.totalMonthly, J)
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ N(d, {
|
|
223
|
+
index: 3,
|
|
224
|
+
children: /* @__PURE__ */ N(f, {
|
|
225
|
+
icon: /* @__PURE__ */ N(w, {
|
|
226
|
+
className: "size-4",
|
|
227
|
+
"aria-hidden": "true"
|
|
228
|
+
}),
|
|
229
|
+
label: i("brainyrich.goals.metrics.atRisk", "Needs attention"),
|
|
230
|
+
value: String(q.atRisk),
|
|
231
|
+
className: q.atRisk > 0 ? "ring-1 ring-status-error-text/30" : void 0
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ N("div", {
|
|
237
|
+
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
238
|
+
children: s.map((e, t) => {
|
|
239
|
+
let n = Ge(e.projection), r = n.icon, a = pe(e.status, e.projection), o = fe(e);
|
|
240
|
+
return /* @__PURE__ */ N(d, {
|
|
241
|
+
index: t,
|
|
242
|
+
children: /* @__PURE__ */ P(we, {
|
|
243
|
+
className: `group flex h-full flex-col transition-shadow motion-safe:hover:shadow-[var(--shadow-pop-hover,var(--shadow-elevation-2))] ${e.status === "ACHIEVED" ? "ring-1 ring-status-success-text/30" : ""}`,
|
|
244
|
+
children: [/* @__PURE__ */ N(De, {
|
|
245
|
+
className: "pb-3",
|
|
246
|
+
children: /* @__PURE__ */ P("div", {
|
|
247
|
+
className: "flex items-start justify-between gap-2",
|
|
248
|
+
children: [/* @__PURE__ */ P("div", {
|
|
249
|
+
className: "min-w-0",
|
|
250
|
+
children: [/* @__PURE__ */ P(Oe, {
|
|
251
|
+
className: "flex items-center gap-2 text-base",
|
|
252
|
+
children: [/* @__PURE__ */ N(E, {
|
|
253
|
+
className: "size-4 shrink-0 text-text-secondary",
|
|
254
|
+
"aria-hidden": "true"
|
|
255
|
+
}), /* @__PURE__ */ N("span", {
|
|
256
|
+
className: "truncate",
|
|
257
|
+
children: e.name
|
|
258
|
+
})]
|
|
259
|
+
}), /* @__PURE__ */ P(Ee, {
|
|
260
|
+
className: "mt-1 flex flex-wrap items-center gap-2",
|
|
261
|
+
children: [/* @__PURE__ */ N(F, {
|
|
262
|
+
variant: "outline",
|
|
263
|
+
children: $(e.type)
|
|
264
|
+
}), /* @__PURE__ */ N(F, {
|
|
265
|
+
variant: de(e.status),
|
|
266
|
+
children: $(e.status)
|
|
267
|
+
})]
|
|
268
|
+
})]
|
|
269
|
+
}), /* @__PURE__ */ P(ke, { children: [/* @__PURE__ */ N(Me, {
|
|
270
|
+
asChild: !0,
|
|
271
|
+
children: /* @__PURE__ */ N(I, {
|
|
272
|
+
variant: "ghost",
|
|
273
|
+
size: "icon",
|
|
274
|
+
"aria-label": i("brainyrich.goals.actions.menu", "Goal actions"),
|
|
275
|
+
children: /* @__PURE__ */ N(ye, {
|
|
276
|
+
className: "size-4",
|
|
277
|
+
"aria-hidden": "true"
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
}), /* @__PURE__ */ P(Ae, {
|
|
281
|
+
align: "end",
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ P(L, {
|
|
284
|
+
onSelect: () => V(e.id),
|
|
285
|
+
children: [/* @__PURE__ */ N(ve, {
|
|
286
|
+
className: "size-4",
|
|
287
|
+
"aria-hidden": "true"
|
|
288
|
+
}), i("brainyrich.goals.actions.manageFunding", "Manage funding")]
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ P(L, {
|
|
291
|
+
onSelect: () => Ie(e),
|
|
292
|
+
children: [/* @__PURE__ */ N(xe, {
|
|
293
|
+
className: "size-4",
|
|
294
|
+
"aria-hidden": "true"
|
|
295
|
+
}), i("brainyrich.goals.actions.editGoal", "Edit goal")]
|
|
296
|
+
}),
|
|
297
|
+
/* @__PURE__ */ N(je, {}),
|
|
298
|
+
/* @__PURE__ */ P(L, {
|
|
299
|
+
className: "text-status-error-text focus:text-status-error-text",
|
|
300
|
+
onSelect: () => U(e),
|
|
301
|
+
children: [/* @__PURE__ */ N(D, {
|
|
302
|
+
className: "size-4",
|
|
303
|
+
"aria-hidden": "true"
|
|
304
|
+
}), i("brainyrich.goals.actions.archive", "Archive goal")]
|
|
286
305
|
})
|
|
287
|
-
|
|
288
|
-
|
|
306
|
+
]
|
|
307
|
+
})] })]
|
|
308
|
+
})
|
|
309
|
+
}), /* @__PURE__ */ P(Te, {
|
|
310
|
+
className: "flex flex-1 flex-col gap-4",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ P("div", {
|
|
313
|
+
className: "flex items-center gap-4",
|
|
314
|
+
children: [/* @__PURE__ */ N(ae, {
|
|
315
|
+
value: o,
|
|
316
|
+
tone: a,
|
|
317
|
+
size: 92,
|
|
318
|
+
strokeWidth: 9,
|
|
319
|
+
label: i("brainyrich.goals.card.funded", "funded")
|
|
320
|
+
}), /* @__PURE__ */ P("div", {
|
|
321
|
+
className: "min-w-0 flex-1",
|
|
289
322
|
children: [
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
className: "
|
|
292
|
-
children:
|
|
293
|
-
value: o,
|
|
294
|
-
tone: a,
|
|
295
|
-
size: 92,
|
|
296
|
-
strokeWidth: 9,
|
|
297
|
-
label: i("brainyrich.goals.card.funded", "funded")
|
|
298
|
-
}), /* @__PURE__ */ M("div", {
|
|
299
|
-
className: "min-w-0 flex-1",
|
|
300
|
-
children: [
|
|
301
|
-
/* @__PURE__ */ j("p", {
|
|
302
|
-
className: "text-xs text-text-secondary",
|
|
303
|
-
children: i("brainyrich.goals.card.target", "Target amount")
|
|
304
|
-
}),
|
|
305
|
-
/* @__PURE__ */ j("p", {
|
|
306
|
-
className: "truncate text-2xl font-semibold text-text-primary",
|
|
307
|
-
children: m(e.targetAmount, e.currency)
|
|
308
|
-
}),
|
|
309
|
-
/* @__PURE__ */ M("span", {
|
|
310
|
-
className: `mt-1 inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium ${n.tone}`,
|
|
311
|
-
children: [/* @__PURE__ */ j(r, {
|
|
312
|
-
className: "size-3.5",
|
|
313
|
-
"aria-hidden": "true"
|
|
314
|
-
}), $(e.projection)]
|
|
315
|
-
})
|
|
316
|
-
]
|
|
317
|
-
})]
|
|
323
|
+
/* @__PURE__ */ N("p", {
|
|
324
|
+
className: "text-xs text-text-secondary",
|
|
325
|
+
children: i("brainyrich.goals.card.target", "Target amount")
|
|
318
326
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
className: "
|
|
321
|
-
children:
|
|
322
|
-
/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("dt", {
|
|
323
|
-
className: "text-xs text-text-secondary",
|
|
324
|
-
children: i("brainyrich.goals.card.targetDate", "Target date")
|
|
325
|
-
}), /* @__PURE__ */ M("dd", {
|
|
326
|
-
className: "flex items-center gap-1 font-medium text-text-primary",
|
|
327
|
-
children: [/* @__PURE__ */ j(fe, {
|
|
328
|
-
className: "size-3.5 text-text-secondary",
|
|
329
|
-
"aria-hidden": "true"
|
|
330
|
-
}), ue(e.targetDate)]
|
|
331
|
-
})] }),
|
|
332
|
-
/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("dt", {
|
|
333
|
-
className: "text-xs text-text-secondary",
|
|
334
|
-
children: i("brainyrich.goals.card.monthly", "Monthly")
|
|
335
|
-
}), /* @__PURE__ */ j("dd", {
|
|
336
|
-
className: "font-medium text-text-primary",
|
|
337
|
-
children: m(e.monthlyContribution, e.currency)
|
|
338
|
-
})] }),
|
|
339
|
-
/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("dt", {
|
|
340
|
-
className: "text-xs text-text-secondary",
|
|
341
|
-
children: i("brainyrich.goals.card.priority", "Priority")
|
|
342
|
-
}), /* @__PURE__ */ j("dd", {
|
|
343
|
-
className: "font-medium text-text-primary",
|
|
344
|
-
children: e.priority
|
|
345
|
-
})] }),
|
|
346
|
-
/* @__PURE__ */ M("div", { children: [/* @__PURE__ */ j("dt", {
|
|
347
|
-
className: "text-xs text-text-secondary",
|
|
348
|
-
children: i("brainyrich.goals.card.fundings", "Funding links")
|
|
349
|
-
}), /* @__PURE__ */ j("dd", {
|
|
350
|
-
className: "font-medium text-text-primary",
|
|
351
|
-
children: e.fundings?.length ?? 0
|
|
352
|
-
})] })
|
|
353
|
-
]
|
|
327
|
+
/* @__PURE__ */ N("p", {
|
|
328
|
+
className: "truncate text-2xl font-semibold text-text-primary",
|
|
329
|
+
children: h(e.targetAmount, e.currency)
|
|
354
330
|
}),
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
className:
|
|
357
|
-
children: /* @__PURE__ */
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
onClick: () => V(e.id),
|
|
362
|
-
children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
|
|
363
|
-
})
|
|
331
|
+
/* @__PURE__ */ P("span", {
|
|
332
|
+
className: `mt-1 inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium ${n.tone}`,
|
|
333
|
+
children: [/* @__PURE__ */ N(r, {
|
|
334
|
+
className: "size-3.5",
|
|
335
|
+
"aria-hidden": "true"
|
|
336
|
+
}), $(e.projection)]
|
|
364
337
|
})
|
|
365
338
|
]
|
|
366
339
|
})]
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ P("dl", {
|
|
342
|
+
className: "grid grid-cols-2 gap-3 rounded-lg bg-bg-sunken p-3 text-sm",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", {
|
|
345
|
+
className: "text-xs text-text-secondary",
|
|
346
|
+
children: i("brainyrich.goals.card.targetDate", "Target date")
|
|
347
|
+
}), /* @__PURE__ */ P("dd", {
|
|
348
|
+
className: "flex items-center gap-1 font-medium text-text-primary",
|
|
349
|
+
children: [/* @__PURE__ */ N(he, {
|
|
350
|
+
className: "size-3.5 text-text-secondary",
|
|
351
|
+
"aria-hidden": "true"
|
|
352
|
+
}), le(e.targetDate)]
|
|
353
|
+
})] }),
|
|
354
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", {
|
|
355
|
+
className: "text-xs text-text-secondary",
|
|
356
|
+
children: i("brainyrich.goals.card.monthly", "Monthly")
|
|
357
|
+
}), /* @__PURE__ */ N("dd", {
|
|
358
|
+
className: "font-medium text-text-primary",
|
|
359
|
+
children: h(e.monthlyContribution, e.currency)
|
|
360
|
+
})] }),
|
|
361
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", {
|
|
362
|
+
className: "text-xs text-text-secondary",
|
|
363
|
+
children: i("brainyrich.goals.card.priority", "Priority")
|
|
364
|
+
}), /* @__PURE__ */ N("dd", {
|
|
365
|
+
className: "font-medium text-text-primary",
|
|
366
|
+
children: e.priority
|
|
367
|
+
})] }),
|
|
368
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", {
|
|
369
|
+
className: "text-xs text-text-secondary",
|
|
370
|
+
children: i("brainyrich.goals.card.fundings", "Funding links")
|
|
371
|
+
}), /* @__PURE__ */ N("dd", {
|
|
372
|
+
className: "font-medium text-text-primary",
|
|
373
|
+
children: e.fundings?.length ?? 0
|
|
374
|
+
})] })
|
|
375
|
+
]
|
|
376
|
+
}),
|
|
377
|
+
/* @__PURE__ */ N("div", {
|
|
378
|
+
className: "mt-auto",
|
|
379
|
+
children: /* @__PURE__ */ N(I, {
|
|
380
|
+
variant: "outline",
|
|
381
|
+
size: "sm",
|
|
382
|
+
className: "w-full",
|
|
383
|
+
onClick: () => V(e.id),
|
|
384
|
+
children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
|
|
385
|
+
})
|
|
367
386
|
})
|
|
368
|
-
|
|
369
|
-
})
|
|
370
|
-
}),
|
|
371
|
-
/* @__PURE__ */ j(te, {
|
|
372
|
-
hasMore: s,
|
|
373
|
-
loading: u,
|
|
374
|
-
onClick: l,
|
|
375
|
-
label: i("brainyrich.goals.actions.loadMore", "Load more goals"),
|
|
376
|
-
loadingLabel: i("brainyrich.goals.actions.loadingMore", "Loading…")
|
|
387
|
+
]
|
|
388
|
+
})]
|
|
377
389
|
})
|
|
378
|
-
|
|
379
|
-
}),
|
|
380
|
-
/* @__PURE__ */ j(Ye, {
|
|
381
|
-
open: ye,
|
|
382
|
-
mode: "create",
|
|
383
|
-
form: W,
|
|
384
|
-
setField: Ee,
|
|
385
|
-
households: h.map((e) => ({
|
|
386
|
-
id: e.id,
|
|
387
|
-
name: e.name
|
|
388
|
-
})),
|
|
389
|
-
valid: X,
|
|
390
|
-
pending: y.isPending,
|
|
391
|
-
onSubmit: () => {
|
|
392
|
-
if (!X) return;
|
|
393
|
-
let e = {
|
|
394
|
-
name: W.name.trim(),
|
|
395
|
-
type: W.type,
|
|
396
|
-
targetAmount: Number(W.targetAmount),
|
|
397
|
-
targetDate: new Date(W.targetDate).toISOString(),
|
|
398
|
-
monthlyContribution: Number(W.monthlyContribution) || 0,
|
|
399
|
-
priority: Number(W.priority) || 1,
|
|
400
|
-
currency: W.currency.trim() || "USD",
|
|
401
|
-
notes: W.notes.trim() || null,
|
|
402
|
-
tags: [],
|
|
403
|
-
...W.householdId ? { householdId: W.householdId } : {}
|
|
404
|
-
};
|
|
405
|
-
y.mutate(e, { onSuccess: () => {
|
|
406
|
-
g(), _(i("brainyrich.goals.created", "Goal created")), D(!1);
|
|
407
|
-
} });
|
|
408
|
-
},
|
|
409
|
-
onOpenChange: (e) => D(e),
|
|
410
|
-
translate: i
|
|
411
|
-
}),
|
|
412
|
-
/* @__PURE__ */ j(Ye, {
|
|
413
|
-
open: !!O,
|
|
414
|
-
mode: "edit",
|
|
415
|
-
goalId: O?.id,
|
|
416
|
-
form: W,
|
|
417
|
-
setField: Ee,
|
|
418
|
-
households: h.map((e) => ({
|
|
419
|
-
id: e.id,
|
|
420
|
-
name: e.name
|
|
421
|
-
})),
|
|
422
|
-
valid: X,
|
|
423
|
-
pending: me.isPending,
|
|
424
|
-
onSubmit: () => {
|
|
425
|
-
if (!O || !X) return;
|
|
426
|
-
let e = {
|
|
427
|
-
name: W.name.trim(),
|
|
428
|
-
type: W.type,
|
|
429
|
-
status: W.status,
|
|
430
|
-
targetAmount: Number(W.targetAmount),
|
|
431
|
-
targetDate: new Date(W.targetDate).toISOString(),
|
|
432
|
-
monthlyContribution: Number(W.monthlyContribution) || 0,
|
|
433
|
-
priority: Number(W.priority) || 1,
|
|
434
|
-
currency: W.currency.trim() || "USD",
|
|
435
|
-
notes: W.notes.trim() || null,
|
|
436
|
-
tags: O.tags
|
|
437
|
-
};
|
|
438
|
-
me.mutate({
|
|
439
|
-
id: O.id,
|
|
440
|
-
input: e
|
|
441
|
-
}, { onSuccess: () => {
|
|
442
|
-
g(), _(i("brainyrich.goals.saved", "Goal saved")), z(null);
|
|
443
|
-
} });
|
|
444
|
-
},
|
|
445
|
-
onOpenChange: (e) => {
|
|
446
|
-
e || z(null);
|
|
447
|
-
},
|
|
448
|
-
translate: i
|
|
449
|
-
}),
|
|
450
|
-
/* @__PURE__ */ j(Xe, {
|
|
451
|
-
goalId: B,
|
|
452
|
-
onClose: () => V(null),
|
|
453
|
-
translate: i
|
|
454
|
-
}),
|
|
455
|
-
/* @__PURE__ */ j(ne, {
|
|
456
|
-
open: !!H,
|
|
457
|
-
onOpenChange: (e) => {
|
|
458
|
-
e || U(null);
|
|
459
|
-
},
|
|
460
|
-
title: i("brainyrich.goals.archive.title", "Archive goal?"),
|
|
461
|
-
description: i("brainyrich.goals.archive.description", "This removes “{name}” from your active goals. You can no longer track its progress.", { name: H?.name ?? "" }),
|
|
462
|
-
confirmLabel: i("brainyrich.goals.archive.confirm", "Archive goal"),
|
|
463
|
-
pendingLabel: i("brainyrich.goals.archive.pending", "Archiving…"),
|
|
464
|
-
destructive: !0,
|
|
465
|
-
pending: E.isPending,
|
|
466
|
-
onConfirm: () => {
|
|
467
|
-
H && E.mutate(H.id, { onSuccess: () => {
|
|
468
|
-
g(), _(i("brainyrich.goals.archived", "Goal archived", { name: H.name })), U(null);
|
|
469
|
-
} });
|
|
470
|
-
}
|
|
390
|
+
}, e.id);
|
|
471
391
|
})
|
|
472
|
-
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ N(te, {
|
|
394
|
+
hasMore: l,
|
|
395
|
+
loading: re,
|
|
396
|
+
onClick: u,
|
|
397
|
+
label: i("brainyrich.goals.actions.loadMore", "Load more goals"),
|
|
398
|
+
loadingLabel: i("brainyrich.goals.actions.loadingMore", "Loading…")
|
|
399
|
+
})
|
|
400
|
+
] }), Z = /* @__PURE__ */ P(M, { children: [
|
|
401
|
+
/* @__PURE__ */ N(Qe, {
|
|
402
|
+
open: Se,
|
|
403
|
+
mode: "create",
|
|
404
|
+
form: W,
|
|
405
|
+
setField: K,
|
|
406
|
+
households: x.map((e) => ({
|
|
407
|
+
id: e.id,
|
|
408
|
+
name: e.name
|
|
409
|
+
})),
|
|
410
|
+
valid: X,
|
|
411
|
+
pending: _e.isPending,
|
|
412
|
+
onSubmit: Le,
|
|
413
|
+
onOpenChange: (e) => A(e),
|
|
414
|
+
translate: i
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ N(Qe, {
|
|
417
|
+
open: !!R,
|
|
418
|
+
mode: "edit",
|
|
419
|
+
goalId: R?.id,
|
|
420
|
+
form: W,
|
|
421
|
+
setField: K,
|
|
422
|
+
households: x.map((e) => ({
|
|
423
|
+
id: e.id,
|
|
424
|
+
name: e.name
|
|
425
|
+
})),
|
|
426
|
+
valid: X,
|
|
427
|
+
pending: O.isPending,
|
|
428
|
+
onSubmit: Re,
|
|
429
|
+
onOpenChange: (e) => {
|
|
430
|
+
e || z(null);
|
|
431
|
+
},
|
|
432
|
+
translate: i
|
|
433
|
+
}),
|
|
434
|
+
/* @__PURE__ */ N($e, {
|
|
435
|
+
goalId: Pe,
|
|
436
|
+
onClose: Fe,
|
|
437
|
+
translate: i
|
|
438
|
+
}),
|
|
439
|
+
/* @__PURE__ */ N(ne, {
|
|
440
|
+
open: !!H,
|
|
441
|
+
onOpenChange: (e) => {
|
|
442
|
+
e || U(null);
|
|
443
|
+
},
|
|
444
|
+
title: i("brainyrich.goals.archive.title", "Archive goal?"),
|
|
445
|
+
description: i("brainyrich.goals.archive.description", "This removes “{name}” from your active goals. You can no longer track its progress.", { name: H?.name ?? "" }),
|
|
446
|
+
confirmLabel: i("brainyrich.goals.archive.confirm", "Archive goal"),
|
|
447
|
+
pendingLabel: i("brainyrich.goals.archive.pending", "Archiving…"),
|
|
448
|
+
destructive: !0,
|
|
449
|
+
pending: k.isPending,
|
|
450
|
+
onConfirm: () => {
|
|
451
|
+
H && k.mutate(H.id, { onSuccess: () => {
|
|
452
|
+
g(), _(i("brainyrich.goals.archived", "Goal archived", { name: H.name })), U(null);
|
|
453
|
+
} });
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
] });
|
|
457
|
+
return a ? /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(S, {
|
|
458
|
+
translate: i,
|
|
459
|
+
goals: s,
|
|
460
|
+
isLoading: ie,
|
|
461
|
+
isError: m,
|
|
462
|
+
refetch: () => ue(),
|
|
463
|
+
hasMore: l,
|
|
464
|
+
loadMore: u,
|
|
465
|
+
isFetchingNextPage: re,
|
|
466
|
+
totals: q,
|
|
467
|
+
currency: J,
|
|
468
|
+
onCreate: Y,
|
|
469
|
+
onOpen: (e) => V(e.id),
|
|
470
|
+
onEdit: Ie,
|
|
471
|
+
onArchive: U
|
|
472
|
+
}), Z] }) : /* @__PURE__ */ P("div", {
|
|
473
|
+
"data-tour": "brainyrich-page-goals",
|
|
474
|
+
className: "contents",
|
|
475
|
+
children: [/* @__PURE__ */ N(p, {
|
|
476
|
+
title: i("brainyrich.goals.title", "Financial Goals"),
|
|
477
|
+
description: i("brainyrich.goals.description", "Track progress toward your wealth milestones and life objectives"),
|
|
478
|
+
actionLabel: i("brainyrich.goals.actions.createGoal", "New goal"),
|
|
479
|
+
onAction: Y,
|
|
480
|
+
children: ze()
|
|
481
|
+
}), Z]
|
|
473
482
|
});
|
|
474
483
|
}
|
|
475
|
-
function
|
|
476
|
-
return /* @__PURE__ */
|
|
484
|
+
function Qe({ open: e, mode: t, goalId: n, form: r, setField: i, households: a, valid: o, pending: s, onSubmit: c, onOpenChange: l, translate: u }) {
|
|
485
|
+
return /* @__PURE__ */ N(B, {
|
|
477
486
|
open: e,
|
|
478
487
|
onOpenChange: l,
|
|
479
|
-
children: /* @__PURE__ */
|
|
488
|
+
children: /* @__PURE__ */ P(Ne, {
|
|
480
489
|
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
490
|
+
children: [/* @__PURE__ */ P(Fe, { children: [/* @__PURE__ */ N(H, { children: t === "create" ? u("brainyrich.goals.form.createTitle", "New goal") : u("brainyrich.goals.form.editTitle", "Edit goal") }), /* @__PURE__ */ N(Pe, { children: u("brainyrich.goals.form.subtitle", "Define the milestone, target and contribution plan.") })] }), /* @__PURE__ */ P("form", {
|
|
482
491
|
className: "space-y-4",
|
|
483
492
|
onSubmit: (e) => {
|
|
484
493
|
e.preventDefault(), c();
|
|
485
494
|
},
|
|
486
495
|
children: [
|
|
487
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ P("div", {
|
|
488
497
|
className: "space-y-1.5",
|
|
489
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ N(z, {
|
|
490
499
|
htmlFor: "goal-name",
|
|
491
500
|
children: u("brainyrich.goals.form.name", "Name")
|
|
492
|
-
}), /* @__PURE__ */
|
|
501
|
+
}), /* @__PURE__ */ N(R, {
|
|
493
502
|
id: "goal-name",
|
|
494
503
|
value: r.name,
|
|
495
504
|
onChange: (e) => i("name", e.target.value),
|
|
@@ -497,46 +506,46 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
497
506
|
required: !0
|
|
498
507
|
})]
|
|
499
508
|
}),
|
|
500
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ P("div", {
|
|
501
510
|
className: "grid grid-cols-2 gap-3",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
511
|
+
children: [/* @__PURE__ */ P("div", {
|
|
503
512
|
className: "space-y-1.5",
|
|
504
|
-
children: [/* @__PURE__ */
|
|
513
|
+
children: [/* @__PURE__ */ N(z, {
|
|
505
514
|
htmlFor: "goal-type",
|
|
506
515
|
children: u("brainyrich.goals.form.type", "Type")
|
|
507
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ P(U, {
|
|
508
517
|
value: r.type,
|
|
509
518
|
onValueChange: (e) => i("type", e),
|
|
510
|
-
children: [/* @__PURE__ */
|
|
519
|
+
children: [/* @__PURE__ */ N(K, {
|
|
511
520
|
id: "goal-type",
|
|
512
|
-
children: /* @__PURE__ */
|
|
513
|
-
}), /* @__PURE__ */
|
|
521
|
+
children: /* @__PURE__ */ N(q, {})
|
|
522
|
+
}), /* @__PURE__ */ N(W, { children: Ue.map((e) => /* @__PURE__ */ N(G, {
|
|
514
523
|
value: e,
|
|
515
524
|
children: $(e)
|
|
516
525
|
}, e)) })]
|
|
517
526
|
})]
|
|
518
|
-
}), t === "edit" ? /* @__PURE__ */
|
|
527
|
+
}), t === "edit" ? /* @__PURE__ */ P("div", {
|
|
519
528
|
className: "space-y-1.5",
|
|
520
|
-
children: [/* @__PURE__ */
|
|
529
|
+
children: [/* @__PURE__ */ N(z, {
|
|
521
530
|
htmlFor: "goal-status",
|
|
522
531
|
children: u("brainyrich.goals.form.status", "Status")
|
|
523
|
-
}), /* @__PURE__ */
|
|
532
|
+
}), /* @__PURE__ */ P(U, {
|
|
524
533
|
value: r.status,
|
|
525
534
|
onValueChange: (e) => i("status", e),
|
|
526
|
-
children: [/* @__PURE__ */
|
|
535
|
+
children: [/* @__PURE__ */ N(K, {
|
|
527
536
|
id: "goal-status",
|
|
528
|
-
children: /* @__PURE__ */
|
|
529
|
-
}), /* @__PURE__ */
|
|
537
|
+
children: /* @__PURE__ */ N(q, {})
|
|
538
|
+
}), /* @__PURE__ */ N(W, { children: We.map((e) => /* @__PURE__ */ N(G, {
|
|
530
539
|
value: e,
|
|
531
540
|
children: $(e)
|
|
532
541
|
}, e)) })]
|
|
533
542
|
})]
|
|
534
|
-
}) : /* @__PURE__ */
|
|
543
|
+
}) : /* @__PURE__ */ P("div", {
|
|
535
544
|
className: "space-y-1.5",
|
|
536
|
-
children: [/* @__PURE__ */
|
|
545
|
+
children: [/* @__PURE__ */ N(z, {
|
|
537
546
|
htmlFor: "goal-priority",
|
|
538
547
|
children: u("brainyrich.goals.form.priority", "Priority")
|
|
539
|
-
}), /* @__PURE__ */
|
|
548
|
+
}), /* @__PURE__ */ N(R, {
|
|
540
549
|
id: "goal-priority",
|
|
541
550
|
type: "number",
|
|
542
551
|
min: 1,
|
|
@@ -545,14 +554,14 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
545
554
|
})]
|
|
546
555
|
})]
|
|
547
556
|
}),
|
|
548
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ P("div", {
|
|
549
558
|
className: "grid grid-cols-2 gap-3",
|
|
550
|
-
children: [/* @__PURE__ */
|
|
559
|
+
children: [/* @__PURE__ */ P("div", {
|
|
551
560
|
className: "space-y-1.5",
|
|
552
|
-
children: [/* @__PURE__ */
|
|
561
|
+
children: [/* @__PURE__ */ N(z, {
|
|
553
562
|
htmlFor: "goal-target",
|
|
554
563
|
children: u("brainyrich.goals.form.targetAmount", "Target amount")
|
|
555
|
-
}), /* @__PURE__ */
|
|
564
|
+
}), /* @__PURE__ */ N(R, {
|
|
556
565
|
id: "goal-target",
|
|
557
566
|
type: "number",
|
|
558
567
|
min: 0,
|
|
@@ -561,12 +570,12 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
561
570
|
onChange: (e) => i("targetAmount", e.target.value),
|
|
562
571
|
required: !0
|
|
563
572
|
})]
|
|
564
|
-
}), /* @__PURE__ */
|
|
573
|
+
}), /* @__PURE__ */ P("div", {
|
|
565
574
|
className: "space-y-1.5",
|
|
566
|
-
children: [/* @__PURE__ */
|
|
575
|
+
children: [/* @__PURE__ */ N(z, {
|
|
567
576
|
htmlFor: "goal-date",
|
|
568
577
|
children: u("brainyrich.goals.form.targetDate", "Target date")
|
|
569
|
-
}), /* @__PURE__ */
|
|
578
|
+
}), /* @__PURE__ */ N(R, {
|
|
570
579
|
id: "goal-date",
|
|
571
580
|
type: "date",
|
|
572
581
|
value: r.targetDate,
|
|
@@ -575,14 +584,14 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
575
584
|
})]
|
|
576
585
|
})]
|
|
577
586
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ P("div", {
|
|
579
588
|
className: "grid grid-cols-2 gap-3",
|
|
580
|
-
children: [/* @__PURE__ */
|
|
589
|
+
children: [/* @__PURE__ */ P("div", {
|
|
581
590
|
className: "space-y-1.5",
|
|
582
|
-
children: [/* @__PURE__ */
|
|
591
|
+
children: [/* @__PURE__ */ N(z, {
|
|
583
592
|
htmlFor: "goal-monthly",
|
|
584
593
|
children: u("brainyrich.goals.form.monthly", "Monthly contribution")
|
|
585
|
-
}), /* @__PURE__ */
|
|
594
|
+
}), /* @__PURE__ */ N(R, {
|
|
586
595
|
id: "goal-monthly",
|
|
587
596
|
type: "number",
|
|
588
597
|
min: 0,
|
|
@@ -590,12 +599,12 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
590
599
|
value: r.monthlyContribution,
|
|
591
600
|
onChange: (e) => i("monthlyContribution", e.target.value)
|
|
592
601
|
})]
|
|
593
|
-
}), /* @__PURE__ */
|
|
602
|
+
}), /* @__PURE__ */ P("div", {
|
|
594
603
|
className: "space-y-1.5",
|
|
595
|
-
children: [/* @__PURE__ */
|
|
604
|
+
children: [/* @__PURE__ */ N(z, {
|
|
596
605
|
htmlFor: "goal-currency",
|
|
597
606
|
children: u("brainyrich.goals.form.currency", "Currency")
|
|
598
|
-
}), /* @__PURE__ */
|
|
607
|
+
}), /* @__PURE__ */ N(R, {
|
|
599
608
|
id: "goal-currency",
|
|
600
609
|
value: r.currency,
|
|
601
610
|
onChange: (e) => i("currency", e.target.value.toUpperCase()),
|
|
@@ -603,12 +612,12 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
603
612
|
})]
|
|
604
613
|
})]
|
|
605
614
|
}),
|
|
606
|
-
t === "edit" ? /* @__PURE__ */
|
|
615
|
+
t === "edit" ? /* @__PURE__ */ P("div", {
|
|
607
616
|
className: "space-y-1.5",
|
|
608
|
-
children: [/* @__PURE__ */
|
|
617
|
+
children: [/* @__PURE__ */ N(z, {
|
|
609
618
|
htmlFor: "goal-priority-edit",
|
|
610
619
|
children: u("brainyrich.goals.form.priority", "Priority")
|
|
611
|
-
}), /* @__PURE__ */
|
|
620
|
+
}), /* @__PURE__ */ N(R, {
|
|
612
621
|
id: "goal-priority-edit",
|
|
613
622
|
type: "number",
|
|
614
623
|
min: 1,
|
|
@@ -616,56 +625,56 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
616
625
|
onChange: (e) => i("priority", e.target.value)
|
|
617
626
|
})]
|
|
618
627
|
}) : null,
|
|
619
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ P("div", {
|
|
620
629
|
className: "space-y-1.5",
|
|
621
|
-
children: [/* @__PURE__ */
|
|
630
|
+
children: [/* @__PURE__ */ N(z, {
|
|
622
631
|
htmlFor: "goal-household",
|
|
623
632
|
children: u("brainyrich.goals.form.household", "Household (optional)")
|
|
624
|
-
}), /* @__PURE__ */
|
|
625
|
-
value: r.householdId ||
|
|
626
|
-
onValueChange: (e) => i("householdId", e ===
|
|
627
|
-
children: [/* @__PURE__ */
|
|
633
|
+
}), /* @__PURE__ */ P(U, {
|
|
634
|
+
value: r.householdId || Xe,
|
|
635
|
+
onValueChange: (e) => i("householdId", e === Xe ? "" : e),
|
|
636
|
+
children: [/* @__PURE__ */ N(K, {
|
|
628
637
|
id: "goal-household",
|
|
629
|
-
children: /* @__PURE__ */
|
|
630
|
-
}), /* @__PURE__ */
|
|
631
|
-
value:
|
|
638
|
+
children: /* @__PURE__ */ N(q, { placeholder: u("brainyrich.goals.form.householdNone", "None") })
|
|
639
|
+
}), /* @__PURE__ */ P(W, { children: [/* @__PURE__ */ N(G, {
|
|
640
|
+
value: Xe,
|
|
632
641
|
children: u("brainyrich.goals.form.householdNone", "None")
|
|
633
|
-
}), a.map((e) => /* @__PURE__ */
|
|
642
|
+
}), a.map((e) => /* @__PURE__ */ N(G, {
|
|
634
643
|
value: e.id,
|
|
635
644
|
children: e.name
|
|
636
645
|
}, e.id))] })]
|
|
637
646
|
})]
|
|
638
647
|
}),
|
|
639
|
-
t === "edit" && n ? /* @__PURE__ */
|
|
648
|
+
t === "edit" && n ? /* @__PURE__ */ N(x, {
|
|
640
649
|
entityType: "brainyrich-goal",
|
|
641
650
|
entityId: n,
|
|
642
651
|
label: u("brainyrich.goals.form.tags", "Tags")
|
|
643
|
-
}) : /* @__PURE__ */
|
|
652
|
+
}) : /* @__PURE__ */ P("div", {
|
|
644
653
|
className: "space-y-1.5",
|
|
645
|
-
children: [/* @__PURE__ */
|
|
654
|
+
children: [/* @__PURE__ */ N(z, { children: u("brainyrich.goals.form.tags", "Tags") }), /* @__PURE__ */ N("p", {
|
|
646
655
|
className: "text-sm text-text-secondary",
|
|
647
656
|
children: u("brainyrich.goals.form.tagsAfterCreate", "You can add tags after creating the goal.")
|
|
648
657
|
})]
|
|
649
658
|
}),
|
|
650
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ P("div", {
|
|
651
660
|
className: "space-y-1.5",
|
|
652
|
-
children: [/* @__PURE__ */
|
|
661
|
+
children: [/* @__PURE__ */ N(z, {
|
|
653
662
|
htmlFor: "goal-notes",
|
|
654
663
|
children: u("brainyrich.goals.form.notes", "Notes")
|
|
655
|
-
}), /* @__PURE__ */
|
|
664
|
+
}), /* @__PURE__ */ N(He, {
|
|
656
665
|
id: "goal-notes",
|
|
657
666
|
value: r.notes,
|
|
658
667
|
onChange: (e) => i("notes", e.target.value),
|
|
659
668
|
rows: 3
|
|
660
669
|
})]
|
|
661
670
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ P(V, { children: [/* @__PURE__ */ N(I, {
|
|
663
672
|
type: "button",
|
|
664
673
|
variant: "outline",
|
|
665
674
|
onClick: () => l(!1),
|
|
666
675
|
disabled: s,
|
|
667
676
|
children: u("brainyrich.goals.form.cancel", "Cancel")
|
|
668
|
-
}), /* @__PURE__ */
|
|
677
|
+
}), /* @__PURE__ */ N(I, {
|
|
669
678
|
type: "submit",
|
|
670
679
|
disabled: !o || s,
|
|
671
680
|
children: s ? u("brainyrich.goals.form.saving", "Saving…") : t === "create" ? u("brainyrich.goals.form.create", "Create goal") : u("brainyrich.goals.form.save", "Save changes")
|
|
@@ -675,173 +684,173 @@ function Ye({ open: e, mode: t, goalId: n, form: r, setField: i, households: a,
|
|
|
675
684
|
})
|
|
676
685
|
});
|
|
677
686
|
}
|
|
678
|
-
function
|
|
679
|
-
let { data: o, isLoading: c, isError: ee, refetch: te } = i(e ?? void 0), { data: d } = a(e ?? void 0), { data: p } = t(), g = s(), _ = u(), v = l(), [
|
|
680
|
-
if (!e || !
|
|
687
|
+
function $e({ goalId: e, onClose: n, translate: r }) {
|
|
688
|
+
let { data: o, isLoading: c, isError: ee, refetch: te } = i(e ?? void 0), { data: d } = a(e ?? void 0), { data: p } = t(), g = s(), _ = u(), v = l(), [y, b] = C(""), [S, me] = C("PERCENT"), [w, ye] = C(""), [T, be] = C(""), [D, O] = C(null), k = d.reduce((e, t) => e + (t.fixedAmount ?? 0), 0), j = o?.currency ?? "USD", Ce = o ? fe(o) : 0, Ee = o ? pe(o.status, o.projection) : "brand", De = o ? Ke(k, o.monthlyContribution, o.targetDate) : [], Oe = (e) => p.find((t) => t.id === e)?.name ?? e, ke = () => {
|
|
689
|
+
if (!e || !y) return;
|
|
681
690
|
let t = Number(w);
|
|
682
691
|
!Number.isFinite(t) || t <= 0 || g.mutate({
|
|
683
692
|
goalId: e,
|
|
684
|
-
accountId:
|
|
685
|
-
...
|
|
693
|
+
accountId: y,
|
|
694
|
+
...S === "PERCENT" ? { allocationPct: t } : { fixedAmount: t }
|
|
686
695
|
}, { onSuccess: () => {
|
|
687
|
-
|
|
696
|
+
b(""), ye("");
|
|
688
697
|
} });
|
|
689
|
-
},
|
|
698
|
+
}, Ae = () => {
|
|
690
699
|
if (!e) return;
|
|
691
|
-
let t =
|
|
700
|
+
let t = T === "" ? k : Number(T);
|
|
692
701
|
Number.isFinite(t) && v.mutate({
|
|
693
702
|
id: e,
|
|
694
703
|
fundedAmount: t
|
|
695
704
|
});
|
|
696
|
-
},
|
|
697
|
-
return /* @__PURE__ */ M
|
|
705
|
+
}, L = !!y && Number(w) > 0, je = D ? D.fixedAmount == null ? Oe(D.accountId) : h(D.fixedAmount, j) : "";
|
|
706
|
+
return /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N(J, {
|
|
698
707
|
open: !!e,
|
|
699
708
|
onOpenChange: (e) => {
|
|
700
709
|
e || n();
|
|
701
710
|
},
|
|
702
|
-
children: /* @__PURE__ */
|
|
711
|
+
children: /* @__PURE__ */ P(Y, {
|
|
703
712
|
className: "flex w-full flex-col gap-0 overflow-y-auto sm:max-w-xl",
|
|
704
|
-
children: [/* @__PURE__ */
|
|
713
|
+
children: [/* @__PURE__ */ P(X, { children: [/* @__PURE__ */ N(Le, { children: o?.name ?? r("brainyrich.goals.detail.title", "Goal") }), /* @__PURE__ */ N(Ie, { children: r("brainyrich.goals.detail.subtitle", "Manage funding links and projection.") })] }), /* @__PURE__ */ N("div", {
|
|
705
714
|
className: "space-y-6 p-4",
|
|
706
|
-
children: c ? /* @__PURE__ */
|
|
715
|
+
children: c ? /* @__PURE__ */ N(ce, { rows: 3 }) : ee ? /* @__PURE__ */ N(se, {
|
|
707
716
|
title: r("brainyrich.goals.detail.error", "Could not load goal"),
|
|
708
717
|
onRetry: () => te()
|
|
709
|
-
}) : o ? /* @__PURE__ */ M
|
|
710
|
-
/* @__PURE__ */
|
|
718
|
+
}) : o ? /* @__PURE__ */ P(M, { children: [
|
|
719
|
+
/* @__PURE__ */ P(re, {
|
|
711
720
|
glow: !0,
|
|
712
721
|
className: "flex items-center gap-5",
|
|
713
|
-
children: [/* @__PURE__ */
|
|
714
|
-
value:
|
|
715
|
-
tone:
|
|
722
|
+
children: [/* @__PURE__ */ N(ae, {
|
|
723
|
+
value: Ce,
|
|
724
|
+
tone: Ee,
|
|
716
725
|
size: 116,
|
|
717
726
|
strokeWidth: 11,
|
|
718
727
|
label: r("brainyrich.goals.detail.funded", "funded")
|
|
719
|
-
}), /* @__PURE__ */
|
|
728
|
+
}), /* @__PURE__ */ P("div", {
|
|
720
729
|
className: "min-w-0 flex-1 space-y-1",
|
|
721
730
|
children: [
|
|
722
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ N(F, {
|
|
723
732
|
variant: de(o.projection),
|
|
724
733
|
children: $(o.projection)
|
|
725
734
|
}),
|
|
726
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ N("p", {
|
|
727
736
|
className: "text-2xl font-semibold text-text-primary",
|
|
728
|
-
children:
|
|
737
|
+
children: h(k, j)
|
|
729
738
|
}),
|
|
730
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ N("p", {
|
|
731
740
|
className: "text-xs text-text-secondary",
|
|
732
|
-
children: r("brainyrich.goals.detail.ofTarget", "of {target} target", { target:
|
|
741
|
+
children: r("brainyrich.goals.detail.ofTarget", "of {target} target", { target: m(o.targetAmount, j) })
|
|
733
742
|
})
|
|
734
743
|
]
|
|
735
744
|
})]
|
|
736
745
|
}),
|
|
737
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ P("div", {
|
|
738
747
|
className: "grid grid-cols-2 gap-3",
|
|
739
748
|
children: [
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
icon: /* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ N(f, {
|
|
750
|
+
icon: /* @__PURE__ */ N(E, {
|
|
742
751
|
className: "size-4",
|
|
743
752
|
"aria-hidden": "true"
|
|
744
753
|
}),
|
|
745
754
|
label: r("brainyrich.goals.detail.target", "Target"),
|
|
746
|
-
value:
|
|
755
|
+
value: h(o.targetAmount, j)
|
|
747
756
|
}),
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
icon: /* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ N(f, {
|
|
758
|
+
icon: /* @__PURE__ */ N(A, {
|
|
750
759
|
className: "size-4",
|
|
751
760
|
"aria-hidden": "true"
|
|
752
761
|
}),
|
|
753
762
|
label: r("brainyrich.goals.detail.funded", "Funded (fixed)"),
|
|
754
|
-
value:
|
|
763
|
+
value: h(k, j)
|
|
755
764
|
}),
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
icon: /* @__PURE__ */
|
|
765
|
+
/* @__PURE__ */ N(f, {
|
|
766
|
+
icon: /* @__PURE__ */ N(ge, {
|
|
758
767
|
className: "size-4",
|
|
759
768
|
"aria-hidden": "true"
|
|
760
769
|
}),
|
|
761
770
|
label: r("brainyrich.goals.detail.monthly", "Monthly"),
|
|
762
|
-
value:
|
|
771
|
+
value: h(o.monthlyContribution, j)
|
|
763
772
|
}),
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
icon: /* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ N(f, {
|
|
774
|
+
icon: /* @__PURE__ */ N(he, {
|
|
766
775
|
className: "size-4",
|
|
767
776
|
"aria-hidden": "true"
|
|
768
777
|
}),
|
|
769
778
|
label: r("brainyrich.goals.detail.targetDate", "Target date"),
|
|
770
|
-
value:
|
|
779
|
+
value: le(o.targetDate)
|
|
771
780
|
})
|
|
772
781
|
]
|
|
773
782
|
}),
|
|
774
|
-
|
|
783
|
+
De.length >= 2 ? /* @__PURE__ */ P("section", {
|
|
775
784
|
className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
776
785
|
children: [
|
|
777
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ P("div", {
|
|
778
787
|
className: "flex items-center gap-2",
|
|
779
|
-
children: [/* @__PURE__ */
|
|
788
|
+
children: [/* @__PURE__ */ N(_e, {
|
|
780
789
|
className: "size-4 text-text-secondary",
|
|
781
790
|
"aria-hidden": "true"
|
|
782
|
-
}), /* @__PURE__ */
|
|
791
|
+
}), /* @__PURE__ */ N("h3", {
|
|
783
792
|
className: "text-sm font-semibold text-text-primary",
|
|
784
793
|
children: r("brainyrich.goals.detail.projectionChart", "Contribution projection")
|
|
785
794
|
})]
|
|
786
795
|
}),
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
data:
|
|
796
|
+
/* @__PURE__ */ N(ie, {
|
|
797
|
+
data: De,
|
|
789
798
|
target: o.targetAmount,
|
|
790
|
-
tone:
|
|
799
|
+
tone: Ee,
|
|
791
800
|
height: 180,
|
|
792
|
-
valueFormatter: (e) =>
|
|
801
|
+
valueFormatter: (e) => m(e, j)
|
|
793
802
|
}),
|
|
794
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ N("p", {
|
|
795
804
|
className: "text-xs text-text-secondary",
|
|
796
805
|
children: r("brainyrich.goals.detail.projectionHint", "Starting balance plus {monthly}/mo through {date}.", {
|
|
797
|
-
monthly:
|
|
798
|
-
date:
|
|
806
|
+
monthly: h(o.monthlyContribution, j),
|
|
807
|
+
date: le(o.targetDate)
|
|
799
808
|
})
|
|
800
809
|
})
|
|
801
810
|
]
|
|
802
811
|
}) : null,
|
|
803
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ P("section", {
|
|
804
813
|
className: "space-y-3",
|
|
805
|
-
children: [/* @__PURE__ */
|
|
814
|
+
children: [/* @__PURE__ */ N("h3", {
|
|
806
815
|
className: "text-sm font-semibold text-text-primary",
|
|
807
816
|
children: r("brainyrich.goals.detail.fundingLinks", "Funding sources")
|
|
808
|
-
}), d.length === 0 ? /* @__PURE__ */
|
|
817
|
+
}), d.length === 0 ? /* @__PURE__ */ N("p", {
|
|
809
818
|
className: "rounded-lg border border-dashed border-border-subtle bg-bg-surface px-4 py-6 text-center text-sm text-text-secondary",
|
|
810
819
|
children: r("brainyrich.goals.detail.noFundings", "No accounts linked to fund this goal yet.")
|
|
811
|
-
}) : /* @__PURE__ */
|
|
820
|
+
}) : /* @__PURE__ */ N("div", {
|
|
812
821
|
className: "overflow-x-auto rounded-lg border border-border-subtle",
|
|
813
|
-
children: /* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
822
|
+
children: /* @__PURE__ */ P(Re, { children: [/* @__PURE__ */ N(Be, { children: /* @__PURE__ */ P(Ve, { children: [
|
|
823
|
+
/* @__PURE__ */ N(Q, { children: r("brainyrich.goals.detail.account", "Account") }),
|
|
824
|
+
/* @__PURE__ */ N(Q, {
|
|
816
825
|
className: "text-right",
|
|
817
826
|
children: r("brainyrich.goals.detail.allocation", "Allocation")
|
|
818
827
|
}),
|
|
819
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ N(Q, {
|
|
820
829
|
className: "text-right",
|
|
821
830
|
children: r("brainyrich.goals.detail.fixedAmount", "Fixed amount")
|
|
822
831
|
}),
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
] }) }), /* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ N(Q, { className: "w-10" })
|
|
833
|
+
] }) }), /* @__PURE__ */ N(ze, { children: d.map((e) => /* @__PURE__ */ P(Ve, { children: [
|
|
834
|
+
/* @__PURE__ */ N(Z, {
|
|
826
835
|
className: "font-medium text-text-primary",
|
|
827
|
-
children:
|
|
836
|
+
children: Oe(e.accountId)
|
|
828
837
|
}),
|
|
829
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ N(Z, {
|
|
830
839
|
className: "text-right tabular-nums text-text-secondary",
|
|
831
|
-
children: e.fixedAmount == null ?
|
|
840
|
+
children: e.fixedAmount == null ? ue(e.allocationPct) : "—"
|
|
832
841
|
}),
|
|
833
|
-
/* @__PURE__ */
|
|
842
|
+
/* @__PURE__ */ N(Z, {
|
|
834
843
|
className: "text-right tabular-nums text-text-secondary",
|
|
835
|
-
children: e.fixedAmount == null ? "—" :
|
|
844
|
+
children: e.fixedAmount == null ? "—" : h(e.fixedAmount, j)
|
|
836
845
|
}),
|
|
837
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ N(Z, {
|
|
838
847
|
className: "text-right",
|
|
839
|
-
children: /* @__PURE__ */
|
|
848
|
+
children: /* @__PURE__ */ N(I, {
|
|
840
849
|
variant: "ghost",
|
|
841
850
|
size: "icon",
|
|
842
851
|
"aria-label": r("brainyrich.goals.detail.unlink", "Unlink funding"),
|
|
843
|
-
onClick: () =>
|
|
844
|
-
children: /* @__PURE__ */
|
|
852
|
+
onClick: () => O(e),
|
|
853
|
+
children: /* @__PURE__ */ N(Se, {
|
|
845
854
|
className: "size-4",
|
|
846
855
|
"aria-hidden": "true"
|
|
847
856
|
})
|
|
@@ -850,132 +859,132 @@ function Xe({ goalId: e, onClose: n, translate: r }) {
|
|
|
850
859
|
] }, e.id)) })] })
|
|
851
860
|
})]
|
|
852
861
|
}),
|
|
853
|
-
/* @__PURE__ */
|
|
862
|
+
/* @__PURE__ */ P("section", {
|
|
854
863
|
className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
855
|
-
children: [/* @__PURE__ */
|
|
864
|
+
children: [/* @__PURE__ */ N("h3", {
|
|
856
865
|
className: "text-sm font-semibold text-text-primary",
|
|
857
866
|
children: r("brainyrich.goals.detail.linkTitle", "Link an account")
|
|
858
|
-
}), p.length === 0 ? /* @__PURE__ */
|
|
867
|
+
}), p.length === 0 ? /* @__PURE__ */ N("p", {
|
|
859
868
|
className: "text-sm text-text-secondary",
|
|
860
869
|
children: r("brainyrich.goals.detail.noAccounts", "No accounts available to link.")
|
|
861
|
-
}) : /* @__PURE__ */ M
|
|
862
|
-
/* @__PURE__ */
|
|
870
|
+
}) : /* @__PURE__ */ P(M, { children: [
|
|
871
|
+
/* @__PURE__ */ P("div", {
|
|
863
872
|
className: "space-y-1.5",
|
|
864
|
-
children: [/* @__PURE__ */
|
|
873
|
+
children: [/* @__PURE__ */ N(z, {
|
|
865
874
|
htmlFor: "funding-account",
|
|
866
875
|
children: r("brainyrich.goals.detail.account", "Account")
|
|
867
|
-
}), /* @__PURE__ */
|
|
868
|
-
value:
|
|
869
|
-
onValueChange:
|
|
870
|
-
children: [/* @__PURE__ */
|
|
876
|
+
}), /* @__PURE__ */ P(U, {
|
|
877
|
+
value: y,
|
|
878
|
+
onValueChange: b,
|
|
879
|
+
children: [/* @__PURE__ */ N(K, {
|
|
871
880
|
id: "funding-account",
|
|
872
|
-
children: /* @__PURE__ */
|
|
873
|
-
}), /* @__PURE__ */
|
|
881
|
+
children: /* @__PURE__ */ N(q, { placeholder: r("brainyrich.goals.detail.selectAccount", "Select account") })
|
|
882
|
+
}), /* @__PURE__ */ N(W, { children: p.map((e) => /* @__PURE__ */ N(G, {
|
|
874
883
|
value: e.id,
|
|
875
884
|
children: e.name
|
|
876
885
|
}, e.id)) })]
|
|
877
886
|
})]
|
|
878
887
|
}),
|
|
879
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ P("div", {
|
|
880
889
|
className: "grid grid-cols-2 gap-3",
|
|
881
|
-
children: [/* @__PURE__ */
|
|
890
|
+
children: [/* @__PURE__ */ P("div", {
|
|
882
891
|
className: "space-y-1.5",
|
|
883
|
-
children: [/* @__PURE__ */
|
|
892
|
+
children: [/* @__PURE__ */ N(z, {
|
|
884
893
|
htmlFor: "funding-mode",
|
|
885
894
|
children: r("brainyrich.goals.detail.mode", "Method")
|
|
886
|
-
}), /* @__PURE__ */
|
|
887
|
-
value:
|
|
888
|
-
onValueChange: (e) =>
|
|
889
|
-
children: [/* @__PURE__ */
|
|
895
|
+
}), /* @__PURE__ */ P(U, {
|
|
896
|
+
value: S,
|
|
897
|
+
onValueChange: (e) => me(e),
|
|
898
|
+
children: [/* @__PURE__ */ N(K, {
|
|
890
899
|
id: "funding-mode",
|
|
891
|
-
children: /* @__PURE__ */
|
|
892
|
-
}), /* @__PURE__ */
|
|
900
|
+
children: /* @__PURE__ */ N(q, {})
|
|
901
|
+
}), /* @__PURE__ */ P(W, { children: [/* @__PURE__ */ N(G, {
|
|
893
902
|
value: "PERCENT",
|
|
894
903
|
children: r("brainyrich.goals.detail.percent", "Percentage")
|
|
895
|
-
}), /* @__PURE__ */
|
|
904
|
+
}), /* @__PURE__ */ N(G, {
|
|
896
905
|
value: "FIXED",
|
|
897
906
|
children: r("brainyrich.goals.detail.fixed", "Fixed amount")
|
|
898
907
|
})] })]
|
|
899
908
|
})]
|
|
900
|
-
}), /* @__PURE__ */
|
|
909
|
+
}), /* @__PURE__ */ P("div", {
|
|
901
910
|
className: "space-y-1.5",
|
|
902
|
-
children: [/* @__PURE__ */
|
|
911
|
+
children: [/* @__PURE__ */ N(z, {
|
|
903
912
|
htmlFor: "funding-value",
|
|
904
|
-
children:
|
|
905
|
-
}), /* @__PURE__ */
|
|
913
|
+
children: S === "PERCENT" ? r("brainyrich.goals.detail.pct", "Percent") : r("brainyrich.goals.detail.amount", "Amount")
|
|
914
|
+
}), /* @__PURE__ */ N(R, {
|
|
906
915
|
id: "funding-value",
|
|
907
916
|
type: "number",
|
|
908
917
|
min: 0,
|
|
909
918
|
step: "0.01",
|
|
910
919
|
value: w,
|
|
911
|
-
onChange: (e) =>
|
|
920
|
+
onChange: (e) => ye(e.target.value)
|
|
912
921
|
})]
|
|
913
922
|
})]
|
|
914
923
|
}),
|
|
915
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ P(I, {
|
|
916
925
|
size: "sm",
|
|
917
926
|
className: "w-full",
|
|
918
|
-
disabled: !
|
|
919
|
-
onClick:
|
|
920
|
-
children: [/* @__PURE__ */
|
|
927
|
+
disabled: !L || g.isPending,
|
|
928
|
+
onClick: ke,
|
|
929
|
+
children: [/* @__PURE__ */ N(ve, {
|
|
921
930
|
className: "size-4",
|
|
922
931
|
"aria-hidden": "true"
|
|
923
932
|
}), g.isPending ? r("brainyrich.goals.detail.linking", "Linking…") : r("brainyrich.goals.detail.link", "Link funding")]
|
|
924
933
|
})
|
|
925
934
|
] })]
|
|
926
935
|
}),
|
|
927
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ N(we, { children: /* @__PURE__ */ N(Te, {
|
|
928
937
|
className: "p-4",
|
|
929
|
-
children: /* @__PURE__ */
|
|
938
|
+
children: /* @__PURE__ */ N(x, {
|
|
930
939
|
entityType: "brainyrich-goal",
|
|
931
940
|
entityId: o.id,
|
|
932
941
|
label: r("brainyrich.goals.detail.tags", "Tags")
|
|
933
942
|
})
|
|
934
943
|
}) }),
|
|
935
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ P("section", {
|
|
936
945
|
className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
|
|
937
946
|
children: [
|
|
938
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ N("h3", {
|
|
939
948
|
className: "text-sm font-semibold text-text-primary",
|
|
940
949
|
children: r("brainyrich.goals.detail.recalcTitle", "Recalculate projection")
|
|
941
950
|
}),
|
|
942
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ P("div", {
|
|
943
952
|
className: "space-y-1.5",
|
|
944
953
|
children: [
|
|
945
|
-
/* @__PURE__ */
|
|
954
|
+
/* @__PURE__ */ N(z, {
|
|
946
955
|
htmlFor: "recalc-funded",
|
|
947
956
|
children: r("brainyrich.goals.detail.fundedAmount", "Funded amount")
|
|
948
957
|
}),
|
|
949
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ N(R, {
|
|
950
959
|
id: "recalc-funded",
|
|
951
960
|
type: "number",
|
|
952
961
|
min: 0,
|
|
953
962
|
step: "0.01",
|
|
954
|
-
value:
|
|
955
|
-
placeholder: String(
|
|
956
|
-
onChange: (e) =>
|
|
963
|
+
value: T,
|
|
964
|
+
placeholder: String(k),
|
|
965
|
+
onChange: (e) => be(e.target.value)
|
|
957
966
|
}),
|
|
958
|
-
/* @__PURE__ */
|
|
967
|
+
/* @__PURE__ */ N("p", {
|
|
959
968
|
className: "text-xs text-text-secondary",
|
|
960
969
|
children: r("brainyrich.goals.detail.recalcHint", "Defaults to the sum of fixed fundings when left blank.")
|
|
961
970
|
})
|
|
962
971
|
]
|
|
963
972
|
}),
|
|
964
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ P(I, {
|
|
965
974
|
size: "sm",
|
|
966
975
|
variant: "outline",
|
|
967
976
|
className: "w-full",
|
|
968
977
|
disabled: v.isPending,
|
|
969
|
-
onClick:
|
|
970
|
-
children: [/* @__PURE__ */
|
|
978
|
+
onClick: Ae,
|
|
979
|
+
children: [/* @__PURE__ */ N(xe, {
|
|
971
980
|
className: "size-4",
|
|
972
981
|
"aria-hidden": "true"
|
|
973
982
|
}), v.isPending ? r("brainyrich.goals.detail.recalculating", "Recalculating…") : r("brainyrich.goals.detail.recalc", "Recalculate")]
|
|
974
983
|
})
|
|
975
984
|
]
|
|
976
985
|
})
|
|
977
|
-
] }) : /* @__PURE__ */
|
|
978
|
-
icon: /* @__PURE__ */
|
|
986
|
+
] }) : /* @__PURE__ */ N(oe, {
|
|
987
|
+
icon: /* @__PURE__ */ N(E, {
|
|
979
988
|
className: "size-6",
|
|
980
989
|
"aria-hidden": "true"
|
|
981
990
|
}),
|
|
@@ -983,23 +992,23 @@ function Xe({ goalId: e, onClose: n, translate: r }) {
|
|
|
983
992
|
})
|
|
984
993
|
})]
|
|
985
994
|
})
|
|
986
|
-
}), /* @__PURE__ */
|
|
987
|
-
open: !!
|
|
995
|
+
}), /* @__PURE__ */ N(ne, {
|
|
996
|
+
open: !!D,
|
|
988
997
|
onOpenChange: (e) => {
|
|
989
|
-
e ||
|
|
998
|
+
e || O(null);
|
|
990
999
|
},
|
|
991
1000
|
title: r("brainyrich.goals.detail.unlinkTitle", "Unlink funding?"),
|
|
992
|
-
description: r("brainyrich.goals.detail.unlinkConfirm", "This removes the “{name}” funding link from this goal.", { name:
|
|
1001
|
+
description: r("brainyrich.goals.detail.unlinkConfirm", "This removes the “{name}” funding link from this goal.", { name: je }),
|
|
993
1002
|
confirmLabel: r("brainyrich.goals.detail.unlink", "Unlink funding"),
|
|
994
1003
|
pendingLabel: r("brainyrich.goals.detail.unlinking", "Unlinking…"),
|
|
995
1004
|
destructive: !0,
|
|
996
1005
|
pending: _.isPending,
|
|
997
1006
|
onConfirm: () => {
|
|
998
|
-
|
|
1007
|
+
D && _.mutate(D.id, { onSuccess: () => O(null) });
|
|
999
1008
|
}
|
|
1000
1009
|
})] });
|
|
1001
1010
|
}
|
|
1002
1011
|
//#endregion
|
|
1003
|
-
export {
|
|
1012
|
+
export { Ze as GoalsPage };
|
|
1004
1013
|
|
|
1005
1014
|
//# sourceMappingURL=GoalsPage.js.map
|