mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-14 20:31:10 -05:00
- Added new keys for "server", "subscribe", "detail", "pending", "sending", "sent", and "unknown" in log.json files for various languages. - Introduced a "type" object with transaction types (Recharge, Withdraw, Purchase, Refund, Reward, Commission) in log.json files for multiple languages. - Updated "traffic_ratio" to "Ratio" and added "transport" in servers.json for English localization. - Ensured consistency and accuracy in translations for all affected languages including German, English, Spanish, French, Russian, Chinese, and more.
84 lines
2.6 KiB
TypeScript
84 lines
2.6 KiB
TypeScript
'use client';
|
|
|
|
import { UserDetail } from '@/app/dashboard/user/user-detail';
|
|
import { Display } from '@/components/display';
|
|
import { OrderLink } from '@/components/order-link';
|
|
import { ProTable } from '@/components/pro-table';
|
|
import { filterBalanceLog } from '@/services/admin/log';
|
|
import { formatDate } from '@/utils/common';
|
|
import { useTranslations } from 'next-intl';
|
|
import { useSearchParams } from 'next/navigation';
|
|
|
|
export default function BalanceLogPage() {
|
|
const t = useTranslations('log');
|
|
const sp = useSearchParams();
|
|
|
|
const today = new Date().toISOString().split('T')[0];
|
|
|
|
const getBalanceTypeText = (type: number) => {
|
|
const typeText = t(`type.${type}`);
|
|
if (typeText === `log.type.${type}`) {
|
|
return `${t('unknown')} (${type})`;
|
|
}
|
|
return typeText;
|
|
};
|
|
|
|
const initialFilters = {
|
|
date: sp.get('date') || today,
|
|
user_id: sp.get('user_id') ? Number(sp.get('user_id')) : undefined,
|
|
};
|
|
return (
|
|
<ProTable<API.BalanceLog, { search?: string }>
|
|
header={{ title: t('title.balance') }}
|
|
initialFilters={initialFilters}
|
|
columns={[
|
|
{
|
|
accessorKey: 'user',
|
|
header: t('column.user'),
|
|
cell: ({ row }) => <UserDetail id={Number(row.original.user_id)} />,
|
|
},
|
|
{
|
|
accessorKey: 'amount',
|
|
header: t('column.amount'),
|
|
cell: ({ row }) => <Display type='currency' value={row.original.amount} />,
|
|
},
|
|
{
|
|
accessorKey: 'order_id',
|
|
header: t('column.orderId'),
|
|
cell: ({ row }) => <OrderLink orderId={row.original.order_id} />,
|
|
},
|
|
{
|
|
accessorKey: 'balance',
|
|
header: t('column.balance'),
|
|
cell: ({ row }) => <Display type='currency' value={row.original.balance} />,
|
|
},
|
|
{
|
|
accessorKey: 'type',
|
|
header: t('column.type'),
|
|
cell: ({ row }) => getBalanceTypeText(row.original.type),
|
|
},
|
|
{
|
|
accessorKey: 'timestamp',
|
|
header: t('column.time'),
|
|
cell: ({ row }) => formatDate(row.original.timestamp),
|
|
},
|
|
]}
|
|
params={[
|
|
{ key: 'date', type: 'date' },
|
|
{ key: 'user_id', placeholder: t('column.userId') },
|
|
]}
|
|
request={async (pagination, filter) => {
|
|
const { data } = await filterBalanceLog({
|
|
page: pagination.page,
|
|
size: pagination.size,
|
|
date: (filter as any)?.date,
|
|
user_id: (filter as any)?.user_id,
|
|
});
|
|
const list = (data?.data?.list || []) as any[];
|
|
const total = Number(data?.data?.total || list.length);
|
|
return { list, total };
|
|
}}
|
|
/>
|
|
);
|
|
}
|