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.cjs.js
CHANGED
|
@@ -59729,7 +59729,7 @@ var ReceiptIcon = createSvgIcon( /*#__PURE__*/require$$2$1.jsx("path", {
|
|
|
59729
59729
|
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"
|
|
59730
59730
|
}), 'Receipt');
|
|
59731
59731
|
|
|
59732
|
-
var
|
|
59732
|
+
var ReceiptLong = createSvgIcon([/*#__PURE__*/require$$2$1.jsx("path", {
|
|
59733
59733
|
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"
|
|
59734
59734
|
}, "0"), /*#__PURE__*/require$$2$1.jsx("path", {
|
|
59735
59735
|
d: "M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"
|
|
@@ -144524,8 +144524,53 @@ const parseMonthValue = (value) => {
|
|
|
144524
144524
|
return new Date(year, month - 1, 1);
|
|
144525
144525
|
};
|
|
144526
144526
|
const toMonthValue = (date) => `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`;
|
|
144527
|
-
const
|
|
144528
|
-
|
|
144527
|
+
const MovementTotalButton = ({ kind, label, amount, selected, color, compact, onSelect, }) => (React$1.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: {
|
|
144528
|
+
flex: 1,
|
|
144529
|
+
minWidth: 0,
|
|
144530
|
+
minHeight: 44,
|
|
144531
|
+
display: "flex",
|
|
144532
|
+
alignItems: "center",
|
|
144533
|
+
gap: 1,
|
|
144534
|
+
px: 1.25,
|
|
144535
|
+
py: compact ? 0.5 : 1,
|
|
144536
|
+
border: 0,
|
|
144537
|
+
borderRadius: 1.5,
|
|
144538
|
+
cursor: "pointer",
|
|
144539
|
+
textAlign: "left",
|
|
144540
|
+
color: "secondary.contrastText",
|
|
144541
|
+
bgcolor: selected ? color : alpha(color, 0.45),
|
|
144542
|
+
"&:hover": {
|
|
144543
|
+
bgcolor: selected ? color : alpha(color, 0.62),
|
|
144544
|
+
},
|
|
144545
|
+
"&:focus-visible": {
|
|
144546
|
+
outline: "2px solid",
|
|
144547
|
+
outlineColor: "secondary.contrastText",
|
|
144548
|
+
outlineOffset: 2,
|
|
144549
|
+
},
|
|
144550
|
+
} },
|
|
144551
|
+
React$1.createElement(Box$1, { "aria-hidden": true, sx: {
|
|
144552
|
+
width: 28,
|
|
144553
|
+
height: 28,
|
|
144554
|
+
borderRadius: "50%",
|
|
144555
|
+
bgcolor: "rgba(255,255,255,0.2)",
|
|
144556
|
+
display: "flex",
|
|
144557
|
+
alignItems: "center",
|
|
144558
|
+
justifyContent: "center",
|
|
144559
|
+
flexShrink: 0,
|
|
144560
|
+
} }, kind === "income" ? (React$1.createElement(ArrowUpward, { fontSize: "small" })) : (React$1.createElement(ArrowDownward, { fontSize: "small" }))),
|
|
144561
|
+
React$1.createElement(Box$1, { sx: { minWidth: 0 } },
|
|
144562
|
+
compact ? null : (React$1.createElement(Typography$1, { variant: "caption", sx: { display: "block", lineHeight: 1.2, opacity: 0.92 } }, label)),
|
|
144563
|
+
React$1.createElement(Typography$1, { component: "span", "data-testid": kind === "income" ? "financial-income-total" : "financial-outcome-total", sx: {
|
|
144564
|
+
display: "block",
|
|
144565
|
+
fontWeight: 700,
|
|
144566
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
144567
|
+
lineHeight: 1.2,
|
|
144568
|
+
whiteSpace: "nowrap",
|
|
144569
|
+
overflow: "hidden",
|
|
144570
|
+
textOverflow: "ellipsis",
|
|
144571
|
+
} }, amount))));
|
|
144572
|
+
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, }) => {
|
|
144573
|
+
var _a, _b, _c, _d;
|
|
144529
144574
|
const theme = useTheme$1();
|
|
144530
144575
|
const periodButtonRef = React$1.useRef(null);
|
|
144531
144576
|
const heroRef = React$1.useRef(null);
|
|
@@ -144576,7 +144621,14 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144576
144621
|
const node = heroRef.current;
|
|
144577
144622
|
if (!node)
|
|
144578
144623
|
return;
|
|
144579
|
-
const measure = () =>
|
|
144624
|
+
const measure = () => {
|
|
144625
|
+
const spacer = node.nextElementSibling;
|
|
144626
|
+
const spacerDocTop = spacer
|
|
144627
|
+
? spacer.getBoundingClientRect().top + window.scrollY
|
|
144628
|
+
: 0;
|
|
144629
|
+
const nextHeight = Math.max(0, Math.round(node.offsetHeight - spacerDocTop));
|
|
144630
|
+
setSpacerHeight(nextHeight);
|
|
144631
|
+
};
|
|
144580
144632
|
const observer = new ResizeObserver(measure);
|
|
144581
144633
|
observer.observe(node);
|
|
144582
144634
|
measure();
|
|
@@ -144587,6 +144639,9 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144587
144639
|
const showAdd = Boolean(onAdd);
|
|
144588
144640
|
const showPeriod = Boolean(onPeriodInputChange);
|
|
144589
144641
|
const isMonthlyFee = variant === "monthlyFee";
|
|
144642
|
+
const showMovementSwitch = variant === "movements" && Boolean(onMovementKindChange);
|
|
144643
|
+
const incomeAmount = incomeTotalLabel !== null && incomeTotalLabel !== void 0 ? incomeTotalLabel : (movementKind === "income" ? balanceLabel : "R$ 0,00");
|
|
144644
|
+
const outcomeAmount = outcomeTotalLabel !== null && outcomeTotalLabel !== void 0 ? outcomeTotalLabel : (movementKind === "outcome" ? balanceLabel : "R$ 0,00");
|
|
144590
144645
|
const overline = variant === "monthlyFee"
|
|
144591
144646
|
? "Mensalidade"
|
|
144592
144647
|
: variant === "movements"
|
|
@@ -144620,9 +144675,8 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144620
144675
|
} },
|
|
144621
144676
|
React$1.createElement(Box$1, { "data-testid": "financial-dashboard-hero-content", sx: {
|
|
144622
144677
|
display: "flex",
|
|
144623
|
-
|
|
144624
|
-
gap:
|
|
144625
|
-
alignItems: isExpanded ? "flex-start" : "center",
|
|
144678
|
+
flexDirection: "column",
|
|
144679
|
+
gap: showMovementSwitch ? 1.5 : 0,
|
|
144626
144680
|
width: "100%",
|
|
144627
144681
|
maxWidth: theme.breakpoints.values.md,
|
|
144628
144682
|
mx: "auto",
|
|
@@ -144630,69 +144684,79 @@ const FinancialSummaryHeader = ({ embedded = false, variant = "balance", balance
|
|
|
144630
144684
|
px: PAGE_LIST_CONTAINER_SPACING.px,
|
|
144631
144685
|
pl: embedded ? { xs: 7, md: 2 } : undefined,
|
|
144632
144686
|
} },
|
|
144633
|
-
React$1.createElement(Box$1, { sx: {
|
|
144634
|
-
|
|
144635
|
-
|
|
144636
|
-
|
|
144637
|
-
|
|
144638
|
-
|
|
144639
|
-
|
|
144640
|
-
|
|
144641
|
-
|
|
144642
|
-
|
|
144643
|
-
|
|
144644
|
-
|
|
144645
|
-
|
|
144646
|
-
|
|
144647
|
-
|
|
144648
|
-
|
|
144649
|
-
|
|
144650
|
-
|
|
144651
|
-
|
|
144652
|
-
React$1.createElement(
|
|
144653
|
-
|
|
144654
|
-
|
|
144655
|
-
|
|
144656
|
-
|
|
144657
|
-
|
|
144658
|
-
|
|
144659
|
-
React$1.createElement(
|
|
144660
|
-
|
|
144661
|
-
|
|
144662
|
-
|
|
144663
|
-
|
|
144664
|
-
|
|
144665
|
-
|
|
144666
|
-
|
|
144667
|
-
|
|
144668
|
-
"
|
|
144669
|
-
|
|
144670
|
-
React$1.createElement(
|
|
144671
|
-
|
|
144672
|
-
|
|
144673
|
-
|
|
144674
|
-
|
|
144675
|
-
|
|
144676
|
-
|
|
144677
|
-
|
|
144678
|
-
React$1.createElement(Collapse$1, { in: isExpanded && showEdit, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144679
|
-
React$1.createElement(IconButton$1, { type: "button", "aria-label": "Editar mensalidade", onClick: onEdit, "data-testid": "financial-monthly-fee-edit", sx: {
|
|
144680
|
-
width: 44,
|
|
144681
|
-
height: 44,
|
|
144682
|
-
color: "secondary.contrastText",
|
|
144683
|
-
bgcolor: "rgba(255,255,255,0.12)",
|
|
144684
|
-
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144685
|
-
} },
|
|
144686
|
-
React$1.createElement(EditIcon, null))),
|
|
144687
|
-
React$1.createElement(Collapse$1, { in: isExpanded && showExport, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144688
|
-
React$1.createElement(IconButton$1, { "aria-label": isExporting ? "Exportando relatório" : "Exportar relatório", onClick: onExport, disabled: isExporting, "data-testid": "financial-report-export-button", sx: {
|
|
144687
|
+
React$1.createElement(Box$1, { sx: {
|
|
144688
|
+
display: "flex",
|
|
144689
|
+
justifyContent: "space-between",
|
|
144690
|
+
gap: 2,
|
|
144691
|
+
alignItems: isExpanded ? "flex-start" : "center",
|
|
144692
|
+
width: "100%",
|
|
144693
|
+
} },
|
|
144694
|
+
React$1.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
144695
|
+
React$1.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144696
|
+
React$1.createElement(Typography$1, { variant: "overline", sx: { opacity: 0.8, letterSpacing: "0.08em" } }, overline),
|
|
144697
|
+
variant === "balance" ? (React$1.createElement(Typography$1, { variant: "body2", sx: { opacity: 0.9, mt: 1 } }, "Saldo da casa")) : null),
|
|
144698
|
+
showMovementSwitch ? null : isLoading ? (React$1.createElement(Skeleton$1, { width: isExpanded ? 180 : 120, height: isExpanded ? 48 : 28, sx: { bgcolor: "rgba(255,255,255,0.16)", my: 0.5 } })) : (React$1.createElement(Typography$1, { component: "p", "data-testid": "financial-dashboard-balance", sx: {
|
|
144699
|
+
fontSize: isExpanded ? { xs: "2rem", sm: "2.5rem" } : "1.125rem",
|
|
144700
|
+
fontWeight: 700,
|
|
144701
|
+
lineHeight: 1.15,
|
|
144702
|
+
letterSpacing: "-0.03em",
|
|
144703
|
+
my: isExpanded ? 0.5 : 0,
|
|
144704
|
+
transition: `font-size ${ANIMATION_DURATION.normal}ms ${ANIMATION_EASING.standard}`,
|
|
144705
|
+
} }, balanceLabel)),
|
|
144706
|
+
isMonthlyFee && detailLines.length > 0 ? (React$1.createElement(Collapse$1, { in: isExpanded, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard },
|
|
144707
|
+
React$1.createElement(Stack$1, { spacing: 1, sx: { mt: 1.5 } }, detailLines.map((line) => (React$1.createElement(Box$1, { key: line.label },
|
|
144708
|
+
React$1.createElement(Typography$1, { variant: "caption", sx: { opacity: 0.75 } }, line.label),
|
|
144709
|
+
React$1.createElement(Typography$1, { variant: "body2", sx: { fontWeight: 600 } }, line.value))))))) : null,
|
|
144710
|
+
periodLabel ? (React$1.createElement(Typography$1, { variant: "body2", "data-testid": "financial-period-label", sx: { opacity: isExpanded ? 1 : 0.85 } }, periodLabel)) : null),
|
|
144711
|
+
showPeriod || showExport || showEdit || showAdd ? (React$1.createElement(Stack$1, { spacing: 2, alignItems: "center", sx: { flexShrink: 0, ml: "auto" } },
|
|
144712
|
+
showPeriod ? (React$1.createElement(React$1.Fragment, null,
|
|
144713
|
+
React$1.createElement(IconButton$1, { ref: periodButtonRef, type: "button", "aria-label": "Selecionar per\u00EDodo", "data-testid": "financial-period-button", onClick: openPeriodPicker, sx: {
|
|
144714
|
+
width: 44,
|
|
144715
|
+
height: 44,
|
|
144716
|
+
color: "secondary.contrastText",
|
|
144717
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144718
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144719
|
+
} },
|
|
144720
|
+
React$1.createElement(CalendarMonth$1, null)),
|
|
144721
|
+
React$1.createElement(Popover$1, { open: periodPickerOpen, anchorEl: periodButtonRef.current, onClose: () => setPeriodPickerOpen(false), anchorOrigin: { vertical: "bottom", horizontal: "right" }, transformOrigin: { vertical: "top", horizontal: "right" } },
|
|
144722
|
+
React$1.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,
|
|
144723
|
+
React$1.createElement(Collapse$1, { in: isExpanded && showAdd, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true }, addQuotaFeature ? (React$1.createElement(QuotaGuard, { feature: addQuotaFeature, behavior: "hide" },
|
|
144724
|
+
React$1.createElement(IconButton$1, { type: "button", "aria-label": addLabel, onClick: onAdd, "data-testid": "financial-summary-add", sx: {
|
|
144725
|
+
width: 44,
|
|
144726
|
+
height: 44,
|
|
144727
|
+
color: "secondary.contrastText",
|
|
144728
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144729
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144730
|
+
} },
|
|
144731
|
+
React$1.createElement(Add$1, null)))) : (React$1.createElement(IconButton$1, { type: "button", "aria-label": addLabel, onClick: onAdd, "data-testid": "financial-summary-add", sx: {
|
|
144689
144732
|
width: 44,
|
|
144690
144733
|
height: 44,
|
|
144691
144734
|
color: "secondary.contrastText",
|
|
144692
144735
|
bgcolor: "rgba(255,255,255,0.12)",
|
|
144693
144736
|
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144694
144737
|
} },
|
|
144695
|
-
React$1.createElement(
|
|
144738
|
+
React$1.createElement(Add$1, null)))),
|
|
144739
|
+
React$1.createElement(Collapse$1, { in: isExpanded && showEdit, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144740
|
+
React$1.createElement(IconButton$1, { type: "button", "aria-label": "Editar mensalidade", onClick: onEdit, "data-testid": "financial-monthly-fee-edit", sx: {
|
|
144741
|
+
width: 44,
|
|
144742
|
+
height: 44,
|
|
144743
|
+
color: "secondary.contrastText",
|
|
144744
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144745
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144746
|
+
} },
|
|
144747
|
+
React$1.createElement(EditIcon, null))),
|
|
144748
|
+
React$1.createElement(Collapse$1, { in: isExpanded && showExport, timeout: ANIMATION_DURATION.normal, easing: ANIMATION_EASING.standard, unmountOnExit: true },
|
|
144749
|
+
React$1.createElement(IconButton$1, { "aria-label": isExporting ? "Exportando relatório" : "Exportar relatório", onClick: onExport, disabled: isExporting, "data-testid": "financial-report-export-button", sx: {
|
|
144750
|
+
width: 44,
|
|
144751
|
+
height: 44,
|
|
144752
|
+
color: "secondary.contrastText",
|
|
144753
|
+
bgcolor: "rgba(255,255,255,0.12)",
|
|
144754
|
+
"&:hover": { bgcolor: "rgba(255,255,255,0.2)" },
|
|
144755
|
+
} },
|
|
144756
|
+
React$1.createElement(FileDownloadIcon, null))))) : null),
|
|
144757
|
+
showMovementSwitch && onMovementKindChange ? (React$1.createElement(Box$1, { sx: { display: "flex", gap: 1, width: "100%" } },
|
|
144758
|
+
React$1.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 }),
|
|
144759
|
+
React$1.createElement(MovementTotalButton, { kind: "outcome", label: "Gastos", amount: outcomeAmount, selected: movementKind === "outcome", color: theme.palette.error.main, compact: !isExpanded, onSelect: onMovementKindChange }))) : null)),
|
|
144696
144760
|
React$1.createElement(Box$1, { sx: { height: spacerHeight } })));
|
|
144697
144761
|
};
|
|
144698
144762
|
|
|
@@ -145928,7 +145992,7 @@ const FinancialBottomNav = ({ audience, activeTab, showMensalidade = false, onNa
|
|
|
145928
145992
|
id: "movements",
|
|
145929
145993
|
label: "Lançamentos",
|
|
145930
145994
|
testId: "financial-nav-movements",
|
|
145931
|
-
icon: React$1.createElement(
|
|
145995
|
+
icon: React$1.createElement(ReceiptLong, null),
|
|
145932
145996
|
onClick: onNavigateMovements,
|
|
145933
145997
|
},
|
|
145934
145998
|
{
|
|
@@ -147230,22 +147294,11 @@ const useIncomeListPage = (props) => {
|
|
|
147230
147294
|
|
|
147231
147295
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147232
147296
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
147233
|
-
|
|
147234
|
-
|
|
147235
|
-
|
|
147236
|
-
|
|
147237
|
-
|
|
147238
|
-
py: EMPTY_STATE_VERTICAL_PADDING,
|
|
147239
|
-
display: "flex",
|
|
147240
|
-
flexDirection: "column",
|
|
147241
|
-
alignItems: "center",
|
|
147242
|
-
gap: 2,
|
|
147243
|
-
textAlign: "center",
|
|
147244
|
-
} },
|
|
147245
|
-
React$1.createElement(ReceiptLongIcon, { sx: { fontSize: 56, color: "text.secondary" }, "aria-hidden": true }),
|
|
147246
|
-
React$1.createElement(Typography$1, { id: "income-empty-title", variant: "h6" }, "Nenhuma contribui\u00E7\u00E3o registrada"),
|
|
147247
|
-
React$1.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."),
|
|
147248
|
-
React$1.createElement(Button$1, { variant: "contained", color: "primary", startIcon: React$1.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")));
|
|
147297
|
+
const SEARCH_DEBOUNCE_MS$2 = 1000;
|
|
147298
|
+
const SEARCH_MIN_CHARS$2 = 2;
|
|
147299
|
+
function EmptyState$1({ message }) {
|
|
147300
|
+
return (React$1.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147301
|
+
React$1.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147249
147302
|
}
|
|
147250
147303
|
/**
|
|
147251
147304
|
* Presentation-only list item component (memoized)
|
|
@@ -147255,10 +147308,8 @@ const IncomeListItem = React$1.memo(function IncomeListItem({ item, idx, isLastI
|
|
|
147255
147308
|
const dateLabel = formatDate(item.date);
|
|
147256
147309
|
const formattedAmount = formatCurrency(item.amount);
|
|
147257
147310
|
const accountName = getAccountName(item);
|
|
147258
|
-
const { category, subcategory } = item;
|
|
147259
147311
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147260
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147261
|
-
const settlementColor = settlementStatus === "PROJECTED" ? "warning" : "success";
|
|
147312
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147262
147313
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147263
147314
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147264
147315
|
? "Marcar como Pago"
|
|
@@ -147269,48 +147320,39 @@ const IncomeListItem = React$1.memo(function IncomeListItem({ item, idx, isLastI
|
|
|
147269
147320
|
onSelect(item.id);
|
|
147270
147321
|
};
|
|
147271
147322
|
return (React$1.createElement(React$1.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147272
|
-
React$1.createElement(ListItem$1, { alignItems: "
|
|
147323
|
+
React$1.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147273
147324
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147274
147325
|
e.preventDefault();
|
|
147275
147326
|
onSelect(item.id);
|
|
147276
147327
|
}
|
|
147277
147328
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar contribuição: ${item.description}` : undefined, sx: {
|
|
147329
|
+
display: "flex",
|
|
147330
|
+
gap: 1,
|
|
147331
|
+
px: 0,
|
|
147278
147332
|
cursor: onSelect ? "pointer" : undefined,
|
|
147279
147333
|
"&:hover, &:focus": onSelect
|
|
147280
147334
|
? { backgroundColor: "action.hover" }
|
|
147281
147335
|
: undefined,
|
|
147282
147336
|
} },
|
|
147283
|
-
React$1.createElement(
|
|
147284
|
-
|
|
147285
|
-
alignItems: "flex-start",
|
|
147286
|
-
flexDirection: "column",
|
|
147287
|
-
gap: 1,
|
|
147288
|
-
} },
|
|
147289
|
-
React$1.createElement(Typography$1, { variant: "subtitle1" }, item.description),
|
|
147290
|
-
category && subcategory && (React$1.createElement(Typography$1, { variant: "caption", color: "text.secondary" },
|
|
147291
|
-
"\u2022 ",
|
|
147292
|
-
category,
|
|
147293
|
-
" / ",
|
|
147294
|
-
subcategory)),
|
|
147295
|
-
React$1.createElement(Chip$1, { size: "small", label: settlementLabel, color: settlementColor, variant: settlementStatus === "PROJECTED" ? "outlined" : "filled" })), secondary: React$1.createElement(Box$1, { sx: {
|
|
147337
|
+
React$1.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147338
|
+
React$1.createElement(Box$1, { sx: {
|
|
147296
147339
|
display: "flex",
|
|
147297
|
-
|
|
147298
|
-
gap:
|
|
147340
|
+
justifyContent: "space-between",
|
|
147341
|
+
gap: 2,
|
|
147342
|
+
alignItems: "baseline",
|
|
147299
147343
|
} },
|
|
147300
|
-
React$1.createElement(Typography$1, { variant: "
|
|
147301
|
-
React$1.createElement(Typography$1, { variant: "
|
|
147302
|
-
|
|
147303
|
-
|
|
147304
|
-
|
|
147305
|
-
|
|
147306
|
-
|
|
147307
|
-
|
|
147308
|
-
|
|
147309
|
-
}, sx: { width: 44, height: 44 } }, settlementStatus === "PROJECTED" ? React$1.createElement(Check$1, null) : React$1.createElement(UndoIcon, null))) : null))),
|
|
147310
|
-
!isLastItem && React$1.createElement(Divider$1, { component: "li", variant: "inset" })));
|
|
147344
|
+
React$1.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147345
|
+
React$1.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147346
|
+
React$1.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, dateLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147347
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React$1.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147348
|
+
event.stopPropagation();
|
|
147349
|
+
item.id &&
|
|
147350
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147351
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React$1.createElement(Check$1, null) : React$1.createElement(UndoIcon, null))) : null),
|
|
147352
|
+
!isLastItem && React$1.createElement(Divider$1, { component: "li" })));
|
|
147311
147353
|
});
|
|
147312
|
-
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147313
|
-
const { data: { dataSource,
|
|
147354
|
+
const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147355
|
+
const { data: { dataSource, theme }, fns: { formatCurrency, formatDate, getAccountName }, } = useIncomeListPage({ data });
|
|
147314
147356
|
const { embedded } = useFinancialChrome();
|
|
147315
147357
|
const totalAmountNumber = React$1.useMemo(() => {
|
|
147316
147358
|
const val = typeof dataSource.totalAmount === "string"
|
|
@@ -147336,48 +147378,64 @@ const IncomeListPage = ({ onBack, onAdd, onSelect, periodLabel, periodInputValue
|
|
|
147336
147378
|
currency: "BRL",
|
|
147337
147379
|
});
|
|
147338
147380
|
const incomes = React$1.useMemo(() => (Array.isArray(dataSource.incomes) ? dataSource.incomes : []), [dataSource.incomes]);
|
|
147381
|
+
const [searchInput, setSearchInput] = React$1.useState("");
|
|
147382
|
+
const [searchTerm, setSearchTerm] = React$1.useState("");
|
|
147383
|
+
React$1.useEffect(() => {
|
|
147384
|
+
const trimmed = searchInput.trim();
|
|
147385
|
+
if (trimmed.length < SEARCH_MIN_CHARS$2) {
|
|
147386
|
+
setSearchTerm("");
|
|
147387
|
+
return;
|
|
147388
|
+
}
|
|
147389
|
+
const timeoutId = window.setTimeout(() => {
|
|
147390
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147391
|
+
}, SEARCH_DEBOUNCE_MS$2);
|
|
147392
|
+
return () => window.clearTimeout(timeoutId);
|
|
147393
|
+
}, [searchInput]);
|
|
147394
|
+
const visibleIncomes = React$1.useMemo(() => {
|
|
147395
|
+
if (!searchTerm)
|
|
147396
|
+
return incomes;
|
|
147397
|
+
return incomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147398
|
+
}, [incomes, searchTerm]);
|
|
147339
147399
|
return (React$1.createElement(Box$1, { sx: {
|
|
147340
147400
|
display: "flex",
|
|
147341
147401
|
flexDirection: "column",
|
|
147342
147402
|
minHeight: embedded ? "auto" : "100vh",
|
|
147343
147403
|
backgroundColor: theme.palette.background.default,
|
|
147344
147404
|
position: "relative",
|
|
147345
|
-
//pb: isMobile ? 2 : 0,
|
|
147346
147405
|
} },
|
|
147347
147406
|
embedded ? null : (React$1.createElement(PageHeader$2, { title: "Contribui\u00E7\u00F5es", onBack: onBack, showAddButton: false })),
|
|
147348
|
-
React$1.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" }),
|
|
147407
|
+
React$1.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 }),
|
|
147349
147408
|
React$1.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147350
|
-
|
|
147351
|
-
|
|
147352
|
-
|
|
147409
|
+
React$1.createElement(TextField$1, { fullWidth: true, placeholder: "Buscar lan\u00E7amento", value: searchInput, onChange: (event) => setSearchInput(event.target.value), inputProps: { "aria-label": "Buscar lançamento" }, InputProps: {
|
|
147410
|
+
startAdornment: (React$1.createElement(InputAdornment$1, { position: "start" },
|
|
147411
|
+
React$1.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147412
|
+
}, sx: {
|
|
147413
|
+
mb: 2,
|
|
147353
147414
|
width: "100%",
|
|
147354
|
-
|
|
147355
|
-
|
|
147356
|
-
|
|
147357
|
-
|
|
147358
|
-
|
|
147359
|
-
|
|
147360
|
-
|
|
147361
|
-
|
|
147362
|
-
|
|
147363
|
-
p: EMPTY_STATE_PADDING,
|
|
147364
|
-
} },
|
|
147365
|
-
React$1.createElement(EmptyState$1, { onAdd: onAdd, isMobile: isMobile }))) : (React$1.createElement(List$1, { sx: {
|
|
147415
|
+
"& .MuiOutlinedInput-root": {
|
|
147416
|
+
borderRadius: RADIUS.default,
|
|
147417
|
+
minHeight: 44,
|
|
147418
|
+
backgroundColor: "background.paper",
|
|
147419
|
+
},
|
|
147420
|
+
} }),
|
|
147421
|
+
visibleIncomes.length === 0 ? (React$1.createElement(EmptyState$1, { message: searchTerm
|
|
147422
|
+
? "Nenhum lançamento encontrado"
|
|
147423
|
+
: "Nenhuma contribuição registrada" })) : (React$1.createElement(List$1, { sx: {
|
|
147366
147424
|
width: "100%",
|
|
147367
147425
|
bgcolor: "transparent",
|
|
147368
147426
|
borderRadius: 0,
|
|
147369
147427
|
boxShadow: "none",
|
|
147370
147428
|
border: "none",
|
|
147371
147429
|
overflow: "hidden",
|
|
147372
|
-
} },
|
|
147430
|
+
} }, visibleIncomes.map((inc, idx) => {
|
|
147373
147431
|
var _a, _b;
|
|
147374
|
-
return (React$1.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 ===
|
|
147432
|
+
return (React$1.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 }));
|
|
147375
147433
|
}))))));
|
|
147376
147434
|
};
|
|
147377
147435
|
var IncomeListPage$1 = React$1.memo(IncomeListPage);
|
|
147378
147436
|
|
|
147379
|
-
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147380
|
-
const SEARCH_MIN_CHARS = 2;
|
|
147437
|
+
const SEARCH_DEBOUNCE_MS$1 = 1000;
|
|
147438
|
+
const SEARCH_MIN_CHARS$1 = 2;
|
|
147381
147439
|
const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
147382
147440
|
const { terreiroId, competenceMonth, requests = [], reminderStatus = null, canDispatchReminders = false, isLoading = false, isReviewing = false, isDispatchingReminders = false, error, onBack, onCompetenceMonthChange, onApprove, onReject, onDispatchReminders, } = props;
|
|
147383
147441
|
const [statusFilter, setStatusFilter] = React$1.useState("ALL");
|
|
@@ -147424,13 +147482,13 @@ const useMonthlyFeePaymentsManagementPage = (props) => {
|
|
|
147424
147482
|
}, []);
|
|
147425
147483
|
React$1.useEffect(() => {
|
|
147426
147484
|
const trimmed = searchInput.trim();
|
|
147427
|
-
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147485
|
+
if (trimmed.length < SEARCH_MIN_CHARS$1) {
|
|
147428
147486
|
setSearchTerm("");
|
|
147429
147487
|
return;
|
|
147430
147488
|
}
|
|
147431
147489
|
const timeoutId = window.setTimeout(() => {
|
|
147432
147490
|
setSearchTerm(trimmed);
|
|
147433
|
-
}, SEARCH_DEBOUNCE_MS);
|
|
147491
|
+
}, SEARCH_DEBOUNCE_MS$1);
|
|
147434
147492
|
return () => {
|
|
147435
147493
|
window.clearTimeout(timeoutId);
|
|
147436
147494
|
};
|
|
@@ -147816,24 +147874,11 @@ const useOutcomeListPage = (props) => {
|
|
|
147816
147874
|
|
|
147817
147875
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
147818
147876
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
147819
|
-
|
|
147820
|
-
|
|
147821
|
-
|
|
147822
|
-
|
|
147823
|
-
|
|
147824
|
-
function EmptyState({ onAdd, isMobile, }) {
|
|
147825
|
-
return (React$1.createElement(Box$1, { role: "region", "aria-labelledby": "outcome-empty-title", sx: {
|
|
147826
|
-
py: EMPTY_STATE_VERTICAL_PADDING,
|
|
147827
|
-
display: "flex",
|
|
147828
|
-
flexDirection: "column",
|
|
147829
|
-
alignItems: "center",
|
|
147830
|
-
gap: 2,
|
|
147831
|
-
textAlign: "center",
|
|
147832
|
-
} },
|
|
147833
|
-
React$1.createElement(ReceiptLongIcon, { sx: { fontSize: 56, color: "text.secondary" }, "aria-hidden": true }),
|
|
147834
|
-
React$1.createElement(Typography$1, { id: "outcome-empty-title", variant: "h6" }, "Nenhum gasto registrado"),
|
|
147835
|
-
React$1.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."),
|
|
147836
|
-
React$1.createElement(Button$1, { variant: "contained", color: "primary", startIcon: React$1.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")));
|
|
147877
|
+
const SEARCH_DEBOUNCE_MS = 1000;
|
|
147878
|
+
const SEARCH_MIN_CHARS = 2;
|
|
147879
|
+
function EmptyState({ message }) {
|
|
147880
|
+
return (React$1.createElement(Box$1, { role: "status", sx: { py: 4, textAlign: "center" } },
|
|
147881
|
+
React$1.createElement(Typography$1, { variant: "body1", color: "text.secondary" }, message)));
|
|
147837
147882
|
}
|
|
147838
147883
|
/**
|
|
147839
147884
|
* Presentation-only list item component
|
|
@@ -147846,11 +147891,9 @@ const OutcomeListItem = React$1.memo(function OutcomeListItem({ item, idx, isLas
|
|
|
147846
147891
|
const dueDateLabel = item.dueDate ? formatDate(item.dueDate) : "";
|
|
147847
147892
|
const formattedAmount = formatCurrency(item.amount);
|
|
147848
147893
|
const accountName = getAccountName(item);
|
|
147849
|
-
const { category, subcategory } = item;
|
|
147850
|
-
const categoryLabel = category && subcategory ? `${category} / ${subcategory}` : category;
|
|
147851
147894
|
const settlementStatus = (_a = item.settlementStatus) !== null && _a !== void 0 ? _a : "CONSOLIDATED";
|
|
147852
|
-
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando
|
|
147853
|
-
const
|
|
147895
|
+
const settlementLabel = settlementStatus === "PROJECTED" ? "Aguardando pagamento" : "Pago";
|
|
147896
|
+
const whenLabel = dueDateLabel ? `vencimento em ${dueDateLabel}` : dateLabel;
|
|
147854
147897
|
const nextSettlementStatus = settlementStatus === "PROJECTED" ? "CONSOLIDATED" : "PROJECTED";
|
|
147855
147898
|
const settlementActionLabel = settlementStatus === "PROJECTED"
|
|
147856
147899
|
? "Marcar como Pago"
|
|
@@ -147861,52 +147904,42 @@ const OutcomeListItem = React$1.memo(function OutcomeListItem({ item, idx, isLas
|
|
|
147861
147904
|
onSelect(item.id);
|
|
147862
147905
|
};
|
|
147863
147906
|
return (React$1.createElement(React$1.Fragment, { key: (_d = item.id) !== null && _d !== void 0 ? _d : keyFallback },
|
|
147864
|
-
React$1.createElement(ListItem$1, { alignItems: "
|
|
147907
|
+
React$1.createElement(ListItem$1, { alignItems: "center", onClick: handleSelect, onKeyDown: (e) => {
|
|
147865
147908
|
if ((e.key === "Enter" || e.key === " ") && onSelect && item.id) {
|
|
147866
147909
|
e.preventDefault();
|
|
147867
147910
|
onSelect(item.id);
|
|
147868
147911
|
}
|
|
147869
147912
|
}, tabIndex: onSelect ? 0 : -1, "aria-label": onSelect ? `Selecionar gasto: ${item.description}` : undefined, sx: {
|
|
147913
|
+
display: "flex",
|
|
147914
|
+
gap: 1,
|
|
147915
|
+
px: 0,
|
|
147870
147916
|
cursor: onSelect ? "pointer" : undefined,
|
|
147871
147917
|
"&:hover, &:focus": onSelect
|
|
147872
147918
|
? { backgroundColor: "action.hover" }
|
|
147873
147919
|
: undefined,
|
|
147874
147920
|
} },
|
|
147875
|
-
React$1.createElement(
|
|
147876
|
-
|
|
147877
|
-
alignItems: "flex-start",
|
|
147878
|
-
flexDirection: "column",
|
|
147879
|
-
gap: 1,
|
|
147880
|
-
} },
|
|
147881
|
-
React$1.createElement(Typography$1, { variant: "subtitle1" }, item.description),
|
|
147882
|
-
item.category && (React$1.createElement(Typography$1, { variant: "caption", color: "text.secondary" },
|
|
147883
|
-
"\u2022 ",
|
|
147884
|
-
categoryLabel)),
|
|
147885
|
-
React$1.createElement(Chip$1, { size: "small", label: settlementLabel, color: settlementColor, variant: settlementStatus === "PROJECTED" ? "outlined" : "filled" })), secondary: React$1.createElement(Box$1, { sx: {
|
|
147921
|
+
React$1.createElement(Box$1, { sx: { flex: 1, minWidth: 0 } },
|
|
147922
|
+
React$1.createElement(Box$1, { sx: {
|
|
147886
147923
|
display: "flex",
|
|
147887
|
-
|
|
147888
|
-
gap:
|
|
147924
|
+
justifyContent: "space-between",
|
|
147925
|
+
gap: 2,
|
|
147926
|
+
alignItems: "baseline",
|
|
147889
147927
|
} },
|
|
147890
|
-
React$1.createElement(Typography$1, { variant: "
|
|
147891
|
-
|
|
147892
|
-
|
|
147893
|
-
|
|
147894
|
-
|
|
147895
|
-
|
|
147896
|
-
|
|
147897
|
-
|
|
147898
|
-
|
|
147899
|
-
event.stopPropagation();
|
|
147900
|
-
if (!item.id)
|
|
147901
|
-
return;
|
|
147902
|
-
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147903
|
-
}, sx: { width: 44, height: 44 } }, settlementStatus === "PROJECTED" ? React$1.createElement(Check$1, null) : React$1.createElement(UndoIcon, null))) : null))),
|
|
147928
|
+
React$1.createElement(Typography$1, { variant: "subtitle1", noWrap: true }, item.description),
|
|
147929
|
+
React$1.createElement(Typography$1, { variant: "subtitle1", sx: { fontWeight: 600, flexShrink: 0 } }, formattedAmount)),
|
|
147930
|
+
React$1.createElement(Typography$1, { variant: "body2", color: "text.secondary" }, [accountName, whenLabel, settlementLabel].filter(Boolean).join(" · "))),
|
|
147931
|
+
canConfirmTransactions && item.id && onToggleSettlementStatus ? (React$1.createElement(IconButton$1, { "aria-label": settlementActionLabel, disabled: Boolean(isUpdatingSettlementStatus), onClick: (event) => {
|
|
147932
|
+
event.stopPropagation();
|
|
147933
|
+
if (!item.id)
|
|
147934
|
+
return;
|
|
147935
|
+
onToggleSettlementStatus(item.id, nextSettlementStatus);
|
|
147936
|
+
}, sx: { width: 44, height: 44, flexShrink: 0 } }, settlementStatus === "PROJECTED" ? React$1.createElement(Check$1, null) : React$1.createElement(UndoIcon, null))) : null),
|
|
147904
147937
|
!isLastItem && React$1.createElement(Divider$1, { component: "li" })));
|
|
147905
147938
|
});
|
|
147906
|
-
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, data, }) => {
|
|
147907
|
-
const theme = useTheme$1();
|
|
147939
|
+
const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValue, periodInputMin, periodInputMax, showPeriodFilter, onPeriodInputChange, canConfirmTransactions, isUpdatingSettlementStatus, onToggleSettlementStatus, movementKind, onMovementKindChange, incomeTotalLabel, outcomeTotalLabel, data, }) => {
|
|
147940
|
+
const theme = useTheme$1();
|
|
147908
147941
|
const { embedded } = useFinancialChrome();
|
|
147909
|
-
const { data: { dataSource
|
|
147942
|
+
const { data: { dataSource }, fns: { formatCurrency, formatDate, getAccountName }, } = useOutcomeListPage({ data });
|
|
147910
147943
|
const totalAmountNumber = typeof dataSource.totalAmount === "string"
|
|
147911
147944
|
? parseFloat(dataSource.totalAmount)
|
|
147912
147945
|
: dataSource.totalAmount;
|
|
@@ -147916,6 +147949,24 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147916
147949
|
currency: "BRL",
|
|
147917
147950
|
});
|
|
147918
147951
|
const outcomes = React$1.useMemo(() => (Array.isArray(dataSource.outcomes) ? dataSource.outcomes : []), [dataSource.outcomes]);
|
|
147952
|
+
const [searchInput, setSearchInput] = React$1.useState("");
|
|
147953
|
+
const [searchTerm, setSearchTerm] = React$1.useState("");
|
|
147954
|
+
React$1.useEffect(() => {
|
|
147955
|
+
const trimmed = searchInput.trim();
|
|
147956
|
+
if (trimmed.length < SEARCH_MIN_CHARS) {
|
|
147957
|
+
setSearchTerm("");
|
|
147958
|
+
return;
|
|
147959
|
+
}
|
|
147960
|
+
const timeoutId = window.setTimeout(() => {
|
|
147961
|
+
setSearchTerm(trimmed.toLowerCase());
|
|
147962
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
147963
|
+
return () => window.clearTimeout(timeoutId);
|
|
147964
|
+
}, [searchInput]);
|
|
147965
|
+
const visibleOutcomes = React$1.useMemo(() => {
|
|
147966
|
+
if (!searchTerm)
|
|
147967
|
+
return outcomes;
|
|
147968
|
+
return outcomes.filter((item) => item.description.toLowerCase().includes(searchTerm));
|
|
147969
|
+
}, [outcomes, searchTerm]);
|
|
147919
147970
|
return (React$1.createElement(Box$1, { sx: {
|
|
147920
147971
|
display: "flex",
|
|
147921
147972
|
flexDirection: "column",
|
|
@@ -147925,33 +147976,30 @@ const OutcomeListPage = ({ onSelect, onBack, onAdd, periodLabel, periodInputValu
|
|
|
147925
147976
|
pb: 0,
|
|
147926
147977
|
} },
|
|
147927
147978
|
embedded ? null : (React$1.createElement(PageHeader$2, { title: "Gastos", onBack: onBack, showAddButton: false })),
|
|
147928
|
-
React$1.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" }),
|
|
147979
|
+
React$1.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 }),
|
|
147929
147980
|
React$1.createElement(Container$1, { maxWidth: "md", sx: Object.assign(Object.assign({}, PAGE_LIST_CONTAINER_SPACING), { pb: LIST_CONTENT_BOTTOM_PADDING }) },
|
|
147930
|
-
|
|
147931
|
-
|
|
147932
|
-
|
|
147981
|
+
React$1.createElement(TextField$1, { fullWidth: true, placeholder: "Buscar lan\u00E7amento", value: searchInput, onChange: (event) => setSearchInput(event.target.value), inputProps: { "aria-label": "Buscar lançamento" }, InputProps: {
|
|
147982
|
+
startAdornment: (React$1.createElement(InputAdornment$1, { position: "start" },
|
|
147983
|
+
React$1.createElement(Search$1, { sx: { color: "text.secondary" } }))),
|
|
147984
|
+
}, sx: {
|
|
147985
|
+
mb: 2,
|
|
147933
147986
|
width: "100%",
|
|
147934
|
-
|
|
147935
|
-
|
|
147936
|
-
|
|
147937
|
-
|
|
147938
|
-
|
|
147939
|
-
|
|
147940
|
-
|
|
147941
|
-
alignItems: "center",
|
|
147942
|
-
justifyContent: "center",
|
|
147943
|
-
p: EMPTY_STATE_PADDING,
|
|
147944
|
-
} },
|
|
147945
|
-
React$1.createElement(EmptyState, { onAdd: onAdd, isMobile: isMobile }))) : (React$1.createElement(List$1, { "aria-label": "Lista de gastos", sx: {
|
|
147987
|
+
"& .MuiOutlinedInput-root": {
|
|
147988
|
+
borderRadius: RADIUS.default,
|
|
147989
|
+
minHeight: 44,
|
|
147990
|
+
backgroundColor: "background.paper",
|
|
147991
|
+
},
|
|
147992
|
+
} }),
|
|
147993
|
+
visibleOutcomes.length === 0 ? (React$1.createElement(EmptyState, { message: searchTerm ? "Nenhum lançamento encontrado" : "Nenhum gasto registrado" })) : (React$1.createElement(List$1, { "aria-label": "Lista de gastos", sx: {
|
|
147946
147994
|
width: "100%",
|
|
147947
147995
|
bgcolor: "transparent",
|
|
147948
147996
|
borderRadius: 0,
|
|
147949
147997
|
boxShadow: "none",
|
|
147950
147998
|
border: "none",
|
|
147951
147999
|
overflow: "hidden",
|
|
147952
|
-
} },
|
|
148000
|
+
} }, visibleOutcomes.map((out, idx) => {
|
|
147953
148001
|
var _a, _b;
|
|
147954
|
-
return (React$1.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 ===
|
|
148002
|
+
return (React$1.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 }));
|
|
147955
148003
|
}))))));
|
|
147956
148004
|
};
|
|
147957
148005
|
var OutcomeListPage$1 = React$1.memo(OutcomeListPage);
|