import { Tag, Typography } from 'antd'; import React from 'react'; import XinTable from '@/components/XinTable'; import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings'; import type IRunnerApplication from '@/domain/iRunnerApplication'; import { useTranslation } from 'react-i18next'; import dayjs from 'dayjs'; import relativeTime from 'dayjs/plugin/relativeTime'; const { Title, Text } = Typography; dayjs.extend(relativeTime); const Table: React.FC = () => { const { t } = useTranslation(); const columns: XinTableColumn[] = [ { title: t('runner.application.id'), dataIndex: 'id', hideInForm: true, sorter: true, align: 'center', width: 80, }, { title: t('runner.application.user_id'), dataIndex: 'user_id', valueType: 'text', align: 'center', }, { title: t('runner.application.real_name'), dataIndex: 'real_name', valueType: 'text', align: 'center', }, { title: t('runner.application.mobile'), dataIndex: 'mobile', valueType: 'text', align: 'center', }, { title: t('runner.application.resume'), dataIndex: 'resume', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('runner.application.id_card'), dataIndex: 'id_card', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('runner.application.id_card_front'), dataIndex: 'id_card_front', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('runner.application.id_card_back'), dataIndex: 'id_card_back', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('runner.application.status'), dataIndex: 'status', valueType: 'radioButton', fieldProps: { options: [ { value: 0, label: t('runner.application.status.0') }, { value: 1, label: t('runner.application.status.1') }, { value: 2, label: t('runner.application.status.2') }, ], }, render: (value: number) => { if (value === 1) return {t('runner.application.status.1')}; if (value === 2) return {t('runner.application.status.2')}; return {t('runner.application.status.0')}; }, filters: [ { text: t('runner.application.status.0'), value: 0 }, { text: t('runner.application.status.1'), value: 1 }, { text: t('runner.application.status.2'), value: 2 }, ], align: 'center', }, { title: t('runner.application.review_remark'), dataIndex: 'review_remark', valueType: 'text', align: 'center', hideInSearch: true, }, { title: t('runner.application.reviewed_at'), dataIndex: 'reviewed_at', hideInForm: true, hideInSearch: true, align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, { title: t('runner.application.created_at'), hideInForm: true, hideInSearch: true, dataIndex: 'created_at', align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, { title: t('runner.application.updated_at'), hideInForm: true, hideInSearch: true, dataIndex: 'updated_at', align: 'center', render: (value: string) => (value ? dayjs(value).fromNow() : '-'), }, ]; const tableProps: XinTableProps = { api: '/runner/application', columns, rowKey: 'id', accessName: 'runner.application', formProps: { grid: true, colProps: { span: 12 }, rowProps: { gutter: [30, 0] }, layout: 'vertical', }, modalProps: { width: 800, }, cardProps: { variant: 'borderless', }, pagination: { size: 'small', style: { marginBottom: 0 }, }, }; return ( <>
{t('runner.application.page.title')} {t('runner.application.page.description')}
{...tableProps} /> ); }; export default Table;