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:
@@ -20,8 +20,10 @@ import { DownloadOutlined } from '@ant-design/icons-vue';
|
||||
import * as XLSX from 'xlsx';
|
||||
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||||
import { api } from '@/lib/api';
|
||||
import TreasuryListPagination from '@/components/treasury/TreasuryListPagination.vue';
|
||||
import TreasuryPartyBalanceTable from '@/components/treasury/TreasuryPartyBalanceTable.vue';
|
||||
import { toman } from './treasury-format';
|
||||
import { useTreasuryListPaging } from './useTreasuryListPaging';
|
||||
import { useTreasuryMobile } from './useTreasuryMobile';
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
@@ -92,6 +94,39 @@ const metricRows = computed<MetricRow[]>(() => {
|
||||
}));
|
||||
});
|
||||
|
||||
const {
|
||||
page: partyPage,
|
||||
pageSize: partyPageSize,
|
||||
pageSizeOptions: partyPageSizeOptions,
|
||||
total: partyTotal,
|
||||
pagedRows: pagedPartyRows,
|
||||
onPageSizeChange: onPartyPageSizeChange,
|
||||
showTotal: partyShowTotal,
|
||||
} = useTreasuryListPaging(() => receivablesByParty.value, 'treasury.reports-party');
|
||||
|
||||
const {
|
||||
page: monthPage,
|
||||
pageSize: monthPageSize,
|
||||
pageSizeOptions: monthPageSizeOptions,
|
||||
total: monthTotal,
|
||||
pagedRows: pagedMonthRows,
|
||||
onPageSizeChange: onMonthPageSizeChange,
|
||||
showTotal: monthShowTotal,
|
||||
} = useTreasuryListPaging(() => payablesByMonth.value, 'treasury.reports-month');
|
||||
|
||||
const {
|
||||
page: expenseCatPage,
|
||||
pageSize: expenseCatPageSize,
|
||||
pageSizeOptions: expenseCatPageSizeOptions,
|
||||
total: expenseCatTotal,
|
||||
pagedRows: pagedExpenseCats,
|
||||
onPageSizeChange: onExpenseCatPageSizeChange,
|
||||
showTotal: expenseCatShowTotal,
|
||||
} = useTreasuryListPaging(
|
||||
() => current.value?.expenseCategories ?? [],
|
||||
'treasury.reports-expense-cats',
|
||||
);
|
||||
|
||||
async function load() {
|
||||
const { data } = await api.get<{
|
||||
current: Period;
|
||||
@@ -213,7 +248,7 @@ onMounted(() => {
|
||||
|
||||
<a-divider orientation="right">مطالبات به تفکیک طرف حساب</a-divider>
|
||||
<a-empty v-if="!receivablesByParty.length" description="مورد بازی نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="receivablesByParty">
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedPartyRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
@@ -225,10 +260,18 @@ onMounted(() => {
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="partyPage"
|
||||
:total="partyTotal"
|
||||
:page-size="partyPageSize"
|
||||
:page-size-options="partyPageSizeOptions"
|
||||
:show-total="partyShowTotal"
|
||||
@update:page-size="onPartyPageSizeChange"
|
||||
/>
|
||||
|
||||
<a-divider orientation="right">تعهدات به تفکیک ماه</a-divider>
|
||||
<a-empty v-if="!payablesByMonth.length" description="تعهد بازی نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="payablesByMonth">
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedMonthRows">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
@@ -240,11 +283,19 @@ onMounted(() => {
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="monthPage"
|
||||
:total="monthTotal"
|
||||
:page-size="monthPageSize"
|
||||
:page-size-options="monthPageSizeOptions"
|
||||
:show-total="monthShowTotal"
|
||||
@update:page-size="onMonthPageSizeChange"
|
||||
/>
|
||||
|
||||
<template v-if="current">
|
||||
<a-divider orientation="right">سهم هزینهها</a-divider>
|
||||
<a-empty v-if="!current.expenseCategories.length" description="دستهای نیست." />
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="current.expenseCategories">
|
||||
<a-list v-else :item-layout="isMobile ? 'vertical' : 'horizontal'" :data-source="pagedExpenseCats">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
@@ -258,6 +309,14 @@ onMounted(() => {
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<TreasuryListPagination
|
||||
v-model:page="expenseCatPage"
|
||||
:total="expenseCatTotal"
|
||||
:page-size="expenseCatPageSize"
|
||||
:page-size-options="expenseCatPageSizeOptions"
|
||||
:show-total="expenseCatShowTotal"
|
||||
@update:page-size="onExpenseCatPageSizeChange"
|
||||
/>
|
||||
</template>
|
||||
</a-flex>
|
||||
</a-tab-pane>
|
||||
|
||||
Reference in New Issue
Block a user