WIP vin-lookup page.
This commit is contained in:
parent
9623fd80bb
commit
d0fb0ee541
2 changed files with 68 additions and 43 deletions
|
|
@ -95,7 +95,7 @@ async function getLatestPageForRedirection() {
|
|||
if (store.getters.vehicle.vin) {
|
||||
return fmgPageValues.LICENSE_PLATE_LOOKUP;
|
||||
} else {
|
||||
return fmgPageValues.ESTIMATE;
|
||||
return fmgPageValues.VIN_LOOKUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ function overrideYmmsDirectionIfNeeded(toRoute) {
|
|||
/* istanbul ignore next */
|
||||
function isVinRelatedPage(toRoute) {
|
||||
const fmgPageValue = toRoute.query[queryStrings.FMG_PAGE];
|
||||
|
||||
|
||||
return fmgPageValue === fmgPageValues.VIN_LOOKUP ||
|
||||
fmgPageValue === fmgPageValues.LICENSE_PLATE_LOOKUP ||
|
||||
fmgPageValue === fmgPageValues.ADDRESS_LOOKUP ||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,11 @@
|
|||
</div>
|
||||
<alert
|
||||
class="my-3"
|
||||
:manualHeadline="MatchedDifferentVehicleAlertHeader"
|
||||
:manualCopy="MatchedDifferentVehicleAlertBody"
|
||||
v-model="customAlertData"
|
||||
v-if="matchedDifferentVehicle"
|
||||
alertClass="alert-danger"
|
||||
cmsWidgetName="MatchedDifferentVehicle"
|
||||
/>
|
||||
<alert
|
||||
class="my-3"
|
||||
|
|
@ -45,24 +46,11 @@
|
|||
/>
|
||||
<alert
|
||||
class="my-3"
|
||||
:manualHeadline="NoServiceZipHeader"
|
||||
:manualCopy="NoServiceZipBody"
|
||||
v-model="customAlertData"
|
||||
v-if="noServiceZip"
|
||||
alertClass="alert-warning"
|
||||
cmsWidgetName="NoServiceZipWidget"
|
||||
/>
|
||||
<alert
|
||||
class="my-3"
|
||||
v-model="customAlertData"
|
||||
v-if="vinFound"
|
||||
alertClass="alert-warning"
|
||||
cmsWidgetName="VinFoundWidget"
|
||||
/>
|
||||
<alert
|
||||
class="my-3"
|
||||
v-model="customAlertData"
|
||||
v-if="vinFoundReadOnly"
|
||||
alertClass="alert-warning"
|
||||
cmsWidgetName="VinFoundReadOnlyWidget"
|
||||
/>
|
||||
<alert
|
||||
class="my-3"
|
||||
|
|
@ -114,6 +102,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
|||
import { storeActions } from "@/constants/store-actions";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper";
|
||||
import { required, regex } from "@/helpers/validation-rules";
|
||||
import { Form, defineRule } from "vee-validate";
|
||||
|
||||
|
|
@ -163,8 +152,43 @@ export default {
|
|||
zip: '',
|
||||
email: '',
|
||||
customAlertData: {},
|
||||
isCarIdDifferent: false,
|
||||
previouslyEnteredCarId: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
MatchedDifferentVehicleAlertHeader(){
|
||||
let text = this.getCmsContent("MatchedDifferentVehicle",
|
||||
"HeadlineText").replaceAll("{custom:damage}", getDamageString());
|
||||
|
||||
return text;
|
||||
},
|
||||
MatchedDifferentVehicleAlertBody(){
|
||||
let text = this.getCmsContent("MatchedDifferentVehicle",
|
||||
"BodyText").replaceAll("{custom:damage}", getDamageString()).replaceAll("{custom:vinlookupYear}", this.customAlertData?.vehicleInfo?.year).replaceAll("{custom:vinlookupMake}", this.customAlertData?.vehicleInfo?.make).replaceAll("{custom:vinlookupModel}",
|
||||
this.customAlertData?.vehicleInfo?.model);
|
||||
|
||||
return text;
|
||||
},
|
||||
NoServiceZipHeader(){
|
||||
let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.zip);
|
||||
|
||||
return text;
|
||||
},
|
||||
NoServiceZipBody(){
|
||||
return this.getCmsContent("NoServiceZipWidget", "BodyText");
|
||||
},
|
||||
PerfectMatchNewVinAlertHeader() {
|
||||
return this.getCmsContent("PerfectMatchNewVinAlert", "HeadlineText");
|
||||
},
|
||||
PerfectMatchNewVinAlertBody() {
|
||||
return this.getCmsContent("PerfectMatchNewVinAlert", "BodyText").replaceAll("{custom:damage}",
|
||||
getDamageString())
|
||||
},
|
||||
isVinFieldReadOnly(){
|
||||
return this.$store.getters.payment.insuranceCoverage.isVerified;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
arePagePrerequisitesValid() {
|
||||
return store.getters.vehicle.carId !== null;
|
||||
|
|
@ -187,30 +211,36 @@ export default {
|
|||
this.noServiceZip = true;
|
||||
return;
|
||||
}
|
||||
const vinLookup = await this.lookupVin(this.vin).catch(() => {
|
||||
const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => {
|
||||
this.vinNotFound = true;
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
this.noMatchAlert = true;
|
||||
return;
|
||||
});
|
||||
if (vinLookup.data.carId !== store.getters.vehicle.carId) {
|
||||
this.customAlertData.vehicleInfo = vinLookup.data.vehicle;
|
||||
this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId;
|
||||
|
||||
if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) {
|
||||
this.previouslyEnteredCarId = vehicleLookup.data.carId;
|
||||
this.customAlertData.vehicleInfo = vehicleLookup.data;
|
||||
this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`);
|
||||
this.isVinValid = true;
|
||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vehicleLookup.data.carId);
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
this.foundWindshieldAlert = true;
|
||||
this.matchedDifferentVehicle = true;
|
||||
return;
|
||||
}
|
||||
const carInfo = this.vinDoesNotMatchCarId ? vinLookup.data : store.getters.vehicle;
|
||||
this.updateStore(carInfo)
|
||||
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||
{
|
||||
carId: store.getters.vehicle.carId,
|
||||
glassArray: store.getters.damage.glassToReplace,
|
||||
zipCode: this.zip,
|
||||
vin: vinLookup.vin
|
||||
},
|
||||
false
|
||||
);
|
||||
this.navigateForward(partsData);
|
||||
};
|
||||
//const carInfo = this.vinDoesNotMatchCarId ? vehicleLookup.data : store.getters.vehicle;
|
||||
//this.updateStore(carInfo)
|
||||
// const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||
// this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||
// {
|
||||
// carId: store.getters.vehicle.carId,
|
||||
// glassArray: store.getters.damage.glassToReplace,
|
||||
// zipCode: this.zip,
|
||||
// vin: vehicleLookup.vin
|
||||
// },
|
||||
// false
|
||||
// );
|
||||
// this.navigateForward(partsData);
|
||||
},
|
||||
navigateForward(partsData){
|
||||
if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){
|
||||
|
|
@ -229,7 +259,7 @@ export default {
|
|||
{ zip }
|
||||
);
|
||||
},
|
||||
lookupVin(vin) {
|
||||
lookupVehicle(vin) {
|
||||
return baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||
storeActions.LOOKUP_VEHICLE_BY_VIN,
|
||||
{ vin }
|
||||
|
|
@ -253,11 +283,6 @@ export default {
|
|||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
isVinFieldReadOnly(){
|
||||
return this.$store.getters.payment.insuranceCoverage.isVerified;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Form,
|
||||
funnelHeader,
|
||||
|
|
|
|||
Loading…
Reference in a new issue