hide fields | disable reactions

This commit is contained in:
Chika 2020-11-16 00:37:51 +03:00
parent 222e49e30c
commit 900277feba
10 changed files with 168 additions and 94 deletions

View File

@ -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,

View File

@ -38,6 +38,7 @@ const Calculation = () => {
mb="50px"
flexWrap={['wrap', 'wrap', 'wrap', 'nowrap']}
justifyContent="center"
minHeight="800px"
>
<Sections width={['100%', '100%', '100%', '700px', '900px', '1200px']} />
<Results width={['100%', '100%', '100%', '500px', '600px']} />

View File

@ -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;

View File

@ -375,6 +375,8 @@ const initialOptions: TEntityQuery[] = [
'evo_min_irr',
'evo_irr_plan',
'evo_ins_type',
'evo_min_period',
'evo_max_period',
],
relatedEntities: [
{

View File

@ -107,7 +107,7 @@ const propsMap: TEntities<{
},
evo_rate: {
name: 'evo_name',
value: 'evo_rateid',
value: 'evo_id',
},
};

View File

@ -1,6 +1,8 @@
import { TElementFilter } from 'core/types/Calculation/Store/filters';
import { TElements } from 'core/types/Calculation/Store/elements';
const initialFilters: TElements<TElementFilter> = {};
const initialFilters: TElements<TElementFilter> = {
radioGraphType: options => options.filter(x => x.value !== 100000003),
};
export default initialFilters;

View File

@ -8,6 +8,34 @@ const initialStatuses: TElements<Status> = {
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;

View File

@ -26,7 +26,7 @@ const initialValues: TValues<TValue> = {
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<TValue> = {
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;

View File

@ -114,7 +114,6 @@ export type ElementsNames =
| 'selectRate'
| 'selectUserSession'
| 'radioRequirementTelematic'
| 'cbxInsuranceDecentral'
| 'tbxMaxPriceChange'
| 'tbxImporterRewardPerc'
| 'tbxImporterRewardRub'

View File

@ -110,7 +110,6 @@ export type ValuesNames =
| 'rate'
| 'userSession'
| 'requirementTelematic'
| 'insuranceDecentral'
| 'maxPriceChange'
| 'importerRewardPerc'
| 'importerRewardRub'