merge release/dyn-2121_supplier-financing
This commit is contained in:
parent
027599ec09
commit
db6fa97be9
@ -35,6 +35,7 @@ const sections: ISection[] = [
|
||||
blocks: [
|
||||
{ elements: ['tbxFirstPaymentPerc'] },
|
||||
{ elements: ['tbxFirstPaymentRub'] },
|
||||
{ elements: ['cbxSupplierFinancing'] },
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
@ -137,6 +137,7 @@ export default {
|
||||
selectImportProgram: Select,
|
||||
tbxAddEquipmentPrice: InputNumber,
|
||||
tbxVIN: Input,
|
||||
cbxSupplierFinancing: Switch,
|
||||
|
||||
/** Computed Elements */
|
||||
labelLeaseObjectRisk: Label,
|
||||
|
||||
@ -131,6 +131,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
|
||||
tbxAddEquipmentPrice: 'Стоимость доп.оборудования',
|
||||
tbxVIN: 'VIN',
|
||||
selectLeasingWithoutKasko: 'Лизинг без КАСКО',
|
||||
cbxSupplierFinancing: 'Финансирование поставщика',
|
||||
|
||||
/** Result Elements */
|
||||
labelResultTotalGraphwithNDS: 'Итого по графику, с НДС',
|
||||
|
||||
@ -137,6 +137,7 @@ const elementsValues: Record<ElementsNames, ValuesNames> = {
|
||||
tbxAddEquipmentPrice: 'addEquipmentPrice',
|
||||
tbxVIN: 'vin',
|
||||
selectLeasingWithoutKasko: 'leasingWithoutKasko',
|
||||
cbxSupplierFinancing: 'supplierFinancing',
|
||||
|
||||
/** Result Elements */
|
||||
labelResultTotalGraphwithNDS: 'resultTotalGraphwithNDS',
|
||||
|
||||
@ -124,6 +124,7 @@ export type ElementsNames =
|
||||
| 'tbxAddEquipmentPrice'
|
||||
| 'tbxVIN'
|
||||
| 'selectLeasingWithoutKasko'
|
||||
| 'cbxSupplierFinancing'
|
||||
/** Result Elements */
|
||||
| 'labelResultTotalGraphwithNDS'
|
||||
| 'labelResultPlPrice'
|
||||
|
||||
@ -81,11 +81,20 @@ export default function ($calculation: ICalculationStore) {
|
||||
dealer,
|
||||
dealer =>
|
||||
//@ts-ignore
|
||||
!importProgram?.accounts?.length ||
|
||||
(!importProgram?.accounts?.length ||
|
||||
importProgram.accounts.filter(
|
||||
//@ts-ignore
|
||||
x => x.accountid === dealer.accountid,
|
||||
)?.length,
|
||||
)?.length) &&
|
||||
dealer,
|
||||
dealer => {
|
||||
if (product?.evo_supplier_financing_accept) {
|
||||
//@ts-ignore
|
||||
return dealer.evo_supplier_financing_accept;
|
||||
} else {
|
||||
return dealer;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -101,11 +110,20 @@ export default function ($calculation: ICalculationStore) {
|
||||
dealerPerson,
|
||||
dealerPerson =>
|
||||
//@ts-ignore
|
||||
!importProgram?.accounts?.length ||
|
||||
(!importProgram?.accounts?.length ||
|
||||
importProgram.accounts.filter(
|
||||
//@ts-ignore
|
||||
x => x.accountid === dealerPerson.accountid,
|
||||
)?.length,
|
||||
)?.length) &&
|
||||
dealerPerson,
|
||||
dealerPerson => {
|
||||
if (product?.evo_supplier_financing_accept) {
|
||||
//@ts-ignore
|
||||
return dealerPerson.evo_supplier_financing_accept;
|
||||
} else {
|
||||
return dealerPerson;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -290,7 +290,7 @@ export default function ($calculation: ICalculationStore) {
|
||||
*/
|
||||
reaction(
|
||||
() => {
|
||||
const { leaseObjectUsed } = $calculation.values;
|
||||
const { leaseObjectUsed, supplierFinancing } = $calculation.values;
|
||||
const sudsidy = $calculation.getOption('selectSubsidy');
|
||||
const product = $calculation.getOption('selectProduct');
|
||||
const dealer = $calculation.getOption('selectDealer');
|
||||
@ -300,17 +300,27 @@ export default function ($calculation: ICalculationStore) {
|
||||
sudsidy,
|
||||
product,
|
||||
dealer,
|
||||
supplierFinancing,
|
||||
};
|
||||
},
|
||||
({ leaseObjectUsed, sudsidy, product, dealer }) => {
|
||||
({ leaseObjectUsed, sudsidy, product, dealer, supplierFinancing }) => {
|
||||
const evo_delivery_time = sudsidy?.evo_delivery_time?.filter(x => x > 0);
|
||||
if (
|
||||
leaseObjectUsed ||
|
||||
sudsidy ||
|
||||
(evo_delivery_time?.length === 1 &&
|
||||
evo_delivery_time.includes(100_000_000)) ||
|
||||
product?.evo_sale_without_nds ||
|
||||
dealer?.evo_return_leasing_dealer
|
||||
) {
|
||||
$calculation.setValue('deliveryTime', 100_000_000);
|
||||
$calculation.setStatus('radioDeliveryTime', ElementStatus.Disabled);
|
||||
} else if (
|
||||
(evo_delivery_time?.length === 1 &&
|
||||
evo_delivery_time.includes(100_000_001)) ||
|
||||
supplierFinancing
|
||||
) {
|
||||
$calculation.setValue('deliveryTime', 100_000_001);
|
||||
$calculation.setStatus('radioDeliveryTime', ElementStatus.Disabled);
|
||||
} else {
|
||||
$calculation.setStatus('radioDeliveryTime', ElementStatus.Default);
|
||||
}
|
||||
@ -325,20 +335,32 @@ export default function ($calculation: ICalculationStore) {
|
||||
if (subsidy) {
|
||||
$calculation.setValues({
|
||||
leaseObjectCount: 1,
|
||||
leaseObjectUsed: false,
|
||||
});
|
||||
$calculation.setStatus('tbxLeaseObjectCount', ElementStatus.Disabled);
|
||||
} else {
|
||||
$calculation.setStatus('tbxLeaseObjectCount', ElementStatus.Default);
|
||||
}
|
||||
$calculation.setStatuses({
|
||||
tbxLeaseObjectCount: subsidy
|
||||
? ElementStatus.Disabled
|
||||
: ElementStatus.Default,
|
||||
cbxLeaseObjectUsed: subsidy
|
||||
? ElementStatus.Disabled
|
||||
: ElementStatus.Default,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
return [
|
||||
$calculation.getOption('selectSubsidy'),
|
||||
$calculation.getValue('supplierFinancing'),
|
||||
];
|
||||
},
|
||||
([subsidy, supplierFinancing]) => {
|
||||
if (subsidy || supplierFinancing) {
|
||||
$calculation.setValues({
|
||||
leaseObjectUsed: false,
|
||||
});
|
||||
$calculation.setStatus('cbxLeaseObjectUsed', ElementStatus.Disabled);
|
||||
} else {
|
||||
$calculation.setStatus('cbxLeaseObjectUsed', ElementStatus.Default);
|
||||
}
|
||||
},
|
||||
);
|
||||
/** VIN */
|
||||
|
||||
const vinRegex = /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/;
|
||||
|
||||
@ -140,6 +140,7 @@ export default function (this: ICalculationStore): PreparedData {
|
||||
preparedValues.transIncludeGr = values.vehicleTaxInYear > 0;
|
||||
preparedValues.transportTaxGrYear = values.vehicleTaxInYear;
|
||||
preparedValues.transportTaxGr = values.vehicleTaxInLeasingPeriod;
|
||||
preparedValues.supplierFinancing = values.supplierFinancing;
|
||||
|
||||
const insuranceKaskoRow = tables.tableInsurance.rows.find(
|
||||
x => x?.key === 'kasko',
|
||||
|
||||
@ -24,10 +24,16 @@ const v = {
|
||||
const gibddReactions: IReactionEffect[] = [
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
return calculationStore.getOption('selectLeaseObjectType');
|
||||
return [
|
||||
calculationStore.getOption('selectLeaseObjectType'),
|
||||
calculationStore.getValue('supplierFinancing'),
|
||||
];
|
||||
},
|
||||
effect: leaseObjectType => {
|
||||
if (['6', '9', '10', '11'].includes(leaseObjectType.evo_id)) {
|
||||
effect: ([leaseObjectType, supplierFinancing]) => {
|
||||
if (
|
||||
['6', '9', '10', '11'].includes(leaseObjectType?.evo_id) ||
|
||||
supplierFinancing
|
||||
) {
|
||||
calculationStore.setStatus(
|
||||
'radioObjectRegistration',
|
||||
ElementStatus.Disabled,
|
||||
|
||||
@ -4,7 +4,7 @@ import { resetIns } from 'client/Containers/Calculation/Components/ELT/lib/reset
|
||||
import { numberElementsProps } from 'client/Containers/Calculation/Elements/props/common';
|
||||
import {
|
||||
getTitle,
|
||||
getValueName
|
||||
getValueName,
|
||||
} from 'client/Containers/Calculation/Elements/tools';
|
||||
import { ElementsNames } from 'client/Containers/Calculation/types/elements';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
@ -14,7 +14,7 @@ import {
|
||||
mainOptionsForQuoteQuery,
|
||||
quoteQuery,
|
||||
secondaryOptionsForQuoteQuery,
|
||||
singleOptionsForQuoteQuery
|
||||
singleOptionsForQuoteQuery,
|
||||
} from 'core/services/CrmService/graphql/query/quote';
|
||||
import { TOptionizedEntity } from 'core/services/CrmService/types/common';
|
||||
import {
|
||||
@ -23,7 +23,7 @@ import {
|
||||
IEvoGraph,
|
||||
IEvoRewardCondition,
|
||||
IEvoTown,
|
||||
IQuote
|
||||
IQuote,
|
||||
} from 'core/services/CrmService/types/entities';
|
||||
import { currentISODate } from 'core/tools/date';
|
||||
import { NIL } from 'core/tools/uuid';
|
||||
@ -318,6 +318,7 @@ const loadKpReaction: IReactionEffect = calculationStore => ({
|
||||
evo_kpp
|
||||
evo_inn
|
||||
evo_supplier_type
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
||||
@ -99,6 +99,7 @@ const mapKPtoValues: Partial<Record<keyof IQuote | string, ValuesNames>> = {
|
||||
evo_program_import_subsidyid: 'importProgram',
|
||||
evo_equip_price: 'addEquipmentPrice',
|
||||
evo_vin: 'vin',
|
||||
evo_supplier_financing: 'supplierFinancing',
|
||||
};
|
||||
|
||||
export function getValuesFromKP(quote: IQuote) {
|
||||
|
||||
@ -1333,6 +1333,35 @@ const reactionEffects: IReactionEffect[] = [
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
calculationStore => ({
|
||||
expression: () => {
|
||||
return {
|
||||
selectProduct: calculationStore.getOption('selectProduct'),
|
||||
selectDealerPerson: calculationStore.getOption('selectDealerPerson'),
|
||||
};
|
||||
},
|
||||
effect: ({ selectProduct, selectDealerPerson }) => {
|
||||
if (
|
||||
selectProduct?.evo_supplier_financing_accept &&
|
||||
selectDealerPerson?.evo_supplier_financing_accept
|
||||
) {
|
||||
calculationStore.setStatus(
|
||||
'cbxSupplierFinancing',
|
||||
ElementStatus.Default,
|
||||
);
|
||||
} else {
|
||||
calculationStore.setStatus(
|
||||
'cbxSupplierFinancing',
|
||||
ElementStatus.Disabled,
|
||||
);
|
||||
calculationStore.setValue('supplierFinancing', false);
|
||||
}
|
||||
},
|
||||
options: {
|
||||
fireImmediately: true,
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export default reactionEffects;
|
||||
|
||||
@ -465,6 +465,7 @@ export default [
|
||||
evo_broker_accountid
|
||||
evo_kpp
|
||||
evo_inn
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
}
|
||||
`,
|
||||
@ -478,10 +479,13 @@ export default [
|
||||
'selectDealerPerson',
|
||||
salon_providers,
|
||||
);
|
||||
|
||||
if (!dealer.evo_supplier_financing_accept)
|
||||
calculationStore.setValue(
|
||||
'dealerPerson',
|
||||
salon_providers[0].accountid,
|
||||
);
|
||||
|
||||
calculationStore.setStatus(
|
||||
'selectDealerPerson',
|
||||
ElementStatus.Default,
|
||||
|
||||
@ -28,6 +28,7 @@ const initialStatuses: Partial<
|
||||
tbxRedemptionPaymentSum: ElementStatus.Disabled,
|
||||
|
||||
tbxLeaseObjectPriceWthtVAT: ElementStatus.Disabled,
|
||||
cbxSupplierFinancing: ElementStatus.Disabled,
|
||||
};
|
||||
|
||||
export default initialStatuses;
|
||||
|
||||
@ -95,5 +95,6 @@ const initialValues: Partial<Record<ValuesNames, any>> = {
|
||||
infuranceOPF: null,
|
||||
addEquipmentPrice: 0,
|
||||
leasingWithoutKasko: null,
|
||||
supplierFinancing: false,
|
||||
};
|
||||
export default initialValues;
|
||||
|
||||
@ -118,6 +118,7 @@ export interface PreparedValues {
|
||||
regionalDirectorBonusFix?: number;
|
||||
profitExpected?: number;
|
||||
bonusCoefficient?: number;
|
||||
supplierFinancing?: boolean;
|
||||
}
|
||||
|
||||
export interface PaymentRow {
|
||||
|
||||
@ -36,6 +36,7 @@ query GetMainOptions(
|
||||
name
|
||||
accountid
|
||||
evo_return_leasing_dealer
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
selectGPSBrand: evo_gps_brands(statecode: $statecode) {
|
||||
evo_name
|
||||
@ -86,6 +87,7 @@ query GetMainOptions(
|
||||
evo_name
|
||||
evo_baseproductid
|
||||
}
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
selectRegistration: evo_addproduct_types(
|
||||
statecode: $statecode
|
||||
@ -259,6 +261,7 @@ query GetMainOptions(
|
||||
accountid
|
||||
}
|
||||
evo_subsidy_type
|
||||
evo_delivery_time
|
||||
}
|
||||
selectFuelCard: evo_addproduct_types(
|
||||
statecode: $statecode
|
||||
|
||||
@ -143,4 +143,5 @@ fragment quoteFields on quote {
|
||||
evo_accept_period
|
||||
evo_db_accept_registration
|
||||
evo_vin
|
||||
evo_supplier_financing
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ query GetMainOptionsForKP(
|
||||
evo_kpp
|
||||
evo_inn
|
||||
evo_supplier_type
|
||||
evo_supplier_financing_accept
|
||||
}
|
||||
selectDealerRewardCondition: evo_reward_conditions(
|
||||
evo_agent_accountid: $dealer_person_accountid
|
||||
|
||||
@ -222,6 +222,7 @@ export interface IEvoBaseproduct extends BaseEntity {
|
||||
evo_cut_irr_with_bonus?: boolean;
|
||||
evo_calculation_method?: number[];
|
||||
evo_baseproducts?: IEvoBaseproduct[];
|
||||
evo_supplier_financing_accept?: boolean;
|
||||
}
|
||||
|
||||
export interface IEvoLeasingObjectType extends BaseEntity {
|
||||
@ -499,6 +500,7 @@ export interface IEvoSubsidy extends BaseEntity {
|
||||
evo_models?: IEvoModel[];
|
||||
accounts?: IAccount[];
|
||||
evo_subsidy_type?: number;
|
||||
evo_delivery_time?: number[];
|
||||
}
|
||||
|
||||
export type CRMEntity = IAccount &
|
||||
|
||||
@ -144,7 +144,8 @@ export type ValuesNames =
|
||||
| 'engineHours'
|
||||
| 'importProgram'
|
||||
| 'addEquipmentPrice'
|
||||
| 'bonusCoefficient';
|
||||
| 'bonusCoefficient'
|
||||
| 'supplierFinancing';
|
||||
|
||||
export type ComputedValuesNames =
|
||||
| 'leaseObjectRiskName'
|
||||
|
||||
Reference in New Issue
Block a user