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