diff --git a/apps/web/config/default-options.ts b/apps/web/config/default-options.ts index d95abf9..bdac36a 100644 --- a/apps/web/config/default-options.ts +++ b/apps/web/config/default-options.ts @@ -184,6 +184,17 @@ export const selectLeaseObjectUseFor = alphabetical( 'asc' ); +export const radioCalcType = [ + { + label: 'IRR', + value: 100_000_000, + }, + { + label: 'Суммы', + value: 100_000_001, + }, +]; + const defaultOptions: CalculationOptions = { radioLastPaymentRule: [ { @@ -321,16 +332,7 @@ const defaultOptions: CalculationOptions = { value: 100_000_007, }, ], - radioCalcType: [ - { - label: 'IRR', - value: 100_000_000, - }, - { - label: 'Суммы', - value: 100_000_001, - }, - ], + radioCalcType, radioObjectRegistration: [ { label: 'Лизингополучатель', diff --git a/apps/web/process/configurator/reactions/filters.ts b/apps/web/process/configurator/reactions/filters.ts index 85f51b3..b200309 100644 --- a/apps/web/process/configurator/reactions/filters.ts +++ b/apps/web/process/configurator/reactions/filters.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { radioGraphType, selectSeasonType } from '@/config/default-options'; +import { radioCalcType, radioGraphType, selectSeasonType } from '@/config/default-options'; import * as CRMTypes from '@/graphql/crm.types'; import { SEASON_TYPES } from '@/process/payments/lib/seasons-constants'; import type { ProcessContext } from '@/process/types'; @@ -278,7 +278,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) { const { data: { evo_baseproduct }, - } = await apolloClient.query({ + } = await apolloClient.query({ query: CRMTypes.GetProductDocument, variables: { productId, @@ -286,10 +286,9 @@ export default function reactions({ store, apolloClient }: ProcessContext) { }); if (evo_baseproduct?.evo_calculation_method) { - const filteredCalcTypeOptions = $calculation - .element('radioCalcType') - .getOptions() - .filter((calcType) => evo_baseproduct.evo_calculation_method?.includes(calcType.value)); + const filteredCalcTypeOptions = radioCalcType.filter((calcType) => + evo_baseproduct.evo_calculation_method?.includes(calcType.value) + ); $calculation.element('radioCalcType').setOptions(filteredCalcTypeOptions); } else { $calculation.element('radioCalcType').resetOptions(); diff --git a/apps/web/process/configurator/reactions/values.ts b/apps/web/process/configurator/reactions/values.ts index f0173bc..b491c31 100644 --- a/apps/web/process/configurator/reactions/values.ts +++ b/apps/web/process/configurator/reactions/values.ts @@ -199,6 +199,7 @@ export default function valuesReactions({ store, apolloClient }: ProcessContext) 'selectFuelCard', 'selectRegistration', 'selectTownRegistration', + 'radioCalcType', ] as Elements[] ).forEach((elementName) => { reaction(