diff --git a/apps/web/process/insurance/reactions.ts b/apps/web/process/insurance/reactions.ts index bdda8e3..9f40499 100644 --- a/apps/web/process/insurance/reactions.ts +++ b/apps/web/process/insurance/reactions.ts @@ -330,7 +330,11 @@ export function common({ store, apolloClient }: ProcessContext) { query: CRMTypes.GetInsuranceCompaniesDocument, }); - if (evo_leasingobject_type?.evo_id === '9' && maxSpeed < 20) { + if ( + evo_leasingobject_type?.evo_id && + ['9', '6', '10'].includes(evo_leasingobject_type.evo_id) && + maxSpeed < 20 + ) { const otherInsuranceCompany = accounts?.find( (x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ') ); diff --git a/apps/web/process/insurance/validation.ts b/apps/web/process/insurance/validation.ts index 19b36ad..31db1a9 100644 --- a/apps/web/process/insurance/validation.ts +++ b/apps/web/process/insurance/validation.ts @@ -256,7 +256,7 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { if ( evo_leasingobject_type?.evo_id && - ['9'].includes(evo_leasingobject_type?.evo_id) && + ['9', '6', '10'].includes(evo_leasingobject_type?.evo_id) && maxSpeed < 20 && insurance.values.osago.insured === 100_000_001 ) { diff --git a/apps/web/process/supplier-agent/validation.ts b/apps/web/process/supplier-agent/validation.ts index fbfad97..2d2ff3e 100644 --- a/apps/web/process/supplier-agent/validation.ts +++ b/apps/web/process/supplier-agent/validation.ts @@ -383,8 +383,23 @@ export function createValidationSchema(context: ValidationContext) { sumFieldName: 'tbxDealerRewardSumm', }); + let evo_broker_accountid: string | null = null; + + if (dealerPerson) { + const { + data: { dealer_person }, + } = await apolloClient.query({ + query: CRMTypes.GetDealerPersonDocument, + variables: { + dealerPersonId: dealerPerson, + }, + }); + + evo_broker_accountid = dealer_person?.evo_broker_accountid || null; + } + await validateRewardSum({ - agentid: dealerBroker, + agentid: dealerBroker || evo_broker_accountid, conditionId: dealerBrokerRewardCondition, sum: dealerBrokerRewardSumm, sumFieldName: 'tbxDealerBrokerRewardSumm',