68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
import type { ColumnsType } from 'antd/lib/table';
|
|
import { MAX_INSURANCE } from 'constants/values';
|
|
import InputNumber from 'elements/InputNumber';
|
|
import Select from 'elements/Select';
|
|
import { formatter, parser } from 'tools/number';
|
|
import { buildOptionComponent, buildValueComponent } from './builders';
|
|
import type * as Insurance from './types';
|
|
|
|
export const columns: ColumnsType<Insurance.RowValues> = [
|
|
{
|
|
key: 'policyType',
|
|
dataIndex: 'policyType',
|
|
title: 'Тип полиса',
|
|
},
|
|
{
|
|
key: 'insuranceCompany',
|
|
dataIndex: 'insuranceCompany',
|
|
title: 'Страховая компания',
|
|
width: 300,
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insuranceCompany');
|
|
|
|
return <Component showSearch optionFilterProp="label" />;
|
|
},
|
|
},
|
|
{
|
|
key: 'insured',
|
|
dataIndex: 'insured',
|
|
title: 'Плательщик',
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insured');
|
|
|
|
return <Component />;
|
|
},
|
|
},
|
|
{
|
|
key: 'insCost',
|
|
dataIndex: 'insCost',
|
|
title: 'Стоимость за 1-й период',
|
|
render: (_, record) => {
|
|
const Component = buildValueComponent(record.key, InputNumber, 'insCost');
|
|
|
|
return (
|
|
<Component
|
|
min={0}
|
|
max={MAX_INSURANCE}
|
|
step={1000}
|
|
precision={2}
|
|
parser={parser}
|
|
formatter={formatter}
|
|
addonAfter="₽"
|
|
/>
|
|
);
|
|
},
|
|
},
|
|
{
|
|
key: 'insTerm',
|
|
dataIndex: 'insTerm',
|
|
title: 'Срок страхования',
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insTerm');
|
|
|
|
return <Component />;
|
|
},
|
|
},
|
|
];
|