From e0be27a5b9bbaed91b51cd2bae307ab43c8c46b6 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 17 Apr 2023 11:51:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20cbxSupplierFinancing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Calculation/Form/Leasing/config.ts | 2 +- .../Calculation/Form/Unlimited/config.ts | 1 + .../supplier-agent/reactions/supplier.ts | 25 ++++--------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/apps/web/Components/Calculation/Form/Leasing/config.ts b/apps/web/Components/Calculation/Form/Leasing/config.ts index 4c8704e..1c77106 100644 --- a/apps/web/Components/Calculation/Form/Leasing/config.ts +++ b/apps/web/Components/Calculation/Form/Leasing/config.ts @@ -7,7 +7,7 @@ export const rows: FormTabRows = [ [['selectProduct'], { gridTemplateColumns: '1fr' }], [['tbxLeaseObjectPrice', 'tbxVATInLeaseObjectPrice', 'tbxLeaseObjectPriceWthtVAT']], [['selectSupplierCurrency', 'tbxSupplierDiscountRub', 'tbxSupplierDiscountPerc']], - [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub', 'cbxSupplierFinancing']], + [['tbxFirstPaymentPerc', 'tbxFirstPaymentRub']], [['tbxLeasingPeriod', 'tbxSaleBonus']], [['selectSubsidy', 'tbxSubsidySum'], { gridTemplateColumns: '2fr 1fr' }], [['selectImportProgram', 'tbxImportProgramSum', 'tbxAddEquipmentPrice']], diff --git a/apps/web/Components/Calculation/Form/Unlimited/config.ts b/apps/web/Components/Calculation/Form/Unlimited/config.ts index 2c5cc34..0ce3042 100644 --- a/apps/web/Components/Calculation/Form/Unlimited/config.ts +++ b/apps/web/Components/Calculation/Form/Unlimited/config.ts @@ -9,4 +9,5 @@ export const rows: FormTabRows = [ [['tbxMinPriceChange', 'tbxMaxPriceChange']], [['tbxImporterRewardPerc', 'tbxImporterRewardRub']], [['tbxBonusCoefficient', 'tbxComissionRub', 'tbxComissionPerc']], + [['cbxSupplierFinancing']], ]; diff --git a/apps/web/process/supplier-agent/reactions/supplier.ts b/apps/web/process/supplier-agent/reactions/supplier.ts index b639cfe..d9a11d8 100644 --- a/apps/web/process/supplier-agent/reactions/supplier.ts +++ b/apps/web/process/supplier-agent/reactions/supplier.ts @@ -158,10 +158,9 @@ export function common({ store, apolloClient }: ProcessContext) { ); reaction( - () => $calculation.$values.getValues(['product', 'dealerPerson']), - async ({ product: productId, dealerPerson: dealerPersonId }) => { + () => $calculation.$values.getValues(['product']), + async ({ product: productId }) => { let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null; - let dealerPerson: CRMTypes.GetDealerPersonQuery['account'] = null; if (productId) { const { data } = await apolloClient.query({ @@ -172,23 +171,9 @@ export function common({ store, apolloClient }: ProcessContext) { ({ evo_baseproduct } = data); } - if (dealerPersonId) { - const { data } = await apolloClient.query({ - query: CRMTypes.GetDealerPersonDocument, - variables: { dealerPersonId }, - }); - - ({ account: dealerPerson } = data); - } - - if ( - evo_baseproduct?.evo_supplier_financing_accept && - dealerPerson?.evo_supplier_financing_accept - ) { - $calculation.element('cbxSupplierFinancing').unblock(); - } else { - $calculation.element('cbxSupplierFinancing').setValue(false).block(); - } + $calculation + .element('cbxSupplierFinancing') + .setValue(Boolean(evo_baseproduct?.evo_supplier_financing_accept)); } ); }