Untitled
nhatlenguyen
plain_text
a year ago
2.7 kB
13
Indexable
import { DATE_TIME_FORMAT } from '@repo/constants/common';
import { TDataMapping } from '@repo/types/dataMapping';
import { dateTimeFormat, mergeRegistrantCustomerCode } from '@repo/utils';
import { TableProps } from 'antd';
export const useDataMappingTableColumns = (isAdmin?: boolean) => {
const columns: TableProps<TDataMapping>['columns'] = [
{
title: '変換フォーマット名',
dataIndex: 'conversionFormatName',
key: 'conversionFormatName',
width: 180,
sorter: true,
ellipsis: true,
},
{
title: '変換フォーマット番号',
dataIndex: 'conversionFormatNumber',
key: 'conversionFormatNumber',
width: 160,
sorter: true,
},
{
title: 'データ種別',
dataIndex: 'dataType',
key: 'dataType',
width: 120,
sorter: true,
ellipsis: true,
render: dataType => {
return `新${dataType}`;
},
},
{
title: 'お客さま名(お客さま番号)',
dataIndex: 'registrantCustomerCode',
key: 'registrantCustomerCode',
sorter: true,
render: (_, record) => (
<>
{record.registrantCustomerName}
<p className="text-12R text-gray-04">
{mergeRegistrantCustomerCode(
record.registrantCustomerCode1,
record.registrantCustomerCode2,
record.registrantCustomerCode3,
record.registrantCustomerCode4,
)}
</p>
</>
),
},
isAdmin
? {
title: '登録者(ユーザーID)',
dataIndex: 'registrantUserId',
key: 'registrantUserId',
sorter: true,
render: (_, record) => (
<>
<p>{record.registrantUserName}</p>
<p className="text-12R text-gray-04">
({record.registrantUserCode})
</p>
</>
),
width: 140,
}
: {
title: 'ユーザーID',
dataIndex: 'registrantUserName',
key: 'registrantUserName',
sorter: true,
width: 140,
},
{
title: '作成日時',
dataIndex: 'createdAt',
key: 'createdAt',
sorter: true,
render: createdAt =>
dateTimeFormat(createdAt, DATE_TIME_FORMAT.SLASH_TIME),
width: 120,
},
{
title: '更新日時',
dataIndex: 'updatedAt',
key: 'updatedAt',
sorter: true,
render: updatedAt =>
dateTimeFormat(updatedAt, DATE_TIME_FORMAT.SLASH_TIME),
width: 120,
},
];
return columns;
};
Editor is loading...
Leave a Comment