diff --git a/src/client/stores/CalculationStore/Effects/action.ts b/src/client/stores/CalculationStore/Effects/action.ts index 340df2b..aede691 100644 --- a/src/client/stores/CalculationStore/Effects/action.ts +++ b/src/client/stores/CalculationStore/Effects/action.ts @@ -157,6 +157,14 @@ const actions: TAction = { ((DGORow && DGORow.insCost?.value > 0) || (NSRow && NSRow.insCost?.value > 0)) ) { + CalculationStore.setTableRow( + 'tableInsurance', + 1, + )({ + insCost: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка во время расчета графика', @@ -170,6 +178,14 @@ const actions: TAction = { kaskoRow.insured?.value === 100000001 && kaskoRow.insCost?.value === 0 ) { + CalculationStore.setTableRow( + 'tableInsurance', + 1, + )({ + insCost: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка во время расчета графика', @@ -177,6 +193,14 @@ const actions: TAction = { })(); return; } + CalculationStore.setTableRow( + 'tableInsurance', + 1, + )({ + insCost: { + validation: true, + }, + }); }, }; diff --git a/src/core/config/initialTables/tableInsurance.ts b/src/core/config/initialTables/tableInsurance.ts index 6cd2bd4..ef3e038 100644 --- a/src/core/config/initialTables/tableInsurance.ts +++ b/src/core/config/initialTables/tableInsurance.ts @@ -18,7 +18,7 @@ const tableInsurance: ITable = { value: 0, }, insTerm: { - value: null, + value: 100000000, status: Status.Disabled, }, }, @@ -112,11 +112,28 @@ const tableInsurance: ITable = { !calculationStore.tables[tableName]?.rows[rowIndex]['insuranceCompany'] ?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insuranceCompany: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указана страховая компания по полису', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insuranceCompany: { + validation: true, + }, + }); } if ( calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value && @@ -124,11 +141,28 @@ const tableInsurance: ITable = { 0 && !calculationStore.tables[tableName]?.rows[rowIndex]['insTerm']?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insTerm: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указан срок страхования', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insTerm: { + validation: true, + }, + }); } if ( calculationStore.tables[tableName]?.rows[rowIndex]['insCost']?.value && @@ -136,11 +170,28 @@ const tableInsurance: ITable = { 0 && !calculationStore.tables[tableName]?.rows[rowIndex]['insured']?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insured: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указан плательщик', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insured: { + validation: true, + }, + }); } }, @@ -151,11 +202,28 @@ const tableInsurance: ITable = { 0 && !calculationStore.tables[tableName]?.rows[rowIndex]['insured']?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insured: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указан плательщик', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insured: { + validation: true, + }, + }); } }, @@ -166,11 +234,28 @@ const tableInsurance: ITable = { 0 && !calculationStore.tables[tableName]?.rows[rowIndex]['insTerm']?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insTerm: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указан срок страхования', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insTerm: { + validation: true, + }, + }); } }, insuranceCompany: (calculationStore, tableName, rowIndex) => { @@ -181,11 +266,28 @@ const tableInsurance: ITable = { !calculationStore.tables[tableName]?.rows[rowIndex]['insuranceCompany'] ?.value ) { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insuranceCompany: { + validation: false, + }, + }); openNotification({ type: 'error', title: 'Ошибка', description: 'Не указана страховая компания по полису', })(); + } else { + calculationStore.setTableRow( + 'tableInsurance', + rowIndex, + )({ + insuranceCompany: { + validation: true, + }, + }); } }, },