Add 10/20/50/100 page-size pagination across treasury list pages.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-17 16:07:13 +03:30
co-authored by Cursor
parent 64280e85c4
commit 634af8a653
13 changed files with 465 additions and 66 deletions
@@ -14,7 +14,9 @@ import {
} from 'ant-design-vue';
import { api } from '@/lib/api';
import type { TreasuryDashboardDto } from '@mento/shared';
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
import { toman } from './treasury-format';
import { useTreasuryListPaging } from './useTreasuryListPaging';
import { useTreasuryMobile } from './useTreasuryMobile';
const { Text: ATypographyText } = Typography;
@@ -36,6 +38,42 @@ const cards = [
{ key: 'totalBalance', label: 'موجودی حساب‌ها', hint: 'صندوق و بانک' },
] as const;
const {
page: installmentPage,
pageSize: installmentPageSize,
pageSizeOptions: installmentPageSizeOptions,
total: installmentTotal,
pagedRows: pagedInstallments,
onPageSizeChange: onInstallmentPageSizeChange,
showTotal: installmentShowTotal,
} = useTreasuryListPaging(
() => data.value?.upcomingInstallments ?? [],
'treasury.home-installments',
);
const {
page: payablePage,
pageSize: payablePageSize,
pageSizeOptions: payablePageSizeOptions,
total: payableTotal,
pagedRows: pagedPayables,
onPageSizeChange: onPayablePageSizeChange,
showTotal: payableShowTotal,
} = useTreasuryListPaging(
() => data.value?.upcomingPayables ?? [],
'treasury.home-payables',
);
const {
page: recentPage,
pageSize: recentPageSize,
pageSizeOptions: recentPageSizeOptions,
total: recentTotal,
pagedRows: pagedRecent,
onPageSizeChange: onRecentPageSizeChange,
showTotal: recentShowTotal,
} = useTreasuryListPaging(() => data.value?.recent ?? [], 'treasury.home-recent');
onMounted(async () => {
try {
const res = await api.get<TreasuryDashboardDto>('/treasury/dashboard');
@@ -78,7 +116,7 @@ onMounted(async () => {
<a-list
v-else
:item-layout="isMobile ? 'vertical' : 'horizontal'"
:data-source="data.upcomingInstallments"
:data-source="pagedInstallments"
>
<template #renderItem="{ item }">
<a-list-item>
@@ -94,6 +132,14 @@ onMounted(async () => {
</a-list-item>
</template>
</a-list>
<TreasuryListPagination
v-model:page="installmentPage"
:total="installmentTotal"
:page-size="installmentPageSize"
:page-size-options="installmentPageSizeOptions"
:show-total="installmentShowTotal"
@update:page-size="onInstallmentPageSizeChange"
/>
</a-col>
<a-col :xs="24" :lg="12">
@@ -105,7 +151,7 @@ onMounted(async () => {
<a-list
v-else
:item-layout="isMobile ? 'vertical' : 'horizontal'"
:data-source="data.upcomingPayables"
:data-source="pagedPayables"
>
<template #renderItem="{ item }">
<a-list-item>
@@ -119,6 +165,14 @@ onMounted(async () => {
</a-list-item>
</template>
</a-list>
<TreasuryListPagination
v-model:page="payablePage"
:total="payableTotal"
:page-size="payablePageSize"
:page-size-options="payablePageSizeOptions"
:show-total="payableShowTotal"
@update:page-size="onPayablePageSizeChange"
/>
</a-col>
</a-row>
@@ -130,7 +184,7 @@ onMounted(async () => {
<a-list
v-else
:item-layout="isMobile ? 'vertical' : 'horizontal'"
:data-source="data.recent"
:data-source="pagedRecent"
>
<template #renderItem="{ item }">
<a-list-item>
@@ -146,6 +200,14 @@ onMounted(async () => {
</a-list-item>
</template>
</a-list>
<TreasuryListPagination
v-model:page="recentPage"
:total="recentTotal"
:page-size="recentPageSize"
:page-size-options="recentPageSizeOptions"
:show-total="recentShowTotal"
@update:page-size="onRecentPageSizeChange"
/>
</a-card>
</template>
</a-flex>