This repository has been archived on 2025-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
2020-10-06 11:14:51 +03:00

195 lines
4.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { openNotification } from 'client/Elements/Notification';
import { Status } from 'core/types/statuses';
import { ITable } from 'core/types/tables';
const tableInsurance: ITable = {
rows: [
{
policyType: {
value: 'ОСАГО',
},
insuranceCompany: {
value: null,
},
insured: {
value: null,
},
insCost: {
value: 0,
},
insTerm: {
value: null,
status: Status.Disabled,
},
},
{
policyType: {
value: 'КАСКО',
},
insuranceCompany: {
value: null,
},
insured: {
value: null,
},
insCost: {
value: 0,
},
insTerm: {
value: null,
status: Status.Disabled,
},
},
{
policyType: {
value: 'ДГО',
},
insuranceCompany: {
value: null,
status: Status.Disabled,
},
insured: {
value: null,
status: Status.Disabled,
},
insCost: {
value: 0,
},
insTerm: {
value: null,
status: Status.Disabled,
},
},
{
policyType: {
value: 'НС',
},
insuranceCompany: {
value: null,
status: Status.Disabled,
},
insured: {
value: null,
status: Status.Disabled,
},
insCost: {
value: 0,
},
insTerm: {
value: null,
status: Status.Disabled,
},
},
],
options: {
insured: [
{
name: 'Лизингополучатель',
value: 100000000,
},
{
name: 'Лизингодатель',
value: 100000001,
},
],
insTerm: [
{
name: '12 месяцев',
value: 100000000,
},
{
name: 'Срок ДЛ',
value: 100000001,
},
],
},
callbacks: {
insCost: (calculationStore, tableName, rowIndex) => {
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insuranceCompany']
?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указана страховая компания по полису',
})();
}
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insTerm']?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указан срок страхования',
})();
}
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insured']?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указан плательщик',
})();
}
},
insured: (calculationStore, tableName, rowIndex) => {
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insured']?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указан плательщик',
})();
}
},
insTerm: (calculationStore, tableName, rowIndex) => {
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insTerm']?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указан срок страхования',
})();
}
},
insuranceCompany: (calculationStore, tableName, rowIndex) => {
if (
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value &&
calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value >
0 &&
!calculationStore.tables[tableName]?.rows[rowIndex]['insuranceCompany']
?.value
) {
openNotification({
type: 'error',
title: 'Ошибка',
description: 'Не указана страховая компания по полису',
})();
}
},
},
};
export default tableInsurance;