Merge branch 'development'
This commit is contained in:
commit
0ae5c774aa
@ -59,6 +59,18 @@ const tablePaymentsStatuses = (graphType, seasonType, leasingPeriod) => {
|
||||
}
|
||||
};
|
||||
|
||||
function getLeasingPeriod(recalcWithRevision: boolean, quote: IQuote) {
|
||||
return recalcWithRevision && quote.evo_period && quote.evo_accept_period
|
||||
? Math.min(quote.evo_period, quote.evo_accept_period)
|
||||
: quote.evo_period;
|
||||
}
|
||||
|
||||
function getObjectRegistration(recalcWithRevision: boolean, quote: IQuote) {
|
||||
return recalcWithRevision && quote.evo_db_accept_registration
|
||||
? quote.evo_db_accept_registration
|
||||
: quote.evo_object_registration;
|
||||
}
|
||||
|
||||
const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
expression: () => {
|
||||
const { quote } = calculationStore.values;
|
||||
@ -244,6 +256,8 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
|
||||
// fill payments table
|
||||
let evo_graph: IEvoGraph = {};
|
||||
const leasingPeriod = getLeasingPeriod(recalcWithRevision, quote);
|
||||
|
||||
if (quote.evo_graphs) {
|
||||
evo_graph = quote.evo_graphs.sort(
|
||||
//@ts-ignore
|
||||
@ -253,10 +267,12 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
const statuses = tablePaymentsStatuses(
|
||||
quote.evo_graph_type,
|
||||
quote.evo_seasons_type,
|
||||
quote.evo_period,
|
||||
leasingPeriod,
|
||||
);
|
||||
const payments = evo_graph.evo_planpayments
|
||||
.slice(1, evo_graph.evo_planpayments.length - 1)
|
||||
//@ts-ignore
|
||||
.slice(0, leasingPeriod - 2)
|
||||
.map((evo_planpayment, i) => ({
|
||||
paymentRelation: {
|
||||
validation: undefined,
|
||||
@ -378,6 +394,11 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
let regionRegistration;
|
||||
let legalClientTown;
|
||||
let townRegistration;
|
||||
const objectRegistration = getObjectRegistration(
|
||||
recalcWithRevision,
|
||||
quote,
|
||||
);
|
||||
|
||||
{
|
||||
const lead = calculationStore.getOption('selectLead');
|
||||
const opportunity = calculationStore.getOption('selectOpportunity');
|
||||
@ -411,7 +432,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
// legalClientRegion
|
||||
|
||||
// regionRegistration
|
||||
if (quote.evo_object_registration === 100000001) {
|
||||
if (objectRegistration === 100000001) {
|
||||
regionRegistration = quote.evo_regionid;
|
||||
calculationStore.setFilter('selectRegionRegistration', regions =>
|
||||
regions.filter(x => x.evo_businessunit_evolution === true),
|
||||
@ -491,7 +512,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
// legalClientTown
|
||||
|
||||
//townRegistration
|
||||
if (quote.evo_object_registration === 100000001) {
|
||||
if (objectRegistration === 100000001) {
|
||||
if (
|
||||
(
|
||||
secondaryOptions?.selectTownRegistration as IEvoTown[]
|
||||
@ -578,6 +599,8 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
redemptionPaymentSum,
|
||||
...agentsValues,
|
||||
engineHours,
|
||||
leasingPeriod,
|
||||
objectRegistration,
|
||||
};
|
||||
|
||||
// check min max number values
|
||||
|
||||
@ -23,7 +23,7 @@ const mapKPtoValues: Partial<Record<keyof IQuote | string, ValuesNames>> = {
|
||||
evo_comission_perc: 'comissionPerc',
|
||||
evo_comission_rub: 'comissionRub',
|
||||
evo_sale_bonus: 'saleBonus',
|
||||
evo_period: 'leasingPeriod',
|
||||
// evo_period: 'leasingPeriod',
|
||||
evo_tarifid: 'tarif',
|
||||
// evo_rate: 'creditRate',
|
||||
evo_msfo_irr: 'IRR_Perc',
|
||||
@ -88,7 +88,7 @@ const mapKPtoValues: Partial<Record<keyof IQuote | string, ValuesNames>> = {
|
||||
// evo_req_telematic_accept: 'requirementTelematic',
|
||||
evo_mileage: 'mileage',
|
||||
evo_price_without_discount_quote: 'fullPriceWithDiscount',
|
||||
evo_object_registration: 'objectRegistration',
|
||||
// evo_object_registration: 'objectRegistration',
|
||||
evo_registration_regionid: 'objectRegionRegistration',
|
||||
// evo_vehicle_tax_approved: vehicleTaxInYear,
|
||||
evo_category_tr: 'objectCategoryTax',
|
||||
|
||||
@ -12,7 +12,7 @@ const initialFilters: Partial<Record<ElementsNames, TElementFilter>> = {
|
||||
|
||||
export const noResetValueElements: ElementsNames[] = [
|
||||
'selectTechnicalCard',
|
||||
'selectTownRegistration',
|
||||
// 'selectTownRegistration',
|
||||
];
|
||||
export const autoSetValuesElements: ElementsNames[] = [
|
||||
'selectProduct',
|
||||
|
||||
@ -137,4 +137,6 @@ fragment quoteFields on quote {
|
||||
evo_engine_hours
|
||||
evo_program_import_subsidyid
|
||||
evo_equip_price
|
||||
evo_accept_period
|
||||
evo_db_accept_registration
|
||||
}
|
||||
|
||||
@ -180,6 +180,8 @@ export interface IQuote extends BaseEntity {
|
||||
}[];
|
||||
evo_program_import_subsidyid?: string;
|
||||
evo_equip_price?: number;
|
||||
evo_accept_period?: number;
|
||||
evo_db_accept_registration?: number;
|
||||
}
|
||||
|
||||
export interface IEvoGraph extends BaseEntity {
|
||||
|
||||
Reference in New Issue
Block a user