From 4b004f0573d1e03681a6246215885996d65966d3 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 9 Sep 2021 13:15:39 +0300 Subject: [PATCH] merge release/dyn-243_elt --- .../ELT/Content/Kasko/lib/composeRequest.ts | 40 ++++++++++++++++++- .../ELT/Content/Kasko/lib/validation.ts | 12 ++++-- .../lib/fetchData/queries/optionsQuery.ts | 1 + src/core/types/Entities/crmEntities.ts | 1 + 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts index 03c0014..8980250 100644 --- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts +++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/composeRequest.ts @@ -45,7 +45,8 @@ export default function (this: ICalculationStore) { const region = this.getOption('selectLegalClientRegion'); const city = this.getOption('selectLegalClientTown'); const kladr = get(city, 'evo_kladr_id') || get(region, 'evo_kladr_id'); - const brandId = this.getOption('selectBrand')?.evo_id; + const brand = this.getOption('selectBrand'); + const brandId = brand?.evo_id; const modelId = this.getOption('selectModel')?.evo_id; const isNew = !this.getValue('leaseObjectUsed'); @@ -53,6 +54,13 @@ export default function (this: ICalculationStore) { const power = this.getValue('leaseObjectMotorPower'); const powerSpecified = getSpecified(power); + let country = 0, + countrySpecified = false; + if (brand?.evo_brand_owner === 100000001) { + country = 1; + countrySpecified = true; + } + let engineType = '5'; const engineTypeValue = this.getValue('engineType'); if (engineTypeValue) { @@ -66,6 +74,26 @@ export default function (this: ICalculationStore) { const cost = this.getValue('leaseObjectPrice') - this.getValue('supplierDiscountRub'); + const leaseObjectCategory = this.getValue('leaseObjectCategory'); + let notConfirmedGlassesDamages, + notConfirmedGlassesDamagesSpecified = false, + notConfirmedDamages, + notConfirmedDamagesSpecified = false, + selfIgnition = false, + selfIgnitionSpecified = false, + outsideRoads, + outsideRoadsSpecified = false; + if (leaseObjectCategory === 100000002) { + notConfirmedGlassesDamages = 3; + notConfirmedGlassesDamagesSpecified = true; + notConfirmedDamages = 2; + notConfirmedDamagesSpecified = true; + // selfIgnition = true; + selfIgnitionSpecified = true; + outsideRoads = true; + outsideRoadsSpecified = true; + } + const franchise = parseInt(this.getValue('insFranchise') || 0); const franchiseSpecified = getSpecified(franchise); const puuMark = this.getOption('selectGPSBrand')?.evo_id; @@ -141,6 +169,8 @@ export default function (this: ICalculationStore) { engineVolumeSpecified: true, KPPTypeId: 1, BodyType: 9, + country, + countrySpecified, }, duration, bankId: '245', @@ -151,6 +181,14 @@ export default function (this: ICalculationStore) { STOA: '0', OfficialDealerSpecified: true, OfficialDealer: true, + notConfirmedGlassesDamages, + notConfirmedGlassesDamagesSpecified, + notConfirmedDamages, + notConfirmedDamagesSpecified, + selfIgnition, + selfIgnitionSpecified, + outsideRoads, + outsideRoadsSpecified, PUUs: puuMark && [ { mark: puuMark, diff --git a/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts b/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts index 44060f7..eca46eb 100644 --- a/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts +++ b/src/client/Components/Calculation/ELT/Content/Kasko/lib/validation.ts @@ -22,17 +22,23 @@ export const requiredFields: ElementsNames[] = [ export const conditions: TElements = { selectLeaseObjectType: calculationStore => { const leaseObjectType = calculationStore.getOption('selectLeaseObjectType'); - if (['9', '11'].includes(leaseObjectType?.evo_id || '')) { + if ( + leaseObjectType?.evo_id && + ['9', '11'].includes(leaseObjectType?.evo_id) + ) { return { isValid: false, message: `По данному Типу предмета лизинга возможен только индивидуальный запрос тарифов КАСКО и ОСАГО. Просьба обратиться на адрес strakhovka@evoleasing.ru`, }; } - if (leaseObjectType?.evo_id !== '1') { + if ( + leaseObjectType?.evo_id && + !['1', '2', '3', '7'].includes(leaseObjectType?.evo_id) + ) { return { isValid: false, - message: `Для выбранной категории ТС расчет в ЭЛТ временно недоступен`, + message: `Для выбранной категории ТС расчет в ЭЛТ недоступен`, }; } return { diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts index 5e8a340..10ef217 100644 --- a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts +++ b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts @@ -81,6 +81,7 @@ const query = gql` evo_id evo_name evo_brandid + evo_brand_owner evo_importer_reward_perc evo_importer_reward_rub evo_vehicle_type diff --git a/src/core/types/Entities/crmEntities.ts b/src/core/types/Entities/crmEntities.ts index 1e0c603..0372f86 100644 --- a/src/core/types/Entities/crmEntities.ts +++ b/src/core/types/Entities/crmEntities.ts @@ -158,6 +158,7 @@ export interface IEvoLeasingObjectType { export interface IEvoBrand { evo_name?: string; evo_brandid?: string; + evo_brand_owner?: number; evo_importer_reward_perc?: number; evo_importer_reward_rub?: number; statecode?: number;