merge release/dyn-1488_vin
This commit is contained in:
parent
e077e94538
commit
6f12b8b448
@ -186,6 +186,12 @@ export default function (this: ICalculationStore) {
|
||||
mileage = 0;
|
||||
}
|
||||
|
||||
let vin;
|
||||
|
||||
if (leaseObjectUsed === true) {
|
||||
vin = this.getValue('vin');
|
||||
}
|
||||
|
||||
const mileageSpecified = getSpecified(mileage);
|
||||
|
||||
let vehicleUsage = 0;
|
||||
@ -305,6 +311,7 @@ export default function (this: ICalculationStore) {
|
||||
risk,
|
||||
payType: '0',
|
||||
vehicle: {
|
||||
vin,
|
||||
maxAllowedMass,
|
||||
maxAllowedMassSpecified,
|
||||
mileage,
|
||||
|
||||
@ -200,7 +200,7 @@ const sections: ISection[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
elements: ['tbxMaxSpeed', 'tbxCountSeats', 'tbxMileage'],
|
||||
elements: ['tbxMaxSpeed', 'tbxCountSeats', 'tbxMileage', 'tbxVIN'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@ -136,6 +136,7 @@ export default {
|
||||
tbxMinPriceChange: InputNumber,
|
||||
selectImportProgram: Select,
|
||||
tbxAddEquipmentPrice: InputNumber,
|
||||
tbxVIN: Input,
|
||||
|
||||
/** Computed Elements */
|
||||
labelLeaseObjectRisk: Label,
|
||||
|
||||
@ -129,6 +129,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
|
||||
selectImportProgram: 'Программа от производителя',
|
||||
labelImportProgramSum: 'Скидка от производителя, руб., с НДС',
|
||||
tbxAddEquipmentPrice: 'Стоимость доп.оборудования',
|
||||
tbxVIN: 'VIN',
|
||||
|
||||
/** Result Elements */
|
||||
labelResultTotalGraphwithNDS: 'Итого по графику, с НДС',
|
||||
|
||||
@ -135,6 +135,7 @@ const elementsValues: Record<ElementsNames, ValuesNames> = {
|
||||
tbxMinPriceChange: 'minPriceChange',
|
||||
selectImportProgram: 'importProgram',
|
||||
tbxAddEquipmentPrice: 'addEquipmentPrice',
|
||||
tbxVIN: 'vin',
|
||||
|
||||
/** Result Elements */
|
||||
labelResultTotalGraphwithNDS: 'resultTotalGraphwithNDS',
|
||||
|
||||
@ -122,6 +122,7 @@ export type ElementsNames =
|
||||
| 'tbxLeaseObjectPriceWthtVAT'
|
||||
| 'tbxVATInLeaseObjectPrice'
|
||||
| 'tbxAddEquipmentPrice'
|
||||
| 'tbxVIN'
|
||||
/** Result Elements */
|
||||
| 'labelResultTotalGraphwithNDS'
|
||||
| 'labelResultPlPrice'
|
||||
|
||||
@ -338,4 +338,38 @@ export default function ($calculation: ICalculationStore) {
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
/** VIN */
|
||||
|
||||
const vinRegex = /^[A-HJ-NPR-Za-hj-npr-z0-9]+$/;
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
return $calculation.getValue('vin');
|
||||
},
|
||||
vin => {
|
||||
if ($calculation.getValue('leaseObjectCategory')) {
|
||||
$calculation.setValidation(
|
||||
'tbxVIN',
|
||||
vin.length === 17 && vinRegex.test(vin),
|
||||
);
|
||||
} else {
|
||||
$calculation.setValidation('tbxVIN', vinRegex.test(vin));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
reaction(
|
||||
() => {
|
||||
return $calculation.getValue('leaseObjectUsed');
|
||||
},
|
||||
leaseObjectUsed => {
|
||||
if (leaseObjectUsed) {
|
||||
$calculation.setStatus('tbxVIN', ElementStatus.Default);
|
||||
} else {
|
||||
$calculation.setValue('vin', undefined);
|
||||
$calculation.setStatus('tbxVIN', ElementStatus.Disabled);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -98,6 +98,7 @@ const mapKPtoValues: Partial<Record<keyof IQuote | string, ValuesNames>> = {
|
||||
evo_subsidy_summ: 'subsidySum',
|
||||
evo_program_import_subsidyid: 'importProgram',
|
||||
evo_equip_price: 'addEquipmentPrice',
|
||||
evo_vin: 'vin',
|
||||
};
|
||||
|
||||
export function getValuesFromKP(quote: IQuote) {
|
||||
|
||||
@ -633,6 +633,7 @@ const elementsToDisable: (InteractionElementsNames | TableNames)[] = [
|
||||
'tbxEngineHours',
|
||||
'selectImportProgram',
|
||||
'tbxAddEquipmentPrice',
|
||||
'tbxVIN',
|
||||
];
|
||||
|
||||
// Для recalc = true и первого платежа = 0
|
||||
|
||||
@ -139,4 +139,5 @@ fragment quoteFields on quote {
|
||||
evo_equip_price
|
||||
evo_accept_period
|
||||
evo_db_accept_registration
|
||||
evo_vin
|
||||
}
|
||||
|
||||
@ -104,6 +104,7 @@ export interface IOpportunity extends BaseEntity {
|
||||
}
|
||||
|
||||
export interface IQuote extends BaseEntity {
|
||||
evo_vin: string;
|
||||
evo_seasons_type?: number;
|
||||
evo_engine_hours?: number;
|
||||
evo_client_riskid?: string;
|
||||
|
||||
@ -118,6 +118,7 @@ export type ValuesNames =
|
||||
| 'subsidySum'
|
||||
| 'fuelCard'
|
||||
| 'minPriceChange'
|
||||
| 'vin'
|
||||
| 'resultTotalGraphwithNDS'
|
||||
| 'resultPlPrice'
|
||||
| 'resultPriceUpPr'
|
||||
|
||||
Reference in New Issue
Block a user