From c3854c8194e9c27ad5442f4dc1c7cccb4e54d793 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 17 Jan 2024 13:29:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=81=D0=BB=D0=B8=20("=D0=A7=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D1=87=D0=BD=D1=8B=D0=B9=20=D0=9D=D0=94=D0=A1"=20cb?= =?UTF-8?q?xPartialVAT=20=3D=20=D0=94=D0=B0=20=D0=B8=D0=BB=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=9F=D1=80=D0=BE=D0=B4=D1=83=D0=BA=D1=82=D0=B5=20=20=D0=A7?= =?UTF-8?q?=D0=B0=D1=81=D1=82=D0=B8=D1=87=D0=BD=D1=8B=D0=B9=20=D0=9D=D0=94?= =?UTF-8?q?=D0=A1=20evo=5Fsale=5Fwithout=5Fnds=20=3D=20=D0=94=D0=B0)=20?= =?UTF-8?q?=D0=B8=20"=D0=9F=D0=BB=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D1=89?= =?UTF-8?q?=D0=B8=D0=BA=20=D0=9A=D0=90=D0=A1=D0=9A=D0=9E"=20insuredKASKO?= =?UTF-8?q?=20=3D=20=D0=9B=D0=94=20100=20000=20001,=20=D1=82=D0=BE=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20"=D0=9F=D1=80=D0=B8=20?= =?UTF-8?q?=D1=87=D0=B0=D1=81=D1=82=D0=B8=D1=87=D0=BD=D0=BE=D0=BC=20=D0=9D?= =?UTF-8?q?=D0=94=D0=A1=20=D0=BD=D0=B5=D0=BB=D1=8C=D0=B7=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D1=82=D1=8C=20=D0=9A=D0=90=D0=A1?= =?UTF-8?q?=D0=9A=D0=9E=20=D0=B2=20=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/process/insurance/validation.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/web/process/insurance/validation.ts b/apps/web/process/insurance/validation.ts index 9566a62..cbfa5ec 100644 --- a/apps/web/process/insurance/validation.ts +++ b/apps/web/process/insurance/validation.ts @@ -14,6 +14,8 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { insDecentral: true, leasingPeriod: true, leasingWithoutKasko: true, + partialVAT: true, + product: true, quote: true, recalcWithRevision: true, }) @@ -33,6 +35,8 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { insurance, brand: brandId, fingap: fingapRisks, + partialVAT, + product: productId, }, ctx ) => { @@ -210,6 +214,26 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { } } } + + let evo_baseproduct: CRMTypes.GetProductQuery['evo_baseproduct'] = null; + if (productId) { + const { data } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { productId }, + }); + ({ evo_baseproduct } = data); + } + + if ( + (partialVAT || evo_baseproduct?.evo_sale_without_nds) && + insurance.values.kasko.insured === 100_000_001 + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'При частичном НДС нельзя включать КАСКО в график', + path: ['cbxPartialVAT'], + }); + } } ); }