From 80d687e6cd3759567b72e22e792686659705f9e5 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 23 Mar 2023 14:41:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B2=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D1=82=D0=B0=D1=80=D0=B8=D1=84=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/configurator/reactions/values.ts | 26 +++++++++++++++++-- .../query/options/main_options.graphql | 1 + .../CrmService/graphql/schema.graphql | 1 + .../services/CrmService/types/entities.ts | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/client/process/configurator/reactions/values.ts b/src/client/process/configurator/reactions/values.ts index ab6c85f..d9db2ac 100644 --- a/src/client/process/configurator/reactions/values.ts +++ b/src/client/process/configurator/reactions/values.ts @@ -14,6 +14,7 @@ export default function ($calculation: ICalculationStore) { 'firstPaymentPerc', 'lastPaymentPerc', 'leaseObjectUsed', + 'leaseObjectType', ]), }; }, @@ -24,6 +25,7 @@ export default function ($calculation: ICalculationStore) { firstPaymentPerc, lastPaymentPerc, leaseObjectUsed, + leaseObjectType, }) => { if (product && leasingPeriod && deliveryTime) { const target_tarif = $calculation.options.selectTarif?.find( @@ -38,13 +40,33 @@ export default function ($calculation: ICalculationStore) { tarif.evo_min_last_payment <= lastPaymentPerc && tarif.evo_max_last_payment >= lastPaymentPerc && tarif, + + tarif => { + if ( + !tarif?.evo_leasingobject_types?.length || + (leaseObjectType && + tarif.evo_leasingobject_types + .map(x => x.evo_leasingobject_typeid) + .includes(leaseObjectType)) + ) { + return tarif; + } + }, tarif => { if (leaseObjectUsed === true) { - if (tarif.evo_used) { + if ( + !tarif?.evo_pl_use_type?.length || + tarif.evo_pl_use_type.includes(100_000_001) + ) { return tarif; } } else { - return tarif; + if ( + !tarif?.evo_pl_use_type?.length || + tarif.evo_pl_use_type.includes(100_000_000) + ) { + return tarif; + } } }, ), diff --git a/src/core/services/CrmService/graphql/query/options/main_options.graphql b/src/core/services/CrmService/graphql/query/options/main_options.graphql index ab9db4c..30f9e65 100644 --- a/src/core/services/CrmService/graphql/query/options/main_options.graphql +++ b/src/core/services/CrmService/graphql/query/options/main_options.graphql @@ -199,6 +199,7 @@ query GetMainOptions( evo_margin_min evo_cut_irr_with_bonus_coefficient evo_used + evo_pl_use_type } selectRate: evo_rates( statecode: $statecode diff --git a/src/core/services/CrmService/graphql/schema.graphql b/src/core/services/CrmService/graphql/schema.graphql index b18a604..3d37d17 100644 --- a/src/core/services/CrmService/graphql/schema.graphql +++ b/src/core/services/CrmService/graphql/schema.graphql @@ -2152,6 +2152,7 @@ type evo_tarif { modifiedon: DateTime statecode: Int toObjectString: String + evo_pl_use_type: [Int!] } type evo_rate { diff --git a/src/core/services/CrmService/types/entities.ts b/src/core/services/CrmService/types/entities.ts index a41ae5b..3768ee8 100644 --- a/src/core/services/CrmService/types/entities.ts +++ b/src/core/services/CrmService/types/entities.ts @@ -439,6 +439,7 @@ export interface IEvoTarif extends BaseEntity { evo_dateto?: Date; evo_irr_plan?: number; evo_used?: boolean; + evo_pl_use_type?: number[]; evo_ins_type?: number; evo_client_risks?: IEvoClientRisk[]; evo_leasingobject_types?: IEvoLeasingObjectType[];