47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
import { Button } from 'antd';
|
|
import type { TableConfig } from '../../components/GenericTable';
|
|
import { setRelatedGroupFilter } from '../../store/slices/catalogueJurSlice/catalogueJurSlice';
|
|
import { store } from '../../store/store';
|
|
import type { RelatedGroupOut } from '../../types/api';
|
|
export const relateGroupConfig: TableConfig<RelatedGroupOut> = {
|
|
rowKey: 'id',
|
|
searchableKeys: ['code', 'crm_id', 'name', 'members_count', 'created_date'],
|
|
columns: [
|
|
{
|
|
key: 'code',
|
|
title: 'ID',
|
|
features: { search: true, multiselect: true },
|
|
},
|
|
{
|
|
key: 'crm_id',
|
|
title: 'CRM ID',
|
|
},
|
|
{
|
|
key: 'name',
|
|
title: 'Наименование',
|
|
features: { search: true, multiselect: true },
|
|
render: (val, row) => {
|
|
const onClick = () => store.dispatch(setRelatedGroupFilter(row));
|
|
return (
|
|
<Button icon={<VerticalAlignTopOutlined />} iconPlacement='end' type='link' onClick={onClick}>
|
|
{val}
|
|
</Button>
|
|
);
|
|
},
|
|
},
|
|
{
|
|
key: 'members_count',
|
|
title: 'Число участников',
|
|
features: { search: true, multiselect: true, sort: true },
|
|
},
|
|
{
|
|
key: 'created_date',
|
|
title: 'Дата создания',
|
|
render: (val) => {
|
|
return val ? new Date(val as string).toLocaleDateString('ru-RU') : '—';
|
|
},
|
|
},
|
|
],
|
|
};
|