56 lines
1.5 KiB
TypeScript
56 lines
1.5 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 { buildOptionComponent, buildValueComponent } from './builders';
|
|
import type * as Insurance from './types';
|
|
|
|
export const columns: ColumnsType<Insurance.Row> = [
|
|
{
|
|
key: 'policyType',
|
|
dataIndex: 'policyType',
|
|
title: 'Тип полиса',
|
|
},
|
|
{
|
|
key: 'insuranceCompany',
|
|
dataIndex: 'insuranceCompany',
|
|
title: 'Страховая компания',
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insuranceCompany');
|
|
|
|
return <Component />;
|
|
},
|
|
},
|
|
{
|
|
key: 'insured',
|
|
dataIndex: 'insured',
|
|
title: 'Плательщик',
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insured');
|
|
|
|
return <Component />;
|
|
},
|
|
},
|
|
{
|
|
key: 'insCost',
|
|
dataIndex: 'insCost',
|
|
title: 'Стоимость за первый период',
|
|
render: (_, record) => {
|
|
const Component = buildValueComponent(record.key, InputNumber, 'insCost');
|
|
|
|
return <Component min={0} max={MAX_INSURANCE} step={1000} precision={2} />;
|
|
},
|
|
},
|
|
{
|
|
key: 'insTerm',
|
|
dataIndex: 'insTerm',
|
|
title: 'Срок страхования',
|
|
render: (_, record) => {
|
|
const Component = buildOptionComponent(record.key, Select, 'insTerm');
|
|
|
|
return <Component />;
|
|
},
|
|
},
|
|
];
|