From 900277feba74ac03ba87e8a128d011249b920c9a Mon Sep 17 00:00:00 2001 From: Chika Date: Mon, 16 Nov 2020 00:37:51 +0300 Subject: [PATCH] hide fields | disable reactions --- .../Calculation/Sections/sectionsList.ts | 146 +++++++++--------- src/client/Containers/Calculation/index.jsx | 1 + .../CalculationStore/Effects/reaction.ts | 69 +++++++-- src/core/Data/initialOptions.ts | 2 + src/core/Data/propsMap.ts | 2 +- src/core/config/initialFilters.ts | 4 +- src/core/config/initialStatuses.ts | 28 ++++ src/core/config/initialValues.ts | 8 +- src/core/types/Calculation/Store/elements.ts | 1 - src/core/types/Calculation/Store/values.ts | 1 - 10 files changed, 168 insertions(+), 94 deletions(-) diff --git a/src/client/Containers/Calculation/Sections/sectionsList.ts b/src/client/Containers/Calculation/Sections/sectionsList.ts index 1c94668..5c51405 100644 --- a/src/client/Containers/Calculation/Sections/sectionsList.ts +++ b/src/client/Containers/Calculation/Sections/sectionsList.ts @@ -67,18 +67,18 @@ const sections: ISection[] = [ }, ], }, - { - elements: [ - { - title: 'Пересчет без пересмотра', - Component: Switch, - props: { - name: 'cbxRecalcWithRevision', - valueName: 'recalcWithRevision', - }, - }, - ], - }, + // { + // elements: [ + // { + // title: 'Пересчет без пересмотра', + // Component: Switch, + // props: { + // name: 'cbxRecalcWithRevision', + // valueName: 'recalcWithRevision', + // }, + // }, + // ], + // }, ], }, @@ -483,25 +483,25 @@ const sections: ISection[] = [ valueName: 'parmentsDecreasePercent', }, }, - { - title: 'Тип сезонности', - Component: Radio, - props: { - name: 'radioSeasonType', - valueName: 'seasonType', - withSearch: false, - style: 'button', - }, - }, - { - title: 'С какого платежа начинается высокий сезон', - Component: Select, - props: { - name: 'selectHighSeasonStart', - valueName: 'highSeasonStart', - withSearch: false, - }, - }, + // { + // title: 'Тип сезонности', + // Component: Radio, + // props: { + // name: 'radioSeasonType', + // valueName: 'seasonType', + // withSearch: false, + // style: 'button', + // }, + // }, + // { + // title: 'С какого платежа начинается высокий сезон', + // Component: Select, + // props: { + // name: 'selectHighSeasonStart', + // valueName: 'highSeasonStart', + // withSearch: false, + // }, + // }, ], layout: { newLine: true, @@ -547,8 +547,8 @@ const sections: ISection[] = [ Component: InputNumber, props: { min: '0.00', - max: '100.00', - step: '1.00', + max: '1.30', + step: '0.1', name: 'tbxSaleBonus', valueName: 'saleBonus', }, @@ -1156,14 +1156,14 @@ const sections: ISection[] = [ blocks: [ { elements: [ - { - title: 'Децентрализованное страхование', - Component: Switch, - props: { - name: 'cbxInsDecentral', - valueName: 'insDecentral', - }, - }, + // { + // title: 'Децентрализованное страхование', + // Component: Switch, + // props: { + // name: 'cbxInsDecentral', + // valueName: 'insDecentral', + // }, + // }, { title: 'Тип страхования КАСКО', Component: Radio, @@ -1560,34 +1560,34 @@ const sections: ISection[] = [ { title: 'Без ограничений', groups: [ + // { + // blocks: [ + // { + // elements: [ + // { + // title: 'Загрузить сессию пользователя', + // Component: Select, + // props: { + // name: 'selectUserSession', + // valueName: 'userSession', + // }, + // }, + // ], + // }, + // ], + // }, { blocks: [ { elements: [ - { - title: 'Загрузить сессию пользователя', - Component: Select, - props: { - name: 'selectUserSession', - valueName: 'userSession', - }, - }, - ], - }, - ], - }, - { - blocks: [ - { - elements: [ - { - title: 'Отключить все проверки', - Component: Switch, - props: { - name: 'cbxDisableChecks', - valueName: 'disableChecks', - }, - }, + // { + // title: 'Отключить все проверки', + // Component: Switch, + // props: { + // name: 'cbxDisableChecks', + // valueName: 'disableChecks', + // }, + // }, { title: 'Тариф', Component: Select, @@ -1628,14 +1628,14 @@ const sections: ISection[] = [ }, { elements: [ - { - title: 'Децентрализованное страхование', - Component: Switch, - props: { - name: 'cbxInsuranceDecentral', - valueName: 'insuranceDecentral', - }, - }, + // { + // title: 'Децентрализованное страхование', + // Component: Switch, + // props: { + // name: 'cbxInsDecentral', + // valueName: 'insDecentral', + // }, + // }, { title: 'Макс.возможное изменение стоимости ПЛ', Component: InputNumber, diff --git a/src/client/Containers/Calculation/index.jsx b/src/client/Containers/Calculation/index.jsx index 7602534..33c7494 100644 --- a/src/client/Containers/Calculation/index.jsx +++ b/src/client/Containers/Calculation/index.jsx @@ -38,6 +38,7 @@ const Calculation = () => { mb="50px" flexWrap={['wrap', 'wrap', 'wrap', 'nowrap']} justifyContent="center" + minHeight="800px" > diff --git a/src/client/stores/CalculationStore/Effects/reaction.ts b/src/client/stores/CalculationStore/Effects/reaction.ts index ad12522..f470015 100644 --- a/src/client/stores/CalculationStore/Effects/reaction.ts +++ b/src/client/stores/CalculationStore/Effects/reaction.ts @@ -223,19 +223,19 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ - expression: () => { - const { options } = calculationStore; - return options.selectQuote; - }, - effect: quotes => { - if (quotes.length > 0) { - calculationStore.setStatus('tbxQuoteName', Status.Disabled); - } else { - calculationStore.setStatus('tbxQuoteName', Status.Default); - } - }, - }), + // calculationStore => ({ + // expression: () => { + // const { options } = calculationStore; + // return options.selectQuote; + // }, + // effect: quotes => { + // if (quotes.length > 0) { + // calculationStore.setStatus('tbxQuoteName', Status.Disabled); + // } else { + // calculationStore.setStatus('tbxQuoteName', Status.Default); + // } + // }, + // }), calculationStore => ({ expression: () => { @@ -3068,6 +3068,49 @@ const reactionEffects: IReactionEffect[] = [ }, options: { fireImmediately: true }, }), + calculationStore => ({ + expression: () => { + const { product, leasingPeriod } = calculationStore.values; + return { product_evo_id: product, leasingPeriod }; + }, + effect: ({ product_evo_id, leasingPeriod }) => { + if (product_evo_id && leasingPeriod) { + const product = calculationStore.options.selectProduct?.find( + x => x.evo_id === product_evo_id, + ); + + if (product) { + const tarif = calculationStore.options.selectTarif?.find( + x => + x.evo_baseproductid === product.evo_baseproductid && + x.evo_min_period && + x.evo_min_period <= leasingPeriod && + x.evo_max_period && + x.evo_max_period >= leasingPeriod, + ); + calculationStore.setValue('tarif', tarif?.evo_tarifid); + } + } else { + calculationStore.setValue('tarif', null); + } + }, + }), + + calculationStore => ({ + expression: () => { + const { tarif } = calculationStore.values; + return tarif; + }, + effect: tarif_evo_id => { + const tarif = calculationStore.options.selectTarif?.find( + x => x.evo_tarifid === tarif_evo_id, + ); + + if (tarif) { + calculationStore.setValue('IRR_Perc', tarif.evo_irr); + } + }, + }), ]; export default reactionEffects; diff --git a/src/core/Data/initialOptions.ts b/src/core/Data/initialOptions.ts index 29b67dd..0127ec6 100644 --- a/src/core/Data/initialOptions.ts +++ b/src/core/Data/initialOptions.ts @@ -375,6 +375,8 @@ const initialOptions: TEntityQuery[] = [ 'evo_min_irr', 'evo_irr_plan', 'evo_ins_type', + 'evo_min_period', + 'evo_max_period', ], relatedEntities: [ { diff --git a/src/core/Data/propsMap.ts b/src/core/Data/propsMap.ts index 90daf3f..b7d96fe 100644 --- a/src/core/Data/propsMap.ts +++ b/src/core/Data/propsMap.ts @@ -107,7 +107,7 @@ const propsMap: TEntities<{ }, evo_rate: { name: 'evo_name', - value: 'evo_rateid', + value: 'evo_id', }, }; diff --git a/src/core/config/initialFilters.ts b/src/core/config/initialFilters.ts index 6b7dc45..f461ea4 100644 --- a/src/core/config/initialFilters.ts +++ b/src/core/config/initialFilters.ts @@ -1,6 +1,8 @@ import { TElementFilter } from 'core/types/Calculation/Store/filters'; import { TElements } from 'core/types/Calculation/Store/elements'; -const initialFilters: TElements = {}; +const initialFilters: TElements = { + radioGraphType: options => options.filter(x => x.value !== 100000003), +}; export default initialFilters; diff --git a/src/core/config/initialStatuses.ts b/src/core/config/initialStatuses.ts index b3dcf5e..69acc66 100644 --- a/src/core/config/initialStatuses.ts +++ b/src/core/config/initialStatuses.ts @@ -8,6 +8,34 @@ const initialStatuses: TElements = { selectDoubleAgent: Status.Disabled, selectCalcDoubleAgent: Status.Disabled, tbxInsKaskoPriceLeasePeriod: Status.Disabled, + selectClientType: Status.Disabled, + selectTelematic: Status.Disabled, + radioRequirementTelematic: Status.Disabled, + selectTechnicalCard: Status.Disabled, + tbxImporterRewardRub: Status.Disabled, + tbxImporterRewardPerc: Status.Disabled, + tbxMaxPriceChange: Status.Disabled, + cbxInsDecentral: Status.Disabled, + tbxCreditRate: Status.Disabled, + selectRate: Status.Disabled, + selectTarif: Status.Disabled, + + selectChannel: Status.Disabled, + tbxNewClient: Status.Disabled, + selectAccount: Status.Disabled, + tbxINN: Status.Disabled, + tbxKPP: Status.Disabled, + selectContactClient: Status.Disabled, + tbxContact: Status.Disabled, + radioContactGender: Status.Disabled, + tbxPhoneNumber: Status.Disabled, + tbxEmailAddress: Status.Disabled, + selectSupplier: Status.Disabled, + selectFinDepartment: Status.Disabled, + selectBroker: Status.Disabled, + selectAgent: Status.Disabled, + tbxCommentLead: Status.Disabled, + btnCreateLead: Status.Disabled, }; export default initialStatuses; diff --git a/src/core/config/initialValues.ts b/src/core/config/initialValues.ts index dedbe33..7c70b10 100644 --- a/src/core/config/initialValues.ts +++ b/src/core/config/initialValues.ts @@ -26,7 +26,7 @@ const initialValues: TValues = { highSeasonStart: 100000000, comissionPerc: 0, comissionRub: 0, - saleBonus: 1.1, + saleBonus: 1.25, IRR_Perc: 20, brand: null, model: null, @@ -71,13 +71,13 @@ const initialValues: TValues = { NSIB: true, quoteContactGender: 100000000, quoteRedemptionGraph: true, - creditRate: 0, - requirementTelematic: 100000001, - insuranceDecentral: false, + creditRate: 7, + requirementTelematic: 100000000, maxPriceChange: 0, importerRewardPerc: 0, importerRewardRub: 0, disableChecks: false, insFranchise: 0, + rate: 'BASE', }; export default initialValues; diff --git a/src/core/types/Calculation/Store/elements.ts b/src/core/types/Calculation/Store/elements.ts index ed3d469..3392176 100644 --- a/src/core/types/Calculation/Store/elements.ts +++ b/src/core/types/Calculation/Store/elements.ts @@ -114,7 +114,6 @@ export type ElementsNames = | 'selectRate' | 'selectUserSession' | 'radioRequirementTelematic' - | 'cbxInsuranceDecentral' | 'tbxMaxPriceChange' | 'tbxImporterRewardPerc' | 'tbxImporterRewardRub' diff --git a/src/core/types/Calculation/Store/values.ts b/src/core/types/Calculation/Store/values.ts index 195fa62..38059ce 100644 --- a/src/core/types/Calculation/Store/values.ts +++ b/src/core/types/Calculation/Store/values.ts @@ -110,7 +110,6 @@ export type ValuesNames = | 'rate' | 'userSession' | 'requirementTelematic' - | 'insuranceDecentral' | 'maxPriceChange' | 'importerRewardPerc' | 'importerRewardRub'