diff --git a/apps/web/process/bonuses/reactions/common.ts b/apps/web/process/bonuses/reactions/common.ts index 18288bb..65e2a37 100644 --- a/apps/web/process/bonuses/reactions/common.ts +++ b/apps/web/process/bonuses/reactions/common.ts @@ -9,7 +9,7 @@ import { reaction } from 'mobx'; dayjs.extend(utc); -export default function commonReactions(context: ReactionsContext) { +export default function reactions(context: ReactionsContext) { const { store, apolloClient } = context; const { $calculation, $process } = store; const { getCoefficient } = helper(context); diff --git a/apps/web/process/calculate/index.ts b/apps/web/process/calculate/action.ts similarity index 100% rename from apps/web/process/calculate/index.ts rename to apps/web/process/calculate/action.ts diff --git a/apps/web/process/calculate/reactions/common.ts b/apps/web/process/calculate/reactions/common.ts index 0f10e9f..bd09384 100644 --- a/apps/web/process/calculate/reactions/common.ts +++ b/apps/web/process/calculate/reactions/common.ts @@ -4,7 +4,7 @@ import type { ReactionsContext } from '@/process/types'; import { reaction } from 'mobx'; import { formatter } from 'tools'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; reaction( diff --git a/apps/web/process/calculate/reactions/validation.ts b/apps/web/process/calculate/reactions/validation.ts index 1f7624a..c34384e 100644 --- a/apps/web/process/calculate/reactions/validation.ts +++ b/apps/web/process/calculate/reactions/validation.ts @@ -13,7 +13,7 @@ function hasInvalidValueOrOptions(value: unknown, options: Array x.value === value); } -export default function validationReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ReactionsContext) { const { $calculation, $tables } = store; reaction( diff --git a/apps/web/process/configurator/reactions/filters.ts b/apps/web/process/configurator/reactions/filters.ts index 2e22343..2f1a3d1 100644 --- a/apps/web/process/configurator/reactions/filters.ts +++ b/apps/web/process/configurator/reactions/filters.ts @@ -11,7 +11,7 @@ import { normalizeOptions } from 'tools'; dayjs.extend(utc); -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; reaction( diff --git a/apps/web/process/configurator/reactions/validation.ts b/apps/web/process/configurator/reactions/validation.ts index 9b2618c..de338e7 100644 --- a/apps/web/process/configurator/reactions/validation.ts +++ b/apps/web/process/configurator/reactions/validation.ts @@ -3,7 +3,7 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ReactionsContext } from '@/process/types'; import { reaction } from 'mobx'; -export default function validationReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; /** * На изменение поля Процет убывания платежей tbxParmentsDecreasePercent необходимо заложить проверку: diff --git a/apps/web/process/create-kp/index.ts b/apps/web/process/create-kp/action.ts similarity index 100% rename from apps/web/process/create-kp/index.ts rename to apps/web/process/create-kp/action.ts diff --git a/apps/web/process/create-kp/reactions.ts b/apps/web/process/create-kp/reactions.ts index e8af874..c397f89 100644 --- a/apps/web/process/create-kp/reactions.ts +++ b/apps/web/process/create-kp/reactions.ts @@ -1,7 +1,7 @@ import type { ReactionsContext } from '../types'; import { reaction } from 'mobx'; -export default function commonReactions({ store }: ReactionsContext) { +export function common({ store }: ReactionsContext) { const { $calculation } = store; reaction( diff --git a/apps/web/process/fingap/reactions/common.ts b/apps/web/process/fingap/reactions/common.ts index c6be69e..18d47e7 100644 --- a/apps/web/process/fingap/reactions/common.ts +++ b/apps/web/process/fingap/reactions/common.ts @@ -14,7 +14,7 @@ import { flatten } from 'tools/object'; dayjs.extend(utc); -export default function commonReactions({ store, apolloClient, queryClient }: ReactionsContext) { +export default function reactions({ store, apolloClient, queryClient }: ReactionsContext) { const { $calculation, $tables } = store; // Расчет итоговой суммы ФинГАП и запись в таблицу страхования reaction( diff --git a/apps/web/process/fingap/reactions/index.js b/apps/web/process/fingap/reactions/index.ts similarity index 100% rename from apps/web/process/fingap/reactions/index.js rename to apps/web/process/fingap/reactions/index.ts diff --git a/apps/web/process/fingap/reactions/validation.ts b/apps/web/process/fingap/reactions/validation.ts index 3a317f9..1937dbe 100644 --- a/apps/web/process/fingap/reactions/validation.ts +++ b/apps/web/process/fingap/reactions/validation.ts @@ -1,7 +1,7 @@ import type { ReactionsContext } from '@/process/types'; import { reaction } from 'mobx'; -export default function validationReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ReactionsContext) { const { $tables } = store; reaction( diff --git a/apps/web/process/init/inject-reactions/default.js b/apps/web/process/init/inject-reactions/default.js index 6f6831b..9c2ad67 100644 --- a/apps/web/process/init/inject-reactions/default.js +++ b/apps/web/process/init/inject-reactions/default.js @@ -1,51 +1,42 @@ import * as bonusesReactions from '../../bonuses/reactions'; import * as calculateReactions from '../../calculate/reactions'; import * as configurator from '../../configurator/reactions'; -import createKPReactions from '../../create-kp/reactions'; +import * as createKPReactions from '../../create-kp/reactions'; import * as fingapReactions from '../../fingap/reactions'; import * as leadOpportunityReactions from '../../lead-opportunity/reactions'; import * as leasingObject from '../../leasing-object/reactions'; import * as leasingWithoutKaskoReactions from '../../leasing-without-kasko/reactions'; -import loadKpReactions from '../../load-kp/reactions'; -import * as paymentsReactions from '../../payments/reactions'; +import * as loadKP from '../../load-kp/reactions'; import * as priceReactions from '../../price/reactions'; import * as subsidyReactions from '../../subsidy/reactions'; -import subsidyImportProgram from '../../subsidy-import-program/reactions'; -import * as agentsReactions from '../../supplier-agent/reactions/agents'; -import leasebackReactions from '../../supplier-agent/reactions/leaseback'; -import * as supplierReactions from '../../supplier-agent/reactions/supplier'; +import * as subsidyImportProgram from '../../subsidy-import-program/reactions'; +import * as agentsReactions from '../../supplier-agent/reactions'; import * as usedPl from '../../used-pl/reactions'; export default function injectDefaultReactions(context) { leadOpportunityReactions.common(context); leadOpportunityReactions.urls(context); - paymentsReactions.commonReactions(context); - paymentsReactions.validationReactions(context); + loadKP.common(context); calculateReactions.validation(context); calculateReactions.common(context); - supplierReactions.commonReactions(context); - supplierReactions.validationReactions(context); - agentsReactions.fillReactions(context); - agentsReactions.commonReactions(context); - agentsReactions.validationReactions(context); - leasebackReactions(context); + agentsReactions.common(context); + agentsReactions.validation(context); priceReactions.computed(context); priceReactions.common(context); priceReactions.validation(context); fingapReactions.common(context); fingapReactions.validation(context); - loadKpReactions(context); + loadKP.common(context); leasingWithoutKaskoReactions.common(context); - subsidyReactions.computedReactions(context); - subsidyReactions.commonReactions(context); + subsidyReactions.common(context); leasingObject.common(context); leasingObject.validation(context); configurator.filters(context); configurator.values(context); configurator.validation(context); - createKPReactions(context); + createKPReactions.common(context); bonusesReactions.common(context); bonusesReactions.validation(context); - usedPl.default(context); - subsidyImportProgram(context); + usedPl.common(context); + subsidyImportProgram.common(context); } diff --git a/apps/web/process/lead-opportunity/reactions/common.ts b/apps/web/process/lead-opportunity/reactions/common.ts index b62407c..d4ff64d 100644 --- a/apps/web/process/lead-opportunity/reactions/common.ts +++ b/apps/web/process/lead-opportunity/reactions/common.ts @@ -4,7 +4,7 @@ import { reaction } from 'mobx'; import { normalizeOptions } from 'tools/entity'; import { makeDisposable } from 'tools/mobx'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation, $process } = store; /** diff --git a/apps/web/process/lead-opportunity/reactions/index.js b/apps/web/process/lead-opportunity/reactions/index.ts similarity index 100% rename from apps/web/process/lead-opportunity/reactions/index.js rename to apps/web/process/lead-opportunity/reactions/index.ts diff --git a/apps/web/process/lead-opportunity/reactions/urls.ts b/apps/web/process/lead-opportunity/reactions/urls.ts index 228183c..fc46c57 100644 --- a/apps/web/process/lead-opportunity/reactions/urls.ts +++ b/apps/web/process/lead-opportunity/reactions/urls.ts @@ -5,7 +5,7 @@ import type { DocumentNode } from '@apollo/client'; import { gql } from '@apollo/client'; import { reaction } from 'mobx'; -export default function urlsReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; /** diff --git a/apps/web/process/leasing-object/reactions/common.ts b/apps/web/process/leasing-object/reactions/common.ts index 9bb4c17..8100bfe 100644 --- a/apps/web/process/leasing-object/reactions/common.ts +++ b/apps/web/process/leasing-object/reactions/common.ts @@ -5,7 +5,7 @@ import { reaction } from 'mobx'; import { intersects } from 'radash'; import { normalizeOptions } from 'tools'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; reaction( diff --git a/apps/web/process/leasing-object/reactions/index.js b/apps/web/process/leasing-object/reactions/index.ts similarity index 100% rename from apps/web/process/leasing-object/reactions/index.js rename to apps/web/process/leasing-object/reactions/index.ts diff --git a/apps/web/process/leasing-object/reactions/validation.ts b/apps/web/process/leasing-object/reactions/validation.ts index 49c9e61..9b55cf3 100644 --- a/apps/web/process/leasing-object/reactions/validation.ts +++ b/apps/web/process/leasing-object/reactions/validation.ts @@ -4,7 +4,7 @@ import type { ReactionsContext } from '@/process/types'; import ValidationHelper from '@/stores/validation/helper'; import { autorun, reaction } from 'mobx'; -export default function validationReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; /** diff --git a/apps/web/process/leasing-without-kasko/reactions/common.ts b/apps/web/process/leasing-without-kasko/reactions.ts similarity index 98% rename from apps/web/process/leasing-without-kasko/reactions/common.ts rename to apps/web/process/leasing-without-kasko/reactions.ts index b1c97e7..89f2e22 100644 --- a/apps/web/process/leasing-without-kasko/reactions/common.ts +++ b/apps/web/process/leasing-without-kasko/reactions.ts @@ -42,7 +42,7 @@ const QUERY_GET_LEASING_WITHOUT_KASKO_OPTIONS = gql` } `; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation, $tables } = store; reaction( diff --git a/apps/web/process/leasing-without-kasko/reactions/index.js b/apps/web/process/leasing-without-kasko/reactions/index.js deleted file mode 100644 index c8077ba..0000000 --- a/apps/web/process/leasing-without-kasko/reactions/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default as common } from './common'; diff --git a/apps/web/process/load-kp/reactions.ts b/apps/web/process/load-kp/reactions.ts index 87cb263..4f5db8a 100644 --- a/apps/web/process/load-kp/reactions.ts +++ b/apps/web/process/load-kp/reactions.ts @@ -5,7 +5,7 @@ import message from 'ui/elements/message'; const key = 'KP_LOADING_INFO'; -export default function loadKpReactions({ store, trpcClient }: ReactionsContext) { +export function common({ store, trpcClient }: ReactionsContext) { const { $calculation, $process, $tables } = store; reaction( diff --git a/apps/web/process/payments/validation.ts b/apps/web/process/payments/lib/validation.ts similarity index 98% rename from apps/web/process/payments/validation.ts rename to apps/web/process/payments/lib/validation.ts index 8f1f919..ae38795 100644 --- a/apps/web/process/payments/validation.ts +++ b/apps/web/process/payments/lib/validation.ts @@ -1,4 +1,4 @@ -import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './lib/seasons-constants'; +import { SEASONS_PERIOD_NUMBER, SEASONS_PERIODS } from './seasons-constants'; import { MIN_PAYMENT } from '@/constants/values'; import type RootStore from '@/stores/root'; import { counting, max, min, shift, sort } from 'radash'; diff --git a/apps/web/process/payments/reactions.ts b/apps/web/process/payments/reactions/common.ts similarity index 88% rename from apps/web/process/payments/reactions.ts rename to apps/web/process/payments/reactions/common.ts index 8c58429..2bcb6d5 100644 --- a/apps/web/process/payments/reactions.ts +++ b/apps/web/process/payments/reactions/common.ts @@ -1,11 +1,9 @@ -import * as seasonsConstants from './lib/seasons-constants'; -import * as seasonsTools from './lib/seasons-tools'; -import validatePaymentsTable from './validation'; +import * as seasonsConstants from '../lib/seasons-constants'; +import * as seasonsTools from '../lib/seasons-tools'; import { selectHighSeasonStart } from '@/config/default-options'; -import { MIN_LASTPAYMENT_NSIB, MIN_PAYMENT } from '@/constants/values'; +import { MIN_PAYMENT } from '@/constants/values'; import type { ReactionsContext } from '@/process/types'; import type { Row } from '@/stores/tables/payments/types'; -import ValidationHelper from '@/stores/validation/helper'; import { comparer, reaction, toJS } from 'mobx'; import { shift } from 'radash'; import { difference } from 'tools/array'; @@ -22,7 +20,7 @@ const { const { DEFAULT_SEASONS_VALUES, FORBIDDEN_HIGH_SEASON_START, SEASONS_PERIOD_NUMBER } = seasonsConstants; -export function commonReactions({ store }: ReactionsContext) { +export default function reactions({ store }: ReactionsContext) { const { $calculation, $tables, $process } = store; reaction( @@ -542,62 +540,3 @@ export function commonReactions({ store }: ReactionsContext) { } ); } - -export function validationReactions({ store }: ReactionsContext) { - const { $calculation, $tables } = store; - - const validationHelper = new ValidationHelper(); - - reaction( - () => { - const payments = toJS($tables.payments.values); - const graphType = $calculation.element('radioGraphType').getValue(); - const seasonType = $calculation.element('selectSeasonType').getValue(); - const highSeasonStart = $calculation.element('selectHighSeasonStart').getValue(); - const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); - - return { - graphType, - highSeasonStart, - leasingPeriod, - payments, - seasonType, - }; - }, - () => { - validationHelper.removeErrors(); - - const errorText = validatePaymentsTable(store); - - if (errorText) { - $tables.payments.validate({ - helper: validationHelper, - invalid: errorText !== null, - message: errorText, - }); - } - }, - { - delay: 50, - equals: comparer.structural, - } - ); - - reaction( - () => { - const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue(); - const insNSIB = $calculation.element('selectInsNSIB').getValue(); - - return { - insNSIB, - lastPaymentRub, - }; - }, - ({ lastPaymentRub, insNSIB }) => { - $calculation.element('tbxLastPaymentRub').validate({ - invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB, - message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`, - }); - } - ); -} diff --git a/apps/web/process/payments/reactions/index.ts b/apps/web/process/payments/reactions/index.ts new file mode 100644 index 0000000..cc8d68a --- /dev/null +++ b/apps/web/process/payments/reactions/index.ts @@ -0,0 +1,2 @@ +export { default as common } from './common'; +export { default as validation } from './validation'; diff --git a/apps/web/process/payments/reactions/validation.ts b/apps/web/process/payments/reactions/validation.ts new file mode 100644 index 0000000..66fd6af --- /dev/null +++ b/apps/web/process/payments/reactions/validation.ts @@ -0,0 +1,64 @@ +import validatePaymentsTable from '../lib/validation'; +import { MIN_LASTPAYMENT_NSIB } from '@/constants/values'; +import type { ReactionsContext } from '@/process/types'; +import ValidationHelper from '@/stores/validation/helper'; +import { comparer, reaction, toJS } from 'mobx'; + +export default function reactions({ store }: ReactionsContext) { + const { $calculation, $tables } = store; + + const validationHelper = new ValidationHelper(); + + reaction( + () => { + const payments = toJS($tables.payments.values); + const graphType = $calculation.element('radioGraphType').getValue(); + const seasonType = $calculation.element('selectSeasonType').getValue(); + const highSeasonStart = $calculation.element('selectHighSeasonStart').getValue(); + const leasingPeriod = $calculation.element('tbxLeasingPeriod').getValue(); + + return { + graphType, + highSeasonStart, + leasingPeriod, + payments, + seasonType, + }; + }, + () => { + validationHelper.removeErrors(); + + const errorText = validatePaymentsTable(store); + + if (errorText) { + $tables.payments.validate({ + helper: validationHelper, + invalid: errorText !== null, + message: errorText, + }); + } + }, + { + delay: 50, + equals: comparer.structural, + } + ); + + reaction( + () => { + const lastPaymentRub = $calculation.element('tbxLastPaymentRub').getValue(); + const insNSIB = $calculation.element('selectInsNSIB').getValue(); + + return { + insNSIB, + lastPaymentRub, + }; + }, + ({ lastPaymentRub, insNSIB }) => { + $calculation.element('tbxLastPaymentRub').validate({ + invalid: Boolean(insNSIB) && lastPaymentRub < MIN_LASTPAYMENT_NSIB, + message: `Последний платеж меньше ${MIN_LASTPAYMENT_NSIB} руб. не может быть при наличии НСИБ, укажите большее значение`, + }); + } + ); +} diff --git a/apps/web/process/price/reactions/common.ts b/apps/web/process/price/reactions/common.ts index f21f9c7..d551b1c 100644 --- a/apps/web/process/price/reactions/common.ts +++ b/apps/web/process/price/reactions/common.ts @@ -5,7 +5,7 @@ import type { ReactionsContext } from '@/process/types'; import { reaction } from 'mobx'; import { makeDisposable } from 'tools'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation, $process } = store; reaction( diff --git a/apps/web/process/price/reactions/computed.ts b/apps/web/process/price/reactions/computed.ts index 6c3cf10..6747108 100644 --- a/apps/web/process/price/reactions/computed.ts +++ b/apps/web/process/price/reactions/computed.ts @@ -7,7 +7,7 @@ import { autorun } from 'mobx'; dayjs.extend(utc); -export default function computedReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; autorun( diff --git a/apps/web/process/price/reactions/validation.ts b/apps/web/process/price/reactions/validation.ts index 9ed3923..b1d1313 100644 --- a/apps/web/process/price/reactions/validation.ts +++ b/apps/web/process/price/reactions/validation.ts @@ -5,7 +5,7 @@ import type { ReactionsContext } from '@/process/types'; import { reaction } from 'mobx'; import { round } from 'tools'; -export default function validationReactions({ store, apolloClient }: ReactionsContext) { +export default function reactions({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; reaction( diff --git a/apps/web/process/subsidy-import-program/reactions.ts b/apps/web/process/subsidy-import-program/reactions.ts index 3d9096f..4094c76 100644 --- a/apps/web/process/subsidy-import-program/reactions.ts +++ b/apps/web/process/subsidy-import-program/reactions.ts @@ -4,7 +4,7 @@ import type { ReactionsContext } from '../types'; import * as CRMTypes from '@/graphql/crm.types'; import { reaction } from 'mobx'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; /** diff --git a/apps/web/process/subsidy/reactions.ts b/apps/web/process/subsidy/reactions.ts index 3dbd832..9da8808 100644 --- a/apps/web/process/subsidy/reactions.ts +++ b/apps/web/process/subsidy/reactions.ts @@ -19,7 +19,7 @@ import { reaction } from 'mobx'; */ /* eslint-enable */ -export function computedReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; reaction( @@ -98,6 +98,3 @@ export function computedReactions({ store, apolloClient }: ReactionsContext) { } ); } - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function commonReactions({ store }: ReactionsContext) {} diff --git a/apps/web/process/supplier-agent/reactions/agents.ts b/apps/web/process/supplier-agent/reactions/agents.ts index f50d5df..3dd8766 100644 --- a/apps/web/process/supplier-agent/reactions/agents.ts +++ b/apps/web/process/supplier-agent/reactions/agents.ts @@ -15,7 +15,21 @@ const { fillAgentRewardReaction, fillAgentRewardSummReaction, validateAgentRewar dayjs.extend(utc); -export function fillReactions({ store, apolloClient }: ReactionsContext) { +class Helper { + public enabled: boolean; + /** + * + */ + constructor() { + this.enabled = false; + } + + public set = (value: boolean) => { + this.enabled = value; + }; +} + +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation, $process } = store; /** @@ -94,24 +108,6 @@ export function fillReactions({ store, apolloClient }: ReactionsContext) { rewardConditionField: 'selectFinDepartmentRewardCondtion', rewardSummField: 'tbxFinDepartmentRewardSumm', }); -} - -class Helper { - public enabled: boolean; - /** - * - */ - constructor() { - this.enabled = false; - } - - public set = (value: boolean) => { - this.enabled = value; - }; -} - -export function commonReactions({ store, apolloClient }: ReactionsContext) { - const { $calculation } = store; /** * Добавить реакцию на изменение списка в поле selectDealerRewardCondition : @@ -526,7 +522,7 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) { } } -export function validationReactions({ store, apolloClient }: ReactionsContext) { +export function validation({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; validateAgentRewardSumm(store, apolloClient, { diff --git a/apps/web/process/supplier-agent/reactions/index.ts b/apps/web/process/supplier-agent/reactions/index.ts new file mode 100644 index 0000000..d64d699 --- /dev/null +++ b/apps/web/process/supplier-agent/reactions/index.ts @@ -0,0 +1,17 @@ +import * as agents from './agents'; +import * as leaseback from './leaseback'; +import * as supplier from './supplier'; +import type { ReactionsContext } from '@/process/types'; + +function common(context: ReactionsContext) { + agents.common(context); + leaseback.common(context); + supplier.common(context); +} + +function validation(context: ReactionsContext) { + agents.validation(context); + supplier.validation(context); +} + +export { common, validation }; diff --git a/apps/web/process/supplier-agent/reactions/leaseback.ts b/apps/web/process/supplier-agent/reactions/leaseback.ts index a5a9bcc..c5c1f91 100644 --- a/apps/web/process/supplier-agent/reactions/leaseback.ts +++ b/apps/web/process/supplier-agent/reactions/leaseback.ts @@ -2,7 +2,7 @@ import * as CRMTypes from '@/graphql/crm.types'; import type { ReactionsContext } from '@/process/types'; import { autorun, reaction } from 'mobx'; -export default function leasebackReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation, $tables } = store; /** * Дополнить реакцию на изменение поля Салон приобретения selectDealer: diff --git a/apps/web/process/supplier-agent/reactions/supplier.ts b/apps/web/process/supplier-agent/reactions/supplier.ts index ac8cdf5..86ff612 100644 --- a/apps/web/process/supplier-agent/reactions/supplier.ts +++ b/apps/web/process/supplier-agent/reactions/supplier.ts @@ -9,7 +9,7 @@ import { normalizeOptions } from 'tools/entity'; dayjs.extend(utc); -export function commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation, $process } = store; /** @@ -158,7 +158,7 @@ export function commonReactions({ store, apolloClient }: ReactionsContext) { ); } -export function validationReactions({ store, apolloClient }: ReactionsContext) { +export function validation({ store, apolloClient }: ReactionsContext) { createReactions.validateAgentRewardSumm(store, apolloClient, { rewardConditionField: 'selectDealerRewardCondition', rewardSummField: 'tbxDealerRewardSumm', diff --git a/apps/web/process/used-pl/reactions.ts b/apps/web/process/used-pl/reactions.ts index 90af867..132b907 100644 --- a/apps/web/process/used-pl/reactions.ts +++ b/apps/web/process/used-pl/reactions.ts @@ -4,7 +4,7 @@ import * as CRMTypes from '@/graphql/crm.types'; import ValidationHelper from '@/stores/validation/helper'; import { reaction } from 'mobx'; -export default function commonReactions({ store, apolloClient }: ReactionsContext) { +export function common({ store, apolloClient }: ReactionsContext) { const { $calculation } = store; /**