merge release/calc-15_calc-by-total-expected
This commit is contained in:
parent
b56ec8bfb3
commit
901211b061
@ -21,7 +21,12 @@ export const controlsList: IGroup[] = [
|
||||
title: 'Параметры расчета',
|
||||
blocks: [
|
||||
{
|
||||
elements: ['tbxIRR_Perc', 'labelIrrInfo'],
|
||||
elements: [
|
||||
'labelIrrInfo',
|
||||
'radioCalcType',
|
||||
'tbxIRR_Perc',
|
||||
'tbxTotalPayments',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@ -159,6 +159,8 @@ const elementsComponents: TElements<Component> = {
|
||||
labelResultBonusDopProd: Label,
|
||||
linkDownloadKp: Download,
|
||||
tbxMileage: InputNumber,
|
||||
radioCalcType: Radio,
|
||||
tbxTotalPayments: InputNumber,
|
||||
};
|
||||
|
||||
const tablesComponents: StoreTables<Component> = {
|
||||
|
||||
@ -334,6 +334,14 @@ const elementsProps: TElements<ElementProps> = {
|
||||
marginBottom: '8px',
|
||||
},
|
||||
},
|
||||
radioCalcType: {
|
||||
style: 'button',
|
||||
},
|
||||
tbxTotalPayments: {
|
||||
min: 0,
|
||||
step: 1000,
|
||||
precision: 2,
|
||||
},
|
||||
};
|
||||
|
||||
const resultElementsProps: TElements<ElementProps> = [
|
||||
|
||||
@ -123,6 +123,8 @@ const elementsTitles: TElements<string> = {
|
||||
selectUserSession: 'Загрузить сессию пользователя',
|
||||
labelIrrInfo: 'Диапазон IRR (Номинал)',
|
||||
tbxMileage: 'Пробег, км',
|
||||
radioCalcType: 'Расчет от',
|
||||
tbxTotalPayments: 'Сумма платежей',
|
||||
};
|
||||
|
||||
const resultsTitles: TElements<string> = {
|
||||
|
||||
@ -124,6 +124,8 @@ export const elementsValues: TElements<ValuesNames> = {
|
||||
selectTelematic: 'telematic',
|
||||
selectTracker: 'tracker',
|
||||
tbxMileage: 'mileage',
|
||||
radioCalcType: 'calcType',
|
||||
tbxTotalPayments: 'totalPayments',
|
||||
};
|
||||
|
||||
const resultElementsValues: TElements<ResultValuesNames> = {
|
||||
|
||||
@ -81,6 +81,7 @@ export default async () => {
|
||||
|
||||
results.showResultsTable(preparedData, res);
|
||||
results.showResults(preparedData, res);
|
||||
results.setResValues(res);
|
||||
|
||||
return Object.assign(preparedData, res);
|
||||
})
|
||||
|
||||
@ -93,10 +93,10 @@ export default ({
|
||||
};
|
||||
|
||||
preparedValues.calcDate = currentDate;
|
||||
preparedValues.calcType = 100000000;
|
||||
preparedValues.calcType = values.calcType;
|
||||
preparedValues.irrExpected = (values.IRR_Perc as number) / 100;
|
||||
preparedValues.npvniExpected = 0;
|
||||
preparedValues.totalExpected = 0;
|
||||
preparedValues.totalExpected = values.totalPayments;
|
||||
preparedValues.nmper = values.leasingPeriod;
|
||||
preparedValues.leasing0K =
|
||||
values.product === 'LEASING0'
|
||||
|
||||
@ -39,7 +39,7 @@ export default {
|
||||
);
|
||||
CalculationStore.setValue(
|
||||
'resultPriceUpPr',
|
||||
(res?.postValues?.priceUP_PR || 0) * 100,
|
||||
(res?.postValues?.priceUP_Year_PR || 0) * 100,
|
||||
);
|
||||
CalculationStore.setValue(
|
||||
'resultIRRGraphPerc',
|
||||
@ -124,4 +124,14 @@ export default {
|
||||
),
|
||||
);
|
||||
},
|
||||
setResValues: (res: IGetCalculationResponse) => {
|
||||
CalculationStore.setValue(
|
||||
'IRR_Perc',
|
||||
(res?.columns?.cashflowMsfoColumn?.nominal || 0) * 100,
|
||||
);
|
||||
CalculationStore.setValue(
|
||||
'totalPayments',
|
||||
res?.columns?.sumWithVatColumn?.values[0] || 0,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@ -54,6 +54,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
opportunity,
|
||||
recalcWithRevision,
|
||||
leaseObjectCount,
|
||||
calcType,
|
||||
} = calculationStore.values;
|
||||
|
||||
calculationStore.setStatus('selectQuote', ElementStatus.Disabled);
|
||||
@ -203,11 +204,11 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
}
|
||||
}
|
||||
|
||||
const evo_planpayments = quote.evo_graphs.sort(
|
||||
const evo_graph = quote.evo_graphs.sort(
|
||||
(a, b) => b.createdon - a.createdon,
|
||||
)[0].evo_planpayments;
|
||||
const payments = evo_planpayments
|
||||
.slice(1, evo_planpayments.length - 1)
|
||||
)[0];
|
||||
const payments = evo_graph.evo_planpayments
|
||||
.slice(1, evo_graph.evo_planpayments.length - 1)
|
||||
.map((evo_planpayment, i) => ({
|
||||
paymentRelation: {
|
||||
validation: undefined,
|
||||
@ -285,6 +286,8 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
}
|
||||
}
|
||||
|
||||
const { evo_sumpay_withnds } = evo_graph;
|
||||
|
||||
calculationStore.setValues({
|
||||
...initialValues,
|
||||
...newValues,
|
||||
@ -299,6 +302,8 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
clientRisk,
|
||||
regionRegistration,
|
||||
townRegistration,
|
||||
calcType,
|
||||
totalPayments: evo_sumpay_withnds,
|
||||
});
|
||||
|
||||
message.success({
|
||||
|
||||
@ -20,6 +20,7 @@ export default gql`
|
||||
evo_insurance_period
|
||||
evo_graphs {
|
||||
createdon
|
||||
evo_sumpay_withnds
|
||||
evo_planpayments {
|
||||
evo_payment_ratio
|
||||
}
|
||||
|
||||
@ -1667,6 +1667,31 @@ const reactionEffects: IReactionEffect[] = [
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
const { calcType } = calculationStore.values;
|
||||
return calcType;
|
||||
},
|
||||
effect: calcType => {
|
||||
switch (calcType) {
|
||||
default:
|
||||
case 100000000: {
|
||||
calculationStore.setStatus('tbxIRR_Perc', ElementStatus.Default);
|
||||
calculationStore.setStatus('tbxTotalPayments', ElementStatus.Disabled);
|
||||
break;
|
||||
}
|
||||
case 100000002: {
|
||||
calculationStore.setStatus('tbxIRR_Perc', ElementStatus.Disabled);
|
||||
calculationStore.setStatus('tbxTotalPayments', ElementStatus.Default);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
options: {
|
||||
fireImmediately: true,
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default reactionEffects;
|
||||
|
||||
@ -296,6 +296,16 @@ const initialOptions: TElements<IBaseOption[]> = {
|
||||
// value: 100000003,
|
||||
// },
|
||||
],
|
||||
radioCalcType: [
|
||||
{
|
||||
name: 'IRR',
|
||||
value: 100000000,
|
||||
},
|
||||
{
|
||||
name: 'Суммы',
|
||||
value: 100000002,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default initialOptions;
|
||||
|
||||
@ -79,5 +79,7 @@ const initialValues: TValues<TValue> = {
|
||||
disableChecks: false,
|
||||
insFranchise: 0,
|
||||
rate: 'BASE',
|
||||
calcType: 100000000,
|
||||
totalPayments: 0,
|
||||
};
|
||||
export default initialValues;
|
||||
|
||||
@ -133,7 +133,9 @@ export type ElementsNames =
|
||||
| 'selectTelematic'
|
||||
| 'selectTracker'
|
||||
| 'labelIrrInfo'
|
||||
| 'tbxMileage';
|
||||
| 'tbxMileage'
|
||||
| 'radioCalcType'
|
||||
| 'tbxTotalPayments';
|
||||
|
||||
export type LinkElementsNames = 'linkDownloadKp';
|
||||
|
||||
|
||||
@ -120,7 +120,9 @@ export type ValuesNames =
|
||||
| 'technicalCard'
|
||||
| 'telematic'
|
||||
| 'tracker'
|
||||
| 'mileage';
|
||||
| 'mileage'
|
||||
| 'calcType'
|
||||
| 'totalPayments';
|
||||
|
||||
export type ComputedValuesNames =
|
||||
| 'leadName'
|
||||
|
||||
@ -88,6 +88,7 @@ export interface IQuote {
|
||||
|
||||
interface IEvoGraph {
|
||||
createdon?: Date;
|
||||
evo_sumpay_withnds?: number;
|
||||
evo_planpayment?: IEvoPlanPayment[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user