start of masking vin when navigating back to vin-lookup

This commit is contained in:
Kroell 2023-03-09 12:09:22 -05:00
parent 162743b75f
commit 48214193a1

View file

@ -24,6 +24,8 @@
<vinQuestion <vinQuestion
v-model="vin" v-model="vin"
:isDisabled="vinPopulatedOnPageLoad"
:mask="vinMask"
/> />
<vinLocationInformation /> <vinLocationInformation />
@ -85,7 +87,8 @@ export default {
activeVehicleLookupAlertType: null, activeVehicleLookupAlertType: null,
needToLookupVehicle: true, needToLookupVehicle: true,
vehicleFromLookup: null, vehicleFromLookup: null,
vin: null, vin: this.getVinFromStore(),
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
}; };
}, },
provide() { provide() {
@ -116,12 +119,23 @@ export default {
this.vehicleFromLookup !== null this.vehicleFromLookup !== null
&& this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId && this.vehicleFromLookup.carId !== this.mainStore.vehicle.carId
); );
} },
vinMask() {
if (this.vinPopulatedOnPageLoad) {
const lastSixChars = this.vin.substring(11, this.vin.length);
return `!X!X!X!X!X!X!X!X!X!X!X${lastSixChars}`;
} else {
return "XXXXXXXXXXXXXXXXX";
}
},
}, },
methods: { methods: {
arePagePrerequisiteValid() { arePagePrerequisiteValid() {
return true; return true;
}, },
getVinFromStore() {
return this.mainStore.vehicle.vin;
},
backButtonAction() { backButtonAction() {
/** /**
* this.navigationScenarios comes from base-mixin * this.navigationScenarios comes from base-mixin
@ -183,7 +197,7 @@ export default {
// navigate() doesn't stop the processing flow // navigate() doesn't stop the processing flow
return; return;
} }
this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.PERFECT_MATCH;
this.mainStore.updateVehicle(this.vehicleFromLookup); this.mainStore.updateVehicle(this.vehicleFromLookup);
const partsOrQuestionsResponse = await this.getPartsOrQuestions(); const partsOrQuestionsResponse = await this.getPartsOrQuestions();
if (partsOrQuestionsResponse.error) { if (partsOrQuestionsResponse.error) {