diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index d5dff8f..532b297 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -120,6 +120,9 @@ query GetQuote($quoteId: Uuid!) { evo_product_type } evo_db_accept_registration + evo_product_risks { + evo_addproduct_typeid + } } } diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index 4ac27ee..9d2bc1d 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -147,7 +147,7 @@ export type GetQuoteQueryVariables = Exact<{ }>; -export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null, evo_one_year_insurance: boolean | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_discount_supplier_currency: number | null, evo_equip_price: number | null, evo_program_import_subsidy_sum: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_approved_first_payment: number | null, evo_recalc_limit: number | null, evo_max_mass: number | null, evo_seats: number | null, evo_year: number | null, evo_last_payment_perc: number | null, evo_maximum_percentage_av: number | null, evo_untype_insurance: boolean | null, evo_percent_subsidy: number | null, evo_programsolution: number | null, evo_kasko_payer: number | null, evo_promotion: Array | null, evo_sale_without_nds: boolean | null, link: string | null, evo_committee_quote: number | null, evo_msfo_irr: number | null, evo_accept_quoteid: string | null, evo_power: number | null, evo_engine_volume: number | null, evo_nsib: boolean | null, evo_db_accept_registration: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null } | null> | null } | null }; +export type GetQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_baseproductid: string | null, evo_one_year_insurance: boolean | null, evo_min_change_price: number | null, evo_max_price_change: number | null, evo_discount_supplier_currency: number | null, evo_equip_price: number | null, evo_program_import_subsidy_sum: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_approved_first_payment: number | null, evo_recalc_limit: number | null, evo_max_mass: number | null, evo_seats: number | null, evo_year: number | null, evo_last_payment_perc: number | null, evo_maximum_percentage_av: number | null, evo_untype_insurance: boolean | null, evo_percent_subsidy: number | null, evo_programsolution: number | null, evo_kasko_payer: number | null, evo_promotion: Array | null, evo_sale_without_nds: boolean | null, link: string | null, evo_committee_quote: number | null, evo_msfo_irr: number | null, evo_accept_quoteid: string | null, evo_power: number | null, evo_engine_volume: number | null, evo_nsib: boolean | null, evo_db_accept_registration: number | null, evo_addproduct_types: Array<{ __typename?: 'evo_addproduct_type', evo_product_type: number | null } | null> | null, evo_product_risks: Array<{ __typename?: 'evo_product_risk', evo_addproduct_typeid: string | null } | null> | null } | null }; export type GetQuoteDataQueryVariables = Exact<{ quoteId: Scalars['Uuid']['input']; @@ -478,7 +478,7 @@ export const GetLeadDocument = {"kind":"Document","definitions":[{"kind":"Operat export const GetOpportunityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"opportunityid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"opportunityid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leadid"}},{"kind":"Field","name":{"kind":"Name","value":"accountidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_address_legalidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_region_fias_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_city_fias_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_okved"}}]}},{"kind":"Field","name":{"kind":"Name","value":"link"}}]}}]}}]} as unknown as DocumentNode; export const GetOpportunitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOpportunities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"opportunities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"owner_domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"opportunityid"}}]}}]}}]} as unknown as DocumentNode; export const GetQuotesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuotes"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quotes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_leadid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"leadid"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_quotename"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"quoteid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_statuscodeidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_purchases_participation"}}]}}]}}]} as unknown as DocumentNode; -export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidy_sum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_approved_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}},{"kind":"Field","name":{"kind":"Name","value":"evo_untype_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_programsolution"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_promotion"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"link"}},{"kind":"Field","name":{"kind":"Name","value":"evo_committee_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_quoteid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}}]}}]}}]} as unknown as DocumentNode; +export const GetQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_one_year_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidy_sum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_approved_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_maximum_percentage_av"}},{"kind":"Field","name":{"kind":"Name","value":"evo_untype_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_programsolution"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_promotion"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"link"}},{"kind":"Field","name":{"kind":"Name","value":"evo_committee_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_quoteid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetQuoteDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetQuoteData"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"quoteId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quoteId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_control_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_client_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_msfo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_change_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price_change"}},{"kind":"Field","name":{"kind":"Name","value":"evo_floating_rate"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_with_discount"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_discount_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_increace"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_card_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nsib_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_redemption_graph"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_quote"}},{"kind":"Field","name":{"kind":"Name","value":"evo_contact_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gender"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_redemption"}},{"kind":"Field","name":{"kind":"Name","value":"evo_full_nds_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_kasko"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_kasko_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_franchise"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id_elt_osago"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_db_accept_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_registration"}},{"kind":"Field","name":{"kind":"Name","value":"evo_pts_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_tax_approved"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category_tr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vehicle_type_tax"}},{"kind":"Field","name":{"kind":"Name","value":"evo_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_legal_townid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_registration_regionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic"}},{"kind":"Field","name":{"kind":"Name","value":"evo_req_telematic_accept"}},{"kind":"Field","name":{"kind":"Name","value":"evo_osago_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_kasko_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_payer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fingap_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_gps_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_insurance_decentral"}},{"kind":"Field","name":{"kind":"Name","value":"evo_unlimit_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_age_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_exp_drivers"}},{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_category"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_hours"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_engine_volume"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_mass"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_speed"}},{"kind":"Field","name":{"kind":"Name","value":"evo_mileage"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_object_count"}},{"kind":"Field","name":{"kind":"Name","value":"evo_power"}},{"kind":"Field","name":{"kind":"Name","value":"evo_recalc_limit"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seats"}},{"kind":"Field","name":{"kind":"Name","value":"evo_trailer"}},{"kind":"Field","name":{"kind":"Name","value":"evo_use_for"}},{"kind":"Field","name":{"kind":"Name","value":"evo_vin"}},{"kind":"Field","name":{"kind":"Name","value":"evo_year"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graph_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_payments_decrease_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_high_season"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdon"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sumpay_withnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_planpayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_payment_ratio"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_program_import_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_person_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_dealer_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_total"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_financing"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leadidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_double_agent_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_broker_accountid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_fin_department_accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_rub"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_price_without_nds_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equip_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_coefficien_bonus_reducttion"}}]}}]}}]} as unknown as DocumentNode; export const GetTarifsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarifs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_datefrom_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"lte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_dateto_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"gte"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_delivery_time"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_last_payment"}},{"kind":"Field","name":{"kind":"Name","value":"evo_used"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_pl_use_type"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_rules"}},{"kind":"Field","name":{"kind":"Name","value":"evo_floating_rate"}}]}}]}}]} as unknown as DocumentNode; export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTarif"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarif"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_tarifid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tarifId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"label"},"name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","alias":{"kind":"Name","value":"value"},"name":{"kind":"Name","value":"evo_tarifid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_graphtype_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_seasons_type_exception"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_decreasing_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_irr_with_bonus_coefficient"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_irr"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_datefrom"}},{"kind":"Field","name":{"kind":"Name","value":"evo_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_irr_plan"}},{"kind":"Field","name":{"kind":"Name","value":"evo_margin_min"}}]}}]}}]} as unknown as DocumentNode; diff --git a/apps/web/process/recalc/validation.ts b/apps/web/process/recalc/validation.ts index c480c68..64b6465 100644 --- a/apps/web/process/recalc/validation.ts +++ b/apps/web/process/recalc/validation.ts @@ -2,6 +2,8 @@ /* eslint-disable complexity */ import type { ValidationContext } from '../types'; import type { Elements } from '@/Components/Calculation/config/map/values'; +import { FinGAPSchema } from '@/config/schema/fingap'; +import { InsuranceSchema } from '@/config/schema/insurance'; import ValuesSchema from '@/config/schema/values'; import { MAX_MASS, VEHICLE_SEATS } from '@/constants/values'; import * as CRMTypes from '@/graphql/crm.types'; @@ -33,280 +35,302 @@ export function createValidationSchema({ apolloClient }: ValidationContext) { quote: true, recalcWithRevision: true, technicalCard: true, - }).superRefine( - async ( - { - addEquipmentPrice, - dealerPerson: dealerPersonId, - importProgramSum, - leaseObjectPriceWthtVAT, - leaseObjectUsed, - product: productId, - quote: quoteId, - recalcWithRevision, - discountRub, - plPriceRub, - firstPaymentPerc, - leaseObjectCount, - maxMass, - countSeats, - leaseObjectYear, - lastPaymentPerc, - leaseObjectCategory, - partialVAT, - IRR_Perc, - leaseObjectMotorPower, - engineVolume, - insNSIB, - technicalCard, - objectRegistration, - }, - ctx - ) => { - if (!recalcWithRevision) { - return; - } - - if (!quoteId) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Не указано предложение, по которому осуществляется Пересчет без пересмотра', - path: ['selectQuote'], - }); - } - - if (dealerPersonId && quoteId && productId) { - const { - data: { account: dealerPerson }, - } = await apolloClient.query({ - query: CRMTypes.GetDealerPersonDocument, - variables: { dealerPersonId }, - }); - - const { - data: { quote }, - } = await apolloClient.query({ - query: CRMTypes.GetQuoteDocument, - variables: { quoteId }, - }); - - const maxCondition1 = - leaseObjectUsed === false && - dealerPerson?.evo_supplier_type !== 100_000_001 && - quote?.evo_max_price_change && - !partialVAT && - plPriceRub - discountRub + addEquipmentPrice - importProgramSum > - quote.evo_max_price_change; - - const maxCondition2 = - leaseObjectUsed === false && - dealerPerson?.evo_supplier_type !== 100_000_001 && - quote?.evo_max_price_change && - partialVAT && - leaseObjectPriceWthtVAT > - quote.evo_max_price_change - (quote.evo_nds_in_price_supplier_currency || 0); - - const maxCondition3 = - (leaseObjectUsed === true || dealerPerson?.evo_supplier_type === 100_000_001) && - quote?.evo_supplier_currency_price && - plPriceRub - discountRub + addEquipmentPrice - importProgramSum > - quote.evo_supplier_currency_price - - (quote.evo_discount_supplier_currency || 0) + - (quote.evo_equip_price || 0) - - (quote.evo_program_import_subsidy_sum || 0); - - const minCondition1 = - !partialVAT && - quote?.evo_min_change_price && - plPriceRub - discountRub + addEquipmentPrice - importProgramSum < - quote.evo_min_change_price; - - const minCondition2 = - partialVAT && - quote?.evo_min_change_price && - leaseObjectPriceWthtVAT < - quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0); - - if (maxCondition1 || maxCondition2) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'Указанная стоимость предмета лизинга больше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' + - 'Уменьшите стоимость предмета лизинга', - path: ['tbxLeaseObjectPrice'], - }); - } else if (maxCondition3) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'При пересчете без пересмотра КП с ПЛ БУ или с непрофессиональным поставщиком недопустимо увеличение стоимости. Создайте новое КП и отправьте его на рассмотрение андеррайтингу для повторной проверки оценщиком.', - path: ['tbxLeaseObjectPrice'], - }); - } else if (minCondition1 || minCondition2) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'Указанная стоимость предмета лизинга меньше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' + - 'Увеличьте стоимость предмета лизинга', - path: ['tbxLeaseObjectPrice'], - }); + }) + .extend({ + fingap: FinGAPSchema, + insurance: InsuranceSchema, + }) + .superRefine( + async ( + { + addEquipmentPrice, + dealerPerson: dealerPersonId, + importProgramSum, + leaseObjectPriceWthtVAT, + leaseObjectUsed, + product: productId, + quote: quoteId, + recalcWithRevision, + discountRub, + plPriceRub, + firstPaymentPerc, + leaseObjectCount, + maxMass, + countSeats, + leaseObjectYear, + lastPaymentPerc, + leaseObjectCategory, + partialVAT, + IRR_Perc, + leaseObjectMotorPower, + engineVolume, + insNSIB, + technicalCard, + objectRegistration, + fingap: fingapRisks, + }, + ctx + ) => { + if (!recalcWithRevision) { + return; } - } - if (quoteId) { - const { - data: { quote }, - } = await apolloClient.query({ - query: CRMTypes.GetQuoteDocument, - variables: { quoteId }, - }); - - if ( - firstPaymentPerc < - (quote?.evo_approved_first_payment || 0) + (quote?.evo_percent_subsidy || 0) - ) { + if (!quoteId) { ctx.addIssue({ code: z.ZodIssueCode.custom, - message: `Указанный первый платеж меньше одобренного ${quote?.evo_approved_first_payment}. При пересчете без пересмотра изменение первого платежа возможно только в большую сторону от одобренного значения`, - path: ['tbxFirstPaymentPerc'], + message: 'Не указано предложение, по которому осуществляется Пересчет без пересмотра', + path: ['selectQuote'], }); } - if (quote?.evo_recalc_limit && leaseObjectCount > quote.evo_recalc_limit) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Количество ПЛ превышает лимит пересчета без пересмотра', - path: ['tbxLeaseObjectCount'], - }); - } - - if ( - quote?.evo_max_mass && - ((quote.evo_max_mass < MAX_MASS && maxMass >= MAX_MASS) || - (quote?.evo_max_mass >= MAX_MASS && maxMass < MAX_MASS)) - ) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'Указанная разрешенная макс. масса выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки', - path: ['tbxMaxMass'], - }); - } - - if ( - leaseObjectCategory === 100_000_003 && - quote?.evo_seats && - ((quote.evo_seats < VEHICLE_SEATS && countSeats >= VEHICLE_SEATS) || - (quote.evo_seats >= VEHICLE_SEATS && countSeats < VEHICLE_SEATS)) - ) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'Указанное кол-во мест выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки', - path: ['tbxCountSeats'], - }); - } - - if (quote?.evo_year && leaseObjectYear < quote.evo_year) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'При пересчете без пересмотра год выпуска нельзя уменьшать', - path: ['tbxLeaseObjectYear'], - }); - } - - if ( - quote?.evo_last_payment_perc && - lastPaymentPerc > 1 && - lastPaymentPerc > quote.evo_last_payment_perc - ) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: - 'При пересчете без пересмотра последний платеж можно уменьшать или увеличивать до 1%', - path: ['tbxLastPaymentPerc'], - }); - } - - if (partialVAT !== quote?.evo_sale_without_nds) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Нельзя менять частичный НДС при пересчете без пересмотра', - path: ['selectProduct'], - }); - } - - if (quote?.evo_committee_quote && quote.evo_accept_quoteid) { + if (dealerPersonId && quoteId && productId) { const { - data: { quote: accept_quote }, + data: { account: dealerPerson }, + } = await apolloClient.query({ + query: CRMTypes.GetDealerPersonDocument, + variables: { dealerPersonId }, + }); + + const { + data: { quote }, } = await apolloClient.query({ query: CRMTypes.GetQuoteDocument, - variables: { quoteId: quote.evo_accept_quoteid }, + variables: { quoteId }, }); - if (accept_quote?.evo_msfo_irr && IRR_Perc - accept_quote?.evo_msfo_irr > 0.1) - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Нельзя увеличивать IRR после рассмотрения предложения на КК', - path: ['tbxIRR_Perc'] as Elements[], - }); + const maxCondition1 = + leaseObjectUsed === false && + dealerPerson?.evo_supplier_type !== 100_000_001 && + quote?.evo_max_price_change && + !partialVAT && + plPriceRub - discountRub + addEquipmentPrice - importProgramSum > + quote.evo_max_price_change; - if ( - accept_quote?.evo_power && - Math.abs(leaseObjectMotorPower - accept_quote.evo_power) > 10 - ) { + const maxCondition2 = + leaseObjectUsed === false && + dealerPerson?.evo_supplier_type !== 100_000_001 && + quote?.evo_max_price_change && + partialVAT && + leaseObjectPriceWthtVAT > + quote.evo_max_price_change - (quote.evo_nds_in_price_supplier_currency || 0); + + const maxCondition3 = + (leaseObjectUsed === true || dealerPerson?.evo_supplier_type === 100_000_001) && + quote?.evo_supplier_currency_price && + plPriceRub - discountRub + addEquipmentPrice - importProgramSum > + quote.evo_supplier_currency_price - + (quote.evo_discount_supplier_currency || 0) + + (quote.evo_equip_price || 0) - + (quote.evo_program_import_subsidy_sum || 0); + + const minCondition1 = + !partialVAT && + quote?.evo_min_change_price && + plPriceRub - discountRub + addEquipmentPrice - importProgramSum < + quote.evo_min_change_price; + + const minCondition2 = + partialVAT && + quote?.evo_min_change_price && + leaseObjectPriceWthtVAT < + quote.evo_min_change_price - (quote.evo_nds_in_price_supplier_currency || 0); + + if (maxCondition1 || maxCondition2) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: - 'Нельзя корректировать мощность более чем на 10 л.с. после рассмотрения предложения на КК', - path: ['tbxLeaseObjectMotorPower'] as Elements[], + 'Указанная стоимость предмета лизинга больше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' + + 'Уменьшите стоимость предмета лизинга', + path: ['tbxLeaseObjectPrice'], }); - } - - if ( - accept_quote?.evo_engine_volume && - Math.abs(engineVolume - accept_quote.evo_engine_volume) > 0.1 - ) { + } else if (maxCondition3) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: - 'Нельзя корректировать объем двигателя более чем на 0.1 л после рассмотрения предложения на КК', - path: ['tbxEngineVolume'] as Elements[], + 'При пересчете без пересмотра КП с ПЛ БУ или с непрофессиональным поставщиком недопустимо увеличение стоимости. Создайте новое КП и отправьте его на рассмотрение андеррайтингу для повторной проверки оценщиком.', + path: ['tbxLeaseObjectPrice'], }); - } - - if (insNSIB && !accept_quote?.evo_nsib) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Нельзя включать в график НСИБ после рассмотрения предложения на КК', - path: ['selectInsNSIB'] as Elements[], - }); - } - - if ( - technicalCard && - !accept_quote?.evo_addproduct_types?.some((x) => x?.evo_product_type === 100_000_000) - ) { + } else if (minCondition1 || minCondition2) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: - 'Нельзя включать в график карту тех.помощи после рассмотрения предложения на КК', - path: ['selectTechnicalCard'] as Elements[], - }); - } - - if ( - objectRegistration && - objectRegistration !== accept_quote?.evo_db_accept_registration - ) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'Нельзя менять регистрацию после рассмотрения предложения на КК', - path: ['radioObjectRegistration'] as Elements[], + 'Указанная стоимость предмета лизинга меньше возможного изменения стоимости предмета лизинга при пересчете без пересмотра. ' + + 'Увеличьте стоимость предмета лизинга', + path: ['tbxLeaseObjectPrice'], }); } } + + if (quoteId) { + const { + data: { quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteDocument, + variables: { quoteId }, + }); + + if ( + firstPaymentPerc < + (quote?.evo_approved_first_payment || 0) + (quote?.evo_percent_subsidy || 0) + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: `Указанный первый платеж меньше одобренного ${quote?.evo_approved_first_payment}. При пересчете без пересмотра изменение первого платежа возможно только в большую сторону от одобренного значения`, + path: ['tbxFirstPaymentPerc'], + }); + } + + if (quote?.evo_recalc_limit && leaseObjectCount > quote.evo_recalc_limit) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Количество ПЛ превышает лимит пересчета без пересмотра', + path: ['tbxLeaseObjectCount'], + }); + } + + if ( + quote?.evo_max_mass && + ((quote.evo_max_mass < MAX_MASS && maxMass >= MAX_MASS) || + (quote?.evo_max_mass >= MAX_MASS && maxMass < MAX_MASS)) + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Указанная разрешенная макс. масса выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки', + path: ['tbxMaxMass'], + }); + } + + if ( + leaseObjectCategory === 100_000_003 && + quote?.evo_seats && + ((quote.evo_seats < VEHICLE_SEATS && countSeats >= VEHICLE_SEATS) || + (quote.evo_seats >= VEHICLE_SEATS && countSeats < VEHICLE_SEATS)) + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Указанное кол-во мест выходит из утвержденного диапазона. Для изменения параметра требуется пересмотр сделки', + path: ['tbxCountSeats'], + }); + } + + if (quote?.evo_year && leaseObjectYear < quote.evo_year) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'При пересчете без пересмотра год выпуска нельзя уменьшать', + path: ['tbxLeaseObjectYear'], + }); + } + + if ( + quote?.evo_last_payment_perc && + lastPaymentPerc > 1 && + lastPaymentPerc > quote.evo_last_payment_perc + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'При пересчете без пересмотра последний платеж можно уменьшать или увеличивать до 1%', + path: ['tbxLastPaymentPerc'], + }); + } + + if (partialVAT !== quote?.evo_sale_without_nds) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Нельзя менять частичный НДС при пересчете без пересмотра', + path: ['selectProduct'], + }); + } + + if (quote?.evo_committee_quote && quote.evo_accept_quoteid) { + const { + data: { quote: accept_quote }, + } = await apolloClient.query({ + query: CRMTypes.GetQuoteDocument, + variables: { quoteId: quote.evo_accept_quoteid }, + }); + + if (accept_quote?.evo_msfo_irr && IRR_Perc - accept_quote?.evo_msfo_irr > 0.1) + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Нельзя увеличивать IRR после рассмотрения предложения на КК', + path: ['tbxIRR_Perc'] as Elements[], + }); + + if ( + accept_quote?.evo_power && + Math.abs(leaseObjectMotorPower - accept_quote.evo_power) > 10 + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Нельзя корректировать мощность более чем на 10 л.с. после рассмотрения предложения на КК', + path: ['tbxLeaseObjectMotorPower'] as Elements[], + }); + } + + if ( + accept_quote?.evo_engine_volume && + Math.abs(engineVolume - accept_quote.evo_engine_volume) > 0.1 + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Нельзя корректировать объем двигателя более чем на 0.1 л после рассмотрения предложения на КК', + path: ['tbxEngineVolume'] as Elements[], + }); + } + + if (insNSIB && !accept_quote?.evo_nsib) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Нельзя включать в график НСИБ после рассмотрения предложения на КК', + path: ['selectInsNSIB'] as Elements[], + }); + } + + if ( + technicalCard && + !accept_quote?.evo_addproduct_types?.some((x) => x?.evo_product_type === 100_000_000) + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Нельзя включать в график карту тех.помощи после рассмотрения предложения на КК', + path: ['selectTechnicalCard'] as Elements[], + }); + } + + if ( + objectRegistration && + objectRegistration !== accept_quote?.evo_db_accept_registration + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'Нельзя менять регистрацию после рассмотрения предложения на КК', + path: ['radioObjectRegistration'] as Elements[], + }); + } + + if ( + !fingapRisks.some((fingapRisk) => + accept_quote?.evo_product_risks?.some( + (evo_product_risk) => + evo_product_risk?.evo_addproduct_typeid === fingapRisk.riskId + ) + ) + ) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: + 'Нельзя включать новые риски Safe Finance после рассмотрения предложения на КК', + path: ['fingap'], + }); + } + } + } } - } - ); + ); }