merge release/dyn-1488_vin

This commit is contained in:
Chika 2022-09-05 13:53:18 +03:00
parent e077e94538
commit 6f12b8b448
12 changed files with 51 additions and 1 deletions

View File

@ -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,

View File

@ -200,7 +200,7 @@ const sections: ISection[] = [
],
},
{
elements: ['tbxMaxSpeed', 'tbxCountSeats', 'tbxMileage'],
elements: ['tbxMaxSpeed', 'tbxCountSeats', 'tbxMileage', 'tbxVIN'],
},
],
},

View File

@ -136,6 +136,7 @@ export default {
tbxMinPriceChange: InputNumber,
selectImportProgram: Select,
tbxAddEquipmentPrice: InputNumber,
tbxVIN: Input,
/** Computed Elements */
labelLeaseObjectRisk: Label,

View File

@ -129,6 +129,7 @@ export const elementsTitles: Partial<Record<AllElementsNames, string>> = {
selectImportProgram: 'Программа от производителя',
labelImportProgramSum: 'Скидка от производителя, руб., с НДС',
tbxAddEquipmentPrice: 'Стоимость доп.оборудования',
tbxVIN: 'VIN',
/** Result Elements */
labelResultTotalGraphwithNDS: 'Итого по графику, с НДС',

View File

@ -135,6 +135,7 @@ const elementsValues: Record<ElementsNames, ValuesNames> = {
tbxMinPriceChange: 'minPriceChange',
selectImportProgram: 'importProgram',
tbxAddEquipmentPrice: 'addEquipmentPrice',
tbxVIN: 'vin',
/** Result Elements */
labelResultTotalGraphwithNDS: 'resultTotalGraphwithNDS',

View File

@ -122,6 +122,7 @@ export type ElementsNames =
| 'tbxLeaseObjectPriceWthtVAT'
| 'tbxVATInLeaseObjectPrice'
| 'tbxAddEquipmentPrice'
| 'tbxVIN'
/** Result Elements */
| 'labelResultTotalGraphwithNDS'
| 'labelResultPlPrice'

View File

@ -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);
}
},
);
}

View File

@ -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) {

View File

@ -633,6 +633,7 @@ const elementsToDisable: (InteractionElementsNames | TableNames)[] = [
'tbxEngineHours',
'selectImportProgram',
'tbxAddEquipmentPrice',
'tbxVIN',
];
// Для recalc = true и первого платежа = 0

View File

@ -139,4 +139,5 @@ fragment quoteFields on quote {
evo_equip_price
evo_accept_period
evo_db_accept_registration
evo_vin
}

View File

@ -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;

View File

@ -118,6 +118,7 @@ export type ValuesNames =
| 'subsidySum'
| 'fuelCard'
| 'minPriceChange'
| 'vin'
| 'resultTotalGraphwithNDS'
| 'resultPlPrice'
| 'resultPriceUpPr'