diff --git a/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts b/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts index 078b635..7f1af36 100644 --- a/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts +++ b/src/client/stores/CalculationStore/Effects/actions/calculate/validate.ts @@ -1,9 +1,9 @@ import { elementsValues } from 'client/Containers/Calculation/lib/elements/values'; +import valuesConstants from 'core/constants/values'; import { shiftRight } from 'core/tools/array'; import { TElements } from 'core/types/Calculation/Store/elements'; -import { isEqual } from 'lodash'; +import { isEqual, isNil } from 'lodash'; import CalculationStore from '../../..'; -import valuesConstants from 'core/constants/values'; const { PERIODS_NUMBER } = valuesConstants; const VALIDATIONS = { @@ -29,7 +29,14 @@ const elementsValidations: TElements = { selectTarif: VALIDATIONS.IS_NULL, // selectRate: VALIDATIONS.IS_NULL, selectRegistration: VALIDATIONS.IS_NULL, - selectLeaseObjectCategory: VALIDATIONS.IS_NULL, + selectLeaseObjectCategory: valueName => { + return ( + !CalculationStore.values[valueName] && + !['6', '9', '10'].includes( + CalculationStore.getOption('selectLeaseObjectType')?.evo_id || '', + ) + ); + }, // selectSeasonType: valueName => // CalculationStore.getValue('graphType') === 100000003 && // VALIDATIONS.IS_NULL(valueName), @@ -74,24 +81,36 @@ const validateInsuranceTable = () => { x => x.policyType?.value === 'ОСАГО', ); - const condition = - !CalculationStore.tables.tableInsurance.rows[kaskoRowIndex].insuranceCompany - ?.value || - !CalculationStore.tables.tableInsurance.rows[osagoRowIndex].insuranceCompany - ?.value; - CalculationStore.setTableRows( 'tableInsurance', 0, )([ { insuranceCompany: { - validation: !condition, + validation: !isNil( + CalculationStore.tables.tableInsurance.rows[osagoRowIndex] + .insuranceCompany?.value, + ), + }, + insured: { + validation: !isNil( + CalculationStore.tables.tableInsurance.rows[osagoRowIndex].insured + ?.value, + ), }, }, { insuranceCompany: { - validation: !condition, + validation: !isNil( + CalculationStore.tables.tableInsurance.rows[kaskoRowIndex] + .insuranceCompany?.value, + ), + }, + insured: { + validation: !isNil( + CalculationStore.tables.tableInsurance.rows[kaskoRowIndex].insured + ?.value, + ), }, }, ]); diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index c24175f..801d044 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1625,6 +1625,16 @@ const reactionEffects: IReactionEffect[] = [ } break; } + case '6': + case '9': + case '10': { + calculationStore.setValue('leaseObjectCategory', null); + calculationStore.setStatus( + 'selectLeaseObjectCategory', + ElementStatus.Disabled, + ); + break; + } case '3': case '7': {