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