@mx-cartographer/experiences 7.0.48 → 7.0.49-alpha.mega2
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/CHANGELOG.md +6 -0
- package/dist/budgets/components/BubbleChart.d.ts +1 -0
- package/dist/budgets/components/bubblechart/Bubble.d.ts +2 -1
- package/dist/budgets/components/bubblechart/Mercury.d.ts +3 -2
- package/dist/budgets/index.es.js +635 -570
- package/dist/budgets/utils/BubblesSVG.d.ts +25 -8
- package/dist/common/index.es.js +3 -1
- package/dist/common/types/AppData.d.ts +1 -0
- package/package.json +1 -1
package/dist/budgets/index.es.js
CHANGED
|
@@ -1,129 +1,153 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as u, Fragment as Ge } from "react/jsx-runtime";
|
|
2
2
|
import l from "react";
|
|
3
|
-
import { observer as
|
|
3
|
+
import { observer as D } from "mobx-react-lite";
|
|
4
4
|
import { endOfMonth as de } from "date-fns/endOfMonth";
|
|
5
|
-
import { startOfMonth as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { startOfMonth as q } from "date-fns/startOfMonth";
|
|
6
|
+
import F from "@mui/material/Box";
|
|
7
|
+
import B from "@mui/material/Stack";
|
|
8
8
|
import Q from "@mui/material/styles/useTheme";
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { u as
|
|
11
|
-
import { C as
|
|
12
|
-
import * as
|
|
13
|
-
import
|
|
14
|
-
import { i as w, m as
|
|
15
|
-
import { L as
|
|
9
|
+
import { Icon as P, Text as f, CategoryIcon as W, H1 as je, H3 as Se } from "@mxenabled/mxui";
|
|
10
|
+
import { u as Ue } from "../BudgetUtil-2EncZLBQ.mjs";
|
|
11
|
+
import { C as ze } from "../ConnectionsDrawer-BprLSCBH.mjs";
|
|
12
|
+
import * as O from "d3";
|
|
13
|
+
import Fe from "@mui/material/Tooltip";
|
|
14
|
+
import { a as me, i as w, m as U, u as I, g as H, b as ee, p as We, j as te, h as ne, d as Ae } from "../hooks-CE2TKk4a.mjs";
|
|
15
|
+
import { L as G } from "../Loader-DUaFpDGv.mjs";
|
|
16
16
|
import { E as ce } from "../EmptyState-C0lr9E5T.mjs";
|
|
17
|
-
import { u as
|
|
18
|
-
import { A as
|
|
19
|
-
import
|
|
17
|
+
import { u as ge } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
18
|
+
import { A as L, W as He } from "../WidgetContainer-hsbxZmZB.mjs";
|
|
19
|
+
import X from "@mui/material/List";
|
|
20
20
|
import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
|
|
21
|
-
import
|
|
21
|
+
import xe from "@mui/material/Button";
|
|
22
22
|
import oe from "@mui/material/Divider";
|
|
23
|
-
import
|
|
23
|
+
import K from "@mui/material/ListItem";
|
|
24
24
|
import ae from "@mui/material/ListItemAvatar";
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { b as
|
|
28
|
-
import { D as
|
|
29
|
-
import
|
|
30
|
-
import { C as
|
|
31
|
-
import { a as
|
|
32
|
-
import { M as
|
|
33
|
-
import { isAfter as
|
|
34
|
-
import { startOfToday as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import { e as
|
|
40
|
-
import { T as
|
|
41
|
-
import
|
|
42
|
-
import
|
|
25
|
+
import V from "@mui/material/ListItemButton";
|
|
26
|
+
import Y from "@mui/material/ListItemText";
|
|
27
|
+
import { b as R } from "../Localization-2MODESHW.mjs";
|
|
28
|
+
import { D as N } from "../Drawer-kEE73B87.mjs";
|
|
29
|
+
import Xe from "@mui/material/ListItemSecondaryAction";
|
|
30
|
+
import { C as Ke } from "../CurrencyInput-CRtdzs3o.mjs";
|
|
31
|
+
import { a as j } from "../Dialog-CWW597AF.mjs";
|
|
32
|
+
import { M as Ve } from "../MiniWidgetContainer-Bg0bELc2.mjs";
|
|
33
|
+
import { isAfter as Ye } from "date-fns/isAfter";
|
|
34
|
+
import { startOfToday as Z } from "date-fns/startOfToday";
|
|
35
|
+
import Ze from "@mui/material/Alert";
|
|
36
|
+
import qe from "@mui/material/Snackbar";
|
|
37
|
+
import ye from "@mui/material/Tab";
|
|
38
|
+
import Je from "@mui/material/Tabs";
|
|
39
|
+
import { e as Qe } from "../exportTransactionsToCSV-D8TTNrrE.mjs";
|
|
40
|
+
import { T as ve, a as et } from "../TransactionDetails-Cl8xcpbh.mjs";
|
|
41
|
+
import pe from "@mui/material/Card";
|
|
42
|
+
import he from "@mui/material/CardContent";
|
|
43
43
|
import { S as ue } from "../StatusBar-BK_uYHAB.mjs";
|
|
44
|
-
import { S as
|
|
45
|
-
import { u as
|
|
46
|
-
import
|
|
47
|
-
import { subDays as
|
|
48
|
-
import
|
|
49
|
-
import { M as
|
|
50
|
-
const
|
|
51
|
-
const o = (
|
|
52
|
-
|
|
53
|
-
}, i = (
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
44
|
+
import { S as Te } from "../SingleSegmentDonut-BgbLgwHi.mjs";
|
|
45
|
+
import { u as tt, b as nt } from "../CategorySelectorDrawer-BmenK5bu.mjs";
|
|
46
|
+
import we from "@mui/material/CardHeader";
|
|
47
|
+
import { subDays as ot } from "date-fns/subDays";
|
|
48
|
+
import at from "@mui/material/IconButton";
|
|
49
|
+
import { M as rt } from "../ManageIncome-clecqBHm.mjs";
|
|
50
|
+
const be = 5, Ie = 100, J = 25, st = (t) => {
|
|
51
|
+
const o = (s) => {
|
|
52
|
+
s.active || t.alphaTarget(0.3).restart(), s.subject.fx = s.subject.x, s.subject.fy = s.subject.y;
|
|
53
|
+
}, i = (s) => {
|
|
54
|
+
s.subject.fx = s.x, s.subject.fy = s.y;
|
|
55
|
+
}, r = (s) => {
|
|
56
|
+
s.active || t.alphaTarget(0), s.subject.fx = null, s.subject.fy = null;
|
|
57
57
|
};
|
|
58
|
-
return
|
|
58
|
+
return O.drag().on("start", o).on("drag", i).on("end", r);
|
|
59
59
|
}, it = (t) => {
|
|
60
60
|
let o = t.transaction_total / t.amount;
|
|
61
61
|
o < 0 ? o = 0 : o > 1 && (o = 1);
|
|
62
|
-
const i = o * 2 * Math.PI,
|
|
63
|
-
return (n) => (
|
|
62
|
+
const i = o * 2 * Math.PI, r = O.interpolate(0, i), s = O.arc().cornerRadius(5).innerRadius(t.radius - be * 2).outerRadius(t.radius - be).startAngle(0).endAngle(0);
|
|
63
|
+
return (n) => (s.endAngle(r(n)), s(t) || "");
|
|
64
64
|
}, ct = (t) => {
|
|
65
|
-
|
|
65
|
+
O.selectAll(".bubble").call(st(t));
|
|
66
66
|
}, lt = (t, o, i) => {
|
|
67
67
|
t.alpha(1).restart().force(
|
|
68
68
|
"x",
|
|
69
|
-
|
|
69
|
+
O.forceX().x(i / 2).strength(0.01)
|
|
70
70
|
).force(
|
|
71
71
|
"y",
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
O.forceY().y(o / 2).strength(0.01)
|
|
73
|
+
).on("tick", () => {
|
|
74
|
+
O.selectAll(".bubble").data(t.nodes()).attr("transform", (r) => `translate(${r.x},${r.y})`);
|
|
75
|
+
});
|
|
76
|
+
}, De = (t, o) => O.scaleLinear().domain([t, o]).range([J, Ie]), dt = (t) => {
|
|
77
|
+
const o = t.reduce((n, a) => {
|
|
78
|
+
const c = Math.max(a.transaction_total, a.amount);
|
|
77
79
|
return c > n ? c : n;
|
|
78
|
-
}, 0), i = t.reduce((n,
|
|
79
|
-
const c = Math.max(
|
|
80
|
+
}, 0), i = t.reduce((n, a) => {
|
|
81
|
+
const c = Math.max(a.transaction_total, a.amount);
|
|
80
82
|
return c < n ? c : n;
|
|
81
|
-
}, o),
|
|
82
|
-
const
|
|
83
|
+
}, o), r = De(i, o), s = t.map((n) => {
|
|
84
|
+
const a = r(Math.max(n.transaction_total, n.amount)) || 25;
|
|
83
85
|
return {
|
|
84
86
|
...n,
|
|
85
|
-
radius:
|
|
87
|
+
radius: a
|
|
86
88
|
};
|
|
87
89
|
});
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
return O.forceSimulation(s).velocityDecay(0.05).force("collide", O.forceCollide((n) => n.radius + 2).strength(0.5));
|
|
91
|
+
}, ut = (t, o, i) => {
|
|
92
|
+
const s = Math.PI * J * J * t, n = i * o;
|
|
93
|
+
let a = J;
|
|
94
|
+
return s < n && (a = Math.min(Ie, Math.sqrt(n / t / Math.PI))), { targetMinRadius: Math.max(20, a * 0.6), targetMaxRadius: a };
|
|
95
|
+
}, mt = (t, o, i, r, s) => {
|
|
96
|
+
const { targetMinRadius: n, targetMaxRadius: a } = ut(t, o, s);
|
|
97
|
+
return O.scaleLinear().domain([r, i]).range([n, a]);
|
|
98
|
+
}, gt = (t, o, i = !1, r, s) => {
|
|
99
|
+
const n = o.map((d) => Math.max(d.transaction_total, d.amount)), a = Math.min(...n), c = Math.max(...n), _ = i ? mt(t.length, r, c, a, s) : De(a, c);
|
|
100
|
+
return t.map((d) => ({
|
|
101
|
+
...d,
|
|
102
|
+
radius: _(Math.max(d.transaction_total, d.amount))
|
|
103
|
+
}));
|
|
104
|
+
}, Ce = 5, pt = 2e3, ht = ({ bubble: t }) => {
|
|
93
105
|
const o = Q(), {
|
|
94
|
-
|
|
106
|
+
amount: i,
|
|
107
|
+
guid: r,
|
|
95
108
|
budgetColors: { mercury: s },
|
|
96
|
-
radius:
|
|
97
|
-
|
|
109
|
+
radius: n,
|
|
110
|
+
transaction_total: a
|
|
111
|
+
} = t, c = `mercury-${r}`;
|
|
98
112
|
l.useEffect(() => {
|
|
99
|
-
|
|
100
|
-
}, [
|
|
101
|
-
const
|
|
102
|
-
return /* @__PURE__ */ e("g", { className:
|
|
113
|
+
O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(pt).delay(0).attr("class", "status").attr("style", `fill: ${s}; fill-opacity: 1;`).attrTween("d", () => it(t));
|
|
114
|
+
}, [i, n, a]);
|
|
115
|
+
const _ = O.arc().innerRadius((d) => d - 2 * Ce).outerRadius((d) => d - Ce).startAngle(0).endAngle(2 * Math.PI);
|
|
116
|
+
return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
|
|
103
117
|
"path",
|
|
104
118
|
{
|
|
105
|
-
d:
|
|
119
|
+
d: _(n) || "",
|
|
106
120
|
style: { fill: o.palette.common.white, fillOpacity: 0.35 }
|
|
107
121
|
}
|
|
108
122
|
) });
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function pt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
123
|
+
}, _t = l.memo(ht), $ = 75, le = 50;
|
|
124
|
+
function ft({ bubble: t, isDraggable: o, isMiniWidget: i, onClick: r = () => {
|
|
112
125
|
} }) {
|
|
113
|
-
const [s,
|
|
126
|
+
const [s, n] = l.useState(!1), { clientConfig: a } = me(), c = a?.is_mx_mobile && i, _ = l.useMemo(() => {
|
|
127
|
+
if (t)
|
|
128
|
+
return {
|
|
129
|
+
amount: t.amount,
|
|
130
|
+
budgetColors: t.budgetColors,
|
|
131
|
+
guid: t.guid,
|
|
132
|
+
radius: t.radius,
|
|
133
|
+
transaction_total: t.transaction_total
|
|
134
|
+
};
|
|
135
|
+
}, [t.amount, t.budgetColors, t.guid, t.radius, t.transaction_total]);
|
|
114
136
|
if (!t) return;
|
|
115
137
|
const {
|
|
116
|
-
budgetColors: { background:
|
|
117
|
-
category: { icon:
|
|
118
|
-
guid:
|
|
119
|
-
description:
|
|
120
|
-
radius:
|
|
121
|
-
x:
|
|
122
|
-
y:
|
|
123
|
-
} = t;
|
|
124
|
-
let
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
budgetColors: { background: d, text: m },
|
|
139
|
+
category: { icon: S, name: b },
|
|
140
|
+
guid: p,
|
|
141
|
+
description: g,
|
|
142
|
+
radius: h,
|
|
143
|
+
x: y,
|
|
144
|
+
y: v
|
|
145
|
+
} = t, A = c ? -8 : -12;
|
|
146
|
+
let x = A, C = A;
|
|
147
|
+
h > $ ? (x = -14, C = -45) : h > le && (C = -32);
|
|
148
|
+
let E = 32;
|
|
149
|
+
h <= $ && (E = c ? 16 : 24);
|
|
150
|
+
const M = `${t.category.name}: ${g}`, k = {
|
|
127
151
|
modifiers: [
|
|
128
152
|
{
|
|
129
153
|
name: "offset",
|
|
@@ -131,101 +155,132 @@ function pt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
|
131
155
|
}
|
|
132
156
|
]
|
|
133
157
|
};
|
|
134
|
-
return /* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ u(
|
|
135
159
|
"g",
|
|
136
160
|
{
|
|
137
161
|
className: "bubble",
|
|
138
|
-
id: `bubble-${
|
|
139
|
-
onClick: () =>
|
|
140
|
-
onMouseEnter: () =>
|
|
141
|
-
onMouseLeave: () =>
|
|
162
|
+
id: `bubble-${p}`,
|
|
163
|
+
onClick: () => r(t),
|
|
164
|
+
onMouseEnter: () => n(!0),
|
|
165
|
+
onMouseLeave: () => n(!1),
|
|
142
166
|
style: { cursor: o ? "pointer" : "default" },
|
|
143
167
|
textAnchor: "middle",
|
|
144
|
-
x:
|
|
145
|
-
y:
|
|
168
|
+
x: y,
|
|
169
|
+
y: v,
|
|
146
170
|
children: [
|
|
147
171
|
/* @__PURE__ */ e(
|
|
148
|
-
|
|
172
|
+
Fe,
|
|
149
173
|
{
|
|
150
174
|
followCursor: !0,
|
|
151
175
|
open: s,
|
|
152
|
-
slotProps: { popper:
|
|
153
|
-
title:
|
|
154
|
-
children: /* @__PURE__ */ e("circle", { fill:
|
|
176
|
+
slotProps: { popper: k },
|
|
177
|
+
title: M,
|
|
178
|
+
children: /* @__PURE__ */ e("circle", { fill: d, id: `circle-${p}`, r: h })
|
|
155
179
|
}
|
|
156
180
|
),
|
|
157
|
-
/* @__PURE__ */ e("svg", { x
|
|
158
|
-
|
|
159
|
-
|
|
181
|
+
/* @__PURE__ */ e("svg", { x, y: C, children: /* @__PURE__ */ e(P, { name: S, size: E, sx: { fill: m } }) }),
|
|
182
|
+
h > $ && /* @__PURE__ */ e(
|
|
183
|
+
f,
|
|
160
184
|
{
|
|
161
185
|
bold: !0,
|
|
162
186
|
component: "text",
|
|
163
|
-
id: `budget-category-${
|
|
164
|
-
sx: { fill:
|
|
187
|
+
id: `budget-category-${p}`,
|
|
188
|
+
sx: { fill: m },
|
|
165
189
|
variant: "Small",
|
|
166
190
|
y: 4,
|
|
167
|
-
children:
|
|
191
|
+
children: b
|
|
168
192
|
}
|
|
169
193
|
),
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
h > le && /* @__PURE__ */ e(
|
|
195
|
+
f,
|
|
172
196
|
{
|
|
173
197
|
bold: !0,
|
|
174
198
|
component: "text",
|
|
175
|
-
id: `budget-description-${
|
|
176
|
-
sx: { fill:
|
|
199
|
+
id: `budget-description-${p}-1`,
|
|
200
|
+
sx: { fill: m },
|
|
177
201
|
variant: "Body",
|
|
178
|
-
y:
|
|
179
|
-
children:
|
|
202
|
+
y: h <= $ ? 12 : 24,
|
|
203
|
+
children: h <= $ ? g.split(" ")[0] : g
|
|
180
204
|
}
|
|
181
205
|
),
|
|
182
|
-
|
|
183
|
-
|
|
206
|
+
h <= $ && h > le && /* @__PURE__ */ e(
|
|
207
|
+
f,
|
|
184
208
|
{
|
|
185
209
|
component: "text",
|
|
186
|
-
id: `budget-description-${
|
|
187
|
-
sx: { fill:
|
|
210
|
+
id: `budget-description-${p}-2`,
|
|
211
|
+
sx: { fill: m },
|
|
188
212
|
variant: "XSmall",
|
|
189
213
|
y: 28,
|
|
190
|
-
children:
|
|
214
|
+
children: g.split(" ")[1]
|
|
191
215
|
}
|
|
192
216
|
),
|
|
193
|
-
/* @__PURE__ */ e(
|
|
217
|
+
/* @__PURE__ */ e(_t, { bubble: _ })
|
|
194
218
|
]
|
|
195
219
|
},
|
|
196
|
-
|
|
220
|
+
p
|
|
197
221
|
);
|
|
198
222
|
}
|
|
199
|
-
|
|
200
|
-
const ht = ({
|
|
223
|
+
const yt = ({
|
|
201
224
|
height: t,
|
|
202
225
|
width: o,
|
|
203
226
|
isDraggable: i = !1,
|
|
227
|
+
isMiniWidget: r = !1,
|
|
204
228
|
onClick: s = () => {
|
|
205
229
|
}
|
|
206
230
|
}) => {
|
|
207
|
-
const { detailedBudgets:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
231
|
+
const [n, a] = l.useState([]), c = l.useRef(null), { detailedBudgets: _ } = w(), d = l.useCallback(() => {
|
|
232
|
+
const m = c.current, S = dt(_), b = S.nodes();
|
|
233
|
+
if (m) {
|
|
234
|
+
const p = m.nodes(), g = new Map(p.map((h) => [h.guid, h]));
|
|
235
|
+
b.forEach((h) => {
|
|
236
|
+
const y = g.get(h.guid);
|
|
237
|
+
y && Object.assign(h, {
|
|
238
|
+
vx: y.vx,
|
|
239
|
+
vy: y.vy,
|
|
240
|
+
x: y.x,
|
|
241
|
+
y: y.y
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
c.current = S, a(b);
|
|
246
|
+
}, [_]);
|
|
247
|
+
return l.useEffect(() => {
|
|
248
|
+
d();
|
|
249
|
+
}, [d]), l.useEffect(() => () => {
|
|
250
|
+
c.current && (c.current.stop(), c.current = null);
|
|
251
|
+
}, []), l.useEffect(() => {
|
|
252
|
+
const m = c.current;
|
|
253
|
+
if (!m) return;
|
|
254
|
+
const S = m.nodes(), b = o > 0 && o < 450, p = gt(S, _, b, t, o);
|
|
255
|
+
m.nodes(p), lt(m, t, o), i && ct(m), a([...p]);
|
|
256
|
+
}, [t, o, i, _]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(o), children: n.map((m) => /* @__PURE__ */ e(
|
|
257
|
+
ft,
|
|
258
|
+
{
|
|
259
|
+
bubble: m,
|
|
260
|
+
isDraggable: i,
|
|
261
|
+
isMiniWidget: r,
|
|
262
|
+
onClick: s
|
|
263
|
+
},
|
|
264
|
+
m.guid
|
|
265
|
+
)) });
|
|
266
|
+
}, bt = D(yt), Ct = ({
|
|
212
267
|
isMiniWidget: t = !1,
|
|
213
268
|
onConnectAccountsClick: o,
|
|
214
269
|
createBudgetOnClick: i
|
|
215
270
|
}) => {
|
|
216
|
-
const { recalculateBudgets:
|
|
217
|
-
|
|
218
|
-
const { data:
|
|
219
|
-
|
|
271
|
+
const { recalculateBudgets: r } = w(), { spendCategories: s } = U(), { budgets: n } = I(), [a, c] = l.useState(!1), [_, d] = l.useState(!1), [m, S] = l.useState(!1), b = l.useMemo(() => [...s.filter((g) => g.totalAverageAmount > 0)], [s]), p = async () => {
|
|
272
|
+
S(!0);
|
|
273
|
+
const { data: g, isSuccess: h } = await r(b);
|
|
274
|
+
S(!1), h ? (g.length === 0 && c(!0), d(!1)) : d(!0);
|
|
220
275
|
};
|
|
221
|
-
return
|
|
276
|
+
return m ? /* @__PURE__ */ e(G, {}) : _ ? /* @__PURE__ */ e(
|
|
222
277
|
ce,
|
|
223
278
|
{
|
|
224
279
|
header: n.autogenerate_budgets_error_header,
|
|
225
280
|
icon: "error",
|
|
226
281
|
iconColor: "#4D4D4D",
|
|
227
|
-
onClick: (
|
|
228
|
-
|
|
282
|
+
onClick: (g) => {
|
|
283
|
+
g === "primary" ? p() : i();
|
|
229
284
|
},
|
|
230
285
|
primaryButton: n.autogenerate_budgets_error_primary_button,
|
|
231
286
|
secondaryButton: n.zero_state_generate_budgets_secondary_button,
|
|
@@ -237,14 +292,14 @@ const ht = ({
|
|
|
237
292
|
}
|
|
238
293
|
}
|
|
239
294
|
}
|
|
240
|
-
) : /* @__PURE__ */ e(
|
|
295
|
+
) : /* @__PURE__ */ e(Ge, { children: a ? /* @__PURE__ */ e(
|
|
241
296
|
ce,
|
|
242
297
|
{
|
|
243
298
|
header: n.zero_state_generate_budgets_header,
|
|
244
299
|
icon: "error",
|
|
245
300
|
iconColor: "#4D4D4D",
|
|
246
|
-
onClick: (
|
|
247
|
-
|
|
301
|
+
onClick: (g) => {
|
|
302
|
+
g === "primary" ? o() : i();
|
|
248
303
|
},
|
|
249
304
|
primaryButton: n.zero_state_generate_budgets_primary_button,
|
|
250
305
|
secondaryButton: n.zero_state_generate_budgets_secondary_button,
|
|
@@ -266,8 +321,8 @@ const ht = ({
|
|
|
266
321
|
header: n.create_budgets_title,
|
|
267
322
|
icon: "bubble_chart",
|
|
268
323
|
iconColor: "#1A1A1A",
|
|
269
|
-
onClick: (
|
|
270
|
-
|
|
324
|
+
onClick: (g) => {
|
|
325
|
+
g === "primary" ? p() : i();
|
|
271
326
|
},
|
|
272
327
|
primaryButton: n.empty_state_primary_button,
|
|
273
328
|
secondaryButton: t ? void 0 : n.empty_state_secondary_button,
|
|
@@ -284,104 +339,105 @@ const ht = ({
|
|
|
284
339
|
}
|
|
285
340
|
}
|
|
286
341
|
) });
|
|
287
|
-
},
|
|
342
|
+
}, Ee = D(
|
|
288
343
|
({
|
|
289
344
|
createBudgetOnClick: t = () => {
|
|
290
345
|
},
|
|
291
346
|
height: o,
|
|
292
347
|
isDraggable: i = !1,
|
|
293
|
-
isMiniWidget:
|
|
294
|
-
shouldShowZeroState:
|
|
348
|
+
isMiniWidget: r = !1,
|
|
349
|
+
shouldShowZeroState: s,
|
|
295
350
|
unavailableWidth: n = 24
|
|
296
351
|
}) => {
|
|
297
|
-
const { onEvent:
|
|
298
|
-
c(
|
|
299
|
-
budget_category:
|
|
352
|
+
const { onEvent: a } = H(), { setSelectedBudget: c } = w(), { isLoadingCategoryTotals: _ } = U(), { isInitialized: d } = ee(), { accounts: m } = I(), { availableWidth: S } = We(), { isMobile: b } = ge(), [p, g] = l.useState(!1), h = l.useMemo(() => S - n, [S]), y = (A) => {
|
|
353
|
+
c(A), a(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
354
|
+
budget_category: A.category.name,
|
|
300
355
|
click_type: "bubble"
|
|
301
356
|
});
|
|
302
|
-
},
|
|
303
|
-
|
|
357
|
+
}, v = () => {
|
|
358
|
+
g(!0), a(L.ACCOUNTS_CLICK_CONNECT);
|
|
304
359
|
};
|
|
305
|
-
return
|
|
306
|
-
|
|
307
|
-
|
|
360
|
+
return _ ? /* @__PURE__ */ e(B, { alignItems: "center", height: o, justifyContent: "center", width: Math.abs(h), children: /* @__PURE__ */ e(G, {}) }) : /* @__PURE__ */ u(F, { ml: s || b ? 0 : 24, sx: { alignSelf: "center" }, children: [
|
|
361
|
+
s || !d ? /* @__PURE__ */ e(
|
|
362
|
+
Ct,
|
|
308
363
|
{
|
|
309
364
|
createBudgetOnClick: t,
|
|
310
|
-
isMiniWidget:
|
|
311
|
-
onConnectAccountsClick:
|
|
365
|
+
isMiniWidget: r,
|
|
366
|
+
onConnectAccountsClick: v
|
|
312
367
|
}
|
|
313
368
|
) : /* @__PURE__ */ e(
|
|
314
|
-
|
|
369
|
+
bt,
|
|
315
370
|
{
|
|
316
371
|
height: o,
|
|
317
372
|
isDraggable: i,
|
|
318
|
-
|
|
319
|
-
|
|
373
|
+
isMiniWidget: r,
|
|
374
|
+
onClick: y,
|
|
375
|
+
width: h
|
|
320
376
|
}
|
|
321
377
|
),
|
|
322
378
|
/* @__PURE__ */ e(
|
|
323
|
-
|
|
379
|
+
ze,
|
|
324
380
|
{
|
|
325
|
-
onClose: () =>
|
|
326
|
-
showConnectionsWidget:
|
|
327
|
-
title:
|
|
381
|
+
onClose: () => g(!1),
|
|
382
|
+
showConnectionsWidget: p,
|
|
383
|
+
title: m.manage_connections
|
|
328
384
|
}
|
|
329
385
|
)
|
|
330
386
|
] });
|
|
331
387
|
}
|
|
332
|
-
),
|
|
333
|
-
const { budgets: t } =
|
|
334
|
-
return /* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */ e(
|
|
337
|
-
/* @__PURE__ */ e(
|
|
388
|
+
), Bt = D(() => {
|
|
389
|
+
const { budgets: t } = I(), { totalBudgeted: o } = w(), { incomeTotal: i } = te(), r = i - o;
|
|
390
|
+
return /* @__PURE__ */ u(B, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
|
|
391
|
+
/* @__PURE__ */ u(B, { alignItems: "center", children: [
|
|
392
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(i, "0,0") }),
|
|
393
|
+
/* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.projected_income })
|
|
338
394
|
] }),
|
|
339
|
-
/* @__PURE__ */ e(
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */ e(
|
|
342
|
-
/* @__PURE__ */ e(
|
|
395
|
+
/* @__PURE__ */ e(f, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
|
|
396
|
+
/* @__PURE__ */ u(B, { alignItems: "center", children: [
|
|
397
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(o, "0,0") }),
|
|
398
|
+
/* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.budgeted })
|
|
343
399
|
] }),
|
|
344
|
-
/* @__PURE__ */ e(
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */ e(
|
|
347
|
-
/* @__PURE__ */ e(
|
|
400
|
+
/* @__PURE__ */ e(f, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
|
|
401
|
+
/* @__PURE__ */ u(B, { alignItems: "center", children: [
|
|
402
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: T(r, "0,0") }),
|
|
403
|
+
/* @__PURE__ */ e(f, { color: "secondary", variant: "Small", children: t.remaining })
|
|
348
404
|
] })
|
|
349
405
|
] });
|
|
350
|
-
}),
|
|
406
|
+
}), St = D(
|
|
351
407
|
({ category: t }) => {
|
|
352
|
-
const { budgets: o } =
|
|
353
|
-
const
|
|
354
|
-
return `${n} - ${
|
|
408
|
+
const { budgets: o } = I(), { budgets: i } = w(), r = l.useMemo(() => {
|
|
409
|
+
const s = i.find((c) => c.category_guid === t.guid), n = T(t.totalAverageAmount, "0,0"), a = s ? R(o.recalculate_previous_budget, T(s.amount, "0,0")) : o.recalculate_new_budget;
|
|
410
|
+
return `${n} - ${a}`;
|
|
355
411
|
}, [o, i]);
|
|
356
|
-
return /* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */ e(
|
|
358
|
-
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(
|
|
359
|
-
/* @__PURE__ */ e(
|
|
412
|
+
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
413
|
+
/* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { children: [
|
|
414
|
+
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid, variant: "filled" }) }),
|
|
415
|
+
/* @__PURE__ */ e(Y, { primary: t.name, secondary: r })
|
|
360
416
|
] }) }),
|
|
361
417
|
/* @__PURE__ */ e(oe, {})
|
|
362
418
|
] }, t.guid);
|
|
363
419
|
}
|
|
364
|
-
),
|
|
365
|
-
const { budgets: o, common: i } =
|
|
366
|
-
await
|
|
420
|
+
), At = ({ onRecalculateBudgets: t }) => {
|
|
421
|
+
const { budgets: o, common: i } = I(), { spendCategories: r } = U(), { recalculateBudgets: s, setAlert: n } = w(), [a, c] = l.useState(!1), _ = r.filter((m) => m.totalAverageAmount > 0), d = async () => {
|
|
422
|
+
await s(_), c(!1), n(o.alert_recalculated_budgets), t?.();
|
|
367
423
|
};
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */ e(
|
|
370
|
-
/* @__PURE__ */ e(
|
|
424
|
+
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
425
|
+
/* @__PURE__ */ e(xe, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: o.recalculate_button }),
|
|
426
|
+
/* @__PURE__ */ e(f, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: o.recalculate_help }),
|
|
371
427
|
/* @__PURE__ */ e(
|
|
372
|
-
|
|
428
|
+
N,
|
|
373
429
|
{
|
|
374
430
|
ariaLabelClose: i.close_aria,
|
|
375
|
-
isOpen:
|
|
431
|
+
isOpen: a,
|
|
376
432
|
onClose: () => c(!1),
|
|
377
|
-
onPrimaryAction:
|
|
433
|
+
onPrimaryAction: d,
|
|
378
434
|
title: o.recalculate_title,
|
|
379
|
-
children: /* @__PURE__ */
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
/* @__PURE__ */ e(
|
|
382
|
-
/* @__PURE__ */ e(
|
|
435
|
+
children: /* @__PURE__ */ u(B, { children: [
|
|
436
|
+
/* @__PURE__ */ u(B, { mx: 24, my: 16, children: [
|
|
437
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: o.recalculate_description_top }),
|
|
438
|
+
/* @__PURE__ */ e(f, { variant: "ParagraphSmall", children: o.recalculate_description_bottom })
|
|
383
439
|
] }),
|
|
384
|
-
/* @__PURE__ */ e(
|
|
440
|
+
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: _.map((m) => /* @__PURE__ */ e(St, { category: m }, m.guid)) }) })
|
|
385
441
|
] })
|
|
386
442
|
}
|
|
387
443
|
)
|
|
@@ -391,673 +447,682 @@ const ht = ({
|
|
|
391
447
|
categoryName: o,
|
|
392
448
|
onAmountChanged: i
|
|
393
449
|
}) => {
|
|
394
|
-
const { budgets:
|
|
395
|
-
return /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */ e(
|
|
398
|
-
|
|
399
|
-
T(
|
|
450
|
+
const { budgets: r } = I(), { totalBudgeted: s } = w(), { incomeTotal: n } = te(), a = n - s;
|
|
451
|
+
return /* @__PURE__ */ u(B, { gap: 16, children: [
|
|
452
|
+
/* @__PURE__ */ u(B, { children: [
|
|
453
|
+
/* @__PURE__ */ e(f, { children: R(
|
|
454
|
+
r.add_description_top,
|
|
455
|
+
T(a, "0,0")
|
|
400
456
|
) }),
|
|
401
|
-
/* @__PURE__ */ e(
|
|
457
|
+
/* @__PURE__ */ e(f, { children: R(r.add_description_bottom, o) })
|
|
402
458
|
] }),
|
|
403
459
|
/* @__PURE__ */ e(
|
|
404
|
-
|
|
460
|
+
Ke,
|
|
405
461
|
{
|
|
406
462
|
amount: t,
|
|
407
463
|
autoFocus: !0,
|
|
408
|
-
label:
|
|
464
|
+
label: r.add_label,
|
|
409
465
|
minAmount: 0,
|
|
410
466
|
setAmount: i,
|
|
411
467
|
sx: { ".MuiTypography-Body": { p: 0 } }
|
|
412
468
|
}
|
|
413
469
|
)
|
|
414
470
|
] });
|
|
415
|
-
},
|
|
416
|
-
const { budgets: i, common:
|
|
471
|
+
}, xt = D(({ category: t, onAddBudget: o }) => {
|
|
472
|
+
const { budgets: i, common: r } = I(), [s, n] = l.useState(!1), [a, c] = l.useState(
|
|
417
473
|
`${t.totalAmount === 0 ? "" : t.totalAmount}`
|
|
418
474
|
);
|
|
419
|
-
return /* @__PURE__ */
|
|
420
|
-
/* @__PURE__ */ e(
|
|
421
|
-
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(
|
|
475
|
+
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
476
|
+
/* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => n(!0), children: [
|
|
477
|
+
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(W, { categoryGuid: t.guid }) }),
|
|
422
478
|
/* @__PURE__ */ e(
|
|
423
|
-
|
|
479
|
+
Y,
|
|
424
480
|
{
|
|
425
481
|
primary: t.name,
|
|
426
482
|
secondary: T(t.totalAmount, "0,0")
|
|
427
483
|
}
|
|
428
484
|
),
|
|
429
|
-
/* @__PURE__ */ e(
|
|
485
|
+
/* @__PURE__ */ e(Xe, { children: /* @__PURE__ */ e(P, { name: "add", size: 20 }) })
|
|
430
486
|
] }) }, t.guid),
|
|
431
487
|
/* @__PURE__ */ e(
|
|
432
|
-
|
|
488
|
+
j,
|
|
433
489
|
{
|
|
434
|
-
copy: { close_aria:
|
|
435
|
-
disablePrimaryButton: Number(
|
|
436
|
-
isOpen:
|
|
490
|
+
copy: { close_aria: r.close_aria, title: i.add_title },
|
|
491
|
+
disablePrimaryButton: Number(a) <= 0,
|
|
492
|
+
isOpen: s,
|
|
437
493
|
onClose: () => n(!1),
|
|
438
|
-
onPrimaryAction: () => o(t, Number(
|
|
494
|
+
onPrimaryAction: () => o(t, Number(a)),
|
|
439
495
|
primaryText: i.add_save_button,
|
|
440
|
-
children: /* @__PURE__ */ e(re, { amount:
|
|
496
|
+
children: /* @__PURE__ */ e(re, { amount: a, categoryName: t.name, onAmountChanged: c })
|
|
441
497
|
}
|
|
442
498
|
)
|
|
443
499
|
] });
|
|
444
|
-
}),
|
|
445
|
-
const { budgets: o } =
|
|
446
|
-
await i(
|
|
500
|
+
}), Oe = D(({ onRecalculateBudgets: t }) => {
|
|
501
|
+
const { budgets: o } = I(), { addBudget: i, setAlert: r, unbudgetedCategories: s } = w(), n = async (a, c) => {
|
|
502
|
+
await i(a, c), r(R(o.alert_budget_created, a.name));
|
|
447
503
|
};
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */ e(
|
|
450
|
-
/* @__PURE__ */ e(
|
|
451
|
-
|
|
504
|
+
return /* @__PURE__ */ u(B, { children: [
|
|
505
|
+
/* @__PURE__ */ e(Bt, {}),
|
|
506
|
+
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(X, { children: s.map((a) => /* @__PURE__ */ e(
|
|
507
|
+
xt,
|
|
452
508
|
{
|
|
453
|
-
category:
|
|
509
|
+
category: a,
|
|
454
510
|
onAddBudget: n
|
|
455
511
|
},
|
|
456
|
-
|
|
512
|
+
a.guid
|
|
457
513
|
)) }) }),
|
|
458
|
-
/* @__PURE__ */ e(
|
|
514
|
+
/* @__PURE__ */ e(At, { onRecalculateBudgets: t })
|
|
459
515
|
] });
|
|
460
|
-
}),
|
|
461
|
-
const o = Q(), {
|
|
462
|
-
|
|
463
|
-
},
|
|
464
|
-
|
|
516
|
+
}), vt = (t) => {
|
|
517
|
+
const o = Q(), { clientConfig: i } = me(), r = i?.is_mx_mobile, { onEvent: s } = H(), { detailedBudgets: n, isDataLoaded: a, loadBudgetData: c, setTheme: _ } = w(), { budgets: d, common: m } = I(), { isCopyLoaded: S, isInitialized: b, selectedAccounts: p } = ee(), { reloadCategoryTotals: g } = U(), h = Ue(), y = n.length === 0, [v, A] = l.useState(!1), x = () => {
|
|
518
|
+
A(!0), s(L.BUDGETS_CLICK_ADD);
|
|
519
|
+
}, C = () => {
|
|
520
|
+
A(!1);
|
|
465
521
|
};
|
|
466
522
|
return l.useEffect(() => {
|
|
467
|
-
|
|
523
|
+
_(o);
|
|
468
524
|
}, [o]), l.useEffect(() => {
|
|
469
|
-
|
|
525
|
+
b && !a && g(p, q(/* @__PURE__ */ new Date()), de(/* @__PURE__ */ new Date())).then(
|
|
470
526
|
() => {
|
|
471
|
-
|
|
527
|
+
c().finally();
|
|
472
528
|
}
|
|
473
529
|
);
|
|
474
|
-
}, [
|
|
475
|
-
|
|
530
|
+
}, [b, p]), S ? /* @__PURE__ */ u(
|
|
531
|
+
Ve,
|
|
476
532
|
{
|
|
477
|
-
primaryCtaLabel:
|
|
478
|
-
title:
|
|
533
|
+
primaryCtaLabel: y ? d.get_started_cta : d.details_cta,
|
|
534
|
+
title: d.budgets_title,
|
|
479
535
|
...t,
|
|
480
536
|
children: [
|
|
481
|
-
a ? /* @__PURE__ */
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
{
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
537
|
+
a ? /* @__PURE__ */ u(
|
|
538
|
+
B,
|
|
539
|
+
{
|
|
540
|
+
sx: {
|
|
541
|
+
height: r ? "100%" : 450,
|
|
542
|
+
mt: r ? 8 : 32
|
|
543
|
+
},
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ e(
|
|
546
|
+
Ee,
|
|
547
|
+
{
|
|
548
|
+
createBudgetOnClick: x,
|
|
549
|
+
height: r ? 220 : 370,
|
|
550
|
+
isMiniWidget: !0,
|
|
551
|
+
shouldShowZeroState: y
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
!y && /* @__PURE__ */ u(F, { ml: 16, children: [
|
|
555
|
+
/* @__PURE__ */ e(f, { bold: !0, color: h < 0 ? "error.main" : "success.main", children: T(Math.abs(h), "0,0") }),
|
|
556
|
+
/* @__PURE__ */ e(f, { children: h < 0 ? d.overspent_in_budgets : d.left_in_budgets })
|
|
557
|
+
] })
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
) : /* @__PURE__ */ e(G, {}),
|
|
496
561
|
/* @__PURE__ */ e(
|
|
497
|
-
|
|
562
|
+
N,
|
|
498
563
|
{
|
|
499
|
-
ariaLabelClose:
|
|
500
|
-
isOpen:
|
|
501
|
-
onClose: () =>
|
|
502
|
-
title:
|
|
503
|
-
children: /* @__PURE__ */ e(
|
|
564
|
+
ariaLabelClose: m.close_aria,
|
|
565
|
+
isOpen: v,
|
|
566
|
+
onClose: () => A(!1),
|
|
567
|
+
title: d.add_new_title,
|
|
568
|
+
children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: C })
|
|
504
569
|
}
|
|
505
570
|
)
|
|
506
571
|
]
|
|
507
572
|
}
|
|
508
|
-
) : /* @__PURE__ */ e(
|
|
509
|
-
},
|
|
573
|
+
) : /* @__PURE__ */ e(G, {});
|
|
574
|
+
}, En = D(vt), Me = ({ budget: t }) => {
|
|
510
575
|
const {
|
|
511
576
|
amount: o,
|
|
512
577
|
budgetColors: { background: i },
|
|
513
|
-
category: { name:
|
|
514
|
-
category_guid:
|
|
578
|
+
category: { name: r },
|
|
579
|
+
category_guid: s,
|
|
515
580
|
percentage: n,
|
|
516
|
-
transaction_total:
|
|
581
|
+
transaction_total: a
|
|
517
582
|
} = t, c = [
|
|
518
583
|
{
|
|
519
584
|
color: i,
|
|
520
585
|
percentage: `${n}%`
|
|
521
586
|
}
|
|
522
587
|
];
|
|
523
|
-
return /* @__PURE__ */ e(
|
|
524
|
-
/* @__PURE__ */ e(
|
|
525
|
-
/* @__PURE__ */ e(
|
|
526
|
-
/* @__PURE__ */ e(
|
|
588
|
+
return /* @__PURE__ */ e(pe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(he, { children: /* @__PURE__ */ u(B, { alignItems: "center", gap: 16, children: [
|
|
589
|
+
/* @__PURE__ */ e(W, { categoryGuid: s, size: 56 }),
|
|
590
|
+
/* @__PURE__ */ e(je, { children: `${T(a, "0,0")} / ${T(o, "0,0")}` }),
|
|
591
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "XSmall", children: r }),
|
|
527
592
|
/* @__PURE__ */ e(ue, { data: c, height: 10 })
|
|
528
593
|
] }) }) });
|
|
529
|
-
},
|
|
530
|
-
const { budgets: t } =
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */ e(
|
|
533
|
-
/* @__PURE__ */ e(
|
|
534
|
-
/* @__PURE__ */ e(
|
|
594
|
+
}, Tt = D(() => {
|
|
595
|
+
const { budgets: t } = I();
|
|
596
|
+
return /* @__PURE__ */ u(B, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
|
|
597
|
+
/* @__PURE__ */ e(P, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
|
|
598
|
+
/* @__PURE__ */ e(f, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
|
|
599
|
+
/* @__PURE__ */ e(f, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
|
|
535
600
|
] });
|
|
536
|
-
}),
|
|
601
|
+
}), wt = D(({ budget: t }) => {
|
|
537
602
|
const {
|
|
538
603
|
amount: o,
|
|
539
604
|
budgetColors: { background: i },
|
|
540
|
-
category:
|
|
541
|
-
percentage:
|
|
605
|
+
category: r,
|
|
606
|
+
percentage: s,
|
|
542
607
|
transaction_total: n
|
|
543
|
-
} = t, { setSelectedSubBudget:
|
|
544
|
-
return /* @__PURE__ */ e(
|
|
545
|
-
/* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(
|
|
608
|
+
} = t, { setSelectedSubBudget: a } = w();
|
|
609
|
+
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => a(t), children: [
|
|
610
|
+
/* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Te, { color: i, percent: s, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: r.parent_guid, variant: "basic" }) }) }),
|
|
546
611
|
/* @__PURE__ */ e(
|
|
547
|
-
|
|
612
|
+
Y,
|
|
548
613
|
{
|
|
549
|
-
primary: /* @__PURE__ */ e(
|
|
550
|
-
secondary: /* @__PURE__ */ e(
|
|
614
|
+
primary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: t.category.name }) }),
|
|
615
|
+
secondary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(f, { fontWeight: 400, variant: "Body", children: `
|
|
551
616
|
${T(n, "0,0")} /
|
|
552
617
|
${T(o, "0,0")}
|
|
553
618
|
` }) })
|
|
554
619
|
}
|
|
555
620
|
)
|
|
556
621
|
] }) });
|
|
557
|
-
}),
|
|
558
|
-
const { budgets: i, common:
|
|
622
|
+
}), It = D(({ category: t, parentBudget: o }) => {
|
|
623
|
+
const { budgets: i, common: r } = I(), { setExpandedGuid: s, setOnSelect: n } = tt(), { addBudget: a } = w(), [c, _] = l.useState(!1), [d, m] = l.useState(!1), [S, b] = l.useState(""), [p, g] = l.useState(void 0);
|
|
559
624
|
l.useEffect(() => {
|
|
560
|
-
n((
|
|
561
|
-
const
|
|
562
|
-
|
|
625
|
+
n((v) => {
|
|
626
|
+
const A = t.subCategories.find((x) => x.guid === v);
|
|
627
|
+
A && (g(A), b(`${A.currentAmount === 0 ? "" : A.currentAmount}`), m(!0));
|
|
563
628
|
});
|
|
564
629
|
}, []);
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
},
|
|
568
|
-
|
|
630
|
+
const h = () => {
|
|
631
|
+
s(t.guid), _(!0);
|
|
632
|
+
}, y = async () => {
|
|
633
|
+
p && Number(S) > 0 && (await a(p, Number(S), o.guid), m(!1), _(!1), g(void 0));
|
|
569
634
|
};
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */ e(
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
/* @__PURE__ */ e(
|
|
574
|
-
/* @__PURE__ */ e(
|
|
635
|
+
return /* @__PURE__ */ u(F, { children: [
|
|
636
|
+
/* @__PURE__ */ e(K, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(V, { onClick: h, children: /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ u(B, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
637
|
+
/* @__PURE__ */ u(B, { alignItems: "center", direction: "row", gap: 8, children: [
|
|
638
|
+
/* @__PURE__ */ e(P, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
|
|
639
|
+
/* @__PURE__ */ e(f, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
|
|
575
640
|
] }),
|
|
576
|
-
/* @__PURE__ */ e(
|
|
641
|
+
/* @__PURE__ */ e(P, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
|
|
577
642
|
] }) }) }) }),
|
|
578
643
|
/* @__PURE__ */ e(oe, {}),
|
|
579
644
|
/* @__PURE__ */ e(
|
|
580
|
-
|
|
645
|
+
N,
|
|
581
646
|
{
|
|
582
|
-
ariaLabelClose:
|
|
647
|
+
ariaLabelClose: r.close_aria,
|
|
583
648
|
isOpen: c,
|
|
584
|
-
onClose: () =>
|
|
649
|
+
onClose: () => _(!1),
|
|
585
650
|
title: i.add_sub_budget_title,
|
|
586
|
-
children: /* @__PURE__ */ e(
|
|
651
|
+
children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(nt, { category: t, subCategories: t.subCategories }) })
|
|
587
652
|
}
|
|
588
653
|
),
|
|
589
654
|
/* @__PURE__ */ e(
|
|
590
|
-
|
|
655
|
+
j,
|
|
591
656
|
{
|
|
592
|
-
copy: { close_aria:
|
|
593
|
-
disablePrimaryButton: Number(
|
|
594
|
-
isOpen:
|
|
595
|
-
onClose: () =>
|
|
596
|
-
onPrimaryAction:
|
|
657
|
+
copy: { close_aria: r.close_aria, title: i.add_title },
|
|
658
|
+
disablePrimaryButton: Number(S) <= 0,
|
|
659
|
+
isOpen: d,
|
|
660
|
+
onClose: () => m(!1),
|
|
661
|
+
onPrimaryAction: y,
|
|
597
662
|
primaryText: i.add_save_button,
|
|
598
663
|
children: /* @__PURE__ */ e(
|
|
599
664
|
re,
|
|
600
665
|
{
|
|
601
|
-
amount:
|
|
602
|
-
categoryName:
|
|
603
|
-
onAmountChanged:
|
|
666
|
+
amount: S,
|
|
667
|
+
categoryName: p?.name || "",
|
|
668
|
+
onAmountChanged: b
|
|
604
669
|
}
|
|
605
670
|
)
|
|
606
671
|
}
|
|
607
672
|
)
|
|
608
673
|
] });
|
|
609
|
-
}),
|
|
610
|
-
const { category: o, subBudgets: i } = t, { budgets:
|
|
674
|
+
}), Dt = D(({ budget: t }) => {
|
|
675
|
+
const { category: o, subBudgets: i } = t, { budgets: r, common: s } = I(), { deleteBudget: n, selectedSubBudget: a, setSelectedSubBudget: c, updateBudget: _ } = w(), { filter: d, setFilter: m } = ne(), [S, b] = l.useState(!1), [p, g] = l.useState(!1), [h, y] = l.useState("");
|
|
611
676
|
l.useEffect(() => {
|
|
612
|
-
|
|
613
|
-
...
|
|
614
|
-
custom: (
|
|
677
|
+
a && (y(`${a.amount}`), m({
|
|
678
|
+
...d,
|
|
679
|
+
custom: (C) => C.category_guid === a.category_guid
|
|
615
680
|
}));
|
|
616
|
-
}, [
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
...
|
|
620
|
-
amount: Number(
|
|
681
|
+
}, [a]);
|
|
682
|
+
const v = async () => {
|
|
683
|
+
a && await _({
|
|
684
|
+
...a,
|
|
685
|
+
amount: Number(h)
|
|
621
686
|
});
|
|
622
|
-
},
|
|
623
|
-
|
|
624
|
-
},
|
|
625
|
-
|
|
626
|
-
...
|
|
627
|
-
custom: (
|
|
687
|
+
}, A = async () => {
|
|
688
|
+
a && await n(a.guid), g(!1), x();
|
|
689
|
+
}, x = () => {
|
|
690
|
+
m({
|
|
691
|
+
...d,
|
|
692
|
+
custom: (C) => C.category_guid === t.category_guid || C.top_level_category_guid === t.category_guid
|
|
628
693
|
}), c(void 0);
|
|
629
694
|
};
|
|
630
|
-
return /* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
i.length === 0 ? /* @__PURE__ */ e(
|
|
633
|
-
/* @__PURE__ */ e(
|
|
695
|
+
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
696
|
+
/* @__PURE__ */ u(X, { sx: { bgcolor: "background.paper" }, children: [
|
|
697
|
+
i.length === 0 ? /* @__PURE__ */ e(Tt, {}) : i.map((C) => /* @__PURE__ */ u(l.Fragment, { children: [
|
|
698
|
+
/* @__PURE__ */ e(wt, { budget: C }),
|
|
634
699
|
/* @__PURE__ */ e(oe, {})
|
|
635
|
-
] },
|
|
636
|
-
/* @__PURE__ */ e(
|
|
700
|
+
] }, C.guid)),
|
|
701
|
+
/* @__PURE__ */ e(It, { category: o, parentBudget: t })
|
|
637
702
|
] }),
|
|
638
703
|
/* @__PURE__ */ e(
|
|
639
|
-
|
|
704
|
+
N,
|
|
640
705
|
{
|
|
641
|
-
ariaLabelClose:
|
|
642
|
-
isOpen: !!
|
|
643
|
-
onClose:
|
|
644
|
-
onPrimaryAction: () =>
|
|
645
|
-
onSecondaryAction: () =>
|
|
646
|
-
primaryText:
|
|
647
|
-
secondaryText:
|
|
648
|
-
title:
|
|
649
|
-
children:
|
|
650
|
-
/* @__PURE__ */ e(
|
|
651
|
-
/* @__PURE__ */ e(
|
|
706
|
+
ariaLabelClose: s.close_aria,
|
|
707
|
+
isOpen: !!a,
|
|
708
|
+
onClose: x,
|
|
709
|
+
onPrimaryAction: () => b(!0),
|
|
710
|
+
onSecondaryAction: () => g(!0),
|
|
711
|
+
primaryText: r.details_edit_button,
|
|
712
|
+
secondaryText: r.details_delete_button,
|
|
713
|
+
title: r.details_title,
|
|
714
|
+
children: a && /* @__PURE__ */ u(B, { gap: 24, children: [
|
|
715
|
+
/* @__PURE__ */ e(Me, { budget: a }),
|
|
716
|
+
/* @__PURE__ */ e(ve, { height: "100%" })
|
|
652
717
|
] })
|
|
653
718
|
}
|
|
654
719
|
),
|
|
655
|
-
|
|
720
|
+
a && /* @__PURE__ */ u(l.Fragment, { children: [
|
|
656
721
|
/* @__PURE__ */ e(
|
|
657
|
-
|
|
722
|
+
j,
|
|
658
723
|
{
|
|
659
|
-
copy: { close_aria:
|
|
660
|
-
disablePrimaryButton: Number(
|
|
661
|
-
isOpen:
|
|
662
|
-
onClose: () =>
|
|
663
|
-
onPrimaryAction:
|
|
664
|
-
primaryText:
|
|
724
|
+
copy: { close_aria: s.close_aria, title: r.details_edit_title },
|
|
725
|
+
disablePrimaryButton: Number(h) <= 0,
|
|
726
|
+
isOpen: S,
|
|
727
|
+
onClose: () => b(!1),
|
|
728
|
+
onPrimaryAction: v,
|
|
729
|
+
primaryText: r.edit_save_button,
|
|
665
730
|
children: /* @__PURE__ */ e(
|
|
666
731
|
re,
|
|
667
732
|
{
|
|
668
|
-
amount:
|
|
669
|
-
categoryName:
|
|
670
|
-
onAmountChanged:
|
|
733
|
+
amount: h,
|
|
734
|
+
categoryName: a.category.name,
|
|
735
|
+
onAmountChanged: y
|
|
671
736
|
}
|
|
672
737
|
)
|
|
673
738
|
}
|
|
674
739
|
),
|
|
675
740
|
/* @__PURE__ */ e(
|
|
676
|
-
|
|
741
|
+
j,
|
|
677
742
|
{
|
|
678
|
-
copy: { close_aria:
|
|
679
|
-
isOpen:
|
|
680
|
-
onClose: () =>
|
|
681
|
-
onPrimaryAction:
|
|
743
|
+
copy: { close_aria: s.close_aria, title: r.delete_title },
|
|
744
|
+
isOpen: p,
|
|
745
|
+
onClose: () => g(!1),
|
|
746
|
+
onPrimaryAction: A,
|
|
682
747
|
primaryColor: "error",
|
|
683
748
|
primaryText: "Delete",
|
|
684
749
|
secondaryColor: "secondary",
|
|
685
|
-
children: /* @__PURE__ */ e(
|
|
750
|
+
children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(r.delete_description, a.category.name) })
|
|
686
751
|
}
|
|
687
752
|
)
|
|
688
753
|
] })
|
|
689
754
|
] });
|
|
690
|
-
}),
|
|
691
|
-
const { is_mobile_webview: o } =
|
|
692
|
-
sortedTransactions:
|
|
693
|
-
sortedTransactionsWithSplits:
|
|
694
|
-
tags:
|
|
695
|
-
} = ne(), [
|
|
696
|
-
() =>
|
|
697
|
-
[
|
|
698
|
-
),
|
|
699
|
-
|
|
700
|
-
},
|
|
701
|
-
|
|
702
|
-
},
|
|
703
|
-
return /* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */ e(
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
|
|
755
|
+
}), Et = D(({ budget: t }) => {
|
|
756
|
+
const { is_mobile_webview: o } = me(), { setAlert: i } = w(), { budgets: r, common: s, transactions: n } = I(), { isDesktop: a, isSmallTablet: c, isTablet: _ } = ge(), {
|
|
757
|
+
sortedTransactions: d,
|
|
758
|
+
sortedTransactionsWithSplits: m,
|
|
759
|
+
tags: S
|
|
760
|
+
} = ne(), [b, p] = l.useState(0), [g, h] = l.useState(""), y = l.useMemo(
|
|
761
|
+
() => d.find((C) => C.guid === g),
|
|
762
|
+
[g, d]
|
|
763
|
+
), v = (C, E) => {
|
|
764
|
+
p(E);
|
|
765
|
+
}, A = () => {
|
|
766
|
+
Qe(m, S), i(r.alert_csv_downloaded);
|
|
767
|
+
}, x = d.length > 0 && !o && (a || _ && !c);
|
|
768
|
+
return /* @__PURE__ */ u(B, { gap: 24, children: [
|
|
769
|
+
/* @__PURE__ */ e(Me, { budget: t }),
|
|
770
|
+
/* @__PURE__ */ u(B, { children: [
|
|
771
|
+
/* @__PURE__ */ u(
|
|
772
|
+
Je,
|
|
708
773
|
{
|
|
709
|
-
onChange:
|
|
774
|
+
onChange: v,
|
|
710
775
|
sx: { width: "100%" },
|
|
711
776
|
textColor: "primary",
|
|
712
|
-
value:
|
|
777
|
+
value: b,
|
|
713
778
|
variant: "fullWidth",
|
|
714
779
|
children: [
|
|
715
|
-
/* @__PURE__ */ e(
|
|
716
|
-
/* @__PURE__ */ e(
|
|
780
|
+
/* @__PURE__ */ e(ye, { label: r.details_transactions_tab }),
|
|
781
|
+
/* @__PURE__ */ e(ye, { label: r.details_subbudgets_tab })
|
|
717
782
|
]
|
|
718
783
|
}
|
|
719
784
|
),
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
785
|
+
b === 0 && /* @__PURE__ */ u(B, { children: [
|
|
786
|
+
x && /* @__PURE__ */ e(B, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
|
|
787
|
+
xe,
|
|
723
788
|
{
|
|
724
|
-
onClick:
|
|
725
|
-
startIcon: /* @__PURE__ */ e(
|
|
789
|
+
onClick: A,
|
|
790
|
+
startIcon: /* @__PURE__ */ e(P, { name: "ios_share" }),
|
|
726
791
|
variant: "text",
|
|
727
792
|
children: n.export_csv_btn
|
|
728
793
|
}
|
|
729
794
|
) }),
|
|
730
|
-
/* @__PURE__ */ e(
|
|
795
|
+
/* @__PURE__ */ e(ve, { height: "100%", onClick: h })
|
|
731
796
|
] }),
|
|
732
|
-
|
|
797
|
+
b === 1 && /* @__PURE__ */ e(Dt, { budget: t }),
|
|
733
798
|
/* @__PURE__ */ e(
|
|
734
|
-
|
|
799
|
+
N,
|
|
735
800
|
{
|
|
736
|
-
ariaLabelClose:
|
|
737
|
-
isOpen: !!
|
|
738
|
-
onClose: () =>
|
|
739
|
-
title:
|
|
740
|
-
children:
|
|
801
|
+
ariaLabelClose: s.close_aria,
|
|
802
|
+
isOpen: !!y,
|
|
803
|
+
onClose: () => h(""),
|
|
804
|
+
title: r.details_transaction_drawer,
|
|
805
|
+
children: y && /* @__PURE__ */ e(et, { transaction: y })
|
|
741
806
|
}
|
|
742
807
|
)
|
|
743
808
|
] })
|
|
744
809
|
] });
|
|
745
|
-
}),
|
|
746
|
-
const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } =
|
|
747
|
-
dateRange:
|
|
748
|
-
deleteBudget:
|
|
810
|
+
}), Ot = D(() => {
|
|
811
|
+
const { selectedAccountGuids: t } = ee(), { budgets: o, common: i } = I(), {
|
|
812
|
+
dateRange: r,
|
|
813
|
+
deleteBudget: s,
|
|
749
814
|
selectedBudget: n,
|
|
750
|
-
selectedSubBudget:
|
|
815
|
+
selectedSubBudget: a,
|
|
751
816
|
setAlert: c,
|
|
752
|
-
setSelectedBudget:
|
|
753
|
-
updateBudget:
|
|
754
|
-
} = w(), { setFilter:
|
|
817
|
+
setSelectedBudget: _,
|
|
818
|
+
updateBudget: d
|
|
819
|
+
} = w(), { setFilter: m } = ne(), [S, b] = l.useState(!1), [p, g] = l.useState(!1), [h, y] = l.useState(!1), [v, A] = l.useState("");
|
|
755
820
|
l.useEffect(() => {
|
|
756
|
-
n && !
|
|
821
|
+
n && !a && (A(`${n.amount}`), b(!0), m({
|
|
757
822
|
accounts: t,
|
|
758
|
-
dateRange:
|
|
759
|
-
custom: (
|
|
823
|
+
dateRange: r,
|
|
824
|
+
custom: (M) => M.category_guid === n.category_guid || M.top_level_category_guid === n.category_guid,
|
|
760
825
|
showSplits: !0
|
|
761
826
|
}));
|
|
762
827
|
}, [n]);
|
|
763
|
-
const
|
|
764
|
-
n && (await
|
|
828
|
+
const x = async () => {
|
|
829
|
+
n && (await d({
|
|
765
830
|
...n,
|
|
766
|
-
amount: Number(
|
|
767
|
-
percentage: n.category.totalAmount / Number(
|
|
768
|
-
}), c(
|
|
769
|
-
},
|
|
770
|
-
n && (await
|
|
771
|
-
},
|
|
772
|
-
|
|
773
|
-
|
|
831
|
+
amount: Number(v),
|
|
832
|
+
percentage: n.category.totalAmount / Number(v) * 100
|
|
833
|
+
}), c(R(o.alert_budget_updated, n.category.name)));
|
|
834
|
+
}, C = async () => {
|
|
835
|
+
n && (await s(n.guid), c(R(o.alert_budget_deleted, n.category.name))), y(!1), E();
|
|
836
|
+
}, E = () => {
|
|
837
|
+
b(!1), setTimeout(() => {
|
|
838
|
+
_(void 0);
|
|
774
839
|
}, 250);
|
|
775
840
|
};
|
|
776
841
|
if (n)
|
|
777
|
-
return /* @__PURE__ */
|
|
842
|
+
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
778
843
|
/* @__PURE__ */ e(
|
|
779
|
-
|
|
844
|
+
N,
|
|
780
845
|
{
|
|
781
846
|
ariaLabelClose: i.close_aria,
|
|
782
|
-
isOpen:
|
|
783
|
-
onClose:
|
|
784
|
-
onPrimaryAction: () =>
|
|
785
|
-
onSecondaryAction: () =>
|
|
847
|
+
isOpen: S,
|
|
848
|
+
onClose: E,
|
|
849
|
+
onPrimaryAction: () => g(!0),
|
|
850
|
+
onSecondaryAction: () => y(!0),
|
|
786
851
|
primaryText: o.details_edit_button,
|
|
787
852
|
secondaryColor: "error",
|
|
788
853
|
secondaryText: o.details_delete_button,
|
|
789
854
|
title: o.details_title,
|
|
790
|
-
children: /* @__PURE__ */ e(
|
|
855
|
+
children: /* @__PURE__ */ e(Et, { budget: n })
|
|
791
856
|
}
|
|
792
857
|
),
|
|
793
858
|
/* @__PURE__ */ e(
|
|
794
|
-
|
|
859
|
+
j,
|
|
795
860
|
{
|
|
796
861
|
copy: { close_aria: i.close_aria, title: o.details_edit_title },
|
|
797
|
-
disablePrimaryButton: Number(
|
|
798
|
-
isOpen:
|
|
799
|
-
onClose: () =>
|
|
800
|
-
onPrimaryAction:
|
|
862
|
+
disablePrimaryButton: Number(v) <= 0,
|
|
863
|
+
isOpen: p,
|
|
864
|
+
onClose: () => g(!1),
|
|
865
|
+
onPrimaryAction: x,
|
|
801
866
|
primaryText: o.edit_save_button,
|
|
802
867
|
children: /* @__PURE__ */ e(
|
|
803
868
|
re,
|
|
804
869
|
{
|
|
805
|
-
amount:
|
|
870
|
+
amount: v,
|
|
806
871
|
categoryName: n.category.name,
|
|
807
|
-
onAmountChanged:
|
|
872
|
+
onAmountChanged: A
|
|
808
873
|
}
|
|
809
874
|
)
|
|
810
875
|
}
|
|
811
876
|
),
|
|
812
877
|
/* @__PURE__ */ e(
|
|
813
|
-
|
|
878
|
+
j,
|
|
814
879
|
{
|
|
815
880
|
copy: { close_aria: i.close_aria, title: o.delete_title },
|
|
816
|
-
isOpen:
|
|
817
|
-
onClose: () =>
|
|
818
|
-
onPrimaryAction:
|
|
881
|
+
isOpen: h,
|
|
882
|
+
onClose: () => y(!1),
|
|
883
|
+
onPrimaryAction: C,
|
|
819
884
|
primaryColor: "error",
|
|
820
885
|
primaryText: o.details_delete_button,
|
|
821
886
|
secondaryColor: "secondary",
|
|
822
|
-
children: /* @__PURE__ */ e(
|
|
887
|
+
children: /* @__PURE__ */ e(f, { variant: "Paragraph", children: R(o.delete_description, n.category.name) })
|
|
823
888
|
}
|
|
824
889
|
)
|
|
825
890
|
] });
|
|
826
|
-
}),
|
|
891
|
+
}), Mt = ({ budget: t, onClick: o }) => {
|
|
827
892
|
const {
|
|
828
893
|
amount: i,
|
|
829
|
-
budgetColors: { background:
|
|
894
|
+
budgetColors: { background: r, description: s },
|
|
830
895
|
category_guid: n,
|
|
831
|
-
description:
|
|
896
|
+
description: a,
|
|
832
897
|
percentage: c,
|
|
833
|
-
subBudgets:
|
|
834
|
-
transaction_total:
|
|
898
|
+
subBudgets: _,
|
|
899
|
+
transaction_total: d
|
|
835
900
|
} = t;
|
|
836
|
-
return /* @__PURE__ */ e(
|
|
837
|
-
/* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(
|
|
901
|
+
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => o?.(t), children: [
|
|
902
|
+
/* @__PURE__ */ e(ae, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Te, { color: r, percent: c, size: 40, children: /* @__PURE__ */ e(W, { categoryGuid: n, variant: "basic" }) }) }),
|
|
838
903
|
/* @__PURE__ */ e(
|
|
839
|
-
|
|
904
|
+
Y,
|
|
840
905
|
{
|
|
841
|
-
primary: /* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */ e(
|
|
843
|
-
/* @__PURE__ */ e(
|
|
844
|
-
${T(
|
|
906
|
+
primary: /* @__PURE__ */ u(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
907
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: t.category.name }),
|
|
908
|
+
/* @__PURE__ */ e(f, { fontWeight: 400, variant: "Body", children: `
|
|
909
|
+
${T(d, "0,0")} /
|
|
845
910
|
${T(i, "0,0")}
|
|
846
911
|
` })
|
|
847
912
|
] }),
|
|
848
|
-
secondary: /* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */ e(
|
|
850
|
-
/* @__PURE__ */ e(
|
|
913
|
+
secondary: /* @__PURE__ */ u(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
914
|
+
/* @__PURE__ */ e(f, { variant: "XSmall", children: `${_.length} Sub-budgets` }),
|
|
915
|
+
/* @__PURE__ */ e(f, { bold: c > 100, color: s, variant: "XSmall", children: a })
|
|
851
916
|
] })
|
|
852
917
|
}
|
|
853
918
|
)
|
|
854
919
|
] }) });
|
|
855
|
-
},
|
|
856
|
-
const { onEvent: t } =
|
|
857
|
-
|
|
920
|
+
}, Rt = D(() => {
|
|
921
|
+
const { onEvent: t } = H(), { budgets: o } = I(), { detailedBudgets: i, setSelectedBudget: r } = w(), s = (n) => {
|
|
922
|
+
r(n), t(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
858
923
|
budget_category: n.category.name,
|
|
859
924
|
click_type: "list"
|
|
860
925
|
});
|
|
861
926
|
};
|
|
862
|
-
return /* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */ e(
|
|
864
|
-
/* @__PURE__ */ e(
|
|
865
|
-
/* @__PURE__ */ e(
|
|
927
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, children: [
|
|
928
|
+
/* @__PURE__ */ e(we, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Se, { children: o.budget_categories_title }) }),
|
|
929
|
+
/* @__PURE__ */ e(he, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(X, { children: i.map((n) => /* @__PURE__ */ u(l.Fragment, { children: [
|
|
930
|
+
/* @__PURE__ */ e(Mt, { budget: n, onClick: s }),
|
|
866
931
|
/* @__PURE__ */ e(oe, {})
|
|
867
932
|
] }, n.guid)) }) })
|
|
868
933
|
] });
|
|
869
|
-
}),
|
|
870
|
-
const t = Q(), { onEvent: o } =
|
|
871
|
-
const
|
|
872
|
-
let
|
|
873
|
-
|
|
874
|
-
let
|
|
875
|
-
|
|
876
|
-
const
|
|
934
|
+
}), Lt = D(() => {
|
|
935
|
+
const t = Q(), { onEvent: o } = H(), { visibleAccounts: i } = Ae(), { budgets: r, common: s, recurring: n } = I(), { incomeCategories: a, spendCategories: c } = U(), { detailedBudgets: _, totalBudgeted: d } = w(), { incomeTotal: m } = te(), { setFilter: S } = ne(), [b, p] = l.useState(!1), [g, h] = l.useMemo(() => {
|
|
936
|
+
const x = c.reduce((k, se) => k + se.totalAmount, 0);
|
|
937
|
+
let C = x / d;
|
|
938
|
+
C > 1 && (C = 1);
|
|
939
|
+
let E = t.palette.success.main;
|
|
940
|
+
C > 0.8 && C < 1 ? E = t.palette.warning.main : C >= 1 && (E = t.palette.error.main);
|
|
941
|
+
const M = [
|
|
877
942
|
{
|
|
878
|
-
color:
|
|
879
|
-
percentage: `${
|
|
943
|
+
color: E,
|
|
944
|
+
percentage: `${C}`
|
|
880
945
|
}
|
|
881
946
|
];
|
|
882
|
-
return [
|
|
883
|
-
}, [
|
|
884
|
-
const
|
|
885
|
-
|
|
947
|
+
return [x, M];
|
|
948
|
+
}, [_, c]), [y, v] = l.useMemo(() => {
|
|
949
|
+
const x = Math.abs(
|
|
950
|
+
a.reduce((M, k) => M + k.totalAmount, 0)
|
|
886
951
|
);
|
|
887
|
-
let
|
|
888
|
-
|
|
889
|
-
const
|
|
952
|
+
let C = x / m;
|
|
953
|
+
C > 1 && (C = 1);
|
|
954
|
+
const E = [
|
|
890
955
|
{
|
|
891
956
|
color: t.palette.secondary.main,
|
|
892
|
-
percentage: `${
|
|
957
|
+
percentage: `${C}`
|
|
893
958
|
}
|
|
894
959
|
];
|
|
895
|
-
return [
|
|
896
|
-
}, [
|
|
897
|
-
|
|
898
|
-
accounts: i.map((
|
|
960
|
+
return [x, E];
|
|
961
|
+
}, [a, m]), A = () => {
|
|
962
|
+
S({
|
|
963
|
+
accounts: i.map((x) => x.guid),
|
|
899
964
|
dateRange: {
|
|
900
|
-
start:
|
|
965
|
+
start: ot(/* @__PURE__ */ new Date(), 90),
|
|
901
966
|
end: /* @__PURE__ */ new Date()
|
|
902
967
|
}
|
|
903
|
-
}),
|
|
968
|
+
}), p(!0), o(L.BUDGETS_CLICK_EDIT_INCOME);
|
|
904
969
|
};
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
/* @__PURE__ */ e(
|
|
907
|
-
/* @__PURE__ */ e(
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */ e(
|
|
910
|
-
/* @__PURE__ */ e(ue, { data:
|
|
911
|
-
/* @__PURE__ */ e(
|
|
912
|
-
|
|
913
|
-
T(
|
|
914
|
-
T(
|
|
970
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, sx: { overflow: "visible" }, children: [
|
|
971
|
+
/* @__PURE__ */ e(we, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Se, { children: r.overview_title }) }),
|
|
972
|
+
/* @__PURE__ */ e(he, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ u(B, { gap: 24, children: [
|
|
973
|
+
/* @__PURE__ */ u(B, { gap: 8, children: [
|
|
974
|
+
/* @__PURE__ */ e(f, { bold: !0, sx: { mb: 8 }, variant: "Body", children: r.spending_title }),
|
|
975
|
+
/* @__PURE__ */ e(ue, { data: h, height: 16 }),
|
|
976
|
+
/* @__PURE__ */ e(f, { variant: "Small", children: R(
|
|
977
|
+
r.spending_description,
|
|
978
|
+
T(g, "0,0"),
|
|
979
|
+
T(d, "0,0")
|
|
915
980
|
) })
|
|
916
981
|
] }),
|
|
917
|
-
/* @__PURE__ */
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */ e(
|
|
982
|
+
/* @__PURE__ */ u(B, { gap: 8, children: [
|
|
983
|
+
/* @__PURE__ */ u(B, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
|
|
984
|
+
/* @__PURE__ */ e(f, { bold: !0, variant: "Body", children: r.income_title }),
|
|
920
985
|
/* @__PURE__ */ e(
|
|
921
|
-
|
|
986
|
+
at,
|
|
922
987
|
{
|
|
923
988
|
"aria-label": n.manage_income,
|
|
924
|
-
onClick:
|
|
989
|
+
onClick: A,
|
|
925
990
|
sx: { p: 0 },
|
|
926
|
-
children: /* @__PURE__ */ e(
|
|
991
|
+
children: /* @__PURE__ */ e(P, { color: "primary", name: "edit" })
|
|
927
992
|
}
|
|
928
993
|
)
|
|
929
994
|
] }),
|
|
930
|
-
/* @__PURE__ */ e(ue, { data:
|
|
931
|
-
/* @__PURE__ */ e(
|
|
932
|
-
|
|
933
|
-
T(
|
|
934
|
-
T(
|
|
995
|
+
/* @__PURE__ */ e(ue, { data: v, height: 16 }),
|
|
996
|
+
/* @__PURE__ */ e(f, { variant: "Small", children: R(
|
|
997
|
+
r.income_description,
|
|
998
|
+
T(y, "0,0"),
|
|
999
|
+
T(m, "0,0")
|
|
935
1000
|
) })
|
|
936
1001
|
] })
|
|
937
1002
|
] }) }),
|
|
938
1003
|
/* @__PURE__ */ e(
|
|
939
|
-
|
|
1004
|
+
N,
|
|
940
1005
|
{
|
|
941
|
-
ariaLabelClose:
|
|
942
|
-
isOpen:
|
|
943
|
-
onClose: () =>
|
|
1006
|
+
ariaLabelClose: s.close_aria,
|
|
1007
|
+
isOpen: b,
|
|
1008
|
+
onClose: () => p(!1),
|
|
944
1009
|
title: n.manage_income,
|
|
945
|
-
children: /* @__PURE__ */ e(
|
|
1010
|
+
children: /* @__PURE__ */ e(rt, { forOverview: !0 })
|
|
946
1011
|
}
|
|
947
1012
|
)
|
|
948
1013
|
] });
|
|
949
|
-
}),
|
|
950
|
-
const i = Q(), { onEvent:
|
|
951
|
-
alert:
|
|
952
|
-
dateRange:
|
|
953
|
-
isDataLoaded:
|
|
954
|
-
loadBudgetData:
|
|
955
|
-
setDateRange:
|
|
956
|
-
setAlert:
|
|
957
|
-
setTheme:
|
|
958
|
-
detailedBudgets:
|
|
959
|
-
} = w(), { loadRepeatingTransactions:
|
|
960
|
-
l.useEffect(() => (
|
|
961
|
-
|
|
1014
|
+
}), Be = 480, On = D(({ onBackClick: t, sx: o }) => {
|
|
1015
|
+
const i = Q(), { onEvent: r } = H(), { visibleAccounts: s } = Ae(), { budgets: n, common: a } = I(), { isCopyLoaded: c, isInitialized: _, selectedAccounts: d, setDisplayedDate: m, setSelectedAccounts: S } = ee(), {
|
|
1016
|
+
alert: b,
|
|
1017
|
+
dateRange: p,
|
|
1018
|
+
isDataLoaded: g,
|
|
1019
|
+
loadBudgetData: h,
|
|
1020
|
+
setDateRange: y,
|
|
1021
|
+
setAlert: v,
|
|
1022
|
+
setTheme: A,
|
|
1023
|
+
detailedBudgets: x
|
|
1024
|
+
} = w(), { loadRepeatingTransactions: C, setDateRange: E } = te(), { reloadCategoryTotals: M } = U(), { isSmallTablet: k, isMobile: se, isSmallMobile: Re } = ge(), z = k || se || Re, [Le, ie] = l.useState(!1);
|
|
1025
|
+
l.useEffect(() => (A(i), S(s), y({ start: q(Z()), end: de(Z()) }), r(L.BUDGETS_VIEW), () => {
|
|
1026
|
+
y({ start: q(Z()), end: de(Z()) });
|
|
962
1027
|
}), []), l.useEffect(() => {
|
|
963
|
-
|
|
964
|
-
}, [
|
|
965
|
-
|
|
966
|
-
}, [
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
}, Re = () => {
|
|
970
|
-
s(k.BUDGETS_CLICK_FILTER);
|
|
971
|
-
}, he = () => {
|
|
972
|
-
ie(!0), s(k.BUDGETS_CLICK_ADD);
|
|
1028
|
+
S(s);
|
|
1029
|
+
}, [s]), l.useEffect(() => {
|
|
1030
|
+
_ && (m(p.start, p.end), M(d, p.start, p.end).finally(), E(p), g || (C().finally(), h().finally()));
|
|
1031
|
+
}, [_, d, p]);
|
|
1032
|
+
const Ne = (fe) => {
|
|
1033
|
+
y({ start: fe[0] || /* @__PURE__ */ new Date(), end: fe[1] || /* @__PURE__ */ new Date() });
|
|
973
1034
|
}, ke = () => {
|
|
1035
|
+
r(L.BUDGETS_CLICK_FILTER);
|
|
1036
|
+
}, _e = () => {
|
|
1037
|
+
ie(!0), r(L.BUDGETS_CLICK_ADD);
|
|
1038
|
+
}, Pe = () => {
|
|
974
1039
|
ie(!1);
|
|
975
|
-
},
|
|
976
|
-
return !c || !
|
|
977
|
-
|
|
1040
|
+
}, $e = Ye(p.end, q(/* @__PURE__ */ new Date()));
|
|
1041
|
+
return !c || !_ || !g ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ u(
|
|
1042
|
+
He,
|
|
978
1043
|
{
|
|
979
|
-
accountOptions:
|
|
1044
|
+
accountOptions: s,
|
|
980
1045
|
actions: [
|
|
981
1046
|
{
|
|
982
1047
|
iconName: "add",
|
|
983
1048
|
label: n.add_title,
|
|
984
|
-
onClick:
|
|
1049
|
+
onClick: _e
|
|
985
1050
|
}
|
|
986
1051
|
],
|
|
987
1052
|
calendarActions: {
|
|
988
|
-
onRangeChanged:
|
|
989
|
-
shouldDisableNext:
|
|
1053
|
+
onRangeChanged: Ne,
|
|
1054
|
+
shouldDisableNext: $e,
|
|
990
1055
|
shouldDisablePicker: !0
|
|
991
1056
|
},
|
|
992
|
-
onAccountsFilterClick:
|
|
1057
|
+
onAccountsFilterClick: ke,
|
|
993
1058
|
onBackClick: t,
|
|
994
1059
|
sx: o,
|
|
995
1060
|
title: n.budgets_title,
|
|
996
1061
|
children: [
|
|
997
|
-
(!
|
|
998
|
-
|
|
999
|
-
|
|
1062
|
+
(!_ || !g) && /* @__PURE__ */ e(G, {}),
|
|
1063
|
+
_ && g && /* @__PURE__ */ u(
|
|
1064
|
+
B,
|
|
1000
1065
|
{
|
|
1001
|
-
direction:
|
|
1066
|
+
direction: z ? "column" : "row",
|
|
1002
1067
|
height: "100%",
|
|
1003
1068
|
sx: { justifyContent: "center" },
|
|
1004
1069
|
width: "100%",
|
|
1005
1070
|
children: [
|
|
1006
|
-
/* @__PURE__ */ e(
|
|
1007
|
-
|
|
1071
|
+
/* @__PURE__ */ e(B, { height: z ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
|
|
1072
|
+
Ee,
|
|
1008
1073
|
{
|
|
1009
|
-
createBudgetOnClick:
|
|
1010
|
-
height:
|
|
1074
|
+
createBudgetOnClick: _e,
|
|
1075
|
+
height: z ? 450 : 800,
|
|
1011
1076
|
isDraggable: !0,
|
|
1012
|
-
shouldShowZeroState:
|
|
1013
|
-
unavailableWidth:
|
|
1077
|
+
shouldShowZeroState: x.length === 0,
|
|
1078
|
+
unavailableWidth: z ? 0 : Be
|
|
1014
1079
|
}
|
|
1015
1080
|
) }),
|
|
1016
|
-
|
|
1017
|
-
|
|
1081
|
+
x.length !== 0 && /* @__PURE__ */ u(
|
|
1082
|
+
B,
|
|
1018
1083
|
{
|
|
1019
1084
|
gap: 24,
|
|
1020
1085
|
height: "100%",
|
|
1021
1086
|
sx: { mr: 24, mt: 48 },
|
|
1022
|
-
width:
|
|
1087
|
+
width: z ? "100%" : Be,
|
|
1023
1088
|
children: [
|
|
1024
|
-
/* @__PURE__ */ e(
|
|
1025
|
-
/* @__PURE__ */ e(
|
|
1089
|
+
/* @__PURE__ */ e(Lt, {}),
|
|
1090
|
+
/* @__PURE__ */ e(Rt, {})
|
|
1026
1091
|
]
|
|
1027
1092
|
}
|
|
1028
1093
|
)
|
|
1029
1094
|
]
|
|
1030
1095
|
}
|
|
1031
1096
|
),
|
|
1032
|
-
/* @__PURE__ */ e(
|
|
1097
|
+
/* @__PURE__ */ e(Ot, {}),
|
|
1033
1098
|
/* @__PURE__ */ e(
|
|
1034
|
-
|
|
1099
|
+
N,
|
|
1035
1100
|
{
|
|
1036
|
-
ariaLabelClose:
|
|
1037
|
-
isOpen:
|
|
1101
|
+
ariaLabelClose: a.close_aria,
|
|
1102
|
+
isOpen: Le,
|
|
1038
1103
|
onClose: () => ie(!1),
|
|
1039
1104
|
title: n.add_new_title,
|
|
1040
|
-
children: /* @__PURE__ */ e(
|
|
1105
|
+
children: /* @__PURE__ */ e(Oe, { onRecalculateBudgets: Pe })
|
|
1041
1106
|
}
|
|
1042
1107
|
),
|
|
1043
1108
|
/* @__PURE__ */ e(
|
|
1044
|
-
|
|
1109
|
+
qe,
|
|
1045
1110
|
{
|
|
1046
1111
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1047
1112
|
autoHideDuration: 3500,
|
|
1048
1113
|
onClose: () => {
|
|
1049
|
-
|
|
1114
|
+
v("");
|
|
1050
1115
|
},
|
|
1051
|
-
open: !!
|
|
1116
|
+
open: !!b,
|
|
1052
1117
|
children: /* @__PURE__ */ e(
|
|
1053
|
-
|
|
1118
|
+
Ze,
|
|
1054
1119
|
{
|
|
1055
1120
|
onClose: () => {
|
|
1056
|
-
|
|
1121
|
+
v("");
|
|
1057
1122
|
},
|
|
1058
1123
|
severity: "success",
|
|
1059
1124
|
variant: "filled",
|
|
1060
|
-
children:
|
|
1125
|
+
children: b
|
|
1061
1126
|
}
|
|
1062
1127
|
)
|
|
1063
1128
|
}
|
|
@@ -1067,6 +1132,6 @@ const ht = ({
|
|
|
1067
1132
|
);
|
|
1068
1133
|
});
|
|
1069
1134
|
export {
|
|
1070
|
-
|
|
1071
|
-
|
|
1135
|
+
En as BubbleBudgetsMiniWidget,
|
|
1136
|
+
On as BubbleBudgetsWidget
|
|
1072
1137
|
};
|