diff --git a/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts b/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts index 2cd0102..8da7391 100644 --- a/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts +++ b/src/client/Containers/Calculation/Components/ELT/Kasko/lib/validation.ts @@ -16,6 +16,29 @@ export const requiredFields: ElementsNames[] = [ 'radioInfuranceOPF', ]; +const okvedCondition: ValidationCondition = calculationStore => { + const lead = calculationStore.getOption('selectLead'); + const opportunity = calculationStore.getOption('selectOpportunity'); + + const okved = + lead?.accountidData?.evo_okved || opportunity?.accountidData?.evo_okved; + + if ( + okved && + ['71.1', '77.3', '49.4', '49.32', '49.39', '47.91.2', '47.99.1'].some( + code => okved.startsWith(code), + ) + ) { + return { + isValid: false, + message: + 'По данному ОКВЭД Контрагента возможен только индивидуальный запрос тарифов КАСКО/ОСАГО. Просьба обратиться на адрес strakhovka@evoleasing.ru ', + }; + } + return { + isValid: true, + }; +}; export const conditions: Partial> = { selectLeaseObjectType: calculationStore => { const leaseObjectType = calculationStore.getOption('selectLeaseObjectType'); @@ -122,6 +145,8 @@ export const conditions: Partial> = { isValid: true, }; }, + selectOpportunity: okvedCondition, + selectLead: okvedCondition, }; export const resetFields: ElementsNames[] = [ diff --git a/src/core/services/CrmService/graphql/query/options/owner_options.graphql b/src/core/services/CrmService/graphql/query/options/owner_options.graphql index e86a206..bfefa9f 100644 --- a/src/core/services/CrmService/graphql/query/options/owner_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/owner_options.graphql @@ -13,6 +13,7 @@ query GetOwnerOptions($statecode: Int, $domainname: String) { evo_region_fias_id evo_city_fias_id } + evo_okved } evo_inn link @@ -33,6 +34,7 @@ query GetOwnerOptions($statecode: Int, $domainname: String) { evo_region_fias_id evo_city_fias_id } + evo_okved } link } diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index b9984e7..186b93d 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -63,6 +63,7 @@ export interface IAccount extends BaseEntity { evo_legal_region_calc?: boolean; evo_osago_with_kasko?: boolean; evo_evokasko_access?: boolean; + evo_okved?: string; } export interface ISalonProvider extends IAccount { @@ -405,7 +406,7 @@ export interface IEvoAddproductType extends BaseEntity { evo_type_calc_cerebellum?: number; evo_addproduct_types?: IEvoAddproductType[]; evo_evokasko_calc_type?: number; - evo_price_service_provider_withoutnds ?: number; + evo_price_service_provider_withoutnds?: number; evo_min_price?: number; evo_max_price?: number; evo_loss_kv?: number;