From eea0abd96ac8f4632142eb0dcc52fc4a6d196ed7 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 10 Feb 2023 13:33:36 +0300 Subject: [PATCH] bonuses --- apps/web/api/user/query.ts | 2 +- apps/web/config/default-values.ts | 2 +- apps/web/graphql/crm.query.graphql | 30 ++++++ apps/web/graphql/crm.types.ts | 39 +++++++- apps/web/process/bonuses/get-kp-data.ts | 40 ++++++++ apps/web/process/bonuses/reactions/common.ts | 97 +++++++++++++++++++ apps/web/process/bonuses/reactions/index.js | 2 + .../process/bonuses/reactions/lib/helper.ts | 65 +++++++++++++ .../process/bonuses/reactions/validation.ts | 24 +++++ .../process/init/inject-reactions/default.js | 3 + apps/web/process/price/get-kp-data.ts | 2 - apps/web/trpc/routers/quote.ts | 3 + 12 files changed, 301 insertions(+), 8 deletions(-) create mode 100644 apps/web/process/bonuses/get-kp-data.ts create mode 100644 apps/web/process/bonuses/reactions/common.ts create mode 100644 apps/web/process/bonuses/reactions/index.js create mode 100644 apps/web/process/bonuses/reactions/lib/helper.ts create mode 100644 apps/web/process/bonuses/reactions/validation.ts diff --git a/apps/web/api/user/query.ts b/apps/web/api/user/query.ts index e19a7e3..dfc6aab 100644 --- a/apps/web/api/user/query.ts +++ b/apps/web/api/user/query.ts @@ -6,6 +6,6 @@ import axios from 'axios'; const { URL_GET_USER } = getUrls(); -export async function getUser(config: AxiosRequestConfig) { +export async function getUser(config?: AxiosRequestConfig) { return await axios.get(URL_GET_USER, config).then((res) => love(res.data)); } diff --git a/apps/web/config/default-values.ts b/apps/web/config/default-values.ts index e457cd3..a8bf023 100644 --- a/apps/web/config/default-values.ts +++ b/apps/web/config/default-values.ts @@ -119,7 +119,7 @@ const defaultValues: CalculationValues = { registrationDescription: '-', registrationQuote: true, requirementTelematic: 100_000_000, - saleBonus: 1.3, + saleBonus: 0, seasonType: null, showFinGAP: true, subsidy: null, diff --git a/apps/web/graphql/crm.query.graphql b/apps/web/graphql/crm.query.graphql index 75d400a..1a72fef 100644 --- a/apps/web/graphql/crm.query.graphql +++ b/apps/web/graphql/crm.query.graphql @@ -131,6 +131,7 @@ query GetProduct($productId: Uuid!) { evo_brandid } evo_sale_without_nds + evo_cut_proportion_bonus_director } } @@ -294,3 +295,32 @@ query GetRewardCondition($conditionId: Uuid!) { } } } + +query GetSotCoefficientTypes { + evo_sot_coefficient_types(statecode: 0) { + evo_id + evo_sot_coefficient_typeid + } +} + +query GetCoefficients($currentDate: DateTime, $jobTitleId: Uuid!) { + evo_coefficients( + statecode: 0 + evo_datefrom_param: { lte: $currentDate } + evo_dateto_param: { gte: $currentDate } + evo_job_titleid: $jobTitleId + ) { + evo_job_titleid + evo_sot_coefficient_typeid + evo_baseproducts { + evo_baseproductid + } + evo_sot_coefficient + } +} + +query GetSystemUser($domainname: String) { + systemuser(domainname: $domainname) { + evo_job_titleid + } +} diff --git a/apps/web/graphql/crm.types.ts b/apps/web/graphql/crm.types.ts index e4f7400..e4d4b26 100644 --- a/apps/web/graphql/crm.types.ts +++ b/apps/web/graphql/crm.types.ts @@ -203,7 +203,7 @@ export type GetProductQueryVariables = Exact<{ }>; -export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | null, evo_sale_without_nds: boolean | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null } | null }; +export type GetProductQuery = { __typename?: 'Query', evo_baseproduct: { __typename?: 'evo_baseproduct', evo_calculation_method: Array | null, evo_sale_without_nds: boolean | null, evo_cut_proportion_bonus_director: boolean | null, evo_leasingobject_types: Array<{ __typename?: 'evo_leasingobject_type', evo_leasingobject_typeid: string | null } | null> | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null, evo_brands: Array<{ __typename?: 'evo_brand', evo_brandid: string | null } | null> | null } | null }; export type GetSubsidiesQueryVariables = Exact<{ currentDate: InputMaybe; @@ -308,6 +308,33 @@ export type GetRewardConditionQueryVariables = Exact<{ export type GetRewardConditionQuery = { __typename?: 'Query', evo_reward_condition: { __typename?: 'evo_reward_condition', evo_reward_summ: number | null, evo_reduce_reward: boolean | null, evo_min_reward_summ: number | null, evo_agency_agreementidData: { __typename?: 'evo_agency_agreement', evo_required_reward: boolean | null, evo_reward_without_other_agent: boolean | null } | null } | null }; +export type GetSotCoefficientTypesQueryVariables = Exact<{ [key: string]: never; }>; + + +export type GetSotCoefficientTypesQuery = { __typename?: 'Query', evo_sot_coefficient_types: Array<{ __typename?: 'evo_sot_coefficient_type', evo_id: string | null, evo_sot_coefficient_typeid: string | null } | null> | null }; + +export type GetCoefficientsQueryVariables = Exact<{ + currentDate: InputMaybe; + jobTitleId: Scalars['Uuid']; +}>; + + +export type GetCoefficientsQuery = { __typename?: 'Query', evo_coefficients: Array<{ __typename?: 'evo_coefficient', evo_job_titleid: string | null, evo_sot_coefficient_typeid: string | null, evo_sot_coefficient: number | null, evo_baseproducts: Array<{ __typename?: 'evo_baseproduct', evo_baseproductid: string | null } | null> | null } | null> | null }; + +export type GetSystemUserQueryVariables = Exact<{ + domainname: InputMaybe; +}>; + + +export type GetSystemUserQuery = { __typename?: 'Query', systemuser: { __typename?: 'systemuser', evo_job_titleid: string | null } | null }; + +export type GetBonusDataFromQuoteQueryVariables = Exact<{ + quoteId: Scalars['Uuid']; +}>; + + +export type GetBonusDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_sale_bonus: number | null } | null }; + export type GetConfiguratorDataFromQuoteQueryVariables = Exact<{ quoteId: Scalars['Uuid']; }>; @@ -397,7 +424,7 @@ export type GetPriceDataFromQuoteQueryVariables = Exact<{ }>; -export type GetPriceDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_perc: number | null, evo_discount_perc: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_nds_in_price_supplier_currency: number | null, evo_sale_bonus: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null } | null }; +export type GetPriceDataFromQuoteQuery = { __typename?: 'Query', quote: { __typename?: 'quote', evo_comission_perc: number | null, evo_discount_perc: number | null, evo_first_payment_perc: number | null, evo_last_payment_calc: number | null, evo_last_payment_perc: number | null, evo_nds_in_price_supplier_currency: number | null, evo_supplier_currency_price: number | null, evo_transactioncurrencyid: string | null } | null }; export type GetRewardRulesQueryVariables = Exact<{ conditionId: Scalars['Uuid']; @@ -426,7 +453,7 @@ export const GetTarifDocument = {"kind":"Document","definitions":[{"kind":"Opera export const GetRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRates"},"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_rates"},"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_rateid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_tarifs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_tarifid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_rate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_rateid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rateId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_base_rate"}}]}}]}}]} as unknown as DocumentNode; export const GetProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProducts"},"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_baseproducts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_relation"},"value":{"kind":"ListValue","values":[{"kind":"IntValue","value":"100000000"}]}},{"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_baseproductid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}}]}}]} as unknown as DocumentNode; -export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_baseproductid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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_calculation_method"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}}]}}]}}]} as unknown as DocumentNode; +export const GetProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_baseproductid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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_calculation_method"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_without_nds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cut_proportion_bonus_director"}}]}}]}}]} as unknown as DocumentNode; export const GetSubsidiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidies"},"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_subsidies"},"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_subsidyid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_type"}}]}}]}}]} as unknown as DocumentNode; export const GetSubsidyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubsidy"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"subsidyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_subsidy_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_percent_subsidy"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_subsidy_summ"}}]}}]}}]} as unknown as DocumentNode; export const GetImportProgramDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetImportProgram"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"importProgram"},"name":{"kind":"Name","value":"evo_subsidy"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_subsidyid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"importProgramId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"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":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_brands"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_brandid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode; @@ -443,6 +470,10 @@ export const GetDealerPersonsDocument = {"kind":"Document","definitions":[{"kind export const GetAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agent"},"name":{"kind":"Name","value":"account"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}}],"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":"accountid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardConditionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardConditions"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}},{"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_reward_conditions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_agent_accountid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"agentid"}}},{"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"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_agency_agreementid_param"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"has"},"value":{"kind":"BooleanValue","value":true}}]}}],"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_reward_conditionid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardConditionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardCondition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reduce_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_reward_summ"}},{"kind":"Field","name":{"kind":"Name","value":"evo_agency_agreementidData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_required_reward"}},{"kind":"Field","name":{"kind":"Name","value":"evo_reward_without_other_agent"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetSotCoefficientTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSotCoefficientTypes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_id"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}}]}}]}}]} as unknown as DocumentNode; +export const GetCoefficientsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCoefficients"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currentDate"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTime"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_coefficients"},"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"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_job_titleid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"jobTitleId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_baseproducts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_baseproductid"}}]}},{"kind":"Field","name":{"kind":"Name","value":"evo_sot_coefficient"}}]}}]}}]} as unknown as DocumentNode; +export const GetSystemUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSystemUser"},"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":"systemuser"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"domainname"},"value":{"kind":"Variable","name":{"kind":"Name","value":"domainname"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_job_titleid"}}]}}]}}]} as unknown as DocumentNode; +export const GetBonusDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetBonusDataFromQuote"},"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_sale_bonus"}}]}}]}}]} as unknown as DocumentNode; export const GetConfiguratorDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetConfiguratorDataFromQuote"},"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"}}]}}]}}]} as unknown as DocumentNode; export const GetFingapDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFingapDataFromQuote"},"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_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_product_risks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetFinGapAddProductTypesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFinGAPAddProductTypes"},"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_addproduct_types"},"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"}}}]}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000006"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_name"}},{"kind":"Field","name":{"kind":"Name","value":"evo_type_calc_cerebellum"}},{"kind":"Field","name":{"kind":"Name","value":"evo_cost_service_provider_withoutnds"}},{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_types"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_addproduct_typeid"}}]}}]}}]}}]} as unknown as DocumentNode; @@ -455,6 +486,6 @@ export const GetQuoteUrlDocument = {"kind":"Document","definitions":[{"kind":"Op export const GetLeasingObjectDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingObjectDataFromQuote"},"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_brandid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_equipmentid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_leasingobject_typeid"}}]}}]}}]} as unknown as DocumentNode; export const GetLeasingWithoutKaskoOptionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLeasingWithoutKaskoOptions"},"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_addproduct_types"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statecode"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"evo_product_type"},"value":{"kind":"IntValue","value":"100000007"}},{"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_addproduct_typeid"}},{"kind":"Field","name":{"kind":"Name","value":"evo_product_type"}},{"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_min_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_price"}},{"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_visible_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_min_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_max_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_models"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_modelid"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetPaymentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentsDataFromQuote"},"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_period"}},{"kind":"Field","name":{"kind":"Name","value":"evo_accept_period"}},{"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_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"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"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_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_nds_in_price_supplier_currency"}},{"kind":"Field","name":{"kind":"Name","value":"evo_sale_bonus"}},{"kind":"Field","name":{"kind":"Name","value":"evo_supplier_currency_price"}},{"kind":"Field","name":{"kind":"Name","value":"evo_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode; +export const GetPriceDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPriceDataFromQuote"},"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_comission_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_discount_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_first_payment_perc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_calc"}},{"kind":"Field","name":{"kind":"Name","value":"evo_last_payment_perc"}},{"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_transactioncurrencyid"}}]}}]}}]} as unknown as DocumentNode; export const GetRewardRulesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRewardRules"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Uuid"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_reward_condition"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"evo_reward_conditionid"},"value":{"kind":"Variable","name":{"kind":"Name","value":"conditionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evo_calc_reward_rules"}}]}}]}}]} as unknown as DocumentNode; export const GetAgentsDataFromQuoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentsDataFromQuote"},"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_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"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/apps/web/process/bonuses/get-kp-data.ts b/apps/web/process/bonuses/get-kp-data.ts new file mode 100644 index 0000000..d3cbd3e --- /dev/null +++ b/apps/web/process/bonuses/get-kp-data.ts @@ -0,0 +1,40 @@ +import type { GetQuoteDataInput, GetQuoteDataOutput } from '../load-kp/types'; +import initializeApollo from '@/apollo/client'; +import type * as CRMTypes from '@/graphql/crm.types'; +import { gql } from '@apollo/client'; + +const QUERY_GET_BONUS_DATA_FROM_QUOTE = gql` + query GetBonusDataFromQuote($quoteId: Uuid!) { + quote(quoteId: $quoteId) { + evo_sale_bonus + } + } +`; + +type QuotePaymentsProcessData = { + values: Partial; +}; + +export default async function getBonusDataFromKP({ + values: { quote: quoteId }, +}: GetQuoteDataInput): Promise { + const apolloClient = initializeApollo(); + + const { + data: { quote }, + } = await apolloClient.query< + CRMTypes.GetBonusDataFromQuoteQuery, + CRMTypes.GetBonusDataFromQuoteQueryVariables + >({ + query: QUERY_GET_BONUS_DATA_FROM_QUOTE, + variables: { + quoteId, + }, + }); + + return { + values: { + saleBonus: quote?.evo_sale_bonus || 0, + }, + }; +} diff --git a/apps/web/process/bonuses/reactions/common.ts b/apps/web/process/bonuses/reactions/common.ts new file mode 100644 index 0000000..69df4f0 --- /dev/null +++ b/apps/web/process/bonuses/reactions/common.ts @@ -0,0 +1,97 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { ReactionsContext } from '../../types'; +import helper from './lib/helper'; +import { makeDisposable } from '@/../../packages/tools'; +import * as CRMTypes from '@/graphql/crm.types'; +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; +import { reaction } from 'mobx'; +import { pick } from 'radash'; + +dayjs.extend(utc); + +export default function commonReactions(context: ReactionsContext) { + const { store, apolloClient } = context; + const { $calculation, $process } = store; + const { getCoefficient } = helper(context); + + /** + * При изменении значения необходимо значение поля tbxSaleBonus сравнивать со значением из записи Коэффициент + * для расчета evo_coefficient как сейчас + данная запись должна быть связана с Продуктом product + * из поля Продукт selectProduct evo_evo_coefficient_evo_baseproduct + * Если продукта нет или нет коэффициента по условиям, то поле tbxSaleBonus = 0 и закрыто для редактирования + */ + + makeDisposable( + () => + reaction( + () => $calculation.element('selectProduct').getValue(), + async (productId) => { + if (!productId) { + $calculation.element('tbxSaleBonus').resetValue().block(); + + return; + } + + const coefficient = await getCoefficient(productId); + + if (!coefficient?.evo_sot_coefficient) { + $calculation.element('tbxSaleBonus').resetValue().block(); + + return; + } + + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + $calculation.element('tbxSaleBonus').setValue(maxBonus).unblock(); + }, + { + fireImmediately: true, + } + ), + () => $process.has('LoadKP') + ); + + /** + * если в Продукте evo_cut_proportion_bonus_director " = Да, + * то tbxBonusCoefficient = tbxSaleBonus/evo_sot_coefficient, + * иначе tbxBonusCoefficient = 1 + * где evo_sot_coefficient ищем так: + * в справочнике Коэффициент для расчета (evo_coefficient) найти запись, у которой: + * + * Тип коэффициента (evo_corfficient_type) = СОТ (100 000 002) + * Статус (statecode) = активный (0) + * Начало действия (evo_datefrom) меньше или равно текущей даты + * Окончание действия (evo_dateto) больше или равно текущей даты + * Должность (evo_evo_job_title_evo_coefficient_job_titleid) = Должности (evo_job_titleid) текущего пользователя (systemuser) + * Тип коэффициента для СОТ (evo_sot_coefficient_typeid) = (evo_sot_coefficient_type.evo_id=BONUS_LEASING) + * данная запись должна быть связана с Продуктом product из поля Продукт selectProduct + */ + reaction( + () => pick($calculation.$values.values, ['product', 'saleBonus']), + async ({ product: productId, saleBonus }) => { + if (!productId) { + $calculation.element('tbxBonusCoefficient').resetValue(); + + return; + } + + const { + data: { evo_baseproduct }, + } = await apolloClient.query({ + query: CRMTypes.GetProductDocument, + variables: { + productId, + }, + }); + + if (evo_baseproduct?.evo_cut_proportion_bonus_director) { + const coefficient = await getCoefficient(productId); + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + + $calculation.element('tbxBonusCoefficient').setValue(maxBonus ? saleBonus / maxBonus : 0); + } else { + $calculation.element('tbxBonusCoefficient').resetValue(); + } + } + ); +} diff --git a/apps/web/process/bonuses/reactions/index.js b/apps/web/process/bonuses/reactions/index.js new file mode 100644 index 0000000..cc8d68a --- /dev/null +++ b/apps/web/process/bonuses/reactions/index.js @@ -0,0 +1,2 @@ +export { default as common } from './common'; +export { default as validation } from './validation'; diff --git a/apps/web/process/bonuses/reactions/lib/helper.ts b/apps/web/process/bonuses/reactions/lib/helper.ts new file mode 100644 index 0000000..a631e98 --- /dev/null +++ b/apps/web/process/bonuses/reactions/lib/helper.ts @@ -0,0 +1,65 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import type { ReactionsContext } from '../../../types'; +import { getUser } from '@/api/user/query'; +import type { ElementsTypes } from '@/Components/Calculation/config/map/values'; +import { STALE_TIME } from '@/constants/request'; +import * as CRMTypes from '@/graphql/crm.types'; +import dayjs from 'dayjs'; + +export type ProductId = ElementsTypes['selectProduct']; + +export default function helper({ apolloClient, queryClient }: ReactionsContext) { + return { + async getCoefficient(productId: ProductId) { + if (!productId) { + return null; + } + + const user = await queryClient.fetchQuery(['user'], () => getUser(), { + staleTime: STALE_TIME, + }); + + const { + data: { systemuser }, + } = await apolloClient.query({ + query: CRMTypes.GetSystemUserDocument, + variables: { + domainname: user.domainName, + }, + }); + + if (!systemuser?.evo_job_titleid) { + return null; + } + + const currentDate = dayjs().utc(false).toISOString(); + + const { + data: { evo_coefficients }, + } = await apolloClient.query({ + query: CRMTypes.GetCoefficientsDocument, + variables: { + currentDate, + jobTitleId: systemuser?.evo_job_titleid, + }, + }); + + const { + data: { evo_sot_coefficient_types }, + } = await apolloClient.query({ + query: CRMTypes.GetSotCoefficientTypesDocument, + }); + + const evo_sot_coefficient_type_bonus = evo_sot_coefficient_types?.find( + (x) => x?.evo_id === 'BONUS_LEASING' + ); + + return evo_coefficients?.find( + (evo_coefficient) => + evo_coefficient?.evo_sot_coefficient_typeid === + evo_sot_coefficient_type_bonus?.evo_sot_coefficient_typeid && + evo_coefficient?.evo_baseproducts?.some((x) => x?.evo_baseproductid === productId) + ); + }, + }; +} diff --git a/apps/web/process/bonuses/reactions/validation.ts b/apps/web/process/bonuses/reactions/validation.ts new file mode 100644 index 0000000..1b3770c --- /dev/null +++ b/apps/web/process/bonuses/reactions/validation.ts @@ -0,0 +1,24 @@ +import helper from './lib/helper'; +import type { ReactionsContext } from '@/process/types'; +import { reaction } from 'mobx'; +import { pick } from 'radash'; +import { round } from 'tools'; + +export default function reactions(context: ReactionsContext) { + const { store } = context; + const { $calculation } = store; + const { getCoefficient } = helper(context); + + reaction( + () => pick($calculation.$values.values, ['product', 'saleBonus']), + async ({ product: productId, saleBonus }) => { + const coefficient = await getCoefficient(productId); + const maxBonus = (coefficient?.evo_sot_coefficient || 0) * 100; + + $calculation.element('tbxSaleBonus').validate({ + invalid: round(saleBonus, 2) > round(maxBonus, 2), + message: 'Размер бонуса МПЛ не может быть выше установленного по СОТ', + }); + } + ); +} diff --git a/apps/web/process/init/inject-reactions/default.js b/apps/web/process/init/inject-reactions/default.js index 6a98bc7..b662c5f 100644 --- a/apps/web/process/init/inject-reactions/default.js +++ b/apps/web/process/init/inject-reactions/default.js @@ -1,3 +1,4 @@ +import * as bonusesReactions from '../../bonuses/reactions'; import * as calculateReactions from '../../calculate/reactions'; import * as configurator from '../../configurator/reactions'; import createKPReactions from '../../create-kp/reactions'; @@ -43,4 +44,6 @@ export default function injectDefaultReactions(context) { configurator.values(context); configurator.validation(context); createKPReactions(context); + bonusesReactions.common(context); + bonusesReactions.validation(context); } diff --git a/apps/web/process/price/get-kp-data.ts b/apps/web/process/price/get-kp-data.ts index 19a1173..7654f2c 100644 --- a/apps/web/process/price/get-kp-data.ts +++ b/apps/web/process/price/get-kp-data.ts @@ -16,7 +16,6 @@ const QUERY_GET_PRICE_DATA_FROM_QUOTE = gql` # evo_last_payment_rub evo_nds_in_price_supplier_currency # evo_price_without_nds_supplier_currency - evo_sale_bonus evo_supplier_currency_price evo_transactioncurrencyid } @@ -55,7 +54,6 @@ export default async function getPriceDataFromKP({ lastPaymentRule: quote?.evo_last_payment_calc, leaseObjectPrice: quote?.evo_supplier_currency_price || 0, // leaseObjectPriceWthtVAT: quote?.evo_price_without_nds_supplier_currency || 0, - saleBonus: quote?.evo_sale_bonus || 0, supplierCurrency: quote?.evo_transactioncurrencyid, supplierDiscountPerc: quote?.evo_discount_perc || 0, // supplierDiscountRub: quote?.evo_discount_supplier_currency || 0, diff --git a/apps/web/trpc/routers/quote.ts b/apps/web/trpc/routers/quote.ts index 0c40560..b0ac4f1 100644 --- a/apps/web/trpc/routers/quote.ts +++ b/apps/web/trpc/routers/quote.ts @@ -2,6 +2,7 @@ import { t } from '../server'; import defaultValues from '@/config/default-values'; import { defaultValues as defaultInsuranceValues } from '@/config/tables/insurance-table'; +import getBonusDataFromKP from '@/process/bonuses/get-kp-data'; import getConfiguratorDataFromKP from '@/process/configurator/get-kp-data'; import getFingapDataFromKP from '@/process/fingap/get-kp-data'; import getLeasingObjectDataFromKP from '@/process/leasing-object/get-kp-data'; @@ -22,6 +23,7 @@ const quoteRouter = t.router({ const { values: supplierAgentsValues } = await getSupplierAgentsDataFromKP(input); const { values: paymentsValues, payments } = await getPaymentsDataFromKP(input); const { values: priceValues } = await getPriceDataFromKP(input); + const { values: bonusValues } = await getBonusDataFromKP(input); const { values: leasingObjectValues } = await getLeasingObjectDataFromKP(input); const { fingap, insurance: fingapInsurance } = await getFingapDataFromKP(input); @@ -32,6 +34,7 @@ const quoteRouter = t.router({ ...supplierAgentsValues, ...paymentsValues, ...priceValues, + ...bonusValues, ...leasingObjectValues, }, payments,