@fayz-ai/plugin-financial 0.28.0 → 0.29.0
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.
|
@@ -1086,7 +1086,8 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1086
1086
|
const { currency, locations } = useFinancialConfig();
|
|
1087
1087
|
const provider = useFinancialProvider();
|
|
1088
1088
|
const invoices = useFinancialStore((s) => s.invoices);
|
|
1089
|
-
useFinancialStore((s) => s.invoicesTotal);
|
|
1089
|
+
const invoicesTotal = useFinancialStore((s) => s.invoicesTotal);
|
|
1090
|
+
const invoicesTotals = useFinancialStore((s) => s.invoicesTotals);
|
|
1090
1091
|
const invoicesLoading = useFinancialStore((s) => s.invoicesLoading);
|
|
1091
1092
|
const fetchInvoices = useFinancialStore((s) => s.fetchInvoices);
|
|
1092
1093
|
const fetchSummary = useFinancialStore((s) => s.fetchSummary);
|
|
@@ -1191,8 +1192,16 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1191
1192
|
void Promise.all([fetchPaymentMethods(), fetchBankAccounts()]);
|
|
1192
1193
|
}, [fetchPaymentMethods, fetchBankAccounts]);
|
|
1193
1194
|
const aplicarFiltros = filtros.apply;
|
|
1195
|
+
const [pageSize, setPageSize] = usePageSize(`financial.invoices.${direction}`, 50);
|
|
1196
|
+
const sliceKey = JSON.stringify([direction, emVigor, search, effectiveUnitId, pageSize]);
|
|
1197
|
+
const [paging, setPaging] = useState({ key: sliceKey, page: 1 });
|
|
1198
|
+
const page = paging.key === sliceKey ? paging.page : 1;
|
|
1199
|
+
const setPage = (next) => setPaging({ key: sliceKey, page: next });
|
|
1194
1200
|
const query = useMemo(() => ({
|
|
1195
1201
|
direction,
|
|
1202
|
+
page,
|
|
1203
|
+
pageSize,
|
|
1204
|
+
withTotals: true,
|
|
1196
1205
|
status: emVigor.status.length > 0 ? emVigor.status : void 0,
|
|
1197
1206
|
search: search || void 0,
|
|
1198
1207
|
contactId: emVigor.contactId || void 0,
|
|
@@ -1208,7 +1217,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1208
1217
|
// A window entirely in the past or future is a deliberate look at that
|
|
1209
1218
|
// period, and stays exactly that period.
|
|
1210
1219
|
includeOverdue: windowReachesToday(emVigor.from, emVigor.to) || void 0
|
|
1211
|
-
}), [direction, emVigor, search, effectiveUnitId]);
|
|
1220
|
+
}), [direction, emVigor, search, effectiveUnitId, page, pageSize]);
|
|
1212
1221
|
useEffect(() => {
|
|
1213
1222
|
fetchInvoices(query);
|
|
1214
1223
|
}, [query]);
|
|
@@ -1242,6 +1251,12 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1242
1251
|
[t]
|
|
1243
1252
|
);
|
|
1244
1253
|
const summaries = useMemo(() => {
|
|
1254
|
+
if (invoicesTotals) {
|
|
1255
|
+
return invoicesTotals.map((sum) => {
|
|
1256
|
+
const cur = resolveCurrency(currency, sum.currency);
|
|
1257
|
+
return { currency: cur, totalAmount: sum.total, paidAmount: sum.paid, openAmount: sum.total - sum.paid };
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1245
1260
|
const byCode = /* @__PURE__ */ new Map();
|
|
1246
1261
|
for (const inv of filtered) {
|
|
1247
1262
|
if (inv.status === "cancelled") continue;
|
|
@@ -1253,7 +1268,7 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1253
1268
|
byCode.set(cur.code, sum);
|
|
1254
1269
|
}
|
|
1255
1270
|
return [...byCode.values()];
|
|
1256
|
-
}, [filtered]);
|
|
1271
|
+
}, [filtered, invoicesTotals, currency]);
|
|
1257
1272
|
const [cancelTarget, setCancelTarget] = useState(null);
|
|
1258
1273
|
const [cnabTarget, setCnabTarget] = useState(null);
|
|
1259
1274
|
const closeBulkCancel = useCallback(() => setCancelTarget(null), []);
|
|
@@ -1633,6 +1648,14 @@ function InvoiceListView({ direction, onNew, onNewReceipt, onEdit }) {
|
|
|
1633
1648
|
if (!row.isProvisionedOccurrence) onEdit?.(row.invoiceId ?? row.id, row.status);
|
|
1634
1649
|
},
|
|
1635
1650
|
rowClassName: (row) => row.isProvisionedOccurrence ? "border-dashed !cursor-default bg-muted/10 text-muted-foreground" : void 0,
|
|
1651
|
+
total: invoicesTotal,
|
|
1652
|
+
page,
|
|
1653
|
+
pageSize,
|
|
1654
|
+
onPageChange: setPage,
|
|
1655
|
+
onPageSizeChange: (n) => {
|
|
1656
|
+
setPageSize(n);
|
|
1657
|
+
setPage(1);
|
|
1658
|
+
},
|
|
1636
1659
|
emptyIcon: FileText,
|
|
1637
1660
|
emptyMessage: t("financial.invoice.noInvoices"),
|
|
1638
1661
|
emptyActionLabel: onNewGated ? t("financial.invoice.createFirst") : void 0,
|
|
@@ -6570,5 +6593,5 @@ function FinancialPage({ config: appConfig, provider, store, registries }) {
|
|
|
6570
6593
|
}
|
|
6571
6594
|
|
|
6572
6595
|
export { FinancialPage };
|
|
6573
|
-
//# sourceMappingURL=FinancialPage-
|
|
6574
|
-
//# sourceMappingURL=FinancialPage-
|
|
6596
|
+
//# sourceMappingURL=FinancialPage-BFC3K4WY.js.map
|
|
6597
|
+
//# sourceMappingURL=FinancialPage-BFC3K4WY.js.map
|