@mx-cartographer/experiences 9.0.2 → 9.1.0-alpha.bb1
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/Analytics-BKzTPees.mjs +61 -0
- package/dist/GlobalCopyApi-BeXzaDH9.mjs +487 -0
- package/dist/HeaderCell-EhCUSjvj.mjs +10 -0
- package/dist/Loader-BlVzRtUd.mjs +73 -0
- package/dist/MiniWidgetContainer-COwnjfy7.mjs +110 -0
- package/dist/OriginalBalanceAction-sbiqaxok.mjs +110 -0
- package/dist/SpendingLegend-D15ixlQ1.mjs +222 -0
- package/dist/accounts/index.es.js +12 -1598
- package/dist/accounts-DkyAiLpg.mjs +15632 -0
- package/dist/analytics/index.es.js +155 -139
- package/dist/budgets/index.es.js +1317 -1266
- package/dist/cashflow/index.es.js +1047 -942
- package/dist/categories/index.es.js +4 -4
- package/dist/common/index.es.js +101 -310
- package/dist/core/index.es.js +80 -104
- package/dist/core-BexP5oiV.mjs +4047 -0
- package/dist/dashboard/index.es.js +185 -141
- package/dist/debts/index.es.js +1384 -1272
- package/dist/finstrong/index.es.js +3366 -3471
- package/dist/goals/index.es.js +1103 -984
- package/dist/help/index.es.js +3 -25
- package/dist/help-CctDYrAH.mjs +2308 -0
- package/dist/insights/index.es.js +93 -4843
- package/dist/investments/index.es.js +1533 -1522
- package/dist/merchants/index.es.js +75 -64
- package/dist/microinsights/index.es.js +15 -824
- package/dist/microinsights-CRf3ChsJ.mjs +1814 -0
- package/dist/networth/index.es.js +550 -503
- package/dist/notifications/index.es.js +169 -161
- package/dist/recurringtransactions/index.es.js +10 -962
- package/dist/recurringtransactions-gbJ_NA8u.mjs +1564 -0
- package/dist/settings/index.es.js +13 -880
- package/dist/settings-ZMHe439l.mjs +1526 -0
- package/dist/spending/index.es.js +400 -456
- package/dist/transactions/index.es.js +10 -603
- package/dist/trends/index.es.js +1268 -1407
- package/package.json +28 -28
- package/dist/Account-BaJmiJAG.mjs +0 -118
- package/dist/Account-BxHMlV9R.mjs +0 -30
- package/dist/AccountDetailsHeader-DIysk_4w.mjs +0 -95
- package/dist/AccountDisplayName-CO7z3v99.mjs +0 -11
- package/dist/AccountFields-mwJ8NXsX.mjs +0 -141
- package/dist/AccountListItem-BDXHs4tV.mjs +0 -94
- package/dist/AccountUtils-T5_Odvos.mjs +0 -27
- package/dist/Accounts-CseLC3lL.mjs +0 -5
- package/dist/Analytics-CkYXKvco.mjs +0 -53
- package/dist/Analytics-CzGzz_sE.mjs +0 -136
- package/dist/ApiEndpoints-DXwIYNUV.mjs +0 -49
- package/dist/BudgetUtil-Bg2AQJpQ.mjs +0 -74
- package/dist/Category-DEKZGLYe.mjs +0 -301
- package/dist/CategorySelectorDrawer-8soGrhB8.mjs +0 -430
- package/dist/Connect-Dk6GZEsA.mjs +0 -39
- package/dist/ConnectCard-CCep7Zqe.mjs +0 -54
- package/dist/ConnectDrawer-Cnjr3Ddg.mjs +0 -58
- package/dist/ConnectionsDrawer-CtfPXk0M.mjs +0 -54
- package/dist/CurrencyDialog-DumQCTPO.mjs +0 -373
- package/dist/CurrencyInput-adTIRtL3.mjs +0 -87
- package/dist/CurrencyText-CCbE6MmF.mjs +0 -20
- package/dist/DateFormats-HudZ3Bjs.mjs +0 -64
- package/dist/DateUtil-Bhq59ZVg.mjs +0 -58
- package/dist/DebtUtils-DD3186U-.mjs +0 -153
- package/dist/Dialog-Bvd2n8hz.mjs +0 -66
- package/dist/Donut-SzzfZDHF.mjs +0 -88
- package/dist/Drawer-BXqqBMxg.mjs +0 -174
- package/dist/EmbeddedCard-DPwJjqMH.mjs +0 -856
- package/dist/EmptyState-CJUDc3kD.mjs +0 -84
- package/dist/Error-Dogaw2jO.mjs +0 -84
- package/dist/ErrorBoundary-CsdOcnJ9.mjs +0 -23
- package/dist/ExportCsvAction-Bw02ZJEj.mjs +0 -24
- package/dist/GlobalAccountFilter-7Cg2-9A5.mjs +0 -237
- package/dist/GlobalCopyApi-wcnDUzMV.mjs +0 -128
- package/dist/GoalsUtil-C9EnLWvC.mjs +0 -107
- package/dist/HeaderCell-P8w6CmfO.mjs +0 -6
- package/dist/Help-CkQTjORd.mjs +0 -299
- package/dist/Help-DJ8PrVHX.mjs +0 -3209
- package/dist/IconBacking-DgT8DCeh.mjs +0 -39
- package/dist/InformationTooltip-4su8bn1e.mjs +0 -41
- package/dist/InvestmentUtil-BItV7uEs.mjs +0 -134
- package/dist/LineChart-CejWS_rh.mjs +0 -612
- package/dist/ListItemAction-CzZ8s39Z.mjs +0 -69
- package/dist/ListItemRow-kH1rn8Xu.mjs +0 -67
- package/dist/ListItemWrapper-B5r-YQQ_.mjs +0 -42
- package/dist/Loader-CxeBwuPG.mjs +0 -21
- package/dist/Localization-DnoVyBNK.mjs +0 -38
- package/dist/ManageIncome-D1yBODQi.mjs +0 -595
- package/dist/MicroWidgetContainer-CfKdQfhi.mjs +0 -45
- package/dist/MiniWidgetContainer-BdPiUU-u.mjs +0 -66
- package/dist/NetWorthUtils-DilGN1nW.mjs +0 -95
- package/dist/Notification-DTNYSd8P.mjs +0 -7
- package/dist/NotificationSettings-B4JA5IKE.mjs +0 -677
- package/dist/NotificationUtils-BRGFTePr.mjs +0 -23
- package/dist/NumberFormatting--XMeeBfr.mjs +0 -49
- package/dist/OriginalBalanceAction-BybTXDtO.mjs +0 -114
- package/dist/RecurringSettings-D2xbNb67.mjs +0 -88
- package/dist/RecurringTransactionsUtil-B3rLEx_g.mjs +0 -253
- package/dist/ResponsiveButton-CC9F_Ezk.mjs +0 -45
- package/dist/SearchBox-Cpgu_gdO.mjs +0 -50
- package/dist/Select-BFt-HD-L.mjs +0 -55
- package/dist/SelectionBox-B4xELRgp.mjs +0 -48
- package/dist/SingleSegmentDonut-7Uy6VEld.mjs +0 -69
- package/dist/Sizes-DISGrlUg.mjs +0 -6
- package/dist/SkeletonLoader-BaNboJjD.mjs +0 -38
- package/dist/SpendingData-PKlh8caU.mjs +0 -53
- package/dist/SpendingLegend-5Ct_FZ8o.mjs +0 -193
- package/dist/StatusBar-CPfSXe80.mjs +0 -30
- package/dist/TabContentContainer-CnMXkVqr.mjs +0 -21
- package/dist/ToggleListItem-Dl1lXNwj.mjs +0 -91
- package/dist/TransactionDetails-DctXr07p.mjs +0 -1714
- package/dist/TransactionUtils-BphBJBbU.mjs +0 -234
- package/dist/TrendsUtil-D9z3kIj_.mjs +0 -69
- package/dist/UserStore-CRpKQjpP.mjs +0 -3002
- package/dist/ViewMoreMicroCard-BD_MNc2z.mjs +0 -1295
- package/dist/WidgetContainer-CmbU4CBH.mjs +0 -482
- package/dist/hooks-BaO_gOI6.mjs +0 -77
- package/dist/useAccountDisplayName-CFa_MrS6.mjs +0 -15
- package/dist/useAriaLive-MkYebyUR.mjs +0 -35
- package/dist/useDimensions-CeDR9V8N.mjs +0 -36
- package/dist/useInsightsEnabled-DaNLPmUU.mjs +0 -11
- package/dist/useScreenSize-mWpmnh5w.mjs +0 -36
- package/dist/useWidgetLoadTimer-CJb-RELP.mjs +0 -19
package/dist/budgets/index.es.js
CHANGED
|
@@ -1,269 +1,296 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as R } from "../GlobalCopyApi-BeXzaDH9.mjs";
|
|
2
|
+
import { J as D, K as Ve, q as Ke, rt as Ee, s as Ye } from "../core-BexP5oiV.mjs";
|
|
3
|
+
import { $t as Se, An as fe, Bn as Xe, Gn as Ze, Vn as qe, Xn as Le, c as Je, d as Qe, f as et, i as tt, lr as $, mr as le, p as nt, sr as P, ur as W, yr as ve } from "../accounts-DkyAiLpg.mjs";
|
|
4
|
+
import { n as Ne } from "../Analytics-BKzTPees.mjs";
|
|
5
|
+
import { E as X, a as E, d as Z, h as q, i as ke, k as de, n as $e, p as w, s as J, t as ue, w as me } from "../Loader-BlVzRtUd.mjs";
|
|
6
|
+
import { t as at } from "../MiniWidgetContainer-COwnjfy7.mjs";
|
|
7
|
+
import { o as ot } from "../recurringtransactions-gbJ_NA8u.mjs";
|
|
2
8
|
import l from "react";
|
|
3
9
|
import { observer as I } from "mobx-react-lite";
|
|
10
|
+
import x from "@mui/material/Stack";
|
|
11
|
+
import { CategoryIcon as H, H3 as Ge, Icon as z, Text as v } from "@mxenabled/mxui";
|
|
4
12
|
import { endOfMonth as Be } from "date-fns/endOfMonth";
|
|
5
|
-
import { isAfter as Ke } from "date-fns/isAfter";
|
|
6
13
|
import { startOfMonth as ie } from "date-fns/startOfMonth";
|
|
7
14
|
import { startOfToday as re } from "date-fns/startOfToday";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import X from "@mui/material/Box";
|
|
13
|
-
import Z from "@mui/material/List";
|
|
14
|
-
import { b as R } from "../Localization-DnoVyBNK.mjs";
|
|
15
|
-
import { Text as C, CategoryIcon as V, Icon as z, H3 as Le } from "@mxenabled/mxui";
|
|
16
|
-
import { f as D } from "../NumberFormatting--XMeeBfr.mjs";
|
|
17
|
-
import { u as E, o as w, i as le, l as q, D as de, a as Ne, g as J, b as Q, h as ee, d as ke } from "../hooks-BaO_gOI6.mjs";
|
|
18
|
-
import $e from "@mui/material/Button";
|
|
19
|
-
import ue from "@mui/material/Divider";
|
|
20
|
-
import te from "@mui/material/ListItem";
|
|
21
|
-
import me from "@mui/material/ListItemAvatar";
|
|
22
|
-
import oe from "@mui/material/ListItemButton";
|
|
23
|
-
import ne from "@mui/material/ListItemText";
|
|
24
|
-
import { D as $ } from "../Drawer-BXqqBMxg.mjs";
|
|
25
|
-
import Xe from "@mui/material/ListItemSecondaryAction";
|
|
26
|
-
import { C as Ze } from "../CurrencyInput-adTIRtL3.mjs";
|
|
27
|
-
import { D as W } from "../Dialog-Bvd2n8hz.mjs";
|
|
28
|
-
import { C as qe } from "../ConnectionsDrawer-CtfPXk0M.mjs";
|
|
15
|
+
import Pe from "@mui/material/Button";
|
|
16
|
+
import { Fragment as rt, jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
17
|
+
import { alpha as st, useTheme as V } from "@mui/material/styles";
|
|
18
|
+
import Q from "@mui/material/Box";
|
|
29
19
|
import * as O from "d3";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ e(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
20
|
+
import { subDays as it } from "date-fns/subDays";
|
|
21
|
+
import we from "@mui/material/Tab";
|
|
22
|
+
import ct from "@mui/material/Tabs";
|
|
23
|
+
import lt from "@mui/material/IconButton";
|
|
24
|
+
import { isAfter as dt } from "date-fns/isAfter";
|
|
25
|
+
import xe from "@mui/material/Card";
|
|
26
|
+
import Ae from "@mui/material/CardContent";
|
|
27
|
+
import je from "@mui/material/CardHeader";
|
|
28
|
+
import ge from "@mui/material/Divider";
|
|
29
|
+
import ut from "@mui/material/Tooltip";
|
|
30
|
+
import ee from "@mui/material/List";
|
|
31
|
+
import te from "@mui/material/ListItem";
|
|
32
|
+
import ne from "@mui/material/ListItemButton";
|
|
33
|
+
import ae from "@mui/material/ListItemText";
|
|
34
|
+
import pe from "@mui/material/ListItemAvatar";
|
|
35
|
+
import Te from "@mui/material/Alert";
|
|
36
|
+
import De from "@mui/material/Snackbar";
|
|
37
|
+
import mt from "@mui/material/ListItemSecondaryAction";
|
|
38
|
+
var gt = I(() => {
|
|
39
|
+
const { budgets: t } = w(), { totalBudgeted: o } = E(), { incomeTotal: i } = me(), r = i - o;
|
|
40
|
+
return /* @__PURE__ */ m(x, {
|
|
41
|
+
direction: "row",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
my: 16,
|
|
44
|
+
spacing: 20,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ m(x, {
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
children: [/* @__PURE__ */ e(v, {
|
|
49
|
+
bold: !0,
|
|
50
|
+
variant: "body1",
|
|
51
|
+
children: D(i, "0,0")
|
|
52
|
+
}), /* @__PURE__ */ e(v, {
|
|
53
|
+
color: "secondary",
|
|
54
|
+
variant: "body2",
|
|
55
|
+
children: t.projected_income
|
|
56
|
+
})]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ e(v, {
|
|
59
|
+
bold: !0,
|
|
60
|
+
justifyContent: "center",
|
|
61
|
+
variant: "body1",
|
|
62
|
+
children: "-"
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ m(x, {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
children: [/* @__PURE__ */ e(v, {
|
|
67
|
+
bold: !0,
|
|
68
|
+
variant: "body1",
|
|
69
|
+
children: D(o, "0,0")
|
|
70
|
+
}), /* @__PURE__ */ e(v, {
|
|
71
|
+
color: "secondary",
|
|
72
|
+
variant: "body2",
|
|
73
|
+
children: t.budgeted
|
|
74
|
+
})]
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ e(v, {
|
|
77
|
+
bold: !0,
|
|
78
|
+
justifyContent: "center",
|
|
79
|
+
variant: "body1",
|
|
80
|
+
children: "="
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ m(x, {
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
children: [/* @__PURE__ */ e(v, {
|
|
85
|
+
bold: !0,
|
|
86
|
+
variant: "body1",
|
|
87
|
+
children: D(r, "0,0")
|
|
88
|
+
}), /* @__PURE__ */ e(v, {
|
|
89
|
+
color: "secondary",
|
|
90
|
+
variant: "body2",
|
|
91
|
+
children: t.remaining
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}), pt = I(({ category: t }) => {
|
|
97
|
+
const { budgets: o } = w(), { budgets: i } = E(), r = l.useMemo(() => {
|
|
98
|
+
const n = i.find((s) => s.category_guid === t.guid);
|
|
99
|
+
return `${D(t.totalAverageAmount, "0,0")} - ${n ? R(o.recalculate_previous_budget, D(n.amount, "0,0")) : o.recalculate_new_budget}`;
|
|
100
|
+
}, [o, i]);
|
|
101
|
+
return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, { children: [/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(H, {
|
|
102
|
+
categoryGuid: t.guid,
|
|
103
|
+
variant: "filled"
|
|
104
|
+
}) }), /* @__PURE__ */ e(ae, {
|
|
105
|
+
primary: t.name,
|
|
106
|
+
secondary: r
|
|
107
|
+
})] }) }), /* @__PURE__ */ e(ge, {})] }, t.guid);
|
|
108
|
+
}), ht = ({ onRecalculateBudgets: t }) => {
|
|
109
|
+
const { budgets: o, common: i } = w(), { spendCategories: r } = J(), { recalculateBudgets: n, setAlert: s } = E(), [a, c] = l.useState(!1), g = r.filter((u) => u.totalAverageAmount > 0), d = async () => {
|
|
110
|
+
await n(g), c(!1), s(o.alert_recalculated_budgets), t?.();
|
|
89
111
|
};
|
|
90
112
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
91
|
-
/* @__PURE__ */ e(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
minAmount: 0,
|
|
132
|
-
setAmount: c,
|
|
133
|
-
sx: { ".MuiTypography-body1": { p: 0 } }
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
] });
|
|
137
|
-
}, bt = I(({ category: t, onAddBudget: n }) => {
|
|
138
|
-
const { budgets: c, common: i } = E(), [a, s] = l.useState(!1), [o, r] = l.useState(
|
|
139
|
-
`${t.totalAmount === 0 ? "" : t.totalAmount}`
|
|
140
|
-
);
|
|
141
|
-
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
142
|
-
/* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(oe, { onClick: () => s(!0), children: [
|
|
143
|
-
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(V, { categoryGuid: t.guid }) }),
|
|
144
|
-
/* @__PURE__ */ e(
|
|
145
|
-
ne,
|
|
146
|
-
{
|
|
147
|
-
primary: t.name,
|
|
148
|
-
secondary: D(t.totalAmount, "0,0")
|
|
149
|
-
}
|
|
150
|
-
),
|
|
151
|
-
/* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(z, { name: "add", size: 20 }) })
|
|
152
|
-
] }) }, t.guid),
|
|
153
|
-
/* @__PURE__ */ e(
|
|
154
|
-
W,
|
|
155
|
-
{
|
|
156
|
-
copy: { close_aria: i.close_aria, title: c.add_title },
|
|
157
|
-
disablePrimaryButton: Number(o) <= 0,
|
|
158
|
-
isOpen: a,
|
|
159
|
-
onClose: () => s(!1),
|
|
160
|
-
onPrimaryAction: () => n(t, Number(o)),
|
|
161
|
-
primaryText: c.add_save_button,
|
|
162
|
-
children: /* @__PURE__ */ e(he, { amount: o, categoryName: t.name, onAmountChanged: r })
|
|
163
|
-
}
|
|
164
|
-
)
|
|
113
|
+
/* @__PURE__ */ e(Pe, {
|
|
114
|
+
onClick: () => c(!0),
|
|
115
|
+
sx: {
|
|
116
|
+
mt: 24,
|
|
117
|
+
mx: 24
|
|
118
|
+
},
|
|
119
|
+
variant: "text",
|
|
120
|
+
children: o.recalculate_button
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ e(v, {
|
|
123
|
+
sx: {
|
|
124
|
+
mx: 24,
|
|
125
|
+
my: 16,
|
|
126
|
+
textAlign: "center"
|
|
127
|
+
},
|
|
128
|
+
variant: "subtitle1",
|
|
129
|
+
children: o.recalculate_help
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ e($, {
|
|
132
|
+
ariaLabelClose: i.close_aria,
|
|
133
|
+
isOpen: a,
|
|
134
|
+
onClose: () => c(!1),
|
|
135
|
+
onPrimaryAction: d,
|
|
136
|
+
title: o.recalculate_title,
|
|
137
|
+
children: /* @__PURE__ */ m(x, { children: [/* @__PURE__ */ m(x, {
|
|
138
|
+
mx: 24,
|
|
139
|
+
my: 16,
|
|
140
|
+
children: [/* @__PURE__ */ e(v, {
|
|
141
|
+
bold: !0,
|
|
142
|
+
variant: "body1",
|
|
143
|
+
children: o.recalculate_description_top
|
|
144
|
+
}), /* @__PURE__ */ e(v, {
|
|
145
|
+
variant: "subtitle2",
|
|
146
|
+
children: o.recalculate_description_bottom
|
|
147
|
+
})]
|
|
148
|
+
}), /* @__PURE__ */ e(Q, {
|
|
149
|
+
bgcolor: "background.paper",
|
|
150
|
+
children: /* @__PURE__ */ e(ee, { children: g.map((u) => /* @__PURE__ */ e(pt, { category: u }, u.guid)) })
|
|
151
|
+
})] })
|
|
152
|
+
})
|
|
165
153
|
] });
|
|
166
|
-
}
|
|
167
|
-
const { budgets:
|
|
168
|
-
|
|
154
|
+
}, he = ({ amount: t, categoryName: o, onAmountChanged: i }) => {
|
|
155
|
+
const { budgets: r } = w(), { totalBudgeted: n } = E(), { incomeTotal: s } = me(), a = s - n;
|
|
156
|
+
return /* @__PURE__ */ m(x, {
|
|
157
|
+
gap: 16,
|
|
158
|
+
children: [/* @__PURE__ */ m(x, { children: [/* @__PURE__ */ e(v, { children: R(r.add_description_top, D(a, "0,0")) }), /* @__PURE__ */ e(v, { children: R(r.add_description_bottom, o) })] }), /* @__PURE__ */ e(Xe, {
|
|
159
|
+
amount: t,
|
|
160
|
+
autoFocus: !0,
|
|
161
|
+
label: r.add_label,
|
|
162
|
+
minAmount: 0,
|
|
163
|
+
setAmount: i,
|
|
164
|
+
sx: { ".MuiTypography-body1": { p: 0 } }
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
}, yt = I(({ category: t, onAddBudget: o }) => {
|
|
168
|
+
const { budgets: i, common: r } = w(), [n, s] = l.useState(!1), [a, c] = l.useState(`${t.totalAmount === 0 ? "" : t.totalAmount}`);
|
|
169
|
+
return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
|
|
170
|
+
onClick: () => s(!0),
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
|
|
173
|
+
/* @__PURE__ */ e(ae, {
|
|
174
|
+
primary: t.name,
|
|
175
|
+
secondary: D(t.totalAmount, "0,0")
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ e(mt, { children: /* @__PURE__ */ e(z, {
|
|
178
|
+
name: "add",
|
|
179
|
+
size: 20
|
|
180
|
+
}) })
|
|
181
|
+
]
|
|
182
|
+
}) }, t.guid), /* @__PURE__ */ e(W, {
|
|
183
|
+
copy: {
|
|
184
|
+
close_aria: r.close_aria,
|
|
185
|
+
title: i.add_title
|
|
186
|
+
},
|
|
187
|
+
disablePrimaryButton: Number(a) <= 0,
|
|
188
|
+
isOpen: n,
|
|
189
|
+
onClose: () => s(!1),
|
|
190
|
+
onPrimaryAction: () => o(t, Number(a)),
|
|
191
|
+
primaryText: i.add_save_button,
|
|
192
|
+
children: /* @__PURE__ */ e(he, {
|
|
193
|
+
amount: a,
|
|
194
|
+
categoryName: t.name,
|
|
195
|
+
onAmountChanged: c
|
|
196
|
+
})
|
|
197
|
+
})] });
|
|
198
|
+
}), ze = I(({ onAddBudget: t, onRecalculateBudgets: o }) => {
|
|
199
|
+
const { budgets: i } = w(), { addBudget: r, setAlert: n, unbudgetedCategories: s } = E(), a = async (c, g) => {
|
|
200
|
+
await r(c, g), t?.(), n(R(i.alert_budget_created, c.name));
|
|
169
201
|
};
|
|
170
202
|
return /* @__PURE__ */ m(x, { children: [
|
|
171
203
|
/* @__PURE__ */ e(gt, {}),
|
|
172
|
-
/* @__PURE__ */ e(
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
category:
|
|
176
|
-
onAddBudget:
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
/* @__PURE__ */ e(ht, { onRecalculateBudgets: n })
|
|
204
|
+
/* @__PURE__ */ e(Q, {
|
|
205
|
+
bgcolor: "background.paper",
|
|
206
|
+
children: /* @__PURE__ */ e(ee, { children: s.map((c) => /* @__PURE__ */ e(yt, {
|
|
207
|
+
category: c,
|
|
208
|
+
onAddBudget: a
|
|
209
|
+
}, c.guid)) })
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ e(ht, { onRecalculateBudgets: o })
|
|
181
212
|
] });
|
|
182
|
-
}), Ie = 5, Fe = 100, ce = 25,
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
|
|
213
|
+
}), Ie = 5, Fe = 100, ce = 25, _t = (t) => {
|
|
214
|
+
const o = (n) => {
|
|
215
|
+
n.active || t.alphaTarget(0.3).restart(), n.subject.fx = n.subject.x, n.subject.fy = n.subject.y;
|
|
216
|
+
}, i = (n) => {
|
|
217
|
+
n.subject.fx = n.x, n.subject.fy = n.y;
|
|
218
|
+
}, r = (n) => {
|
|
219
|
+
n.active || t.alphaTarget(0), n.subject.fx = null, n.subject.fy = null;
|
|
189
220
|
};
|
|
190
|
-
return O.drag().on("start",
|
|
191
|
-
},
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
return (s) => (
|
|
196
|
-
},
|
|
197
|
-
O.selectAll(".bubble").call(
|
|
198
|
-
}, Oe = (t,
|
|
199
|
-
t.alpha(1).restart().force(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
O.
|
|
205
|
-
).on("tick", () => {
|
|
206
|
-
const i = t.nodes();
|
|
207
|
-
i.forEach((a) => {
|
|
208
|
-
const s = a.radius ?? ce;
|
|
209
|
-
a.x = Oe(a.x ?? 0, s, c - s), a.y = Oe(a.y ?? 0, s, n - s);
|
|
210
|
-
}), O.selectAll(".bubble").data(i).attr("transform", (a) => `translate(${a.x},${a.y})`);
|
|
221
|
+
return O.drag().on("start", o).on("drag", i).on("end", r);
|
|
222
|
+
}, bt = (t) => {
|
|
223
|
+
let o = t.transaction_total / t.amount;
|
|
224
|
+
o < 0 ? o = 0 : o > 1 && (o = 1);
|
|
225
|
+
const i = o * 2 * Math.PI, r = O.interpolate(0, i), n = O.arc().cornerRadius(5).innerRadius(t.radius - Ie * 2).outerRadius(t.radius - Ie).startAngle(0).endAngle(0);
|
|
226
|
+
return (s) => (n.endAngle(r(s)), n(t) || "");
|
|
227
|
+
}, ft = (t) => {
|
|
228
|
+
O.selectAll(".bubble").call(_t(t));
|
|
229
|
+
}, Oe = (t, o, i) => Math.min(Math.max(t, o), i), Ct = (t, o, i) => {
|
|
230
|
+
t.alpha(1).restart().force("x", O.forceX().x(i / 2).strength(0.01)).force("y", O.forceY().y(o / 2).strength(0.02)).on("tick", () => {
|
|
231
|
+
const r = t.nodes();
|
|
232
|
+
r.forEach((n) => {
|
|
233
|
+
const s = n.radius ?? ce;
|
|
234
|
+
n.x = Oe(n.x ?? 0, s, i - s), n.y = Oe(n.y ?? 0, s, o - s);
|
|
235
|
+
}), O.selectAll(".bubble").data(r).attr("transform", (n) => `translate(${n.x},${n.y})`);
|
|
211
236
|
});
|
|
212
|
-
}, Ue = (t,
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
return
|
|
216
|
-
}, 0),
|
|
217
|
-
const
|
|
218
|
-
return
|
|
219
|
-
},
|
|
220
|
-
const
|
|
237
|
+
}, Ue = (t, o) => O.scaleLinear().domain([t, o]).range([ce, Fe]), vt = (t) => {
|
|
238
|
+
const o = t.reduce((n, s) => {
|
|
239
|
+
const a = Math.max(s.transaction_total, s.amount);
|
|
240
|
+
return a > n ? a : n;
|
|
241
|
+
}, 0), i = Ue(t.reduce((n, s) => {
|
|
242
|
+
const a = Math.max(s.transaction_total, s.amount);
|
|
243
|
+
return a < n ? a : n;
|
|
244
|
+
}, o), o), r = t.map((n) => {
|
|
245
|
+
const s = i(Math.max(n.transaction_total, n.amount)) || 25;
|
|
221
246
|
return {
|
|
222
|
-
...
|
|
223
|
-
radius:
|
|
247
|
+
...n,
|
|
248
|
+
radius: s
|
|
224
249
|
};
|
|
225
250
|
});
|
|
226
|
-
return O.forceSimulation(
|
|
227
|
-
},
|
|
228
|
-
const
|
|
229
|
-
let
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
|
|
251
|
+
return O.forceSimulation(r).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.7));
|
|
252
|
+
}, Bt = (t, o, i) => {
|
|
253
|
+
const r = Math.PI * ce ** 2 * t, n = i < 400 || o < 300, s = n ? 40 : 20, a = Math.max(100, i - s), c = Math.max(100, o - s), g = a * c;
|
|
254
|
+
let d = ce;
|
|
255
|
+
if (r < g) {
|
|
256
|
+
const u = Math.sqrt(g / (t * Math.PI)), C = Math.min(a, c) / 4;
|
|
257
|
+
d = Math.min(Fe, u, C);
|
|
233
258
|
}
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
const
|
|
259
|
+
return n && t <= 3 && (d = Math.min(d, 45)), {
|
|
260
|
+
minRadius: Math.max(20, d * 0.6),
|
|
261
|
+
maxRadius: d
|
|
262
|
+
};
|
|
263
|
+
}, St = (t, o, i, r, n) => {
|
|
264
|
+
const { maxRadius: s, minRadius: a } = Bt(t, o, n);
|
|
265
|
+
return O.scaleLinear().domain([r, i]).range([a, s]);
|
|
266
|
+
}, xt = (t, o, i = !1, r, n) => {
|
|
267
|
+
const s = o.map((d) => Math.max(d.transaction_total, d.amount)), a = Math.min(...s), c = Math.max(...s), g = i ? St(t.length, r, c, a, n) : Ue(a, c);
|
|
240
268
|
return t.map((d) => ({
|
|
241
269
|
...d,
|
|
242
|
-
radius:
|
|
270
|
+
radius: g(Math.max(d.transaction_total, d.amount))
|
|
243
271
|
}));
|
|
244
|
-
},
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
) });
|
|
272
|
+
}, Re = 5, At = 2e3, Tt = ({ bubble: t }) => {
|
|
273
|
+
const o = V(), { amount: i, guid: r, budgetColors: { mercury: n }, radius: s, transaction_total: a } = t, c = `mercury-${r}`;
|
|
274
|
+
return l.useEffect(() => {
|
|
275
|
+
O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(At).delay(0).attr("class", "status").attr("style", `fill: ${n}; fill-opacity: 1;`).attrTween("d", () => bt(t));
|
|
276
|
+
}, [
|
|
277
|
+
i,
|
|
278
|
+
s,
|
|
279
|
+
a
|
|
280
|
+
]), /* @__PURE__ */ e("g", {
|
|
281
|
+
className: c,
|
|
282
|
+
children: /* @__PURE__ */ e("path", {
|
|
283
|
+
d: O.arc().innerRadius((g) => g - 2 * Re).outerRadius((g) => g - Re).startAngle(0).endAngle(2 * Math.PI)(s) || "",
|
|
284
|
+
style: {
|
|
285
|
+
fill: o.palette.common.white,
|
|
286
|
+
fillOpacity: 0.35
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
});
|
|
263
290
|
}, Dt = l.memo(Tt), U = 75, Ce = 50;
|
|
264
|
-
function Et({ bubble: t, isDraggable:
|
|
291
|
+
function Et({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
265
292
|
} }) {
|
|
266
|
-
const [
|
|
293
|
+
const [r, n] = l.useState(!1), s = V(), { availableWidth: a } = de(), c = l.useMemo(() => {
|
|
267
294
|
if (t)
|
|
268
295
|
return {
|
|
269
296
|
amount: t.amount,
|
|
@@ -272,55 +299,50 @@ function Et({ bubble: t, isDraggable: n, onClick: c = () => {
|
|
|
272
299
|
radius: t.radius,
|
|
273
300
|
transaction_total: t.transaction_total
|
|
274
301
|
};
|
|
275
|
-
}, [
|
|
302
|
+
}, [
|
|
303
|
+
t.amount,
|
|
304
|
+
t.budgetColors,
|
|
305
|
+
t.guid,
|
|
306
|
+
t.radius,
|
|
307
|
+
t.transaction_total
|
|
308
|
+
]);
|
|
276
309
|
if (!t) return;
|
|
277
|
-
const {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
_ > U ? (b = -14, B = -45) : _ > Ce && (B = -32);
|
|
288
|
-
let f = 32;
|
|
289
|
-
_ <= U && (f = o < 400 ? 16 : 24);
|
|
290
|
-
const T = `${t.category.name}: ${h}`, L = {
|
|
291
|
-
modifiers: [
|
|
292
|
-
{
|
|
293
|
-
name: "offset",
|
|
294
|
-
options: { offset: [0, 15] }
|
|
295
|
-
}
|
|
296
|
-
]
|
|
297
|
-
}, M = (G) => {
|
|
298
|
-
(G.key === "Enter" || G.key === " ") && (G.preventDefault(), c(t));
|
|
310
|
+
const { budgetColors: { background: g, text: d }, category: { icon: u, name: C }, guid: p, description: b, radius: f, x: _, y: S } = t, A = a < 400 ? -8 : -12;
|
|
311
|
+
let h = A, B = A;
|
|
312
|
+
f > U ? (h = -14, B = -45) : f > Ce && (B = -32);
|
|
313
|
+
let y = 32;
|
|
314
|
+
f <= U && (y = a < 400 ? 16 : 24);
|
|
315
|
+
const T = `${t.category.name}: ${b}`, M = { modifiers: [{
|
|
316
|
+
name: "offset",
|
|
317
|
+
options: { offset: [0, 15] }
|
|
318
|
+
}] }, L = (G) => {
|
|
319
|
+
(G.key === "Enter" || G.key === " ") && (G.preventDefault(), i(t));
|
|
299
320
|
}, N = () => {
|
|
300
|
-
|
|
321
|
+
n(!0);
|
|
301
322
|
}, k = () => {
|
|
302
|
-
|
|
323
|
+
n(!1);
|
|
303
324
|
};
|
|
304
|
-
return /* @__PURE__ */ m(
|
|
305
|
-
"
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
325
|
+
return /* @__PURE__ */ m("g", {
|
|
326
|
+
"aria-label": `${C} - ${b}`,
|
|
327
|
+
className: "bubble",
|
|
328
|
+
id: `bubble-${p}`,
|
|
329
|
+
onBlur: k,
|
|
330
|
+
onClick: () => i(t),
|
|
331
|
+
onFocus: N,
|
|
332
|
+
onKeyDown: L,
|
|
333
|
+
onMouseEnter: () => n(!0),
|
|
334
|
+
onMouseLeave: () => n(!1),
|
|
335
|
+
role: "button",
|
|
336
|
+
style: {
|
|
337
|
+
cursor: o ? "pointer" : "default",
|
|
338
|
+
touchAction: "manipulation"
|
|
339
|
+
},
|
|
340
|
+
tabIndex: 0,
|
|
341
|
+
textAnchor: "middle",
|
|
342
|
+
x: _,
|
|
343
|
+
y: S,
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ e("style", { children: `
|
|
324
346
|
.bubble:focus,
|
|
325
347
|
.bubble:focus-visible {
|
|
326
348
|
outline: none;
|
|
@@ -332,1070 +354,1099 @@ function Et({ bubble: t, isDraggable: n, onClick: c = () => {
|
|
|
332
354
|
stroke-opacity: 0.8;
|
|
333
355
|
}
|
|
334
356
|
` }),
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
357
|
+
/* @__PURE__ */ e(ut, {
|
|
358
|
+
open: r,
|
|
359
|
+
slotProps: { popper: M },
|
|
360
|
+
title: T,
|
|
361
|
+
children: /* @__PURE__ */ e("circle", {
|
|
362
|
+
fill: g,
|
|
363
|
+
id: `circle-${p}`,
|
|
364
|
+
r: f
|
|
365
|
+
})
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ e("svg", {
|
|
368
|
+
x: h,
|
|
369
|
+
y: B,
|
|
370
|
+
children: /* @__PURE__ */ e(z, {
|
|
371
|
+
name: u,
|
|
372
|
+
size: y,
|
|
373
|
+
sx: { fill: d }
|
|
374
|
+
})
|
|
375
|
+
}),
|
|
376
|
+
f > U && /* @__PURE__ */ e(v, {
|
|
377
|
+
bold: !0,
|
|
378
|
+
component: "text",
|
|
379
|
+
id: `budget-category-${p}`,
|
|
380
|
+
sx: { fill: d },
|
|
381
|
+
variant: "body2",
|
|
382
|
+
y: 4,
|
|
383
|
+
children: C
|
|
384
|
+
}),
|
|
385
|
+
f > Ce && /* @__PURE__ */ e(v, {
|
|
386
|
+
bold: !0,
|
|
387
|
+
component: "text",
|
|
388
|
+
id: `budget-description-${p}-1`,
|
|
389
|
+
sx: { fill: d },
|
|
390
|
+
variant: "body1",
|
|
391
|
+
y: f <= U ? 12 : 24,
|
|
392
|
+
children: f <= U ? b.split(" ")[0] : b
|
|
393
|
+
}),
|
|
394
|
+
f <= U && f > Ce && /* @__PURE__ */ e(v, {
|
|
395
|
+
component: "text",
|
|
396
|
+
id: `budget-description-${p}-2`,
|
|
397
|
+
sx: { fill: d },
|
|
398
|
+
variant: "caption",
|
|
399
|
+
y: 28,
|
|
400
|
+
children: b.split(" ")[1]
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ e(Dt, { bubble: c })
|
|
403
|
+
]
|
|
404
|
+
}, p);
|
|
377
405
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
onClick: i = () => {
|
|
383
|
-
}
|
|
384
|
-
}) => {
|
|
385
|
-
const [a, s] = l.useState([]), o = l.useRef(null), r = l.useRef(!1), { detailedBudgets: p } = w(), d = l.useCallback(() => {
|
|
386
|
-
const u = o.current, S = Bt(p), g = S.nodes();
|
|
406
|
+
var wt = ({ height: t, width: o, isDraggable: i = !1, onClick: r = () => {
|
|
407
|
+
} }) => {
|
|
408
|
+
const [n, s] = l.useState([]), a = l.useRef(null), c = l.useRef(!1), { detailedBudgets: g } = E(), d = l.useCallback(() => {
|
|
409
|
+
const u = a.current, C = vt(g), p = C.nodes();
|
|
387
410
|
if (u) {
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
vx:
|
|
393
|
-
vy:
|
|
394
|
-
x:
|
|
395
|
-
y:
|
|
411
|
+
const b = u.nodes(), f = new Map(b.map((_) => [_.guid, _]));
|
|
412
|
+
p.forEach((_) => {
|
|
413
|
+
const S = f.get(_.guid);
|
|
414
|
+
S && Object.assign(_, {
|
|
415
|
+
vx: S.vx,
|
|
416
|
+
vy: S.vy,
|
|
417
|
+
x: S.x,
|
|
418
|
+
y: S.y
|
|
396
419
|
});
|
|
397
420
|
});
|
|
398
421
|
}
|
|
399
|
-
|
|
400
|
-
}, [
|
|
422
|
+
a.current = C, c.current = !1, s(p);
|
|
423
|
+
}, [g]);
|
|
401
424
|
return l.useEffect(() => {
|
|
402
425
|
d();
|
|
403
426
|
}, [d]), l.useEffect(() => () => {
|
|
404
|
-
|
|
427
|
+
a.current && (a.current.stop(), a.current = null);
|
|
405
428
|
}, []), l.useEffect(() => {
|
|
406
|
-
const u =
|
|
429
|
+
const u = a.current;
|
|
407
430
|
if (!u) return;
|
|
408
|
-
const
|
|
409
|
-
u.nodes(
|
|
410
|
-
|
|
411
|
-
}, 0), s([...
|
|
412
|
-
}, [
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
431
|
+
const C = xt(u.nodes(), g, o > 0 && o < 450 || t > 0 && t < 300, t, o);
|
|
432
|
+
u.nodes(C), Ct(u, t, o), i && setTimeout(() => {
|
|
433
|
+
ft(u);
|
|
434
|
+
}, 0), s([...C]);
|
|
435
|
+
}, [
|
|
436
|
+
t,
|
|
437
|
+
o,
|
|
438
|
+
i,
|
|
439
|
+
g
|
|
440
|
+
]), /* @__PURE__ */ e("svg", {
|
|
441
|
+
height: t,
|
|
442
|
+
style: {
|
|
443
|
+
overflow: "visible",
|
|
444
|
+
touchAction: "manipulation"
|
|
445
|
+
},
|
|
446
|
+
width: Math.abs(o),
|
|
447
|
+
children: n.map((u) => /* @__PURE__ */ e(Et, {
|
|
448
|
+
bubble: u,
|
|
449
|
+
isDraggable: i,
|
|
450
|
+
onClick: r
|
|
451
|
+
}, u.guid))
|
|
452
|
+
});
|
|
453
|
+
}, It = I(wt), Ot = ({ isMiniWidget: t = !1, onConnectAccountsClick: o, createBudgetOnClick: i }) => {
|
|
454
|
+
const { config: r } = ke(), { recalculateBudgets: n } = E(), { spendCategories: s } = J(), { budgets: a } = w(), { availableWidth: c } = de(), { isMobile: g } = le(c), d = t && g, [u, C] = l.useState(!1), [p, b] = l.useState(!1), [f, _] = l.useState(!1), S = l.useMemo(() => [...s.filter((h) => h.totalAverageAmount > 0)], [s]), A = async () => {
|
|
455
|
+
_(!0);
|
|
456
|
+
const { data: h, isSuccess: B } = await n(S);
|
|
457
|
+
_(!1), B ? (h.length === 0 && b(!0), C(!1)) : C(!0);
|
|
430
458
|
};
|
|
431
|
-
return
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
459
|
+
return f ? /* @__PURE__ */ e(ue, {}) : u ? /* @__PURE__ */ e(fe, {
|
|
460
|
+
header: a.autogenerate_budgets_error_header,
|
|
461
|
+
icon: "error",
|
|
462
|
+
iconColor: "#4D4D4D",
|
|
463
|
+
onClick: (h) => {
|
|
464
|
+
h === "primary" ? A() : i();
|
|
465
|
+
},
|
|
466
|
+
primaryButton: a.autogenerate_budgets_error_primary_button,
|
|
467
|
+
secondaryButton: a.zero_state_generate_budgets_secondary_button,
|
|
468
|
+
subText: a.autogenerate_budgets_error_subheader,
|
|
469
|
+
sx: {
|
|
470
|
+
width: { sm: 468 },
|
|
471
|
+
".buttons-footer": {
|
|
472
|
+
width: 208,
|
|
473
|
+
...d && {
|
|
474
|
+
mt: 16,
|
|
475
|
+
button: { height: "max-content" }
|
|
476
|
+
}
|
|
439
477
|
},
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
...d && { mt: 16, button: { height: "max-content" } }
|
|
448
|
-
},
|
|
449
|
-
...d && { justifyContent: "center", mt: 0, svg: { height: 32, width: 32 } }
|
|
478
|
+
...d && {
|
|
479
|
+
justifyContent: "center",
|
|
480
|
+
mt: 0,
|
|
481
|
+
svg: {
|
|
482
|
+
height: 32,
|
|
483
|
+
width: 32
|
|
484
|
+
}
|
|
450
485
|
}
|
|
451
486
|
}
|
|
452
|
-
) : /* @__PURE__ */ e(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
487
|
+
}) : /* @__PURE__ */ e(rt, { children: p ? /* @__PURE__ */ e(fe, {
|
|
488
|
+
header: a.zero_state_generate_budgets_header,
|
|
489
|
+
icon: "error",
|
|
490
|
+
iconColor: "#4D4D4D",
|
|
491
|
+
onClick: (h) => {
|
|
492
|
+
h === "primary" ? o() : i();
|
|
493
|
+
},
|
|
494
|
+
primaryButton: r.show_connections_widget_in_master ? a.zero_state_generate_budgets_primary_button : void 0,
|
|
495
|
+
secondaryButton: a.zero_state_generate_budgets_secondary_button,
|
|
496
|
+
subText: a.zero_state_generate_budgets_subheader,
|
|
497
|
+
sx: {
|
|
498
|
+
width: t ? "100%" : { sm: 500 },
|
|
499
|
+
height: t ? "100%" : { sm: 468 },
|
|
500
|
+
mt: d ? 0 : 50,
|
|
501
|
+
".buttons-footer": {
|
|
502
|
+
width: 208,
|
|
503
|
+
height: 100,
|
|
504
|
+
...d && {
|
|
505
|
+
mt: 16,
|
|
506
|
+
button: { height: "max-content" }
|
|
507
|
+
}
|
|
460
508
|
},
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
".buttons-footer": {
|
|
469
|
-
width: 208,
|
|
470
|
-
height: 100,
|
|
471
|
-
...d && { mt: 16, button: { height: "max-content" } }
|
|
472
|
-
},
|
|
473
|
-
padding: t ? 5 : 0,
|
|
474
|
-
...d && { justifyContent: "center", svg: { height: 32, width: 32 } }
|
|
509
|
+
padding: t ? 5 : 0,
|
|
510
|
+
...d && {
|
|
511
|
+
justifyContent: "center",
|
|
512
|
+
svg: {
|
|
513
|
+
height: 32,
|
|
514
|
+
width: 32
|
|
515
|
+
}
|
|
475
516
|
}
|
|
476
517
|
}
|
|
477
|
-
) : /* @__PURE__ */ e(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
518
|
+
}) : /* @__PURE__ */ e(fe, {
|
|
519
|
+
header: a.create_budgets_title,
|
|
520
|
+
icon: "bubble_chart",
|
|
521
|
+
iconColor: "#1A1A1A",
|
|
522
|
+
onClick: (h) => {
|
|
523
|
+
h === "primary" ? A() : i();
|
|
524
|
+
},
|
|
525
|
+
primaryButton: a.empty_state_primary_button,
|
|
526
|
+
secondaryButton: t ? void 0 : a.empty_state_secondary_button,
|
|
527
|
+
subText: a.empty_state_subheader,
|
|
528
|
+
sx: {
|
|
529
|
+
width: t ? "100%" : { sm: 432 },
|
|
530
|
+
height: t ? "100%" : { sm: 468 },
|
|
531
|
+
mt: d ? 0 : 50,
|
|
532
|
+
".buttons-footer": {
|
|
533
|
+
width: 208,
|
|
534
|
+
height: 100,
|
|
535
|
+
...d && {
|
|
536
|
+
mt: 24,
|
|
537
|
+
button: { height: "max-content" }
|
|
538
|
+
}
|
|
485
539
|
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
".buttons-footer": {
|
|
494
|
-
width: 208,
|
|
495
|
-
height: 100,
|
|
496
|
-
...d && { mt: 24, button: { height: "max-content" } }
|
|
497
|
-
},
|
|
498
|
-
padding: t ? 4 : 0,
|
|
499
|
-
...d && { justifyContent: "center", svg: { height: 32, width: 32 } }
|
|
540
|
+
padding: t ? 4 : 0,
|
|
541
|
+
...d && {
|
|
542
|
+
justifyContent: "center",
|
|
543
|
+
svg: {
|
|
544
|
+
height: 32,
|
|
545
|
+
width: 32
|
|
546
|
+
}
|
|
500
547
|
}
|
|
501
548
|
}
|
|
502
|
-
) });
|
|
503
|
-
}, We = I(
|
|
504
|
-
|
|
505
|
-
|
|
549
|
+
}) });
|
|
550
|
+
}, We = I(({ createBudgetOnClick: t = () => {
|
|
551
|
+
}, height: o, isDraggable: i = !1, isMiniWidget: r = !1, shouldShowZeroState: n, unavailableWidth: s = 24 }) => {
|
|
552
|
+
const { onEvent: a } = Z(), { setSelectedBudget: c } = E(), { isInitialized: g } = q(), { accounts: d } = w(), { availableWidth: u } = de(), { isMobile: C } = le(), [p, b] = l.useState(!1), f = l.useMemo(() => u - s, [u]), _ = (A) => {
|
|
553
|
+
c(A), a(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
554
|
+
budget_category: A.category.name,
|
|
555
|
+
click_type: "bubble"
|
|
556
|
+
});
|
|
557
|
+
}, S = () => {
|
|
558
|
+
b(!0), a(P.ACCOUNTS_CLICK_CONNECT);
|
|
559
|
+
};
|
|
560
|
+
return /* @__PURE__ */ m(Q, {
|
|
561
|
+
ml: n || C ? 0 : 24,
|
|
562
|
+
sx: {
|
|
563
|
+
alignSelf: "center",
|
|
564
|
+
...r && { height: "100%" }
|
|
506
565
|
},
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
),
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
},
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
})
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
566
|
+
children: [n || !g ? /* @__PURE__ */ e(Ot, {
|
|
567
|
+
createBudgetOnClick: t,
|
|
568
|
+
isMiniWidget: r,
|
|
569
|
+
onConnectAccountsClick: S
|
|
570
|
+
}) : /* @__PURE__ */ e(It, {
|
|
571
|
+
height: o,
|
|
572
|
+
isDraggable: i,
|
|
573
|
+
onClick: _,
|
|
574
|
+
width: f
|
|
575
|
+
}), /* @__PURE__ */ e(tt, {
|
|
576
|
+
onClose: () => b(!1),
|
|
577
|
+
showConnectionsWidget: p,
|
|
578
|
+
title: d.manage_connections
|
|
579
|
+
})]
|
|
580
|
+
});
|
|
581
|
+
}), He = ({ budget: t }) => {
|
|
582
|
+
const { amount: o, budgetColors: { background: i }, category: { name: r }, category_guid: n, percentage: s, transaction_total: a } = t, c = [{
|
|
583
|
+
color: i,
|
|
584
|
+
percentage: `${s}%`
|
|
585
|
+
}];
|
|
586
|
+
return /* @__PURE__ */ e(xe, {
|
|
587
|
+
sx: {
|
|
588
|
+
mt: 24,
|
|
589
|
+
mx: 24
|
|
590
|
+
},
|
|
591
|
+
children: /* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ m(x, {
|
|
592
|
+
alignItems: "center",
|
|
593
|
+
gap: 16,
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ e(H, {
|
|
596
|
+
categoryGuid: n,
|
|
597
|
+
size: 56
|
|
598
|
+
}),
|
|
599
|
+
/* @__PURE__ */ e(v, {
|
|
600
|
+
variant: "h1",
|
|
601
|
+
children: `${D(a, "0,0")} / ${D(o, "0,0")}`
|
|
602
|
+
}),
|
|
603
|
+
/* @__PURE__ */ e(v, {
|
|
604
|
+
bold: !0,
|
|
605
|
+
variant: "caption",
|
|
606
|
+
children: r
|
|
607
|
+
}),
|
|
608
|
+
/* @__PURE__ */ e(ve, {
|
|
609
|
+
data: c,
|
|
610
|
+
height: 10
|
|
611
|
+
})
|
|
612
|
+
]
|
|
613
|
+
}) })
|
|
614
|
+
});
|
|
615
|
+
}, Rt = I(() => {
|
|
616
|
+
const { budgets: t } = w();
|
|
617
|
+
return /* @__PURE__ */ m(x, {
|
|
618
|
+
alignItems: "center",
|
|
619
|
+
gap: 12,
|
|
620
|
+
height: "auto",
|
|
621
|
+
mb: 24,
|
|
622
|
+
mt: 24,
|
|
623
|
+
children: [
|
|
624
|
+
/* @__PURE__ */ e(z, {
|
|
625
|
+
color: "action",
|
|
626
|
+
name: "bubble_chart",
|
|
627
|
+
sx: { fontSize: 32 }
|
|
628
|
+
}),
|
|
629
|
+
/* @__PURE__ */ e(v, {
|
|
630
|
+
bold: !0,
|
|
631
|
+
color: "text.secondary",
|
|
632
|
+
variant: "body2",
|
|
633
|
+
children: t.zero_state_no_sub_budgets
|
|
634
|
+
}),
|
|
635
|
+
/* @__PURE__ */ e(v, {
|
|
636
|
+
color: "text.secondary",
|
|
637
|
+
variant: "caption",
|
|
638
|
+
children: t.zero_state_no_sub_budgets_description
|
|
639
|
+
})
|
|
640
|
+
]
|
|
641
|
+
});
|
|
642
|
+
}), Mt = I(({ budget: t }) => {
|
|
643
|
+
const { amount: o, budgetColors: { background: i }, category: r, percentage: n, transaction_total: s } = t, { setSelectedSubBudget: a } = E();
|
|
644
|
+
return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
|
|
645
|
+
onClick: () => a(t),
|
|
646
|
+
children: [/* @__PURE__ */ e(pe, {
|
|
647
|
+
sx: {
|
|
648
|
+
mb: -8,
|
|
649
|
+
mr: 16
|
|
650
|
+
},
|
|
651
|
+
children: /* @__PURE__ */ e(Le, {
|
|
652
|
+
color: i,
|
|
653
|
+
percent: n,
|
|
654
|
+
size: 40,
|
|
655
|
+
children: /* @__PURE__ */ e(H, {
|
|
656
|
+
categoryGuid: r.parent_guid,
|
|
657
|
+
variant: "basic"
|
|
658
|
+
})
|
|
659
|
+
})
|
|
660
|
+
}), /* @__PURE__ */ e(ae, {
|
|
661
|
+
primary: /* @__PURE__ */ e(x, {
|
|
662
|
+
component: "span",
|
|
663
|
+
direction: "row",
|
|
664
|
+
justifyContent: "space-between",
|
|
665
|
+
children: /* @__PURE__ */ e(v, {
|
|
666
|
+
bold: !0,
|
|
667
|
+
variant: "body1",
|
|
668
|
+
children: t.category.name
|
|
669
|
+
})
|
|
670
|
+
}),
|
|
671
|
+
secondary: /* @__PURE__ */ e(x, {
|
|
672
|
+
component: "span",
|
|
673
|
+
direction: "row",
|
|
674
|
+
justifyContent: "space-between",
|
|
675
|
+
children: /* @__PURE__ */ e(v, {
|
|
676
|
+
fontWeight: 400,
|
|
677
|
+
variant: "body1",
|
|
678
|
+
children: `
|
|
597
679
|
${D(s, "0,0")} /
|
|
598
|
-
${D(
|
|
599
|
-
`
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
})
|
|
604
|
-
|
|
680
|
+
${D(o, "0,0")}
|
|
681
|
+
`
|
|
682
|
+
})
|
|
683
|
+
})
|
|
684
|
+
})]
|
|
685
|
+
}) });
|
|
686
|
+
}), Lt = I(({ category: t, parentBudget: o }) => {
|
|
687
|
+
const { budgets: i, common: r } = w(), { setExpandedGuid: n, setOnSelect: s } = et(), { addBudget: a } = E(), [c, g] = l.useState(!1), [d, u] = l.useState(!1), [C, p] = l.useState(""), [b, f] = l.useState(void 0);
|
|
605
688
|
l.useEffect(() => {
|
|
606
|
-
s((
|
|
607
|
-
const
|
|
608
|
-
|
|
689
|
+
s((A) => {
|
|
690
|
+
const h = t.subCategories.find((B) => B.guid === A);
|
|
691
|
+
h && (f(h), p(`${h.currentAmount === 0 ? "" : h.currentAmount}`), u(!0));
|
|
609
692
|
});
|
|
610
693
|
}, []);
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
},
|
|
614
|
-
|
|
694
|
+
const _ = () => {
|
|
695
|
+
n(t.guid), g(!0);
|
|
696
|
+
}, S = async () => {
|
|
697
|
+
b && Number(C) > 0 && (await a(b, Number(C), o.guid), u(!1), g(!1), f(void 0));
|
|
615
698
|
};
|
|
616
|
-
return /* @__PURE__ */ m(
|
|
617
|
-
/* @__PURE__ */ e(te, {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
699
|
+
return /* @__PURE__ */ m(Q, { children: [
|
|
700
|
+
/* @__PURE__ */ e(te, {
|
|
701
|
+
disableGutters: !0,
|
|
702
|
+
disablePadding: !0,
|
|
703
|
+
sx: { bgcolor: "background.paper" },
|
|
704
|
+
children: /* @__PURE__ */ e(ne, {
|
|
705
|
+
onClick: _,
|
|
706
|
+
children: /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ m(x, {
|
|
707
|
+
alignItems: "center",
|
|
708
|
+
direction: "row",
|
|
709
|
+
justifyContent: "space-between",
|
|
710
|
+
children: [/* @__PURE__ */ m(x, {
|
|
711
|
+
alignItems: "center",
|
|
712
|
+
direction: "row",
|
|
713
|
+
gap: 8,
|
|
714
|
+
children: [/* @__PURE__ */ e(z, {
|
|
715
|
+
fill: !0,
|
|
716
|
+
name: "add_box",
|
|
717
|
+
size: 24,
|
|
718
|
+
sx: { color: "primary.light" }
|
|
719
|
+
}), /* @__PURE__ */ e(v, {
|
|
720
|
+
bold: !0,
|
|
721
|
+
sx: { color: "primary.light" },
|
|
722
|
+
variant: "body1",
|
|
723
|
+
children: i.add_sub_budget_button
|
|
724
|
+
})]
|
|
725
|
+
}), /* @__PURE__ */ e(z, {
|
|
726
|
+
name: "chevron_right",
|
|
727
|
+
size: 24,
|
|
728
|
+
sx: { color: "primary.light" }
|
|
729
|
+
})]
|
|
730
|
+
}) })
|
|
731
|
+
})
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ e(ge, {}),
|
|
734
|
+
/* @__PURE__ */ e($, {
|
|
735
|
+
ariaLabelClose: r.close_aria,
|
|
736
|
+
isOpen: c,
|
|
737
|
+
onClose: () => g(!1),
|
|
738
|
+
title: i.add_sub_budget_title,
|
|
739
|
+
children: /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(Qe, {
|
|
740
|
+
category: t,
|
|
741
|
+
subCategories: t.subCategories
|
|
742
|
+
}) })
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ e(W, {
|
|
745
|
+
copy: {
|
|
746
|
+
close_aria: r.close_aria,
|
|
747
|
+
title: i.add_title
|
|
748
|
+
},
|
|
749
|
+
disablePrimaryButton: Number(C) <= 0,
|
|
750
|
+
isOpen: d,
|
|
751
|
+
onClose: () => u(!1),
|
|
752
|
+
onPrimaryAction: S,
|
|
753
|
+
primaryText: i.add_save_button,
|
|
754
|
+
children: /* @__PURE__ */ e(he, {
|
|
755
|
+
amount: C,
|
|
756
|
+
categoryName: b?.name || "",
|
|
757
|
+
onAmountChanged: p
|
|
758
|
+
})
|
|
759
|
+
})
|
|
654
760
|
] });
|
|
655
761
|
}), Nt = I(({ budget: t }) => {
|
|
656
|
-
const { category:
|
|
762
|
+
const { category: o, subBudgets: i } = t, { budgets: r, common: n } = w(), { deleteBudget: s, selectedSubBudget: a, setSelectedSubBudget: c, updateBudget: g } = E(), { filter: d, setFilter: u } = X(), [C, p] = l.useState(!1), [b, f] = l.useState(!1), [_, S] = l.useState("");
|
|
657
763
|
l.useEffect(() => {
|
|
658
|
-
|
|
764
|
+
a && (S(`${a.amount}`), u({
|
|
659
765
|
...d,
|
|
660
|
-
custom: (
|
|
766
|
+
custom: (y) => y.category_guid === a.category_guid
|
|
661
767
|
}));
|
|
662
|
-
}, [
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
...
|
|
666
|
-
amount: Number(
|
|
768
|
+
}, [a]);
|
|
769
|
+
const A = async () => {
|
|
770
|
+
a && await g({
|
|
771
|
+
...a,
|
|
772
|
+
amount: Number(_)
|
|
667
773
|
});
|
|
668
|
-
},
|
|
669
|
-
|
|
774
|
+
}, h = async () => {
|
|
775
|
+
a && await s(a.guid), f(!1), B();
|
|
670
776
|
}, B = () => {
|
|
671
777
|
u({
|
|
672
778
|
...d,
|
|
673
|
-
custom: (
|
|
674
|
-
}),
|
|
779
|
+
custom: (y) => y.category_guid === t.category_guid || y.top_level_category_guid === t.category_guid
|
|
780
|
+
}), c(void 0);
|
|
675
781
|
};
|
|
676
782
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
677
|
-
/* @__PURE__ */ m(
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
/* @__PURE__ */ e(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
children:
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
primaryText: "Delete",
|
|
730
|
-
secondaryColor: "secondary",
|
|
731
|
-
children: /* @__PURE__ */ e(C, { variant: "subtitle1", children: R(i.delete_description, o.category.name) })
|
|
732
|
-
}
|
|
733
|
-
)
|
|
734
|
-
] })
|
|
783
|
+
/* @__PURE__ */ m(ee, {
|
|
784
|
+
sx: { bgcolor: "background.paper" },
|
|
785
|
+
children: [i.length === 0 ? /* @__PURE__ */ e(Rt, {}) : i.map((y) => /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(Mt, { budget: y }), /* @__PURE__ */ e(ge, {})] }, y.guid)), /* @__PURE__ */ e(Lt, {
|
|
786
|
+
category: o,
|
|
787
|
+
parentBudget: t
|
|
788
|
+
})]
|
|
789
|
+
}),
|
|
790
|
+
/* @__PURE__ */ e($, {
|
|
791
|
+
ariaLabelClose: n.close_aria,
|
|
792
|
+
isOpen: !!a,
|
|
793
|
+
onClose: B,
|
|
794
|
+
onPrimaryAction: () => p(!0),
|
|
795
|
+
onSecondaryAction: () => f(!0),
|
|
796
|
+
primaryText: r.details_edit_button,
|
|
797
|
+
secondaryText: r.details_delete_button,
|
|
798
|
+
title: r.details_title,
|
|
799
|
+
children: a && /* @__PURE__ */ m(x, {
|
|
800
|
+
gap: 24,
|
|
801
|
+
children: [/* @__PURE__ */ e(He, { budget: a }), /* @__PURE__ */ e(Se, { height: "100%" })]
|
|
802
|
+
})
|
|
803
|
+
}),
|
|
804
|
+
a && /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(W, {
|
|
805
|
+
copy: {
|
|
806
|
+
close_aria: n.close_aria,
|
|
807
|
+
title: r.details_edit_title
|
|
808
|
+
},
|
|
809
|
+
disablePrimaryButton: Number(_) <= 0,
|
|
810
|
+
isOpen: C,
|
|
811
|
+
onClose: () => p(!1),
|
|
812
|
+
onPrimaryAction: A,
|
|
813
|
+
primaryText: r.edit_save_button,
|
|
814
|
+
children: /* @__PURE__ */ e(he, {
|
|
815
|
+
amount: _,
|
|
816
|
+
categoryName: a.category.name,
|
|
817
|
+
onAmountChanged: S
|
|
818
|
+
})
|
|
819
|
+
}), /* @__PURE__ */ e(W, {
|
|
820
|
+
copy: {
|
|
821
|
+
close_aria: n.close_aria,
|
|
822
|
+
title: r.delete_title
|
|
823
|
+
},
|
|
824
|
+
isOpen: b,
|
|
825
|
+
onClose: () => f(!1),
|
|
826
|
+
onPrimaryAction: h,
|
|
827
|
+
primaryColor: "error",
|
|
828
|
+
primaryText: "Delete",
|
|
829
|
+
secondaryColor: "secondary",
|
|
830
|
+
children: /* @__PURE__ */ e(v, {
|
|
831
|
+
variant: "subtitle1",
|
|
832
|
+
children: R(r.delete_description, a.category.name)
|
|
833
|
+
})
|
|
834
|
+
})] })
|
|
735
835
|
] });
|
|
736
836
|
}), kt = I(({ budget: t }) => {
|
|
737
|
-
const { is_mobile_webview:
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
/* @__PURE__ */ e(
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
$,
|
|
781
|
-
{
|
|
782
|
-
ariaLabelClose: a.close_aria,
|
|
783
|
-
isOpen: !!A,
|
|
784
|
-
onClose: () => y(""),
|
|
785
|
-
title: i.details_transaction_drawer,
|
|
786
|
-
children: A && /* @__PURE__ */ e(tt, { transaction: A })
|
|
787
|
-
}
|
|
788
|
-
)
|
|
789
|
-
] })
|
|
790
|
-
] });
|
|
837
|
+
const { is_mobile_webview: o } = ke(), { setAlert: i } = E(), { budgets: r, common: n, transactions: s } = w(), { isDesktop: a, isSmallTablet: c, isTablet: g } = le(), { sortedTransactions: d, sortedTransactionsWithSplits: u, tags: C } = X(), [p, b] = l.useState(0), [f, _] = l.useState(""), S = l.useMemo(() => d.find((y) => y.guid === f), [f, d]), A = (y, T) => {
|
|
838
|
+
b(T);
|
|
839
|
+
}, h = () => {
|
|
840
|
+
Ye(u, C), i(r.alert_csv_downloaded);
|
|
841
|
+
}, B = d.length > 0 && !o && (a || g && !c);
|
|
842
|
+
return /* @__PURE__ */ m(x, {
|
|
843
|
+
gap: 24,
|
|
844
|
+
children: [/* @__PURE__ */ e(He, { budget: t }), /* @__PURE__ */ m(x, { children: [
|
|
845
|
+
/* @__PURE__ */ m(ct, {
|
|
846
|
+
onChange: A,
|
|
847
|
+
sx: { width: "100%" },
|
|
848
|
+
textColor: "primary",
|
|
849
|
+
value: p,
|
|
850
|
+
variant: "fullWidth",
|
|
851
|
+
children: [/* @__PURE__ */ e(we, { label: r.details_transactions_tab }), /* @__PURE__ */ e(we, { label: r.details_subbudgets_tab })]
|
|
852
|
+
}),
|
|
853
|
+
p === 0 && /* @__PURE__ */ m(x, { children: [B && /* @__PURE__ */ e(x, {
|
|
854
|
+
direction: "row",
|
|
855
|
+
justifyContent: "right",
|
|
856
|
+
mb: -24,
|
|
857
|
+
mr: 8,
|
|
858
|
+
mt: 8,
|
|
859
|
+
zIndex: 1,
|
|
860
|
+
children: /* @__PURE__ */ e(Pe, {
|
|
861
|
+
onClick: h,
|
|
862
|
+
startIcon: /* @__PURE__ */ e(z, { name: "ios_share" }),
|
|
863
|
+
variant: "text",
|
|
864
|
+
children: s.export_csv_btn
|
|
865
|
+
})
|
|
866
|
+
}), /* @__PURE__ */ e(Se, {
|
|
867
|
+
height: "100%",
|
|
868
|
+
onClick: _
|
|
869
|
+
})] }),
|
|
870
|
+
p === 1 && /* @__PURE__ */ e(Nt, { budget: t }),
|
|
871
|
+
/* @__PURE__ */ e($, {
|
|
872
|
+
ariaLabelClose: n.close_aria,
|
|
873
|
+
isOpen: !!S,
|
|
874
|
+
onClose: () => _(""),
|
|
875
|
+
title: r.details_transaction_drawer,
|
|
876
|
+
children: S && /* @__PURE__ */ e(Je, { transaction: S })
|
|
877
|
+
})
|
|
878
|
+
] })]
|
|
879
|
+
});
|
|
791
880
|
}), $t = I(() => {
|
|
792
|
-
const { selectedAccountGuids: t } =
|
|
793
|
-
alert: i,
|
|
794
|
-
dateRange: a,
|
|
795
|
-
deleteBudget: s,
|
|
796
|
-
selectedBudget: o,
|
|
797
|
-
selectedSubBudget: r,
|
|
798
|
-
setAlert: p,
|
|
799
|
-
setSelectedBudget: d,
|
|
800
|
-
updateBudget: u
|
|
801
|
-
} = w(), { setFilter: S } = ee(), [g, h] = l.useState(!1), [_, y] = l.useState(!1), [A, v] = l.useState(!1), [b, B] = l.useState("");
|
|
881
|
+
const { selectedAccountGuids: t } = q(), { budgets: o, common: i } = w(), { alert: r, dateRange: n, deleteBudget: s, selectedBudget: a, selectedSubBudget: c, setAlert: g, setSelectedBudget: d, updateBudget: u } = E(), { setFilter: C } = X(), [p, b] = l.useState(!1), [f, _] = l.useState(!1), [S, A] = l.useState(!1), [h, B] = l.useState("");
|
|
802
882
|
l.useEffect(() => {
|
|
803
|
-
|
|
883
|
+
a && !c && (B(`${a.amount}`), b(!0), C({
|
|
804
884
|
accounts: t,
|
|
805
|
-
dateRange:
|
|
806
|
-
custom: (N) => N.category_guid ===
|
|
885
|
+
dateRange: n,
|
|
886
|
+
custom: (N) => N.category_guid === a.category_guid || N.top_level_category_guid === a.category_guid,
|
|
807
887
|
showSplits: !0
|
|
808
888
|
}));
|
|
809
|
-
}, [
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
...
|
|
813
|
-
amount: Number(
|
|
814
|
-
percentage:
|
|
815
|
-
}),
|
|
889
|
+
}, [a]);
|
|
890
|
+
const y = async () => {
|
|
891
|
+
a && (await u({
|
|
892
|
+
...a,
|
|
893
|
+
amount: Number(h),
|
|
894
|
+
percentage: a.category.totalAmount / Number(h) * 100
|
|
895
|
+
}), _(!1), g(R(o.alert_budget_updated, a.category.name)));
|
|
816
896
|
}, T = async () => {
|
|
817
|
-
|
|
818
|
-
},
|
|
819
|
-
|
|
897
|
+
a && (await s(a.guid), g(R(o.alert_budget_deleted, a.category.name))), M();
|
|
898
|
+
}, M = () => {
|
|
899
|
+
b(!1), setTimeout(() => {
|
|
820
900
|
d(void 0);
|
|
821
901
|
}, 250);
|
|
822
|
-
},
|
|
823
|
-
|
|
902
|
+
}, L = () => {
|
|
903
|
+
_(!1), B(`${a?.amount}`);
|
|
824
904
|
};
|
|
825
|
-
if (
|
|
905
|
+
if (a)
|
|
826
906
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
827
|
-
/* @__PURE__ */ m(
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
}
|
|
853
|
-
),
|
|
854
|
-
/* @__PURE__ */ e(
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
children:
|
|
885
|
-
}
|
|
886
|
-
)
|
|
907
|
+
/* @__PURE__ */ m($, {
|
|
908
|
+
ariaLabelClose: i.close_aria,
|
|
909
|
+
isOpen: p,
|
|
910
|
+
onClose: M,
|
|
911
|
+
onPrimaryAction: () => _(!0),
|
|
912
|
+
onSecondaryAction: () => A(!0),
|
|
913
|
+
primaryText: o.details_edit_button,
|
|
914
|
+
secondaryColor: "error",
|
|
915
|
+
secondaryText: o.details_delete_button,
|
|
916
|
+
title: o.details_title,
|
|
917
|
+
children: [/* @__PURE__ */ e(kt, { budget: a }), /* @__PURE__ */ e(De, {
|
|
918
|
+
anchorOrigin: {
|
|
919
|
+
vertical: "bottom",
|
|
920
|
+
horizontal: "right"
|
|
921
|
+
},
|
|
922
|
+
autoHideDuration: 3500,
|
|
923
|
+
onClose: () => g(""),
|
|
924
|
+
open: !!r,
|
|
925
|
+
children: /* @__PURE__ */ e(Te, {
|
|
926
|
+
closeText: "",
|
|
927
|
+
onClose: () => g(""),
|
|
928
|
+
severity: "success",
|
|
929
|
+
variant: "filled",
|
|
930
|
+
children: r
|
|
931
|
+
})
|
|
932
|
+
})]
|
|
933
|
+
}),
|
|
934
|
+
/* @__PURE__ */ e(W, {
|
|
935
|
+
copy: {
|
|
936
|
+
close_aria: i.close_aria,
|
|
937
|
+
title: o.details_edit_title
|
|
938
|
+
},
|
|
939
|
+
disablePrimaryButton: Number(h) <= 0,
|
|
940
|
+
isOpen: f,
|
|
941
|
+
onClose: L,
|
|
942
|
+
onPrimaryAction: y,
|
|
943
|
+
onSecondaryAction: L,
|
|
944
|
+
primaryText: o.edit_save_button,
|
|
945
|
+
children: /* @__PURE__ */ e(he, {
|
|
946
|
+
amount: h,
|
|
947
|
+
categoryName: a.category.name,
|
|
948
|
+
onAmountChanged: B
|
|
949
|
+
})
|
|
950
|
+
}),
|
|
951
|
+
/* @__PURE__ */ e(W, {
|
|
952
|
+
copy: {
|
|
953
|
+
close_aria: i.close_aria,
|
|
954
|
+
title: o.delete_title
|
|
955
|
+
},
|
|
956
|
+
isOpen: S,
|
|
957
|
+
onClose: () => A(!1),
|
|
958
|
+
onPrimaryAction: T,
|
|
959
|
+
primaryColor: "error",
|
|
960
|
+
primaryText: o.details_delete_button,
|
|
961
|
+
secondaryColor: "secondary",
|
|
962
|
+
children: /* @__PURE__ */ e(v, {
|
|
963
|
+
variant: "subtitle1",
|
|
964
|
+
children: R(o.delete_description, a.category.name)
|
|
965
|
+
})
|
|
966
|
+
})
|
|
887
967
|
] });
|
|
888
|
-
}), Gt = ({ budget: t, onClick:
|
|
889
|
-
const {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
968
|
+
}), Gt = ({ budget: t, onClick: o }) => {
|
|
969
|
+
const { amount: i, budgetColors: { background: r, description: n }, category_guid: s, description: a, percentage: c, subBudgets: g, transaction_total: d } = t, u = c > 100;
|
|
970
|
+
return /* @__PURE__ */ e(te, { children: /* @__PURE__ */ m(ne, {
|
|
971
|
+
onClick: () => o?.(t),
|
|
972
|
+
children: [/* @__PURE__ */ e(pe, {
|
|
973
|
+
sx: {
|
|
974
|
+
mb: -8,
|
|
975
|
+
mr: 16
|
|
976
|
+
},
|
|
977
|
+
children: /* @__PURE__ */ e(Le, {
|
|
978
|
+
color: r,
|
|
979
|
+
percent: c,
|
|
980
|
+
size: 40,
|
|
981
|
+
children: /* @__PURE__ */ e(H, {
|
|
982
|
+
categoryGuid: s,
|
|
983
|
+
variant: "basic"
|
|
984
|
+
})
|
|
985
|
+
})
|
|
986
|
+
}), /* @__PURE__ */ e(ae, {
|
|
987
|
+
primary: /* @__PURE__ */ m(x, {
|
|
988
|
+
component: "span",
|
|
989
|
+
direction: "row",
|
|
990
|
+
justifyContent: "space-between",
|
|
991
|
+
children: [/* @__PURE__ */ e(v, {
|
|
992
|
+
bold: !0,
|
|
993
|
+
variant: "body1",
|
|
994
|
+
children: t.category.name
|
|
995
|
+
}), /* @__PURE__ */ e(v, {
|
|
996
|
+
fontWeight: 400,
|
|
997
|
+
variant: "body1",
|
|
998
|
+
children: `
|
|
906
999
|
${D(d, "0,0")} /
|
|
907
|
-
${D(
|
|
908
|
-
`
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
)
|
|
931
|
-
] }) });
|
|
1000
|
+
${D(i, "0,0")}
|
|
1001
|
+
`
|
|
1002
|
+
})]
|
|
1003
|
+
}),
|
|
1004
|
+
secondary: /* @__PURE__ */ m(x, {
|
|
1005
|
+
component: "span",
|
|
1006
|
+
direction: "row",
|
|
1007
|
+
justifyContent: "space-between",
|
|
1008
|
+
children: [/* @__PURE__ */ e(v, {
|
|
1009
|
+
variant: "caption",
|
|
1010
|
+
children: `${g.length} Sub-budgets`
|
|
1011
|
+
}), /* @__PURE__ */ e(v, {
|
|
1012
|
+
bold: u,
|
|
1013
|
+
sx: {
|
|
1014
|
+
color: n,
|
|
1015
|
+
...u && { ".MuiListItemButton-root:hover &, .MuiListItemButton-root:active &": { color: "error.dark" } }
|
|
1016
|
+
},
|
|
1017
|
+
variant: "caption",
|
|
1018
|
+
children: a
|
|
1019
|
+
})]
|
|
1020
|
+
})
|
|
1021
|
+
})]
|
|
1022
|
+
}) });
|
|
932
1023
|
}, Pt = I(() => {
|
|
933
|
-
const { onEvent: t } =
|
|
934
|
-
|
|
1024
|
+
const { onEvent: t } = Z(), { budgets: o } = w(), { detailedBudgets: i, setSelectedBudget: r } = E(), n = (s) => {
|
|
1025
|
+
r(s), t(P.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
935
1026
|
budget_category: s.category.name,
|
|
936
1027
|
click_type: "list"
|
|
937
1028
|
});
|
|
938
1029
|
};
|
|
939
|
-
return /* @__PURE__ */ m(
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1030
|
+
return /* @__PURE__ */ m(xe, {
|
|
1031
|
+
elevation: 2,
|
|
1032
|
+
children: [/* @__PURE__ */ e(je, {
|
|
1033
|
+
sx: {
|
|
1034
|
+
pb: 8,
|
|
1035
|
+
pl: 24
|
|
1036
|
+
},
|
|
1037
|
+
title: /* @__PURE__ */ e(Ge, { children: o.budget_categories_title })
|
|
1038
|
+
}), /* @__PURE__ */ e(Ae, {
|
|
1039
|
+
sx: {
|
|
1040
|
+
p: 0,
|
|
1041
|
+
":last-child": { p: 0 }
|
|
1042
|
+
},
|
|
1043
|
+
children: /* @__PURE__ */ e(ee, { children: i.map((s) => /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ e(Gt, {
|
|
1044
|
+
budget: s,
|
|
1045
|
+
onClick: n
|
|
1046
|
+
}), /* @__PURE__ */ e(ge, {})] }, s.guid)) })
|
|
1047
|
+
})]
|
|
1048
|
+
});
|
|
946
1049
|
}), jt = I(() => {
|
|
947
|
-
const t =
|
|
948
|
-
const B =
|
|
949
|
-
let
|
|
950
|
-
|
|
1050
|
+
const t = V(), { onEvent: o } = Z(), { visibleAccounts: i } = $e(), { budgets: r, common: n, recurring: s } = w(), { incomeCategories: a, spendCategories: c } = J(), { detailedBudgets: g, totalBudgeted: d } = E(), { incomeTotal: u } = me(), { setFilter: C } = X(), [p, b] = l.useState(!1), [f, _] = l.useMemo(() => {
|
|
1051
|
+
const B = c.reduce((M, L) => M + L.totalAmount, 0);
|
|
1052
|
+
let y = B / d;
|
|
1053
|
+
y > 1 && (y = 1);
|
|
951
1054
|
let T = t.palette.success.main;
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
return [B,
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
const T = [
|
|
967
|
-
{
|
|
968
|
-
color: t.palette.secondary.main,
|
|
969
|
-
percentage: `${f}`
|
|
970
|
-
}
|
|
971
|
-
];
|
|
972
|
-
return [B, T];
|
|
973
|
-
}, [o, u]), b = () => {
|
|
974
|
-
S({
|
|
975
|
-
accounts: c.map((B) => B.guid),
|
|
1055
|
+
return y > 0.8 && y < 1 ? T = t.palette.warning.main : y >= 1 && (T = t.palette.error.main), [B, [{
|
|
1056
|
+
color: T,
|
|
1057
|
+
percentage: `${y}`
|
|
1058
|
+
}]];
|
|
1059
|
+
}, [g, c]), [S, A] = l.useMemo(() => {
|
|
1060
|
+
const B = Math.abs(a.reduce((T, M) => T + M.totalAmount, 0));
|
|
1061
|
+
let y = B / u;
|
|
1062
|
+
return y > 1 && (y = 1), [B, [{
|
|
1063
|
+
color: t.palette.secondary.main,
|
|
1064
|
+
percentage: `${y}`
|
|
1065
|
+
}]];
|
|
1066
|
+
}, [a, u]), h = () => {
|
|
1067
|
+
C({
|
|
1068
|
+
accounts: i.map((B) => B.guid),
|
|
976
1069
|
dateRange: {
|
|
977
|
-
start:
|
|
1070
|
+
start: it(/* @__PURE__ */ new Date(), 90),
|
|
978
1071
|
end: /* @__PURE__ */ new Date()
|
|
979
1072
|
}
|
|
980
|
-
}),
|
|
1073
|
+
}), b(!0), o(P.BUDGETS_CLICK_EDIT_INCOME);
|
|
981
1074
|
};
|
|
982
|
-
return /* @__PURE__ */ m(
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1075
|
+
return /* @__PURE__ */ m(xe, {
|
|
1076
|
+
elevation: 2,
|
|
1077
|
+
sx: { overflow: "visible" },
|
|
1078
|
+
children: [
|
|
1079
|
+
/* @__PURE__ */ e(je, {
|
|
1080
|
+
sx: {
|
|
1081
|
+
pb: 8,
|
|
1082
|
+
pl: 24
|
|
1083
|
+
},
|
|
1084
|
+
title: /* @__PURE__ */ e(Ge, { children: r.overview_title })
|
|
1085
|
+
}),
|
|
1086
|
+
/* @__PURE__ */ e(Ae, {
|
|
1087
|
+
sx: {
|
|
1088
|
+
pt: 12,
|
|
1089
|
+
px: 24
|
|
1090
|
+
},
|
|
1091
|
+
children: /* @__PURE__ */ m(x, {
|
|
1092
|
+
gap: 24,
|
|
1093
|
+
children: [/* @__PURE__ */ m(x, {
|
|
1094
|
+
gap: 8,
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ e(v, {
|
|
1097
|
+
bold: !0,
|
|
1098
|
+
sx: { mb: 8 },
|
|
1099
|
+
variant: "body1",
|
|
1100
|
+
children: r.spending_title
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ e(ve, {
|
|
1103
|
+
data: _,
|
|
1104
|
+
height: 16
|
|
1105
|
+
}),
|
|
1106
|
+
/* @__PURE__ */ e(v, {
|
|
1107
|
+
variant: "body2",
|
|
1108
|
+
children: R(r.spending_description, D(f, "0,0"), D(d, "0,0"))
|
|
1109
|
+
})
|
|
1110
|
+
]
|
|
1111
|
+
}), /* @__PURE__ */ m(x, {
|
|
1112
|
+
gap: 8,
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ m(x, {
|
|
1115
|
+
alignItems: "center",
|
|
1116
|
+
direction: "row",
|
|
1117
|
+
gap: 4,
|
|
1118
|
+
mb: -4,
|
|
1119
|
+
children: [/* @__PURE__ */ e(v, {
|
|
1120
|
+
bold: !0,
|
|
1121
|
+
variant: "body1",
|
|
1122
|
+
children: r.income_title
|
|
1123
|
+
}), /* @__PURE__ */ e(lt, {
|
|
1124
|
+
"aria-label": s.manage_income,
|
|
1125
|
+
onClick: h,
|
|
1126
|
+
sx: { p: 0 },
|
|
1127
|
+
children: /* @__PURE__ */ e(z, {
|
|
1128
|
+
color: "primary",
|
|
1129
|
+
name: "edit"
|
|
1130
|
+
})
|
|
1131
|
+
})]
|
|
1132
|
+
}),
|
|
1133
|
+
/* @__PURE__ */ e(ve, {
|
|
1134
|
+
data: A,
|
|
1135
|
+
height: 16
|
|
1136
|
+
}),
|
|
1137
|
+
/* @__PURE__ */ e(v, {
|
|
1138
|
+
variant: "body2",
|
|
1139
|
+
children: R(r.income_description, D(S, "0,0"), D(u, "0,0"))
|
|
1140
|
+
})
|
|
1141
|
+
]
|
|
1142
|
+
})]
|
|
1143
|
+
})
|
|
1144
|
+
}),
|
|
1145
|
+
/* @__PURE__ */ e($, {
|
|
1146
|
+
ariaLabelClose: n.close_aria,
|
|
1147
|
+
isOpen: p,
|
|
1148
|
+
onClose: () => b(!1),
|
|
1021
1149
|
title: s.manage_income,
|
|
1022
|
-
children: /* @__PURE__ */ e(
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}),
|
|
1027
|
-
({
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1150
|
+
children: /* @__PURE__ */ e(ot, { forOverview: !0 })
|
|
1151
|
+
})
|
|
1152
|
+
]
|
|
1153
|
+
});
|
|
1154
|
+
}), Me = 480, Dn = I(({ onBackClick: t, onMenuClick: o, sx: i }) => {
|
|
1155
|
+
const r = V(), { onEvent: n } = Z(), { visibleAccounts: s } = $e(), { budgets: a, common: c } = w(), { isInitialized: g, selectedAccounts: d, setDisplayedDate: u } = q(), { alert: C, dateRange: p, isDataLoaded: b, loadBudgetData: f, setDateRange: _, setAlert: S, setTheme: A, detailedBudgets: h } = E(), { setDateRange: B } = me(), { loadDateRangeCategoryTotals: y, loadMonthlyCategoryTotals: T } = J(), { isSmallTablet: M, isMobile: L, isSmallMobile: N } = le(), k = M || L || N, [G, F] = l.useState(!1);
|
|
1156
|
+
Ne({
|
|
1157
|
+
widgetName: "BubbleBudgetsWidget",
|
|
1158
|
+
isLoaded: b
|
|
1159
|
+
}), l.useEffect(() => {
|
|
1160
|
+
A(r), b || f().finally(() => {
|
|
1161
|
+
n(P.BUDGETS_VIEW);
|
|
1162
|
+
});
|
|
1163
|
+
}, []), l.useEffect(() => (_({
|
|
1164
|
+
start: ie(re()),
|
|
1165
|
+
end: Be(re())
|
|
1166
|
+
}), () => {
|
|
1167
|
+
_({
|
|
1168
|
+
start: ie(re()),
|
|
1169
|
+
end: Be(re())
|
|
1170
|
+
});
|
|
1171
|
+
}), [s]), l.useEffect(() => {
|
|
1172
|
+
g && (u(p.start, p.end), y(d, p.start, p.end).finally(), T(d).finally(), B(p));
|
|
1173
|
+
}, [
|
|
1174
|
+
g,
|
|
1175
|
+
d,
|
|
1176
|
+
p
|
|
1177
|
+
]);
|
|
1178
|
+
const ye = (Y) => {
|
|
1179
|
+
_({
|
|
1180
|
+
start: Y[0] || /* @__PURE__ */ new Date(),
|
|
1181
|
+
end: Y[1] || /* @__PURE__ */ new Date()
|
|
1182
|
+
});
|
|
1183
|
+
}, _e = () => {
|
|
1184
|
+
n(P.BUDGETS_CLICK_FILTER);
|
|
1185
|
+
}, oe = () => {
|
|
1186
|
+
F(!0), n(P.BUDGETS_CLICK_ADD);
|
|
1187
|
+
}, be = () => {
|
|
1188
|
+
F(!1);
|
|
1189
|
+
}, j = () => {
|
|
1190
|
+
F(!1);
|
|
1191
|
+
}, K = dt(p.end, ie(/* @__PURE__ */ new Date()));
|
|
1192
|
+
return !g || !b ? /* @__PURE__ */ e(ue, {}) : /* @__PURE__ */ m(Ze, {
|
|
1193
|
+
actions: [{
|
|
1194
|
+
iconName: "add",
|
|
1195
|
+
label: a.add_title,
|
|
1196
|
+
onClick: oe
|
|
1197
|
+
}],
|
|
1198
|
+
calendarActions: {
|
|
1199
|
+
onRangeChanged: ye,
|
|
1200
|
+
shouldDisableNext: K,
|
|
1201
|
+
shouldDisablePicker: !0
|
|
1202
|
+
},
|
|
1203
|
+
hasDivider: !0,
|
|
1204
|
+
onAccountsFilterClick: _e,
|
|
1205
|
+
onBackClick: t,
|
|
1206
|
+
onMenuClick: o,
|
|
1207
|
+
sx: i,
|
|
1208
|
+
title: a.budgets_title,
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ m(x, {
|
|
1211
|
+
direction: k ? "column" : "row",
|
|
1212
|
+
height: "100%",
|
|
1213
|
+
sx: { justifyContent: "center" },
|
|
1214
|
+
width: "100%",
|
|
1215
|
+
children: [/* @__PURE__ */ e(x, {
|
|
1216
|
+
height: k ? 450 : "calc(100dvh - 150px)",
|
|
1217
|
+
children: /* @__PURE__ */ e(We, {
|
|
1218
|
+
createBudgetOnClick: oe,
|
|
1219
|
+
height: k ? 450 : 800,
|
|
1220
|
+
isDraggable: !0,
|
|
1221
|
+
shouldShowZeroState: h.length === 0,
|
|
1222
|
+
unavailableWidth: k ? 0 : Me
|
|
1223
|
+
})
|
|
1224
|
+
}), h.length !== 0 && /* @__PURE__ */ m(x, {
|
|
1225
|
+
gap: 24,
|
|
1226
|
+
height: "100%",
|
|
1227
|
+
sx: {
|
|
1228
|
+
mr: 24,
|
|
1229
|
+
mt: 48
|
|
1230
|
+
},
|
|
1231
|
+
width: k ? "100%" : Me,
|
|
1232
|
+
children: [/* @__PURE__ */ e(jt, {}), /* @__PURE__ */ e(Pt, {})]
|
|
1233
|
+
})]
|
|
1234
|
+
}),
|
|
1235
|
+
/* @__PURE__ */ e($t, {}),
|
|
1236
|
+
/* @__PURE__ */ e($, {
|
|
1237
|
+
ariaLabelClose: c.close_aria,
|
|
1238
|
+
isOpen: G,
|
|
1239
|
+
onClose: () => F(!1),
|
|
1240
|
+
title: a.add_new_title,
|
|
1241
|
+
children: /* @__PURE__ */ e(ze, {
|
|
1242
|
+
onAddBudget: be,
|
|
1243
|
+
onRecalculateBudgets: j
|
|
1244
|
+
})
|
|
1245
|
+
}),
|
|
1246
|
+
/* @__PURE__ */ e(De, {
|
|
1247
|
+
anchorOrigin: {
|
|
1248
|
+
vertical: "bottom",
|
|
1249
|
+
horizontal: "right"
|
|
1075
1250
|
},
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
$,
|
|
1120
|
-
{
|
|
1121
|
-
ariaLabelClose: r.close_aria,
|
|
1122
|
-
isOpen: G,
|
|
1123
|
-
onClose: () => F(!1),
|
|
1124
|
-
title: o.add_new_title,
|
|
1125
|
-
children: /* @__PURE__ */ e(
|
|
1126
|
-
ze,
|
|
1127
|
-
{
|
|
1128
|
-
onAddBudget: ye,
|
|
1129
|
-
onRecalculateBudgets: j
|
|
1130
|
-
}
|
|
1131
|
-
)
|
|
1132
|
-
}
|
|
1133
|
-
),
|
|
1134
|
-
/* @__PURE__ */ e(
|
|
1135
|
-
xe,
|
|
1136
|
-
{
|
|
1137
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1138
|
-
autoHideDuration: 3500,
|
|
1139
|
-
onClose: () => {
|
|
1140
|
-
A("");
|
|
1141
|
-
},
|
|
1142
|
-
open: !!S,
|
|
1143
|
-
children: /* @__PURE__ */ e(
|
|
1144
|
-
Ae,
|
|
1145
|
-
{
|
|
1146
|
-
closeText: "",
|
|
1147
|
-
onClose: () => {
|
|
1148
|
-
A("");
|
|
1149
|
-
},
|
|
1150
|
-
severity: "success",
|
|
1151
|
-
variant: "filled",
|
|
1152
|
-
children: S
|
|
1153
|
-
}
|
|
1154
|
-
)
|
|
1155
|
-
}
|
|
1156
|
-
)
|
|
1157
|
-
]
|
|
1158
|
-
}
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
), zt = ({
|
|
1162
|
-
budgetsCopy: t,
|
|
1163
|
-
difference: n,
|
|
1164
|
-
handleAddClick: c,
|
|
1165
|
-
shouldShowZeroState: i
|
|
1166
|
-
}) => {
|
|
1167
|
-
const { availableHeight: a = 0 } = de(), s = l.useRef(null);
|
|
1168
|
-
l.useEffect(() => {
|
|
1169
|
-
a > 0 && s.current === null && (s.current = a);
|
|
1170
|
-
}, [a]);
|
|
1171
|
-
const o = l.useMemo(() => {
|
|
1172
|
-
const r = s.current ?? a;
|
|
1173
|
-
return r > 0 ? Math.round(Math.max(120, Math.min(450, r * 0.8))) - 40 : 450;
|
|
1174
|
-
}, [a]);
|
|
1175
|
-
return /* @__PURE__ */ m(x, { sx: { height: "100%", justifyContent: "space-between" }, children: [
|
|
1176
|
-
/* @__PURE__ */ e(
|
|
1177
|
-
We,
|
|
1178
|
-
{
|
|
1179
|
-
createBudgetOnClick: c,
|
|
1180
|
-
height: o,
|
|
1181
|
-
isMiniWidget: !0,
|
|
1182
|
-
shouldShowZeroState: i
|
|
1183
|
-
}
|
|
1184
|
-
),
|
|
1185
|
-
!i && /* @__PURE__ */ m(X, { ml: 16, children: [
|
|
1186
|
-
/* @__PURE__ */ e(C, { bold: !0, color: n < 0 ? "error.main" : "success.main", children: D(Math.abs(n), "0,0") }),
|
|
1187
|
-
/* @__PURE__ */ e(C, { children: n < 0 ? t.overspent_in_budgets : t.left_in_budgets })
|
|
1188
|
-
] })
|
|
1189
|
-
] });
|
|
1251
|
+
autoHideDuration: 3500,
|
|
1252
|
+
onClose: () => {
|
|
1253
|
+
S("");
|
|
1254
|
+
},
|
|
1255
|
+
open: !!C,
|
|
1256
|
+
children: /* @__PURE__ */ e(Te, {
|
|
1257
|
+
closeText: "",
|
|
1258
|
+
onClose: () => {
|
|
1259
|
+
S("");
|
|
1260
|
+
},
|
|
1261
|
+
severity: "success",
|
|
1262
|
+
variant: "filled",
|
|
1263
|
+
children: C
|
|
1264
|
+
})
|
|
1265
|
+
})
|
|
1266
|
+
]
|
|
1267
|
+
});
|
|
1268
|
+
}), zt = ({ budgetsCopy: t, difference: o, handleAddClick: i, shouldShowZeroState: r }) => {
|
|
1269
|
+
const { availableHeight: n = 0 } = de(), s = l.useRef(null);
|
|
1270
|
+
return l.useEffect(() => {
|
|
1271
|
+
n > 0 && s.current === null && (s.current = n);
|
|
1272
|
+
}, [n]), /* @__PURE__ */ m(x, {
|
|
1273
|
+
sx: {
|
|
1274
|
+
height: "100%",
|
|
1275
|
+
justifyContent: "space-between"
|
|
1276
|
+
},
|
|
1277
|
+
children: [/* @__PURE__ */ e(We, {
|
|
1278
|
+
createBudgetOnClick: i,
|
|
1279
|
+
height: l.useMemo(() => {
|
|
1280
|
+
const a = s.current ?? n;
|
|
1281
|
+
return a > 0 ? Math.round(Math.max(120, Math.min(450, a * 0.8))) - 40 : 450;
|
|
1282
|
+
}, [n]),
|
|
1283
|
+
isMiniWidget: !0,
|
|
1284
|
+
shouldShowZeroState: r
|
|
1285
|
+
}), !r && /* @__PURE__ */ m(Q, {
|
|
1286
|
+
ml: 16,
|
|
1287
|
+
children: [/* @__PURE__ */ e(v, {
|
|
1288
|
+
bold: !0,
|
|
1289
|
+
color: o < 0 ? "error.main" : "success.main",
|
|
1290
|
+
children: D(Math.abs(o), "0,0")
|
|
1291
|
+
}), /* @__PURE__ */ e(v, { children: o < 0 ? t.overspent_in_budgets : t.left_in_budgets })]
|
|
1292
|
+
})]
|
|
1293
|
+
});
|
|
1190
1294
|
}, Ft = (t) => {
|
|
1191
|
-
const
|
|
1295
|
+
const o = V(), { onEvent: i } = Z(), { detailedBudgets: r, isDataLoaded: n, loadBudgetData: s, setTheme: a } = E(), { budgets: c, common: g } = w(), { isInitialized: d, selectedAccounts: u } = q(), { loadDateRangeCategoryTotals: C, loadMonthlyCategoryTotals: p } = J(), b = Ve(r), [f, _] = l.useState(!1);
|
|
1192
1296
|
l.useEffect(() => {
|
|
1193
|
-
|
|
1297
|
+
n || s().finally();
|
|
1194
1298
|
}, []), l.useEffect(() => {
|
|
1195
|
-
o
|
|
1196
|
-
}, [
|
|
1197
|
-
d && !
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
},
|
|
1206
|
-
|
|
1207
|
-
},
|
|
1208
|
-
if (
|
|
1299
|
+
a(o);
|
|
1300
|
+
}, [o]), l.useEffect(() => {
|
|
1301
|
+
d && !n && (C(u, ie(/* @__PURE__ */ new Date()), Be(/* @__PURE__ */ new Date())).finally(), p(u).finally());
|
|
1302
|
+
}, [
|
|
1303
|
+
d,
|
|
1304
|
+
u,
|
|
1305
|
+
n
|
|
1306
|
+
]);
|
|
1307
|
+
const S = () => {
|
|
1308
|
+
_(!0), i(P.BUDGETS_CLICK_ADD);
|
|
1309
|
+
}, A = () => {
|
|
1310
|
+
_(!1);
|
|
1311
|
+
}, h = () => _(!1);
|
|
1312
|
+
if (Ne({
|
|
1209
1313
|
widgetName: "BubbleBudgetsMiniWidget",
|
|
1210
|
-
isLoaded:
|
|
1211
|
-
}), !d || !
|
|
1212
|
-
const B =
|
|
1213
|
-
return /* @__PURE__ */ m(
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
ze,
|
|
1241
|
-
{
|
|
1242
|
-
onAddBudget: v,
|
|
1243
|
-
onRecalculateBudgets: b
|
|
1244
|
-
}
|
|
1245
|
-
)
|
|
1246
|
-
}
|
|
1247
|
-
)
|
|
1248
|
-
]
|
|
1249
|
-
}
|
|
1250
|
-
);
|
|
1251
|
-
}, Wo = I(Ft), se = {
|
|
1314
|
+
isLoaded: n
|
|
1315
|
+
}), !d || !n) return /* @__PURE__ */ e(ue, {});
|
|
1316
|
+
const B = r.length === 0;
|
|
1317
|
+
return /* @__PURE__ */ m(at, {
|
|
1318
|
+
contentStyles: {
|
|
1319
|
+
height: "calc(100% - 66px)",
|
|
1320
|
+
":last-child": { pb: 0 }
|
|
1321
|
+
},
|
|
1322
|
+
primaryCtaLabel: B ? c.get_started_cta : c.details_cta,
|
|
1323
|
+
primaryCtaLabelAria: c.details_cta_aria,
|
|
1324
|
+
sx: { height: "100%" },
|
|
1325
|
+
title: c.budgets_title,
|
|
1326
|
+
...t,
|
|
1327
|
+
children: [/* @__PURE__ */ e(zt, {
|
|
1328
|
+
budgetsCopy: c,
|
|
1329
|
+
difference: b,
|
|
1330
|
+
handleAddClick: S,
|
|
1331
|
+
shouldShowZeroState: B
|
|
1332
|
+
}), /* @__PURE__ */ e($, {
|
|
1333
|
+
ariaLabelClose: g.close_aria,
|
|
1334
|
+
isOpen: f,
|
|
1335
|
+
onClose: () => _(!1),
|
|
1336
|
+
title: c.add_new_title,
|
|
1337
|
+
children: /* @__PURE__ */ e(ze, {
|
|
1338
|
+
onAddBudget: A,
|
|
1339
|
+
onRecalculateBudgets: h
|
|
1340
|
+
})
|
|
1341
|
+
})]
|
|
1342
|
+
});
|
|
1343
|
+
}, En = I(Ft), se = {
|
|
1252
1344
|
CANCEL_DELETE: "Cancel - Delete",
|
|
1253
1345
|
END_SAVE: "End - Save",
|
|
1254
1346
|
END_DELETE: "End - Delete",
|
|
1255
1347
|
START_DELETE: "Start - Delete"
|
|
1256
|
-
}, Ut = ({
|
|
1257
|
-
|
|
1258
|
-
onEvent: n,
|
|
1259
|
-
onViewHistory: c,
|
|
1260
|
-
transactionListProps: i
|
|
1261
|
-
}) => {
|
|
1262
|
-
const {
|
|
1263
|
-
alert: a,
|
|
1264
|
-
dateRange: s,
|
|
1265
|
-
deleteBudget: o,
|
|
1266
|
-
selectedBudget: r,
|
|
1267
|
-
selectedSubBudget: p,
|
|
1268
|
-
setAlert: d,
|
|
1269
|
-
setSelectedBudget: u,
|
|
1270
|
-
updateBudget: S
|
|
1271
|
-
} = w(), { budgets: g, common: h } = E(), { isCopyLoaded: _, selectedAccountGuids: y } = Q(), A = H(), { setFilter: v } = ee(), [b, B] = l.useState(""), [f, T] = l.useState(null), [L, M] = l.useState(!1), N = l.useRef(!1);
|
|
1348
|
+
}, Ut = ({ onClose: t, onEvent: o, onViewHistory: i, transactionListProps: r }) => {
|
|
1349
|
+
const { alert: n, dateRange: s, deleteBudget: a, selectedBudget: c, selectedSubBudget: g, setAlert: d, setSelectedBudget: u, updateBudget: C } = E(), { budgets: p, common: b } = w(), { isCopyLoaded: f, selectedAccountGuids: _ } = q(), S = V(), { setFilter: A } = X(), [h, B] = l.useState(""), [y, T] = l.useState(null), [M, L] = l.useState(!1), N = l.useRef(!1);
|
|
1272
1350
|
if (l.useEffect(() => {
|
|
1273
|
-
!
|
|
1274
|
-
accounts:
|
|
1351
|
+
!c || g || (B(`${c.amount}`), A({
|
|
1352
|
+
accounts: _,
|
|
1275
1353
|
dateRange: s,
|
|
1276
1354
|
custom: ({ category_guid: j, top_level_category_guid: K }) => {
|
|
1277
|
-
const { category_guid: Y } =
|
|
1355
|
+
const { category_guid: Y } = c;
|
|
1278
1356
|
return j === Y || K === Y;
|
|
1279
1357
|
}
|
|
1280
|
-
}),
|
|
1281
|
-
}, [
|
|
1282
|
-
if (!
|
|
1358
|
+
}), L(!0));
|
|
1359
|
+
}, [c]), !f) return /* @__PURE__ */ e(ue, {});
|
|
1360
|
+
if (!c) return null;
|
|
1283
1361
|
const k = () => {
|
|
1284
|
-
B(""), T(null),
|
|
1362
|
+
B(""), T(null), L(!1), setTimeout(() => {
|
|
1285
1363
|
u(void 0), t?.();
|
|
1286
1364
|
}, 250);
|
|
1287
1365
|
}, G = () => {
|
|
1288
|
-
|
|
1366
|
+
y === "delete" && o?.(se.CANCEL_DELETE, h), B(c.amount ? `${c.amount}` : ""), T(null);
|
|
1289
1367
|
}, F = async () => {
|
|
1290
|
-
if (
|
|
1368
|
+
if (y === "edit") {
|
|
1291
1369
|
if (N.current) return;
|
|
1292
|
-
N.current = !0, await
|
|
1293
|
-
...
|
|
1294
|
-
amount: Number(
|
|
1295
|
-
}),
|
|
1296
|
-
R(g.alert_budget_updated, r.category.name)
|
|
1297
|
-
), T(null), N.current = !1;
|
|
1370
|
+
N.current = !0, await C({
|
|
1371
|
+
...c,
|
|
1372
|
+
amount: Number(h)
|
|
1373
|
+
}), o?.(se.END_SAVE, h), d(R(p.alert_budget_updated, c.category.name)), T(null), N.current = !1;
|
|
1298
1374
|
}
|
|
1299
|
-
|
|
1300
|
-
}, { remainingAmount:
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
sx: {
|
|
1329
|
-
"& .list-wrapper": {
|
|
1330
|
-
pr: 24
|
|
1375
|
+
y === "delete" && (await a(c.guid), o?.(se.END_DELETE, h), k());
|
|
1376
|
+
}, { remainingAmount: ye, spentPercentage: _e, iconColor: oe } = Ke(c.transaction_total ?? 0, c.amount ?? 0), be = (j, K) => R(j, /* @__PURE__ */ e("b", { children: K }));
|
|
1377
|
+
return /* @__PURE__ */ m(l.Fragment, { children: [/* @__PURE__ */ m($, {
|
|
1378
|
+
ariaLabelClose: b.close_aria,
|
|
1379
|
+
footerStyles: {
|
|
1380
|
+
px: 24,
|
|
1381
|
+
py: 16
|
|
1382
|
+
},
|
|
1383
|
+
isOpen: M,
|
|
1384
|
+
onClose: k,
|
|
1385
|
+
onPrimaryAction: () => T("edit"),
|
|
1386
|
+
onSecondaryAction: () => {
|
|
1387
|
+
o?.(se.START_DELETE, h), T("delete");
|
|
1388
|
+
},
|
|
1389
|
+
primaryText: p.details_edit_button,
|
|
1390
|
+
secondaryColor: "error",
|
|
1391
|
+
secondaryText: p.details_delete_button,
|
|
1392
|
+
sx: { "& .list-wrapper": { pr: 24 } },
|
|
1393
|
+
title: R(p.details_type_title, c.category.name),
|
|
1394
|
+
children: [
|
|
1395
|
+
/* @__PURE__ */ e(nt, {
|
|
1396
|
+
amount: c.amount,
|
|
1397
|
+
icon: /* @__PURE__ */ e(H, {
|
|
1398
|
+
categoryGuid: c.category.guid,
|
|
1399
|
+
size: 44,
|
|
1400
|
+
sx: {
|
|
1401
|
+
bgcolor: st(Ee(c.category.guid, S), 0.15),
|
|
1402
|
+
border: `1px solid ${Ee(c.category.guid, S)}`,
|
|
1403
|
+
color: "text.primary"
|
|
1331
1404
|
}
|
|
1405
|
+
}),
|
|
1406
|
+
iconColor: oe,
|
|
1407
|
+
onViewHistory: i,
|
|
1408
|
+
remainingAmount: ye,
|
|
1409
|
+
spentPercentage: _e,
|
|
1410
|
+
startDate: (s.start.getTime() ?? 0) / 1e3,
|
|
1411
|
+
totalTransaction: c.transaction_total
|
|
1412
|
+
}),
|
|
1413
|
+
/* @__PURE__ */ e(Se, { ...r }),
|
|
1414
|
+
n && /* @__PURE__ */ e(De, {
|
|
1415
|
+
anchorOrigin: {
|
|
1416
|
+
horizontal: "right",
|
|
1417
|
+
vertical: "bottom"
|
|
1332
1418
|
},
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
{
|
|
1363
|
-
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
1364
|
-
autoHideDuration: 3500,
|
|
1365
|
-
onClose: () => d(""),
|
|
1366
|
-
open: !!a,
|
|
1367
|
-
children: /* @__PURE__ */ e(Ae, { closeText: "", onClose: () => d(""), severity: "success", variant: "filled", children: a })
|
|
1368
|
-
}
|
|
1369
|
-
)
|
|
1370
|
-
]
|
|
1371
|
-
}
|
|
1372
|
-
),
|
|
1373
|
-
f && /* @__PURE__ */ e(
|
|
1374
|
-
mt,
|
|
1375
|
-
{
|
|
1376
|
-
closeAriaLabel: h.close_aria,
|
|
1377
|
-
content: ye(
|
|
1378
|
-
g[f === "edit" ? "edit_budget_content" : "delete_description"],
|
|
1379
|
-
r.category.name
|
|
1380
|
-
),
|
|
1381
|
-
handleInputChange: (j) => B(j.toString()),
|
|
1382
|
-
handleModalClose: G,
|
|
1383
|
-
handlePrimaryAction: F,
|
|
1384
|
-
handleSecondaryAction: G,
|
|
1385
|
-
inputLabel: f === "edit" ? g.details_edit_title : "",
|
|
1386
|
-
inputValue: b,
|
|
1387
|
-
isOpen: !0,
|
|
1388
|
-
primaryColor: f === "edit" ? "primary" : "error",
|
|
1389
|
-
primaryText: g[f === "edit" ? "add_save_button" : "details_delete_button"],
|
|
1390
|
-
secondaryColor: f === "edit" ? "primary" : "inherit",
|
|
1391
|
-
secondaryText: h.cancel_button,
|
|
1392
|
-
title: g[f === "edit" ? "details_edit_title" : "delete_title"]
|
|
1393
|
-
}
|
|
1394
|
-
)
|
|
1395
|
-
] });
|
|
1396
|
-
}, Ho = I(Ut);
|
|
1419
|
+
autoHideDuration: 3500,
|
|
1420
|
+
onClose: () => d(""),
|
|
1421
|
+
open: !!n,
|
|
1422
|
+
children: /* @__PURE__ */ e(Te, {
|
|
1423
|
+
closeText: "",
|
|
1424
|
+
onClose: () => d(""),
|
|
1425
|
+
severity: "success",
|
|
1426
|
+
variant: "filled",
|
|
1427
|
+
children: n
|
|
1428
|
+
})
|
|
1429
|
+
})
|
|
1430
|
+
]
|
|
1431
|
+
}), y && /* @__PURE__ */ e(qe, {
|
|
1432
|
+
closeAriaLabel: b.close_aria,
|
|
1433
|
+
content: be(p[y === "edit" ? "edit_budget_content" : "delete_description"], c.category.name),
|
|
1434
|
+
handleInputChange: (j) => B(j.toString()),
|
|
1435
|
+
handleModalClose: G,
|
|
1436
|
+
handlePrimaryAction: F,
|
|
1437
|
+
handleSecondaryAction: G,
|
|
1438
|
+
inputLabel: y === "edit" ? p.details_edit_title : "",
|
|
1439
|
+
inputValue: h,
|
|
1440
|
+
isOpen: !0,
|
|
1441
|
+
primaryColor: y === "edit" ? "primary" : "error",
|
|
1442
|
+
primaryText: p[y === "edit" ? "add_save_button" : "details_delete_button"],
|
|
1443
|
+
secondaryColor: y === "edit" ? "primary" : "inherit",
|
|
1444
|
+
secondaryText: b.cancel_button,
|
|
1445
|
+
title: p[y === "edit" ? "details_edit_title" : "delete_title"]
|
|
1446
|
+
})] });
|
|
1447
|
+
}, wn = I(Ut);
|
|
1397
1448
|
export {
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1449
|
+
En as BubbleBudgetsMiniWidget,
|
|
1450
|
+
Dn as BubbleBudgetsWidget,
|
|
1451
|
+
wn as BudgetDetailsDrawerV2
|
|
1401
1452
|
};
|