diff --git a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts index de78d5c..14fc964 100644 --- a/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts +++ b/src/client/Containers/Calculation/lib/fetchData/queries/optionsQuery.ts @@ -250,8 +250,10 @@ const query = gql` } } selectRate: evo_rates( - statecode: $statecode # evo_datefrom_param: { lte: $currentDate } # evo_dateto_param: { gte: $currentDate } - ) { + statecode: $statecode + ) # evo_datefrom_param: { lte: $currentDate } + # evo_dateto_param: { gte: $currentDate } + { evo_id evo_rateid evo_name diff --git a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts index e674efe..1543d29 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/loadKpReaction/index.ts @@ -63,6 +63,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ INNForCalc, regionRegistration, creditRate, + rate, infuranceOPF, } = calculationStore.values; @@ -237,10 +238,6 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ }), ); - const rate = calculationStore.getOption('selectRate', { - evo_rateid: quote.evo_rateid, - }); - let clientRisk = quote.evo_client_riskid; if (opportunity) { const current_opportunity = calculationStore.getOption( @@ -291,7 +288,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({ ...newValues, product: base_product?.evo_id, ...addProducts, - rate: rate?.evo_id, + rate, lead, opportunity, quote: quoteId, diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 4260933..734655b 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -1,4 +1,5 @@ import { openNotification } from 'client/Elements/Notification'; +import valuesConstants from 'core/constants/values'; import { pipe } from 'core/tools/func'; import { IReactionEffect } from 'core/types/Calculation/Store/effect'; import { Process } from 'core/types/Calculation/Store/process'; @@ -1754,6 +1755,18 @@ const reactionEffects: IReactionEffect[] = [ calculationStore.setValue('INNForCalc', inn); }, }), + + calculationStore => ({ + expression: () => { + return calculationStore.getOption('selectRate'); + }, + effect: ({ evo_base_rate }) => { + calculationStore.setValue( + 'creditRate', + evo_base_rate || valuesConstants.RATE, + ); + }, + }), ]; export default reactionEffects; diff --git a/src/client/stores/CalculationStore/config/initialValues.ts b/src/client/stores/CalculationStore/config/initialValues.ts index d51bf04..685f26e 100644 --- a/src/client/stores/CalculationStore/config/initialValues.ts +++ b/src/client/stores/CalculationStore/config/initialValues.ts @@ -1,3 +1,4 @@ +import valuesConstants from 'core/constants/values'; import { currentYear } from 'core/tools/date'; import { TValue, TValues } from 'core/types/Calculation/Store/values'; @@ -71,7 +72,7 @@ const initialValues: TValues = { NSIB: true, quoteContactGender: 100000000, quoteRedemptionGraph: true, - creditRate: 7.75, + creditRate: valuesConstants.RATE, requirementTelematic: 100000000, maxPriceChange: 0, importerRewardPerc: 0, diff --git a/src/core/constants/values.js b/src/core/constants/values.js index 2ae8799..9beb1e3 100644 --- a/src/core/constants/values.js +++ b/src/core/constants/values.js @@ -8,4 +8,5 @@ export default { MAX_VEHICLE_MASS: 3500, MAX_VEHICLE_SEATS: 20, PERIODS_NUMBER: 12, + RATE: 7.75, };