gsintegrations 0.0.494 → 0.0.496
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/bundle.cjs.js +340 -262
- package/dist/bundle.cjs.js.map +2 -2
- package/dist/bundle.esm.js +340 -262
- package/dist/bundle.esm.js.map +2 -2
- package/dist/index.d.ts +68 -59
- package/dist/types/pages/FinancialAccountsList/FinancialAccountsList.d.ts +10 -10
- package/dist/types/pages/FinancialAccountsList/FinancialAccountsList.types.d.ts +20 -20
- package/dist/types/pages/FinancialApp/FinancialSummaryHeader.d.ts +6 -1
- package/dist/types/pages/FinancialRegisterPage/FinancialRegister.types.d.ts +24 -24
- package/dist/types/pages/IncomeListPage/IncomeListPage.d.ts +4 -2
- package/dist/types/pages/IncomeListPage/IncomeListPage.types.d.ts +10 -4
- package/dist/types/pages/OutcomeListPage/OutcomeListPage.d.ts +4 -2
- package/dist/types/pages/OutcomeListPage/OutcomeListPage.types.d.ts +10 -4
- package/package.json +1 -1
package/dist/bundle.esm.js
CHANGED
|
@@ -59709,7 +59709,7 @@ var ReceiptIcon = createSvgIcon( /*#__PURE__*/jsx$1("path", {
|
|
|
59709
59709
|
d: "M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"
|
|
59710
59710
|
}), 'Receipt');
|
|
59711
59711
|
|
|
59712
|
-
var
|
|
59712
|
+
var ReceiptLong = createSvgIcon([/*#__PURE__*/jsx$1("path", {
|
|
59713
59713
|
d: "M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2zM19 19c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11z"
|
|
59714
59714
|
}, "0"), /*#__PURE__*/jsx$1("path", {
|
|
59715
59715
|
d: "M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"
|
|
@@ -59727,10 +59727,6 @@ var Save$1 = createSvgIcon( /*#__PURE__*/jsx$1("path", {
|
|
|
59727
59727
|
d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
|
|
59728
59728
|
}), 'Save');
|
|
59729
59729
|
|
|
59730
|
-
var SavingsIcon = createSvgIcon( /*#__PURE__*/jsx$1("path", {
|
|
59731
|
-
d: "m19.83 7.5-2.27-2.27c.07-.42.18-.81.32-1.15.08-.18.12-.37.12-.58 0-.83-.67-1.5-1.5-1.5-1.64 0-3.09.79-4 2h-5C4.46 4 2 6.46 2 9.5S4.5 21 4.5 21H10v-2h2v2h5.5l1.68-5.59 2.82-.94V7.5zM13 9H8V7h5zm3 2c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"
|
|
59732
|
-
}), 'Savings');
|
|
59733
|
-
|
|
59734
59730
|
var Schedule = createSvgIcon([/*#__PURE__*/jsx$1("path", {
|
|
59735
59731
|
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"
|
|
59736
59732
|
}, "0"), /*#__PURE__*/jsx$1("path", {
|
|
@@ -144504,8 +144500,53 @@ const parseMonthValue = (value) => {
|
|
|
144504
144500
|
return new Date(year, month - 1, 1);
|
|
144505
144501
|
};
|
|
144506
144502
|
const toMonthValue = (date) => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`;
|
|
144507
|
-
const
|
|
144508
|
-
|
|
144503
|
+
const MovementTotalButton = ({ kind, label, amount, selected, color, compact, onSelect, }) => (React__default.createElement(Box$1, { component: "button", type: "button", "aria-pressed": selected, "aria-label": label, "data-testid": kind === "income" ? "financial-movement-income" : "financial-movement-outcome", onClick: () => onSelect(kind), sx: {
|
|
144504
|
+
flex: 1,
|
|
144505
|
+
minWidth: 0,
|
|
144506
|
+
minHeight: 44,
|
|
144507
|
+
display: "flex",
|
|
144508
|
+
alignItems: "center",
|
|
144509
|
+
gap: 1,
|
|
144510
|
+
px: 1.25,
|
|
144511
|
+
py: compact ? 0.5 : 1,
|
|
144512
|
+
border: 0,
|
|
144513
|
+
borderRadius: 1.5,
|
|
144514
|
+
cursor: "pointer",
|
|
144515
|
+
textAlign: "left",
|
|
144516
|
+
color: "secondary.contrastText",
|
|
144517
|
+
bgcolor: selected ? color : alpha(color, 0.45),
|
|
144518
|
+
"&:hover": {
|
|
144519
|
+
bgcolor: selected ? color : alpha(color, 0.62),
|
|
144520
|
+
},
|
|
144521
|
+
"&:focus-visible": {
|
|
144522
|
+
outline: "2px solid",
|
|
144523
|
+
outlineColor: "secondary.contrastText",
|
|
144524
|
+
outlineOffset: 2,
|
|
144525
|
+
},
|
|
144526
|
+
} },
|
|
144527
|
+
React__default.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
144528
|
+
width: 28,
|
|
144529
|
+
height: 28,
|
|
144530
|
+
borderRadius: "50%",
|
|
144531
|
+
bgcolor: "rgba(255,255,255,0.2)",
|
|
144532
|
+
display: "flex",
|
|
144533
|
+
alignItems: "center",
|
|
144534
|
+
justifyContent: "center",
|
|
144535
|
+
flexShrink: 0,
|
|
144536
|
+
} }, kind === "income" ? (React__default.createElement(ArrowUpward, { fontSize: "small" })) : (React__default.createElement(ArrowDownward, { fontSize: "small" }))),
|
|
144537
|
+
React__default.createElement(Box$1, { sx: { minWidth: 0 } },
|
|
144538
|
+
compact ? null : (React__default.createElement(Typography$1, { variant: "caption", sx: { display: "block", lineHeight: 1.2, opacity: 0.92 } }, label)),
|
|
144539
|
+
React__default.createElement(Typography$1, { component: "span", "data-testid": kind === "income" ? "financial-income-total" : "financial-outcome-total", sx: {
|
|
144540
|
+
display: "block",
|
|
144541
|
+
fontWeight: 700,
|
|
144542
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
144543
|
+
lineHeight: 1.2,
|
|
144544
|
+
whiteSpace: "nowrap",
|
|
144545
|
+
overflow: "hidden",
|
|
144546
|
+
textOverflow: "ellipsis",
|
|
144547
|
+
} }, amount))));
|
|
144548
|
+
const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balanceLabel, movementKind = "income", incomeTotalLabel, outcomeTotalLabel, onMovementKindChange, isLoading = false, periodLabel, periodInputValue, periodInputMin, periodInputMax, onPeriodInputChange, detailLines = [], onEdit, onAdd, addLabel = "Adicionar", addQuotaFeature, canExport = false, isExporting = false, onExport, }) => {
|
|
144549
|
+
var _a, _b, _c, _d;
|
|
144509
144550
|
const theme = useTheme$1();
|
|
144510
144551
|
const periodButtonRef = useRef(null);
|
|
144511
144552
|
const heroRef = useRef(null);
|
|
@@ -144556,7 +144597,14 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144556
144597
|
const node = heroRef.current;
|
|
144557
144598
|
if (!node)
|
|
144558
144599
|
return;
|
|
144559
|
-
const measure = () =>
|
|
144600
|
+
const measure = () => {
|
|
144601
|
+
const spacer = node.nextElementSibling;
|
|
144602
|
+
const spacerDocTop = spacer
|
|
144603
|
+
? spacer.getBoundingClientRect().top + window.scrollY
|
|
144604
|
+
: 0;
|
|
144605
|
+
const nextHeight = Math.max(0, Math.round(node.offsetHeight - spacerDocTop));
|
|
144606
|
+
setSpacerHeight(nextHeight);
|
|
144607
|
+
};
|
|
144560
144608
|
const observer = new ResizeObserver(measure);
|
|
144561
144609
|
observer.observe(node);
|
|
144562
144610
|
measure();
|
|
@@ -144567,11 +144615,16 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144567
144615
|
const showAdd = Boolean(onAdd);
|
|
144568
144616
|
const showPeriod = Boolean(onPeriodInputChange);
|
|
144569
144617
|
const isMonthlyFee = variant === "monthlyFee";
|
|
144618
|
+
const showMovementSwitch = variant === "movements" && Boolean(onMovementKindChange);
|
|
144619
|
+
const incomeAmount = incomeTotalLabel !== null && incomeTotalLabel !== void 0 ? incomeTotalLabel : (movementKind === "income" ? balanceLabel : "R$ 0,00");
|
|
144620
|
+
const outcomeAmount = outcomeTotalLabel !== null && outcomeTotalLabel !== void 0 ? outcomeTotalLabel : (movementKind === "outcome" ? balanceLabel : "R$ 0,00");
|
|
144570
144621
|
const overline = variant === "monthlyFee"
|
|
144571
144622
|
? "Mensalidade"
|
|
144572
144623
|
: variant === "movements"
|
|
144573
144624
|
? "Lançamentos"
|
|
144574
|
-
:
|
|
144625
|
+
: variant === "accounts"
|
|
144626
|
+
? "Contas"
|
|
144627
|
+
: "Resumo Financeiro";
|
|
144575
144628
|
const periodDate = parseMonthValue(periodInputValue);
|
|
144576
144629
|
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: ptBR$1, localeText: ptBR.components.MuiLocalizationProvider.defaultProps.localeText },
|
|
144577
144630
|
React__default.createElement(Box$1, { ref: heroRef, "data-testid": "financial-dashboard-hero", "data-collapsed": isExpanded ? "false" : "true", sx: {
|
|
@@ -144600,9 +144653,8 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144600
144653
|
} },
|
|
144601
144654
|
React__default.createElement(Box$1, { "data-testid": "financial-dashboard-hero-content", sx: {
|
|
144602
144655
|
display: "flex",
|
|
144603
|
-
|
|
144604
|
-
gap:
|
|
144605
|
-
alignItems: isExpanded ? "flex-start" : "center",
|
|
144656
|
+
flexDirection: "column",
|
|
144657
|
+
gap: showMovementSwitch ? 1.5 : 0,
|
|
144606
144658
|
width: "100%",
|
|
144607
144659
|
maxWidth: theme.breakpoints.values.md,
|
|
144608
144660
|
mx: "auto",
|
|
@@ -144610,69 +144662,79 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144610
144662
|
px: PAGE_LIST_CONTAINER_SPACING.px,
|
|
144611
144663
|
pl: embedded ? { xs: 7, md: 2 } : undefined,
|
|
144612
144664
|
} },
|
|
144613
|
-
React__default.createElement(Box$1, { sx: {
|
|
144614
|
-
|
|
144615
|
-
|
|
144616
|
-
|
|
144617
|
-
|
|
144618
|
-
|
|
144619
|
-
|
|
144620
|
-
|
|
144621
|
-
|
|
144622
|
-
|
|
144623
|
-
|
|
144624
|
-
|
|
144625
|
-
|
|
144626
|
-
|
|
144627
|
-
|
|
144628
|
-
|
|
144629
|
-
|
|
144630
|
-
|
|
144631
|
-
|
|
144632
|
-
React__default.createElement(
|
|
144633
|
-
|
|
144634
|
-
|
|
144635
|
-
|
|
144636
|
-
|
|
144637
|
-
|
|
144638
|
-
|
|
144639
|
-
React__default.createElement(
|
|
144640
|
-
|
|
144641
|
-
|
|
144642
|
-
|
|
144643
|
-
|
|
144644
|
-
|
|
144645
|
-
|
|
144646
|
-
|
|
144647
|
-
|
|
144648
|
-
"
|
|
144649
|
-
|
|
144650
|
-
React__default.createElement(
|
|
144651
|
-
|
|
144652
|
-
|
|
144653
|
-
|
|
144654
|
-
|
|
144655
|
-
|
|
144656
|
-
|
|
144657
|
-
|
|
144658
|
-
React__default.createElement(Collapse$1, { in: isExpanded && showEdit, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144659
|
-
React__default.createElement(IconButton$1, { type: "button", "aria-label": "Editar mensalidade", onClick: onEdit, "data-testid": "financial-monthly-fee-edit", sx: {
|
|
144660
|
-
width: 44,
|
|
144661
|
-
height: 44,
|
|
144662
|
-
color: "secondary.contrastText",
|
|
144663
|
-
bgcolor: "rgba(255,255,255,0.12)",
|
|
144664
|
-
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144665
|
-
} },
|
|
144666
|
-
React__default.createElement(EditIcon, null))),
|
|
144667
|
-
React__default.createElement(Collapse$1, { in: isExpanded && showExport, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144668
|
-
React__default.createElement(IconButton$1, { "aria-label": isExporting ? "Exportando relatório" : "Exportar relatório", onClick: onExport, disabled: isExporting, "data-testid": "financial-report-export-button", sx: {
|
|
144665
|
+
React__default.createElement(Box$1, { sx: {
|
|
144666
|
+
display: "flex",
|
|
144667
|
+
justifyContent: "space-between",
|
|
144668
|
+
gap: 2,
|
|
144669
|
+
alignItems: isExpanded ? "flex-start" : "center",
|
|
144670
|
+
width: "100%",
|
|
144671
|
+
} },
|
|
144672
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
144673
|
+
React__default.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144674
|
+
React__default.createElement(Typography$1, { variant: "overline", sx: { opacity: 0.8, letterSpacing: "0.08em" } }, overline),
|
|
144675
|
+
variant === "balance" || variant === "accounts" ? (React__default.createElement(Typography$1, { variant: "body2", sx: { opacity: 0.9, mt: 1 } }, variant === "accounts" ? "Saldo das contas" : "Saldo da casa")) : null),
|
|
144676
|
+
showMovementSwitch ? null : isLoading ? (React__default.createElement(Skeleton$1, { width: isExpanded ? 180 : 120, height: isExpanded ? 48 : 28, sx: { bgcolor: "rgba(255,255,255,0.16)", my: 0.5 } })) : (React__default.createElement(Typography$1, { component: "p", "data-testid": "financial-dashboard-balance", sx: {
|
|
144677
|
+
fontSize: isExpanded ? { xs: "2rem", sm: "2.5rem" } : "1.125rem",
|
|
144678
|
+
fontWeight: 700,
|
|
144679
|
+
lineHeight: 1.15,
|
|
144680
|
+
letterSpacing: "-0.03em",
|
|
144681
|
+
my: isExpanded ? 0.5 : 0,
|
|
144682
|
+
transition: `font-size ${ANIMATION_DURATION.normal}ms ${ANIMATION_EASING.standard}`,
|
|
144683
|
+
} }, balanceLabel)),
|
|
144684
|
+
isMonthlyFee && detailLines.length > 0 ? (React__default.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144685
|
+
React__default.createElement(Stack$1, { spacing: 1, sx: { mt: 1.5 } }, detailLines.map((line) => (React__default.createElement(Box$1, { key: line.label },
|
|
144686
|
+
React__default.createElement(Typography$1, { variant: "caption", sx: { opacity: 0.75 } }, line.label),
|
|
144687
|
+
React__default.createElement(Typography$1, { variant: "body2", sx: { fontWeight: 600 } }, line.value))))))) : null,
|
|
144688
|
+
periodLabel ? (React__default.createElement(Typography$1, { variant: "body2", "data-testid": "financial-period-label", sx: { opacity: isExpanded ? 1 : 0.85 } }, periodLabel)) : null),
|
|
144689
|
+
showPeriod || showExport || showEdit || showAdd ? (React__default.createElement(Stack$1, { spacing: 2, alignItems: "center", sx: { flexShrink: 0, ml: "auto" } },
|
|
144690
|
+
showPeriod ? (React__default.createElement(React__default.Fragment, null,
|
|
144691
|
+
React__default.createElement(IconButton$1, { ref: periodButtonRef, type: "button", "aria-label": "Selecionar per\u00EDodo", "data-testid": "financial-period-button", onClick: openPeriodPicker, sx: {
|
|
144692
|
+
width: 44,
|
|
144693
|
+
height: 44,
|
|
144694
|
+
color: "secondary.contrastText",
|
|
144695
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144696
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144697
|
+
} },
|
|
144698
|
+
React__default.createElement(CalendarMonth$1, null)),
|
|
144699
|
+
React__default.createElement(Popover$1, { open: periodPickerOpen, anchorEl: periodButtonRef.current, onClose: () => setPeriodPickerOpen(false), anchorOrigin: { vertical: "bottom", horizontal: "right" }, transformOrigin: { vertical: "top", horizontal: "right" } },
|
|
144700
|
+
React__default.createElement(DateCalendar, { views: ["year", "month"], openTo: "month", value: periodDate, minDate: (_a = parseMonthValue(periodInputMin || "2000-01")) !== null && _a !== void 0 ? _a : undefined, maxDate: (_b = parseMonthValue(periodInputMax || "2100-12")) !== null && _b !== void 0 ? _b : undefined, onChange: selectPeriod, "data-testid": "financial-period-calendar" })))) : null,
|
|
144701
|
+
React__default.createElement(Collapse$1, { in: isExpanded && showAdd, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true }, addQuotaFeature ? (React__default.createElement(QuotaGuard, { feature: addQuotaFeature, behavior: "hide" },
|
|
144702
|
+
React__default.createElement(IconButton$1, { type: "button", "aria-label": addLabel, onClick: onAdd, "data-testid": "financial-summary-add", sx: {
|
|
144703
|
+
width: 44,
|
|
144704
|
+
height: 44,
|
|
144705
|
+
color: "secondary.contrastText",
|
|
144706
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144707
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144708
|
+
} },
|
|
144709
|
+
React__default.createElement(Add$1, null)))) : (React__default.createElement(IconButton$1, { type: "button", "aria-label": addLabel, onClick: onAdd, "data-testid": "financial-summary-add", sx: {
|
|
144669
144710
|
width: 44,
|
|
144670
144711
|
height: 44,
|
|
144671
144712
|
color: "secondary.contrastText",
|
|
144672
144713
|
bgcolor: "rgba(255,255,255,0.12)",
|
|
144673
144714
|
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144674
144715
|
} },
|
|
144675
|
-
React__default.createElement(
|
|
144716
|
+
React__default.createElement(Add$1, null)))),
|
|
144717
|
+
React__default.createElement(Collapse$1, { in: isExpanded && showEdit, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144718
|
+
React__default.createElement(IconButton$1, { type: "button", "aria-label": "Editar mensalidade", onClick: onEdit, "data-testid": "financial-monthly-fee-edit", sx: {
|
|
144719
|
+
width: 44,
|
|
144720
|
+
height: 44,
|
|
144721
|
+
color: "secondary.contrastText",
|
|
144722
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144723
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144724
|
+
} },
|
|
144725
|
+
React__default.createElement(EditIcon, null))),
|
|
144726
|
+
React__default.createElement(Collapse$1, { in: isExpanded && showExport, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144727
|
+
React__default.createElement(IconButton$1, { "aria-label": isExporting ? "Exportando relatório" : "Exportar relatório", onClick: onExport, disabled: isExporting, "data-testid": "financial-report-export-button", sx: {
|
|
144728
|
+
width: 44,
|
|
144729
|
+
height: 44,
|
|
144730
|
+
color: "secondary.contrastText",
|
|
144731
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144732
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144733
|
+
} },
|
|
144734
|
+
React__default.createElement(FileDownloadIcon, null))))) : null),
|
|
144735
|
+
showMovementSwitch && onMovementKindChange ? (React__default.createElement(Box$1, { sx: { display: "flex", gap: 1, width: "100%" } },
|
|
144736
|
+
React__default.createElement(MovementTotalButton, { kind: "income", label: "Contribui\u00E7\u00F5es", amount: incomeAmount, selected: movementKind === "income", color: (_d = (_c = theme.brand) === null || _c === void 0 ? void 0 : _c.green) !== null && _d !== void 0 ? _d : "#6F8C3A", compact: !isExpanded, onSelect: onMovementKindChange }),
|
|
144737
|
+
React__default.createElement(MovementTotalButton, { kind: "outcome", label: "Gastos", amount: outcomeAmount, selected: movementKind === "outcome", color: theme.palette.error.main, compact: !isExpanded, onSelect: onMovementKindChange }))) : null)),
|
|
144676
144738
|
React__default.createElement(Box$1, { sx: { height: spacerHeight } })));
|
|
144677
144739
|
};
|
|
144678
144740
|
|
|
@@ -145908,7 +145970,7 @@ const FinancialBottomNav = ({ audience, activeTab, showMensalidade = false, onNa
|
|
|
145908
145970
|
id: "movements",
|
|
145909
145971
|
label: "Lançamentos",
|
|
145910
145972
|
testId: "financial-nav-movements",
|
|
145911
|
-
icon: React__default.createElement(
|
|
145973
|
+
icon: React__default.createElement(ReceiptLong, null),
|
|
145912
145974
|
onClick: onNavigateMovements,
|
|
145913
145975
|
},
|
|
145914
145976
|
{
|
|
@@ -146010,65 +146072,97 @@ const FinancialAppShell = ({ audience, activeTab, showBottomNav = true, showMens
|
|
|
146010
146072
|
showBottomNav ? (React__default.createElement(FinancialBottomNav, { audience: audience, activeTab: activeTab, showMensalidade: showMensalidade, onNavigateHome: onNavigateHome, onNavigateMovements: onNavigateMovements, onNavigateAccounts: onNavigateAccounts, onNavigateMonthlyFee: onNavigateMonthlyFee })) : null)));
|
|
146011
146073
|
};
|
|
146012
146074
|
|
|
146075
|
+
const SEARCH_DEBOUNCE_MS$3 = 1000;
|
|
146076
|
+
const SEARCH_MIN_CHARS$3 = 2;
|
|
146013
146077
|
const formatCurrency$3 = (value) => new Intl.NumberFormat("pt-BR", {
|
|
146014
146078
|
style: "currency",
|
|
146015
146079
|
currency: "BRL",
|
|
146016
|
-
}).format(Number(value));
|
|
146080
|
+
}).format(Number(value) || 0);
|
|
146081
|
+
const accountDetail = (account) => {
|
|
146082
|
+
const place = account.accountType === "CASH"
|
|
146083
|
+
? "Caixa"
|
|
146084
|
+
: [
|
|
146085
|
+
account.agency ? `Agência ${account.agency}` : "",
|
|
146086
|
+
account.account ? `Conta ${account.account}` : "",
|
|
146087
|
+
]
|
|
146088
|
+
.filter(Boolean)
|
|
146089
|
+
.join(" · ");
|
|
146090
|
+
return [place, account.pixKey].filter(Boolean).join(" · ");
|
|
146091
|
+
};
|
|
146092
|
+
function EmptyState$2({ message }) {
|
|
146093
|
+
return (React__default.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
146094
|
+
React__default.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
146095
|
+
}
|
|
146017
146096
|
const AccountListItem = memo(({ account, isLastItem, onSelect, }) => {
|
|
146018
|
-
|
|
146019
|
-
|
|
146020
|
-
|
|
146021
|
-
|
|
146022
|
-
|
|
146023
|
-
|
|
146024
|
-
|
|
146025
|
-
|
|
146026
|
-
|
|
146027
|
-
|
|
146028
|
-
|
|
146029
|
-
|
|
146030
|
-
|
|
146031
|
-
|
|
146032
|
-
|
|
146033
|
-
|
|
146034
|
-
|
|
146035
|
-
|
|
146036
|
-
|
|
146037
|
-
|
|
146038
|
-
|
|
146039
|
-
|
|
146040
|
-
|
|
146041
|
-
|
|
146042
|
-
|
|
146043
|
-
React__default.createElement(ListItemSecondaryAction$1, null,
|
|
146044
|
-
React__default.createElement(ChevronRight$2, { color: "action" }))));
|
|
146097
|
+
const detail = accountDetail(account);
|
|
146098
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
146099
|
+
React__default.createElement(ListItem$1, { "data-testid": `financial-account-list-item-${account.id}`, onClick: () => onSelect(account.id), onKeyDown: (event) => {
|
|
146100
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
146101
|
+
event.preventDefault();
|
|
146102
|
+
onSelect(account.id);
|
|
146103
|
+
}
|
|
146104
|
+
}, tabIndex: 0, "aria-label": `Selecionar conta: ${account.name}`, sx: {
|
|
146105
|
+
display: "flex",
|
|
146106
|
+
px: 0,
|
|
146107
|
+
minHeight: 44,
|
|
146108
|
+
cursor: "pointer",
|
|
146109
|
+
"&:hover, &:focus": { backgroundColor: "action.hover" },
|
|
146110
|
+
} },
|
|
146111
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
146112
|
+
React__default.createElement(Box$1, { sx: {
|
|
146113
|
+
display: "flex",
|
|
146114
|
+
justifyContent: "space-between",
|
|
146115
|
+
gap: 2,
|
|
146116
|
+
alignItems: "baseline",
|
|
146117
|
+
} },
|
|
146118
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, account.name),
|
|
146119
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formatCurrency$3(account.currentBalance))),
|
|
146120
|
+
detail ? (React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, detail)) : null)),
|
|
146121
|
+
!isLastItem ? React__default.createElement(Divider$1, { component: "li" }) : null));
|
|
146045
146122
|
});
|
|
146046
146123
|
AccountListItem.displayName = "AccountListItem";
|
|
146047
146124
|
const FinancialAccountsPage = ({ accounts, onBack, onSelectAccount, onAddAccount, }) => {
|
|
146048
|
-
useTheme$1();
|
|
146049
146125
|
const { embedded } = useFinancialChrome();
|
|
146050
|
-
const
|
|
146051
|
-
const
|
|
146052
|
-
|
|
146053
|
-
|
|
146054
|
-
|
|
146126
|
+
const [searchInput, setSearchInput] = useState("");
|
|
146127
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
146128
|
+
useEffect(() => {
|
|
146129
|
+
const normalized = searchInput.trim().toLowerCase();
|
|
146130
|
+
if (normalized.length < SEARCH_MIN_CHARS$3) {
|
|
146131
|
+
setSearchTerm("");
|
|
146132
|
+
return;
|
|
146133
|
+
}
|
|
146134
|
+
const timeout = window.setTimeout(() => setSearchTerm(normalized), SEARCH_DEBOUNCE_MS$3);
|
|
146135
|
+
return () => window.clearTimeout(timeout);
|
|
146136
|
+
}, [searchInput]);
|
|
146137
|
+
const balanceLabel = useMemo(() => {
|
|
146138
|
+
const total = accounts.reduce((sum, account) => {
|
|
146139
|
+
const value = Number(account.currentBalance);
|
|
146140
|
+
return sum + (Number.isFinite(value) ? value : 0);
|
|
146141
|
+
}, 0);
|
|
146142
|
+
return formatCurrency$3(total);
|
|
146143
|
+
}, [accounts]);
|
|
146144
|
+
const visibleAccounts = useMemo(() => {
|
|
146145
|
+
if (!searchTerm)
|
|
146146
|
+
return accounts;
|
|
146147
|
+
return accounts.filter((account) => account.name.toLowerCase().includes(searchTerm));
|
|
146148
|
+
}, [accounts, searchTerm]);
|
|
146055
146149
|
return (React__default.createElement(Box$1, { sx: { minHeight: embedded ? "auto" : "100vh", bgcolor: "background.default" } },
|
|
146056
|
-
embedded ? null : (React__default.createElement(PageHeader$2, { title: "Contas", onBack: onBack,
|
|
146057
|
-
React__default.createElement(
|
|
146058
|
-
|
|
146059
|
-
|
|
146060
|
-
|
|
146061
|
-
|
|
146062
|
-
|
|
146063
|
-
|
|
146064
|
-
|
|
146065
|
-
|
|
146066
|
-
|
|
146067
|
-
|
|
146068
|
-
|
|
146069
|
-
|
|
146070
|
-
|
|
146071
|
-
|
|
146150
|
+
embedded ? null : (React__default.createElement(PageHeader$2, { title: "Contas", onBack: onBack, showAddButton: false })),
|
|
146151
|
+
React__default.createElement(FinancialSummaryHeader, { embedded: embedded, variant: "accounts", balanceLabel: balanceLabel, onAdd: onAddAccount, addLabel: "Adicionar conta" }),
|
|
146152
|
+
React__default.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
146153
|
+
React__default.createElement(TextField$1, { fullWidth: true, placeholder: "Buscar conta", value: searchInput, onChange: (event) => setSearchInput(event.target.value), inputProps: { "aria-label": "Buscar conta" }, InputProps: {
|
|
146154
|
+
startAdornment: (React__default.createElement(InputAdornment$1, { position: "start" },
|
|
146155
|
+
React__default.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
146156
|
+
}, sx: {
|
|
146157
|
+
mb: 2,
|
|
146158
|
+
width: "100%",
|
|
146159
|
+
"& .MuiOutlinedInput-root": {
|
|
146160
|
+
borderRadius: RADIUS.default,
|
|
146161
|
+
minHeight: 44,
|
|
146162
|
+
backgroundColor: "background.paper",
|
|
146163
|
+
},
|
|
146164
|
+
} }),
|
|
146165
|
+
visibleAccounts.length === 0 ? (React__default.createElement(EmptyState$2, { message: searchTerm ? "Nenhuma conta encontrada" : "Nenhuma conta cadastrada" })) : (React__default.createElement(List$1, { "data-testid": "financial-accounts-list", sx: { py: 0 } }, visibleAccounts.map((account, index) => (React__default.createElement(AccountListItem, { key: account.id, account: account, isLastItem: index === visibleAccounts.length - 1, onSelect: onSelectAccount }))))))));
|
|
146072
146166
|
};
|
|
146073
146167
|
|
|
146074
146168
|
const FinancialMonthlyFeePage = ({ formatCurrency, monthlyFee, dueDay, paymentMethod, receivingAccount, onBack, onEdit, summary, receiptForm, children, }) => {
|
|
@@ -147210,22 +147304,11 @@ const useIncomeListPage = (props) => {
|
|
|
147210
147304
|
|
|
147211
147305
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147212
147306
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
147213
|
-
|
|
147214
|
-
|
|
147215
|
-
|
|
147216
|
-
|
|
147217
|
-
|
|
147218
|
-
py: EMPTY_STATE_VERTICAL_PADDING,
|
|
147219
|
-
display: "flex",
|
|
147220
|
-
flexDirection: "column",
|
|
147221
|
-
alignItems: "center",
|
|
147222
|
-
gap: 2,
|
|
147223
|
-
textAlign: "center",
|
|
147224
|
-
} },
|
|
147225
|
-
React__default.createElement(ReceiptLongIcon, { sx: { fontSize: 56, color: "text.secondary" }, "aria-hidden": true }),
|
|
147226
|
-
React__default.createElement(Typography$1, { id: "income-empty-title", variant: "h6" }, "Nenhuma contribui\u00E7\u00E3o registrada"),
|
|
147227
|
-
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary", sx: { maxWidth: 440 } }, "Registre sua primeira contribui\u00E7\u00E3o para acompanhar o saldo e controlar as doa\u00E7\u00F5es e receitas do m\u00EAs. Voc\u00EA pode adicionar uma contribui\u00E7\u00E3o agora mesmo."),
|
|
147228
|
-
React__default.createElement(Button$1, { variant: "contained", color: "primary", startIcon: React__default.createElement(Add$1, null), onClick: onAdd !== null && onAdd !== void 0 ? onAdd : (() => { }), "aria-label": "Adicionar nova contribui\u00E7\u00E3o", sx: { mt: 1, px: 3 }, size: isMobile ? "medium" : "large" }, "Adicionar Contribui\u00E7\u00E3o")));
|
|
147307
|
+
const SEARCH_DEBOUNCE_MS$2 = 1000;
|
|
147308
|
+
const SEARCH_MIN_CHARS$2 = 2;
|
|
147309
|
+
function EmptyState$1({ message }) {
|
|
147310
|
+
return (React__default.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147311
|
+
React__default.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147229
147312
|
}
|
|
147230
147313
|
/**
|
|
147231
147314
|
* Presentation-only list item component (memoized)
|
|
@@ -147235,10 +147318,8 @@ const IncomeListItem = React__default.memo(function IncomeListItem({ item, idx,
|
|
|
147235
147318
|
const dateLabel = formatDate(item.date);
|
|
147236
147319
|
const formattedAmount = formatCurrency(item.amount);
|
|
147237
147320
|
const accountName = getAccountName(item);
|
|
147238
|
-
const { category, subcategory } = item;
|
|
147239
147321
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147240
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147241
|
-
const settlementColor = settlementStatus === "PROJECTED" ? "warning" : "success";
|
|
147322
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147242
147323
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147243
147324
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147244
147325
|
? "Marcar como Pago"
|
|
@@ -147249,48 +147330,39 @@ const IncomeListItem = React__default.memo(function IncomeListItem({ item, idx,
|
|
|
147249
147330
|
onSelect(item.id);
|
|
147250
147331
|
};
|
|
147251
147332
|
return (React__default.createElement(React__default.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147252
|
-
React__default.createElement(ListItem$1, { alignItems: "
|
|
147333
|
+
React__default.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147253
147334
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147254
147335
|
e.preventDefault();
|
|
147255
147336
|
onSelect(item.id);
|
|
147256
147337
|
}
|
|
147257
147338
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar contribuição: ${item.description}` : undefined, sx: {
|
|
147339
|
+
display: "flex",
|
|
147340
|
+
gap: 1,
|
|
147341
|
+
px: 0,
|
|
147258
147342
|
cursor: onSelect ? "pointer" : undefined,
|
|
147259
147343
|
"&:hover, &:focus": onSelect
|
|
147260
147344
|
? { backgroundColor: "action.hover" }
|
|
147261
147345
|
: undefined,
|
|
147262
147346
|
} },
|
|
147263
|
-
React__default.createElement(
|
|
147264
|
-
|
|
147265
|
-
alignItems: "flex-start",
|
|
147266
|
-
flexDirection: "column",
|
|
147267
|
-
gap: 1,
|
|
147268
|
-
} },
|
|
147269
|
-
React__default.createElement(Typography$1, { variant: "subtitle1" }, item.description),
|
|
147270
|
-
category && subcategory && (React__default.createElement(Typography$1, { variant: "caption", color: "text.secondary" },
|
|
147271
|
-
"\u2022 ",
|
|
147272
|
-
category,
|
|
147273
|
-
" / ",
|
|
147274
|
-
subcategory)),
|
|
147275
|
-
React__default.createElement(Chip$1, { size: "small", label: settlementLabel, color: settlementColor, variant: settlementStatus === "PROJECTED" ? "outlined" : "filled" })), secondary: React__default.createElement(Box$1, { sx: {
|
|
147347
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147348
|
+
React__default.createElement(Box$1, { sx: {
|
|
147276
147349
|
display: "flex",
|
|
147277
|
-
|
|
147278
|
-
gap:
|
|
147350
|
+
justifyContent: "space-between",
|
|
147351
|
+
gap: 2,
|
|
147352
|
+
alignItems: "baseline",
|
|
147279
147353
|
} },
|
|
147280
|
-
React__default.createElement(Typography$1, { variant: "
|
|
147281
|
-
React__default.createElement(Typography$1, { variant: "
|
|
147282
|
-
|
|
147283
|
-
|
|
147284
|
-
|
|
147285
|
-
|
|
147286
|
-
|
|
147287
|
-
|
|
147288
|
-
|
|
147289
|
-
}, sx: { width: 44, height: 44 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null))),
|
|
147290
|
-
!isLastItem && React__default.createElement(Divider$1, { component: "li", variant: "inset" })));
|
|
147354
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147355
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147356
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, dateLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147357
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React__default.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147358
|
+
event.stopPropagation();
|
|
147359
|
+
item.id &&
|
|
147360
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147361
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null),
|
|
147362
|
+
!isLastItem && React__default.createElement(Divider$1, { component: "li" })));
|
|
147291
147363
|
});
|
|
147292
|
-
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147293
|
-
const { data: { dataSource,
|
|
147364
|
+
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147365
|
+
const { data: { dataSource, theme }, fns: { formatCurrency, formatDate, getAccountName }, } = useIncomeListPage({ data });
|
|
147294
147366
|
const { embedded } = useFinancialChrome();
|
|
147295
147367
|
const totalAmountNumber = useMemo(() => {
|
|
147296
147368
|
const val = typeof dataSource.totalAmount === "string"
|
|
@@ -147316,48 +147388,64 @@ const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue
|
|
|
147316
147388
|
currency: "BRL",
|
|
147317
147389
|
});
|
|
147318
147390
|
const incomes = useMemo(() => (Array.isArray(dataSource.incomes) ? dataSource.incomes : []), [dataSource.incomes]);
|
|
147391
|
+
const [searchInput, setSearchInput] = useState("");
|
|
147392
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
147393
|
+
useEffect(() => {
|
|
147394
|
+
const trimmed = searchInput.trim();
|
|
147395
|
+
if (trimmed.length < SEARCH_MIN_CHARS$2) {
|
|
147396
|
+
setSearchTerm("");
|
|
147397
|
+
return;
|
|
147398
|
+
}
|
|
147399
|
+
const timeoutId = window.setTimeout(() => {
|
|
147400
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147401
|
+
}, SEARCH_DEBOUNCE_MS$2);
|
|
147402
|
+
return () => window.clearTimeout(timeoutId);
|
|
147403
|
+
}, [searchInput]);
|
|
147404
|
+
const visibleIncomes = useMemo(() => {
|
|
147405
|
+
if (!searchTerm)
|
|
147406
|
+
return incomes;
|
|
147407
|
+
return incomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147408
|
+
}, [incomes, searchTerm]);
|
|
147319
147409
|
return (React__default.createElement(Box$1, { sx: {
|
|
147320
147410
|
display: "flex",
|
|
147321
147411
|
flexDirection: "column",
|
|
147322
147412
|
minHeight: embedded ? "auto" : "100vh",
|
|
147323
147413
|
backgroundColor: theme.palette.background.default,
|
|
147324
147414
|
position: "relative",
|
|
147325
|
-
//pb: isMobile ? 2 : 0,
|
|
147326
147415
|
} },
|
|
147327
147416
|
embedded ? null : (React__default.createElement(PageHeader$2, { title: "Contribui\u00E7\u00F5es", onBack: onBack, showAddButton: false })),
|
|
147328
|
-
React__default.createElement(FinancialSummaryHeader, { embedded: embedded, variant: "movements", balanceLabel: amountLabel, periodLabel: periodLabel || metricPeriodLabel, periodInputValue: periodInputValue, periodInputMin: periodInputMin, periodInputMax: periodInputMax, onPeriodInputChange: showPeriodFilter === false ? undefined : onPeriodInputChange, onAdd: onAdd, addLabel: "Adicionar contribui\u00E7\u00E3o", addQuotaFeature: "incomes" }),
|
|
147417
|
+
React__default.createElement(FinancialSummaryHeader, { embedded: embedded, variant: "movements", balanceLabel: amountLabel, periodLabel: periodLabel || metricPeriodLabel, periodInputValue: periodInputValue, periodInputMin: periodInputMin, periodInputMax: periodInputMax, onPeriodInputChange: showPeriodFilter === false ? undefined : onPeriodInputChange, onAdd: onAdd, addLabel: "Adicionar contribui\u00E7\u00E3o", addQuotaFeature: "incomes", movementKind: movementKind !== null && movementKind !== void 0 ? movementKind : "income", incomeTotalLabel: incomeTotalLabel !== null && incomeTotalLabel !== void 0 ? incomeTotalLabel : amountLabel, outcomeTotalLabel: outcomeTotalLabel, onMovementKindChange: onMovementKindChange }),
|
|
147329
147418
|
React__default.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147330
|
-
|
|
147331
|
-
|
|
147332
|
-
|
|
147419
|
+
React__default.createElement(TextField$1, { fullWidth: true, placeholder: "Buscar lan\u00E7amento", value: searchInput, onChange: (event) => setSearchInput(event.target.value), inputProps: { "aria-label": "Buscar lançamento" }, InputProps: {
|
|
147420
|
+
startAdornment: (React__default.createElement(InputAdornment$1, { position: "start" },
|
|
147421
|
+
React__default.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147422
|
+
}, sx: {
|
|
147423
|
+
mb: 2,
|
|
147333
147424
|
width: "100%",
|
|
147334
|
-
|
|
147335
|
-
|
|
147336
|
-
|
|
147337
|
-
|
|
147338
|
-
|
|
147339
|
-
|
|
147340
|
-
|
|
147341
|
-
|
|
147342
|
-
|
|
147343
|
-
p: EMPTY_STATE_PADDING,
|
|
147344
|
-
} },
|
|
147345
|
-
React__default.createElement(EmptyState$1, { onAdd: onAdd, isMobile: isMobile }))) : (React__default.createElement(List$1, { sx: {
|
|
147425
|
+
"& .MuiOutlinedInput-root": {
|
|
147426
|
+
borderRadius: RADIUS.default,
|
|
147427
|
+
minHeight: 44,
|
|
147428
|
+
backgroundColor: "background.paper",
|
|
147429
|
+
},
|
|
147430
|
+
} }),
|
|
147431
|
+
visibleIncomes.length === 0 ? (React__default.createElement(EmptyState$1, { message: searchTerm
|
|
147432
|
+
? "Nenhum lançamento encontrado"
|
|
147433
|
+
: "Nenhuma contribuição registrada" })) : (React__default.createElement(List$1, { sx: {
|
|
147346
147434
|
width: "100%",
|
|
147347
147435
|
bgcolor: "transparent",
|
|
147348
147436
|
borderRadius: 0,
|
|
147349
147437
|
boxShadow: "none",
|
|
147350
147438
|
border: "none",
|
|
147351
147439
|
overflow: "hidden",
|
|
147352
|
-
} },
|
|
147440
|
+
} }, visibleIncomes.map((inc, idx) => {
|
|
147353
147441
|
var _a, _b;
|
|
147354
|
-
return (React__default.createElement(IncomeListItem, { key: `${(_a = inc.date) !== null && _a !== void 0 ? _a : ""}-${idx}-${(_b = inc.amount) !== null && _b !== void 0 ? _b : ""}`, item: inc, idx: idx, isLastItem: idx ===
|
|
147442
|
+
return (React__default.createElement(IncomeListItem, { key: `${(_a = inc.date) !== null && _a !== void 0 ? _a : ""}-${idx}-${(_b = inc.amount) !== null && _b !== void 0 ? _b : ""}`, item: inc, idx: idx, isLastItem: idx === visibleIncomes.length - 1, formatCurrency: formatCurrency, formatDate: formatDate, getAccountName: getAccountName, onSelect: onSelect, canConfirmTransactions: canConfirmTransactions, isUpdatingSettlementStatus: isUpdatingSettlementStatus, onToggleSettlementStatus: onToggleSettlementStatus }));
|
|
147355
147443
|
}))))));
|
|
147356
147444
|
};
|
|
147357
147445
|
var IncomeListPage$1 = React__default.memo(IncomeListPage);
|
|
147358
147446
|
|
|
147359
|
-
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147360
|
-
const SEARCH_MIN_CHARS = 2;
|
|
147447
|
+
const SEARCH_DEBOUNCE_MS$1 = 1000;
|
|
147448
|
+
const SEARCH_MIN_CHARS$1 = 2;
|
|
147361
147449
|
const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
147362
147450
|
const { terreiroId, competenceMonth, requests = [], reminderStatus = null, canDispatchReminders = false, isLoading = false, isReviewing = false, isDispatchingReminders = false, error, onBack, onCompetenceMonthChange, onApprove, onReject, onDispatchReminders, } = props;
|
|
147363
147451
|
const [statusFilter, setStatusFilter] = useState("ALL");
|
|
@@ -147404,13 +147492,13 @@ const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
|
147404
147492
|
}, []);
|
|
147405
147493
|
useEffect(() => {
|
|
147406
147494
|
const trimmed = searchInput.trim();
|
|
147407
|
-
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147495
|
+
if (trimmed.length < SEARCH_MIN_CHARS$1) {
|
|
147408
147496
|
setSearchTerm("");
|
|
147409
147497
|
return;
|
|
147410
147498
|
}
|
|
147411
147499
|
const timeoutId = window.setTimeout(() => {
|
|
147412
147500
|
setSearchTerm(trimmed);
|
|
147413
|
-
}, SEARCH_DEBOUNCE_MS);
|
|
147501
|
+
}, SEARCH_DEBOUNCE_MS$1);
|
|
147414
147502
|
return () => {
|
|
147415
147503
|
window.clearTimeout(timeoutId);
|
|
147416
147504
|
};
|
|
@@ -147796,24 +147884,11 @@ const useOutcomeListPage = (props) => {
|
|
|
147796
147884
|
|
|
147797
147885
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147798
147886
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
147799
|
-
|
|
147800
|
-
|
|
147801
|
-
|
|
147802
|
-
|
|
147803
|
-
|
|
147804
|
-
function EmptyState({ onAdd, isMobile, }) {
|
|
147805
|
-
return (React__default.createElement(Box$1, { role: "region", "aria-labelledby": "outcome-empty-title", sx: {
|
|
147806
|
-
py: EMPTY_STATE_VERTICAL_PADDING,
|
|
147807
|
-
display: "flex",
|
|
147808
|
-
flexDirection: "column",
|
|
147809
|
-
alignItems: "center",
|
|
147810
|
-
gap: 2,
|
|
147811
|
-
textAlign: "center",
|
|
147812
|
-
} },
|
|
147813
|
-
React__default.createElement(ReceiptLongIcon, { sx: { fontSize: 56, color: "text.secondary" }, "aria-hidden": true }),
|
|
147814
|
-
React__default.createElement(Typography$1, { id: "outcome-empty-title", variant: "h6" }, "Nenhum gasto registrado"),
|
|
147815
|
-
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary", sx: { maxWidth: 440 } }, "Registre seu primeiro gasto para acompanhar as despesas do m\u00EAs e organizar seu caixa. Voc\u00EA pode adicionar um gasto agora mesmo."),
|
|
147816
|
-
React__default.createElement(Button$1, { variant: "contained", color: "primary", startIcon: React__default.createElement(Add$1, null), onClick: onAdd !== null && onAdd !== void 0 ? onAdd : (() => { }), "aria-label": "Adicionar novo gasto", sx: { mt: 1, px: 3 }, size: isMobile ? "medium" : "large" }, "Adicionar Gastos")));
|
|
147887
|
+
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147888
|
+
const SEARCH_MIN_CHARS = 2;
|
|
147889
|
+
function EmptyState({ message }) {
|
|
147890
|
+
return (React__default.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147891
|
+
React__default.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147817
147892
|
}
|
|
147818
147893
|
/**
|
|
147819
147894
|
* Presentation-only list item component
|
|
@@ -147826,11 +147901,9 @@ const OutcomeListItem = React__default.memo(function OutcomeListItem({ item, idx
|
|
|
147826
147901
|
const dueDateLabel = item.dueDate ? formatDate(item.dueDate) : "";
|
|
147827
147902
|
const formattedAmount = formatCurrency(item.amount);
|
|
147828
147903
|
const accountName = getAccountName(item);
|
|
147829
|
-
const { category, subcategory } = item;
|
|
147830
|
-
const categoryLabel = category && subcategory ? `${category} / ${subcategory}` : category;
|
|
147831
147904
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147832
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147833
|
-
const
|
|
147905
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147906
|
+
const whenLabel = dueDateLabel ? `vencimento em ${dueDateLabel}` : dateLabel;
|
|
147834
147907
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147835
147908
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147836
147909
|
? "Marcar como Pago"
|
|
@@ -147841,52 +147914,42 @@ const OutcomeListItem = React__default.memo(function OutcomeListItem({ item, idx
|
|
|
147841
147914
|
onSelect(item.id);
|
|
147842
147915
|
};
|
|
147843
147916
|
return (React__default.createElement(React__default.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147844
|
-
React__default.createElement(ListItem$1, { alignItems: "
|
|
147917
|
+
React__default.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147845
147918
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147846
147919
|
e.preventDefault();
|
|
147847
147920
|
onSelect(item.id);
|
|
147848
147921
|
}
|
|
147849
147922
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar gasto: ${item.description}` : undefined, sx: {
|
|
147923
|
+
display: "flex",
|
|
147924
|
+
gap: 1,
|
|
147925
|
+
px: 0,
|
|
147850
147926
|
cursor: onSelect ? "pointer" : undefined,
|
|
147851
147927
|
"&:hover, &:focus": onSelect
|
|
147852
147928
|
? { backgroundColor: "action.hover" }
|
|
147853
147929
|
: undefined,
|
|
147854
147930
|
} },
|
|
147855
|
-
React__default.createElement(
|
|
147856
|
-
|
|
147857
|
-
alignItems: "flex-start",
|
|
147858
|
-
flexDirection: "column",
|
|
147859
|
-
gap: 1,
|
|
147860
|
-
} },
|
|
147861
|
-
React__default.createElement(Typography$1, { variant: "subtitle1" }, item.description),
|
|
147862
|
-
item.category && (React__default.createElement(Typography$1, { variant: "caption", color: "text.secondary" },
|
|
147863
|
-
"\u2022 ",
|
|
147864
|
-
categoryLabel)),
|
|
147865
|
-
React__default.createElement(Chip$1, { size: "small", label: settlementLabel, color: settlementColor, variant: settlementStatus === "PROJECTED" ? "outlined" : "filled" })), secondary: React__default.createElement(Box$1, { sx: {
|
|
147931
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147932
|
+
React__default.createElement(Box$1, { sx: {
|
|
147866
147933
|
display: "flex",
|
|
147867
|
-
|
|
147868
|
-
gap:
|
|
147934
|
+
justifyContent: "space-between",
|
|
147935
|
+
gap: 2,
|
|
147936
|
+
alignItems: "baseline",
|
|
147869
147937
|
} },
|
|
147870
|
-
React__default.createElement(Typography$1, { variant: "
|
|
147871
|
-
|
|
147872
|
-
|
|
147873
|
-
|
|
147874
|
-
|
|
147875
|
-
|
|
147876
|
-
|
|
147877
|
-
|
|
147878
|
-
|
|
147879
|
-
event.stopPropagation();
|
|
147880
|
-
if (!item.id)
|
|
147881
|
-
return;
|
|
147882
|
-
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147883
|
-
}, sx: { width: 44, height: 44 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null))),
|
|
147938
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147939
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147940
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, whenLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147941
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React__default.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147942
|
+
event.stopPropagation();
|
|
147943
|
+
if (!item.id)
|
|
147944
|
+
return;
|
|
147945
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147946
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null),
|
|
147884
147947
|
!isLastItem && React__default.createElement(Divider$1, { component: "li" })));
|
|
147885
147948
|
});
|
|
147886
|
-
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147887
|
-
const theme = useTheme$1();
|
|
147949
|
+
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147950
|
+
const theme = useTheme$1();
|
|
147888
147951
|
const { embedded } = useFinancialChrome();
|
|
147889
|
-
const { data: { dataSource
|
|
147952
|
+
const { data: { dataSource }, fns: { formatCurrency, formatDate, getAccountName }, } = useOutcomeListPage({ data });
|
|
147890
147953
|
const totalAmountNumber = typeof dataSource.totalAmount === "string"
|
|
147891
147954
|
? parseFloat(dataSource.totalAmount)
|
|
147892
147955
|
: dataSource.totalAmount;
|
|
@@ -147896,6 +147959,24 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147896
147959
|
currency: "BRL",
|
|
147897
147960
|
});
|
|
147898
147961
|
const outcomes = useMemo(() => (Array.isArray(dataSource.outcomes) ? dataSource.outcomes : []), [dataSource.outcomes]);
|
|
147962
|
+
const [searchInput, setSearchInput] = useState("");
|
|
147963
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
147964
|
+
useEffect(() => {
|
|
147965
|
+
const trimmed = searchInput.trim();
|
|
147966
|
+
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147967
|
+
setSearchTerm("");
|
|
147968
|
+
return;
|
|
147969
|
+
}
|
|
147970
|
+
const timeoutId = window.setTimeout(() => {
|
|
147971
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147972
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
147973
|
+
return () => window.clearTimeout(timeoutId);
|
|
147974
|
+
}, [searchInput]);
|
|
147975
|
+
const visibleOutcomes = useMemo(() => {
|
|
147976
|
+
if (!searchTerm)
|
|
147977
|
+
return outcomes;
|
|
147978
|
+
return outcomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147979
|
+
}, [outcomes, searchTerm]);
|
|
147899
147980
|
return (React__default.createElement(Box$1, { sx: {
|
|
147900
147981
|
display: "flex",
|
|
147901
147982
|
flexDirection: "column",
|
|
@@ -147905,33 +147986,30 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147905
147986
|
pb: 0,
|
|
147906
147987
|
} },
|
|
147907
147988
|
embedded ? null : (React__default.createElement(PageHeader$2, { title: "Gastos", onBack: onBack, showAddButton: false })),
|
|
147908
|
-
React__default.createElement(FinancialSummaryHeader, { embedded: embedded, variant: "movements", balanceLabel: amountLabel, periodLabel: periodLabel, periodInputValue: periodInputValue, periodInputMin: periodInputMin, periodInputMax: periodInputMax, onPeriodInputChange: showPeriodFilter === false ? undefined : onPeriodInputChange, onAdd: onAdd, addLabel: "Adicionar gasto", addQuotaFeature: "outcomes" }),
|
|
147989
|
+
React__default.createElement(FinancialSummaryHeader, { embedded: embedded, variant: "movements", balanceLabel: amountLabel, periodLabel: periodLabel, periodInputValue: periodInputValue, periodInputMin: periodInputMin, periodInputMax: periodInputMax, onPeriodInputChange: showPeriodFilter === false ? undefined : onPeriodInputChange, onAdd: onAdd, addLabel: "Adicionar gasto", addQuotaFeature: "outcomes", movementKind: movementKind !== null && movementKind !== void 0 ? movementKind : "outcome", incomeTotalLabel: incomeTotalLabel, outcomeTotalLabel: outcomeTotalLabel !== null && outcomeTotalLabel !== void 0 ? outcomeTotalLabel : amountLabel, onMovementKindChange: onMovementKindChange }),
|
|
147909
147990
|
React__default.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147910
|
-
|
|
147911
|
-
|
|
147912
|
-
|
|
147991
|
+
React__default.createElement(TextField$1, { fullWidth: true, placeholder: "Buscar lan\u00E7amento", value: searchInput, onChange: (event) => setSearchInput(event.target.value), inputProps: { "aria-label": "Buscar lançamento" }, InputProps: {
|
|
147992
|
+
startAdornment: (React__default.createElement(InputAdornment$1, { position: "start" },
|
|
147993
|
+
React__default.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147994
|
+
}, sx: {
|
|
147995
|
+
mb: 2,
|
|
147913
147996
|
width: "100%",
|
|
147914
|
-
|
|
147915
|
-
|
|
147916
|
-
|
|
147917
|
-
|
|
147918
|
-
|
|
147919
|
-
|
|
147920
|
-
|
|
147921
|
-
alignItems: "center",
|
|
147922
|
-
justifyContent: "center",
|
|
147923
|
-
p: EMPTY_STATE_PADDING,
|
|
147924
|
-
} },
|
|
147925
|
-
React__default.createElement(EmptyState, { onAdd: onAdd, isMobile: isMobile }))) : (React__default.createElement(List$1, { "aria-label": "Lista de gastos", sx: {
|
|
147997
|
+
"& .MuiOutlinedInput-root": {
|
|
147998
|
+
borderRadius: RADIUS.default,
|
|
147999
|
+
minHeight: 44,
|
|
148000
|
+
backgroundColor: "background.paper",
|
|
148001
|
+
},
|
|
148002
|
+
} }),
|
|
148003
|
+
visibleOutcomes.length === 0 ? (React__default.createElement(EmptyState, { message: searchTerm ? "Nenhum lançamento encontrado" : "Nenhum gasto registrado" })) : (React__default.createElement(List$1, { "aria-label": "Lista de gastos", sx: {
|
|
147926
148004
|
width: "100%",
|
|
147927
148005
|
bgcolor: "transparent",
|
|
147928
148006
|
borderRadius: 0,
|
|
147929
148007
|
boxShadow: "none",
|
|
147930
148008
|
border: "none",
|
|
147931
148009
|
overflow: "hidden",
|
|
147932
|
-
} },
|
|
148010
|
+
} }, visibleOutcomes.map((out, idx) => {
|
|
147933
148011
|
var _a, _b;
|
|
147934
|
-
return (React__default.createElement(OutcomeListItem, { key: `${(_a = out.date) !== null && _a !== void 0 ? _a : ""}-${idx}-${(_b = out.amount) !== null && _b !== void 0 ? _b : ""}`, item: out, idx: idx, isLastItem: idx ===
|
|
148012
|
+
return (React__default.createElement(OutcomeListItem, { key: `${(_a = out.date) !== null && _a !== void 0 ? _a : ""}-${idx}-${(_b = out.amount) !== null && _b !== void 0 ? _b : ""}`, item: out, idx: idx, isLastItem: idx === visibleOutcomes.length - 1, formatCurrency: formatCurrency, formatDate: formatDate, getAccountName: getAccountName, onSelect: onSelect, canConfirmTransactions: canConfirmTransactions, isUpdatingSettlementStatus: isUpdatingSettlementStatus, onToggleSettlementStatus: onToggleSettlementStatus }));
|
|
147935
148013
|
}))))));
|
|
147936
148014
|
};
|
|
147937
148015
|
var OutcomeListPage$1 = React__default.memo(OutcomeListPage);
|