gsintegrations 0.0.494 → 0.0.495
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 +255 -207
- package/dist/bundle.cjs.js.map +2 -2
- package/dist/bundle.esm.js +255 -207
- package/dist/bundle.esm.js.map +2 -2
- package/dist/index.d.ts +43 -34
- 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 +5 -0
- 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"
|
|
@@ -144504,8 +144504,53 @@ const parseMonthValue = (value) => {
|
|
|
144504
144504
|
return new Date(year, month - 1, 1);
|
|
144505
144505
|
};
|
|
144506
144506
|
const toMonthValue = (date) => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`;
|
|
144507
|
-
const
|
|
144508
|
-
|
|
144507
|
+
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: {
|
|
144508
|
+
flex: 1,
|
|
144509
|
+
minWidth: 0,
|
|
144510
|
+
minHeight: 44,
|
|
144511
|
+
display: "flex",
|
|
144512
|
+
alignItems: "center",
|
|
144513
|
+
gap: 1,
|
|
144514
|
+
px: 1.25,
|
|
144515
|
+
py: compact ? 0.5 : 1,
|
|
144516
|
+
border: 0,
|
|
144517
|
+
borderRadius: 1.5,
|
|
144518
|
+
cursor: "pointer",
|
|
144519
|
+
textAlign: "left",
|
|
144520
|
+
color: "secondary.contrastText",
|
|
144521
|
+
bgcolor: selected ? color : alpha(color, 0.45),
|
|
144522
|
+
"&:hover": {
|
|
144523
|
+
bgcolor: selected ? color : alpha(color, 0.62),
|
|
144524
|
+
},
|
|
144525
|
+
"&:focus-visible": {
|
|
144526
|
+
outline: "2px solid",
|
|
144527
|
+
outlineColor: "secondary.contrastText",
|
|
144528
|
+
outlineOffset: 2,
|
|
144529
|
+
},
|
|
144530
|
+
} },
|
|
144531
|
+
React__default.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
144532
|
+
width: 28,
|
|
144533
|
+
height: 28,
|
|
144534
|
+
borderRadius: "50%",
|
|
144535
|
+
bgcolor: "rgba(255,255,255,0.2)",
|
|
144536
|
+
display: "flex",
|
|
144537
|
+
alignItems: "center",
|
|
144538
|
+
justifyContent: "center",
|
|
144539
|
+
flexShrink: 0,
|
|
144540
|
+
} }, kind === "income" ? (React__default.createElement(ArrowUpward, { fontSize: "small" })) : (React__default.createElement(ArrowDownward, { fontSize: "small" }))),
|
|
144541
|
+
React__default.createElement(Box$1, { sx: { minWidth: 0 } },
|
|
144542
|
+
compact ? null : (React__default.createElement(Typography$1, { variant: "caption", sx: { display: "block", lineHeight: 1.2, opacity: 0.92 } }, label)),
|
|
144543
|
+
React__default.createElement(Typography$1, { component: "span", "data-testid": kind === "income" ? "financial-income-total" : "financial-outcome-total", sx: {
|
|
144544
|
+
display: "block",
|
|
144545
|
+
fontWeight: 700,
|
|
144546
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
144547
|
+
lineHeight: 1.2,
|
|
144548
|
+
whiteSpace: "nowrap",
|
|
144549
|
+
overflow: "hidden",
|
|
144550
|
+
textOverflow: "ellipsis",
|
|
144551
|
+
} }, amount))));
|
|
144552
|
+
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, }) => {
|
|
144553
|
+
var _a, _b, _c, _d;
|
|
144509
144554
|
const theme = useTheme$1();
|
|
144510
144555
|
const periodButtonRef = useRef(null);
|
|
144511
144556
|
const heroRef = useRef(null);
|
|
@@ -144556,7 +144601,14 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144556
144601
|
const node = heroRef.current;
|
|
144557
144602
|
if (!node)
|
|
144558
144603
|
return;
|
|
144559
|
-
const measure = () =>
|
|
144604
|
+
const measure = () => {
|
|
144605
|
+
const spacer = node.nextElementSibling;
|
|
144606
|
+
const spacerDocTop = spacer
|
|
144607
|
+
? spacer.getBoundingClientRect().top + window.scrollY
|
|
144608
|
+
: 0;
|
|
144609
|
+
const nextHeight = Math.max(0, Math.round(node.offsetHeight - spacerDocTop));
|
|
144610
|
+
setSpacerHeight(nextHeight);
|
|
144611
|
+
};
|
|
144560
144612
|
const observer = new ResizeObserver(measure);
|
|
144561
144613
|
observer.observe(node);
|
|
144562
144614
|
measure();
|
|
@@ -144567,6 +144619,9 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144567
144619
|
const showAdd = Boolean(onAdd);
|
|
144568
144620
|
const showPeriod = Boolean(onPeriodInputChange);
|
|
144569
144621
|
const isMonthlyFee = variant === "monthlyFee";
|
|
144622
|
+
const showMovementSwitch = variant === "movements" && Boolean(onMovementKindChange);
|
|
144623
|
+
const incomeAmount = incomeTotalLabel !== null && incomeTotalLabel !== void 0 ? incomeTotalLabel : (movementKind === "income" ? balanceLabel : "R$ 0,00");
|
|
144624
|
+
const outcomeAmount = outcomeTotalLabel !== null && outcomeTotalLabel !== void 0 ? outcomeTotalLabel : (movementKind === "outcome" ? balanceLabel : "R$ 0,00");
|
|
144570
144625
|
const overline = variant === "monthlyFee"
|
|
144571
144626
|
? "Mensalidade"
|
|
144572
144627
|
: variant === "movements"
|
|
@@ -144600,9 +144655,8 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144600
144655
|
} },
|
|
144601
144656
|
React__default.createElement(Box$1, { "data-testid": "financial-dashboard-hero-content", sx: {
|
|
144602
144657
|
display: "flex",
|
|
144603
|
-
|
|
144604
|
-
gap:
|
|
144605
|
-
alignItems: isExpanded ? "flex-start" : "center",
|
|
144658
|
+
flexDirection: "column",
|
|
144659
|
+
gap: showMovementSwitch ? 1.5 : 0,
|
|
144606
144660
|
width: "100%",
|
|
144607
144661
|
maxWidth: theme.breakpoints.values.md,
|
|
144608
144662
|
mx: "auto",
|
|
@@ -144610,69 +144664,79 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144610
144664
|
px: PAGE_LIST_CONTAINER_SPACING.px,
|
|
144611
144665
|
pl: embedded ? { xs: 7, md: 2 } : undefined,
|
|
144612
144666
|
} },
|
|
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: {
|
|
144667
|
+
React__default.createElement(Box$1, { sx: {
|
|
144668
|
+
display: "flex",
|
|
144669
|
+
justifyContent: "space-between",
|
|
144670
|
+
gap: 2,
|
|
144671
|
+
alignItems: isExpanded ? "flex-start" : "center",
|
|
144672
|
+
width: "100%",
|
|
144673
|
+
} },
|
|
144674
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
144675
|
+
React__default.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144676
|
+
React__default.createElement(Typography$1, { variant: "overline", sx: { opacity: 0.8, letterSpacing: "0.08em" } }, overline),
|
|
144677
|
+
variant === "balance" ? (React__default.createElement(Typography$1, { variant: "body2", sx: { opacity: 0.9, mt: 1 } }, "Saldo da casa")) : null),
|
|
144678
|
+
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: {
|
|
144679
|
+
fontSize: isExpanded ? { xs: "2rem", sm: "2.5rem" } : "1.125rem",
|
|
144680
|
+
fontWeight: 700,
|
|
144681
|
+
lineHeight: 1.15,
|
|
144682
|
+
letterSpacing: "-0.03em",
|
|
144683
|
+
my: isExpanded ? 0.5 : 0,
|
|
144684
|
+
transition: `font-size ${ANIMATION_DURATION.normal}ms ${ANIMATION_EASING.standard}`,
|
|
144685
|
+
} }, balanceLabel)),
|
|
144686
|
+
isMonthlyFee && detailLines.length > 0 ? (React__default.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144687
|
+
React__default.createElement(Stack$1, { spacing: 1, sx: { mt: 1.5 } }, detailLines.map((line) => (React__default.createElement(Box$1, { key: line.label },
|
|
144688
|
+
React__default.createElement(Typography$1, { variant: "caption", sx: { opacity: 0.75 } }, line.label),
|
|
144689
|
+
React__default.createElement(Typography$1, { variant: "body2", sx: { fontWeight: 600 } }, line.value))))))) : null,
|
|
144690
|
+
periodLabel ? (React__default.createElement(Typography$1, { variant: "body2", "data-testid": "financial-period-label", sx: { opacity: isExpanded ? 1 : 0.85 } }, periodLabel)) : null),
|
|
144691
|
+
showPeriod || showExport || showEdit || showAdd ? (React__default.createElement(Stack$1, { spacing: 2, alignItems: "center", sx: { flexShrink: 0, ml: "auto" } },
|
|
144692
|
+
showPeriod ? (React__default.createElement(React__default.Fragment, null,
|
|
144693
|
+
React__default.createElement(IconButton$1, { ref: periodButtonRef, type: "button", "aria-label": "Selecionar per\u00EDodo", "data-testid": "financial-period-button", onClick: openPeriodPicker, sx: {
|
|
144694
|
+
width: 44,
|
|
144695
|
+
height: 44,
|
|
144696
|
+
color: "secondary.contrastText",
|
|
144697
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144698
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144699
|
+
} },
|
|
144700
|
+
React__default.createElement(CalendarMonth$1, null)),
|
|
144701
|
+
React__default.createElement(Popover$1, { open: periodPickerOpen, anchorEl: periodButtonRef.current, onClose: () => setPeriodPickerOpen(false), anchorOrigin: { vertical: "bottom", horizontal: "right" }, transformOrigin: { vertical: "top", horizontal: "right" } },
|
|
144702
|
+
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,
|
|
144703
|
+
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" },
|
|
144704
|
+
React__default.createElement(IconButton$1, { type: "button", "aria-label": addLabel, onClick: onAdd, "data-testid": "financial-summary-add", sx: {
|
|
144705
|
+
width: 44,
|
|
144706
|
+
height: 44,
|
|
144707
|
+
color: "secondary.contrastText",
|
|
144708
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144709
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144710
|
+
} },
|
|
144711
|
+
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
144712
|
width: 44,
|
|
144670
144713
|
height: 44,
|
|
144671
144714
|
color: "secondary.contrastText",
|
|
144672
144715
|
bgcolor: "rgba(255,255,255,0.12)",
|
|
144673
144716
|
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144674
144717
|
} },
|
|
144675
|
-
React__default.createElement(
|
|
144718
|
+
React__default.createElement(Add$1, null)))),
|
|
144719
|
+
React__default.createElement(Collapse$1, { in: isExpanded && showEdit, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144720
|
+
React__default.createElement(IconButton$1, { type: "button", "aria-label": "Editar mensalidade", onClick: onEdit, "data-testid": "financial-monthly-fee-edit", sx: {
|
|
144721
|
+
width: 44,
|
|
144722
|
+
height: 44,
|
|
144723
|
+
color: "secondary.contrastText",
|
|
144724
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144725
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144726
|
+
} },
|
|
144727
|
+
React__default.createElement(EditIcon, null))),
|
|
144728
|
+
React__default.createElement(Collapse$1, { in: isExpanded && showExport, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144729
|
+
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: {
|
|
144730
|
+
width: 44,
|
|
144731
|
+
height: 44,
|
|
144732
|
+
color: "secondary.contrastText",
|
|
144733
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144734
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144735
|
+
} },
|
|
144736
|
+
React__default.createElement(FileDownloadIcon, null))))) : null),
|
|
144737
|
+
showMovementSwitch && onMovementKindChange ? (React__default.createElement(Box$1, { sx: { display: "flex", gap: 1, width: "100%" } },
|
|
144738
|
+
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 }),
|
|
144739
|
+
React__default.createElement(MovementTotalButton, { kind: "outcome", label: "Gastos", amount: outcomeAmount, selected: movementKind === "outcome", color: theme.palette.error.main, compact: !isExpanded, onSelect: onMovementKindChange }))) : null)),
|
|
144676
144740
|
React__default.createElement(Box$1, { sx: { height: spacerHeight } })));
|
|
144677
144741
|
};
|
|
144678
144742
|
|
|
@@ -145908,7 +145972,7 @@ const FinancialBottomNav = ({ audience, activeTab, showMensalidade = false, onNa
|
|
|
145908
145972
|
id: "movements",
|
|
145909
145973
|
label: "Lançamentos",
|
|
145910
145974
|
testId: "financial-nav-movements",
|
|
145911
|
-
icon: React__default.createElement(
|
|
145975
|
+
icon: React__default.createElement(ReceiptLong, null),
|
|
145912
145976
|
onClick: onNavigateMovements,
|
|
145913
145977
|
},
|
|
145914
145978
|
{
|
|
@@ -147210,22 +147274,11 @@ const useIncomeListPage = (props) => {
|
|
|
147210
147274
|
|
|
147211
147275
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147212
147276
|
/* 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")));
|
|
147277
|
+
const SEARCH_DEBOUNCE_MS$2 = 1000;
|
|
147278
|
+
const SEARCH_MIN_CHARS$2 = 2;
|
|
147279
|
+
function EmptyState$1({ message }) {
|
|
147280
|
+
return (React__default.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147281
|
+
React__default.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147229
147282
|
}
|
|
147230
147283
|
/**
|
|
147231
147284
|
* Presentation-only list item component (memoized)
|
|
@@ -147235,10 +147288,8 @@ const IncomeListItem = React__default.memo(function IncomeListItem({ item, idx,
|
|
|
147235
147288
|
const dateLabel = formatDate(item.date);
|
|
147236
147289
|
const formattedAmount = formatCurrency(item.amount);
|
|
147237
147290
|
const accountName = getAccountName(item);
|
|
147238
|
-
const { category, subcategory } = item;
|
|
147239
147291
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147240
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147241
|
-
const settlementColor = settlementStatus === "PROJECTED" ? "warning" : "success";
|
|
147292
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147242
147293
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147243
147294
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147244
147295
|
? "Marcar como Pago"
|
|
@@ -147249,48 +147300,39 @@ const IncomeListItem = React__default.memo(function IncomeListItem({ item, idx,
|
|
|
147249
147300
|
onSelect(item.id);
|
|
147250
147301
|
};
|
|
147251
147302
|
return (React__default.createElement(React__default.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147252
|
-
React__default.createElement(ListItem$1, { alignItems: "
|
|
147303
|
+
React__default.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147253
147304
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147254
147305
|
e.preventDefault();
|
|
147255
147306
|
onSelect(item.id);
|
|
147256
147307
|
}
|
|
147257
147308
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar contribuição: ${item.description}` : undefined, sx: {
|
|
147309
|
+
display: "flex",
|
|
147310
|
+
gap: 1,
|
|
147311
|
+
px: 0,
|
|
147258
147312
|
cursor: onSelect ? "pointer" : undefined,
|
|
147259
147313
|
"&:hover, &:focus": onSelect
|
|
147260
147314
|
? { backgroundColor: "action.hover" }
|
|
147261
147315
|
: undefined,
|
|
147262
147316
|
} },
|
|
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: {
|
|
147317
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147318
|
+
React__default.createElement(Box$1, { sx: {
|
|
147276
147319
|
display: "flex",
|
|
147277
|
-
|
|
147278
|
-
gap:
|
|
147320
|
+
justifyContent: "space-between",
|
|
147321
|
+
gap: 2,
|
|
147322
|
+
alignItems: "baseline",
|
|
147279
147323
|
} },
|
|
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" })));
|
|
147324
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147325
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147326
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, dateLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147327
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React__default.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147328
|
+
event.stopPropagation();
|
|
147329
|
+
item.id &&
|
|
147330
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147331
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null),
|
|
147332
|
+
!isLastItem && React__default.createElement(Divider$1, { component: "li" })));
|
|
147291
147333
|
});
|
|
147292
|
-
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147293
|
-
const { data: { dataSource,
|
|
147334
|
+
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147335
|
+
const { data: { dataSource, theme }, fns: { formatCurrency, formatDate, getAccountName }, } = useIncomeListPage({ data });
|
|
147294
147336
|
const { embedded } = useFinancialChrome();
|
|
147295
147337
|
const totalAmountNumber = useMemo(() => {
|
|
147296
147338
|
const val = typeof dataSource.totalAmount === "string"
|
|
@@ -147316,48 +147358,64 @@ const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue
|
|
|
147316
147358
|
currency: "BRL",
|
|
147317
147359
|
});
|
|
147318
147360
|
const incomes = useMemo(() => (Array.isArray(dataSource.incomes) ? dataSource.incomes : []), [dataSource.incomes]);
|
|
147361
|
+
const [searchInput, setSearchInput] = useState("");
|
|
147362
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
147363
|
+
useEffect(() => {
|
|
147364
|
+
const trimmed = searchInput.trim();
|
|
147365
|
+
if (trimmed.length < SEARCH_MIN_CHARS$2) {
|
|
147366
|
+
setSearchTerm("");
|
|
147367
|
+
return;
|
|
147368
|
+
}
|
|
147369
|
+
const timeoutId = window.setTimeout(() => {
|
|
147370
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147371
|
+
}, SEARCH_DEBOUNCE_MS$2);
|
|
147372
|
+
return () => window.clearTimeout(timeoutId);
|
|
147373
|
+
}, [searchInput]);
|
|
147374
|
+
const visibleIncomes = useMemo(() => {
|
|
147375
|
+
if (!searchTerm)
|
|
147376
|
+
return incomes;
|
|
147377
|
+
return incomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147378
|
+
}, [incomes, searchTerm]);
|
|
147319
147379
|
return (React__default.createElement(Box$1, { sx: {
|
|
147320
147380
|
display: "flex",
|
|
147321
147381
|
flexDirection: "column",
|
|
147322
147382
|
minHeight: embedded ? "auto" : "100vh",
|
|
147323
147383
|
backgroundColor: theme.palette.background.default,
|
|
147324
147384
|
position: "relative",
|
|
147325
|
-
//pb: isMobile ? 2 : 0,
|
|
147326
147385
|
} },
|
|
147327
147386
|
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" }),
|
|
147387
|
+
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
147388
|
React__default.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147330
|
-
|
|
147331
|
-
|
|
147332
|
-
|
|
147389
|
+
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: {
|
|
147390
|
+
startAdornment: (React__default.createElement(InputAdornment$1, { position: "start" },
|
|
147391
|
+
React__default.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147392
|
+
}, sx: {
|
|
147393
|
+
mb: 2,
|
|
147333
147394
|
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: {
|
|
147395
|
+
"& .MuiOutlinedInput-root": {
|
|
147396
|
+
borderRadius: RADIUS.default,
|
|
147397
|
+
minHeight: 44,
|
|
147398
|
+
backgroundColor: "background.paper",
|
|
147399
|
+
},
|
|
147400
|
+
} }),
|
|
147401
|
+
visibleIncomes.length === 0 ? (React__default.createElement(EmptyState$1, { message: searchTerm
|
|
147402
|
+
? "Nenhum lançamento encontrado"
|
|
147403
|
+
: "Nenhuma contribuição registrada" })) : (React__default.createElement(List$1, { sx: {
|
|
147346
147404
|
width: "100%",
|
|
147347
147405
|
bgcolor: "transparent",
|
|
147348
147406
|
borderRadius: 0,
|
|
147349
147407
|
boxShadow: "none",
|
|
147350
147408
|
border: "none",
|
|
147351
147409
|
overflow: "hidden",
|
|
147352
|
-
} },
|
|
147410
|
+
} }, visibleIncomes.map((inc, idx) => {
|
|
147353
147411
|
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 ===
|
|
147412
|
+
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
147413
|
}))))));
|
|
147356
147414
|
};
|
|
147357
147415
|
var IncomeListPage$1 = React__default.memo(IncomeListPage);
|
|
147358
147416
|
|
|
147359
|
-
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147360
|
-
const SEARCH_MIN_CHARS = 2;
|
|
147417
|
+
const SEARCH_DEBOUNCE_MS$1 = 1000;
|
|
147418
|
+
const SEARCH_MIN_CHARS$1 = 2;
|
|
147361
147419
|
const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
147362
147420
|
const { terreiroId, competenceMonth, requests = [], reminderStatus = null, canDispatchReminders = false, isLoading = false, isReviewing = false, isDispatchingReminders = false, error, onBack, onCompetenceMonthChange, onApprove, onReject, onDispatchReminders, } = props;
|
|
147363
147421
|
const [statusFilter, setStatusFilter] = useState("ALL");
|
|
@@ -147404,13 +147462,13 @@ const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
|
147404
147462
|
}, []);
|
|
147405
147463
|
useEffect(() => {
|
|
147406
147464
|
const trimmed = searchInput.trim();
|
|
147407
|
-
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147465
|
+
if (trimmed.length < SEARCH_MIN_CHARS$1) {
|
|
147408
147466
|
setSearchTerm("");
|
|
147409
147467
|
return;
|
|
147410
147468
|
}
|
|
147411
147469
|
const timeoutId = window.setTimeout(() => {
|
|
147412
147470
|
setSearchTerm(trimmed);
|
|
147413
|
-
}, SEARCH_DEBOUNCE_MS);
|
|
147471
|
+
}, SEARCH_DEBOUNCE_MS$1);
|
|
147414
147472
|
return () => {
|
|
147415
147473
|
window.clearTimeout(timeoutId);
|
|
147416
147474
|
};
|
|
@@ -147796,24 +147854,11 @@ const useOutcomeListPage = (props) => {
|
|
|
147796
147854
|
|
|
147797
147855
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147798
147856
|
/* 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")));
|
|
147857
|
+
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147858
|
+
const SEARCH_MIN_CHARS = 2;
|
|
147859
|
+
function EmptyState({ message }) {
|
|
147860
|
+
return (React__default.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147861
|
+
React__default.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147817
147862
|
}
|
|
147818
147863
|
/**
|
|
147819
147864
|
* Presentation-only list item component
|
|
@@ -147826,11 +147871,9 @@ const OutcomeListItem = React__default.memo(function OutcomeListItem({ item, idx
|
|
|
147826
147871
|
const dueDateLabel = item.dueDate ? formatDate(item.dueDate) : "";
|
|
147827
147872
|
const formattedAmount = formatCurrency(item.amount);
|
|
147828
147873
|
const accountName = getAccountName(item);
|
|
147829
|
-
const { category, subcategory } = item;
|
|
147830
|
-
const categoryLabel = category && subcategory ? `${category} / ${subcategory}` : category;
|
|
147831
147874
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147832
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147833
|
-
const
|
|
147875
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147876
|
+
const whenLabel = dueDateLabel ? `vencimento em ${dueDateLabel}` : dateLabel;
|
|
147834
147877
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147835
147878
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147836
147879
|
? "Marcar como Pago"
|
|
@@ -147841,52 +147884,42 @@ const OutcomeListItem = React__default.memo(function OutcomeListItem({ item, idx
|
|
|
147841
147884
|
onSelect(item.id);
|
|
147842
147885
|
};
|
|
147843
147886
|
return (React__default.createElement(React__default.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147844
|
-
React__default.createElement(ListItem$1, { alignItems: "
|
|
147887
|
+
React__default.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147845
147888
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147846
147889
|
e.preventDefault();
|
|
147847
147890
|
onSelect(item.id);
|
|
147848
147891
|
}
|
|
147849
147892
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar gasto: ${item.description}` : undefined, sx: {
|
|
147893
|
+
display: "flex",
|
|
147894
|
+
gap: 1,
|
|
147895
|
+
px: 0,
|
|
147850
147896
|
cursor: onSelect ? "pointer" : undefined,
|
|
147851
147897
|
"&:hover, &:focus": onSelect
|
|
147852
147898
|
? { backgroundColor: "action.hover" }
|
|
147853
147899
|
: undefined,
|
|
147854
147900
|
} },
|
|
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: {
|
|
147901
|
+
React__default.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147902
|
+
React__default.createElement(Box$1, { sx: {
|
|
147866
147903
|
display: "flex",
|
|
147867
|
-
|
|
147868
|
-
gap:
|
|
147904
|
+
justifyContent: "space-between",
|
|
147905
|
+
gap: 2,
|
|
147906
|
+
alignItems: "baseline",
|
|
147869
147907
|
} },
|
|
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))),
|
|
147908
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147909
|
+
React__default.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147910
|
+
React__default.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, whenLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147911
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React__default.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147912
|
+
event.stopPropagation();
|
|
147913
|
+
if (!item.id)
|
|
147914
|
+
return;
|
|
147915
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147916
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React__default.createElement(Check$1, null) : React__default.createElement(UndoIcon, null))) : null),
|
|
147884
147917
|
!isLastItem && React__default.createElement(Divider$1, { component: "li" })));
|
|
147885
147918
|
});
|
|
147886
|
-
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147887
|
-
const theme = useTheme$1();
|
|
147919
|
+
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147920
|
+
const theme = useTheme$1();
|
|
147888
147921
|
const { embedded } = useFinancialChrome();
|
|
147889
|
-
const { data: { dataSource
|
|
147922
|
+
const { data: { dataSource }, fns: { formatCurrency, formatDate, getAccountName }, } = useOutcomeListPage({ data });
|
|
147890
147923
|
const totalAmountNumber = typeof dataSource.totalAmount === "string"
|
|
147891
147924
|
? parseFloat(dataSource.totalAmount)
|
|
147892
147925
|
: dataSource.totalAmount;
|
|
@@ -147896,6 +147929,24 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147896
147929
|
currency: "BRL",
|
|
147897
147930
|
});
|
|
147898
147931
|
const outcomes = useMemo(() => (Array.isArray(dataSource.outcomes) ? dataSource.outcomes : []), [dataSource.outcomes]);
|
|
147932
|
+
const [searchInput, setSearchInput] = useState("");
|
|
147933
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
147934
|
+
useEffect(() => {
|
|
147935
|
+
const trimmed = searchInput.trim();
|
|
147936
|
+
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147937
|
+
setSearchTerm("");
|
|
147938
|
+
return;
|
|
147939
|
+
}
|
|
147940
|
+
const timeoutId = window.setTimeout(() => {
|
|
147941
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147942
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
147943
|
+
return () => window.clearTimeout(timeoutId);
|
|
147944
|
+
}, [searchInput]);
|
|
147945
|
+
const visibleOutcomes = useMemo(() => {
|
|
147946
|
+
if (!searchTerm)
|
|
147947
|
+
return outcomes;
|
|
147948
|
+
return outcomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147949
|
+
}, [outcomes, searchTerm]);
|
|
147899
147950
|
return (React__default.createElement(Box$1, { sx: {
|
|
147900
147951
|
display: "flex",
|
|
147901
147952
|
flexDirection: "column",
|
|
@@ -147905,33 +147956,30 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147905
147956
|
pb: 0,
|
|
147906
147957
|
} },
|
|
147907
147958
|
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" }),
|
|
147959
|
+
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
147960
|
React__default.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147910
|
-
|
|
147911
|
-
|
|
147912
|
-
|
|
147961
|
+
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: {
|
|
147962
|
+
startAdornment: (React__default.createElement(InputAdornment$1, { position: "start" },
|
|
147963
|
+
React__default.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147964
|
+
}, sx: {
|
|
147965
|
+
mb: 2,
|
|
147913
147966
|
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: {
|
|
147967
|
+
"& .MuiOutlinedInput-root": {
|
|
147968
|
+
borderRadius: RADIUS.default,
|
|
147969
|
+
minHeight: 44,
|
|
147970
|
+
backgroundColor: "background.paper",
|
|
147971
|
+
},
|
|
147972
|
+
} }),
|
|
147973
|
+
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
147974
|
width: "100%",
|
|
147927
147975
|
bgcolor: "transparent",
|
|
147928
147976
|
borderRadius: 0,
|
|
147929
147977
|
boxShadow: "none",
|
|
147930
147978
|
border: "none",
|
|
147931
147979
|
overflow: "hidden",
|
|
147932
|
-
} },
|
|
147980
|
+
} }, visibleOutcomes.map((out, idx) => {
|
|
147933
147981
|
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 ===
|
|
147982
|
+
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
147983
|
}))))));
|
|
147936
147984
|
};
|
|
147937
147985
|
var OutcomeListPage$1 = React__default.memo(OutcomeListPage);
|