merge release/dyn-1068_filter-types-leasing-obj

This commit is contained in:
Chika 2022-04-15 14:59:01 +03:00
parent 90be89dd50
commit a2e982df6e
2 changed files with 33 additions and 6 deletions

View File

@ -1142,10 +1142,28 @@ const reactionEffects: IReactionEffect[] = [
calculationStore => ({
expression: () => {
const { product, leasingPeriod, deliveryTime } = calculationStore.values;
return { product_evo_id: product, leasingPeriod, deliveryTime };
const {
product,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
} = calculationStore.values;
return {
product_evo_id: product,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
};
},
effect: ({ product_evo_id, leasingPeriod, deliveryTime }) => {
effect: ({
product_evo_id,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
}) => {
if (product_evo_id && leasingPeriod && deliveryTime) {
const product = calculationStore.getOption('selectProduct', {
evo_id: product_evo_id,
@ -1154,11 +1172,13 @@ const reactionEffects: IReactionEffect[] = [
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 &&
x.evo_delivery_time?.includes(deliveryTime),
x.evo_delivery_time?.includes(deliveryTime) &&
x.evo_min_first_payment <= firstPaymentPerc &&
x.evo_max_first_payment >= firstPaymentPerc &&
x.evo_min_last_payment <= lastPaymentPerc &&
x.evo_max_last_payment >= lastPaymentPerc,
);
calculationStore.setValue('tarif', tarif?.evo_tarifid);
}

View File

@ -172,6 +172,13 @@ query GetMainOptions(
evo_leasingobject_typeid
}
evo_delivery_time
evo_graphtype_exception
evo_seasons_type_exception
evo_min_decreasing_perc
evo_min_first_payment
evo_max_first_payment
evo_min_last_payment
evo_max_last_payment
}
selectRate: evo_rates(
statecode: $statecode