More implementations for license plate lookup
This commit is contained in:
parent
263b847ebc
commit
ebc30c7776
5 changed files with 176 additions and 95 deletions
|
|
@ -43,6 +43,10 @@ const endpoints = {
|
||||||
url: "/vehicle/api/v1/vehicle/Lookup",
|
url: "/vehicle/api/v1/vehicle/Lookup",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
|
LookupVinByPlate: {
|
||||||
|
url: "/vehicle/api/v1/vehicle/lookup-vin-by-plate",
|
||||||
|
method: "POST",
|
||||||
|
},
|
||||||
GetPartsOrQuestions: {
|
GetPartsOrQuestions: {
|
||||||
url: "/parts/api/v1/parts/parts-or-questions",
|
url: "/parts/api/v1/parts/parts-or-questions",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ const storeActions = {
|
||||||
GET_EVOX_IMAGE: "getEvoxImage",
|
GET_EVOX_IMAGE: "getEvoxImage",
|
||||||
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms",
|
||||||
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
|
LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin",
|
||||||
|
LOOKUP_VIN_BY_PLATE: "lookupVinByPlate",
|
||||||
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
|
||||||
|
VALIDATE_ZIP: "validateZip",
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall">
|
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall">
|
||||||
<funnelHeader ref="funnelHeader" />
|
<funnelHeader ref="funnelHeader" />
|
||||||
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage="false" />
|
||||||
<funnelSubHeader ref="funnelSubHeader" />
|
<funnelSubHeader ref="funnelSubHeader" />
|
||||||
<textboxQuestion />
|
<textboxQuestion />
|
||||||
<funnelFooter
|
<funnelFooter
|
||||||
|
|
@ -18,12 +18,13 @@ import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
import textboxQuestion from "@/common-components/textbox-question/textbox-question"
|
import textboxQuestion from "@/common-components/textbox-question/textbox-question";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
|
|
||||||
|
|
@ -60,9 +61,16 @@ export default {
|
||||||
// vm.$refs.licensePlateNumber.initializeComponent(
|
// vm.$refs.licensePlateNumber.initializeComponent(
|
||||||
// resultMap.cmsContent.LicensePlateNumber
|
// resultMap.cmsContent.LicensePlateNumber
|
||||||
// );
|
// );
|
||||||
console.log(resultMap)
|
console.log(resultMap);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
newServiceZipRequired: false,
|
||||||
|
vinNotValid: false,
|
||||||
|
vinDoesNotMatchCarId: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return store.getters.vehicle.carId !== null;
|
return store.getters.vehicle.carId !== null;
|
||||||
|
|
@ -76,13 +84,59 @@ export default {
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
// route to move backwards
|
// route to move backwards
|
||||||
this.$router.navigate(
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
this.navigationScenarios.CLICKED_BACK,
|
},
|
||||||
this.$route
|
async forwardButtonAction(zip, plate) {
|
||||||
|
const zipValidation = await this.validateZip(zip);
|
||||||
|
const vinLookup = await this.lookupVin(plate);
|
||||||
|
if (!zipValidation.isServiceable) {
|
||||||
|
this.newServiceZipRequired = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!vinLookup.vin) {
|
||||||
|
this.vinNotValid = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (vinLookup.vehicle.carId !== store.getters.vehicle.carId) {
|
||||||
|
this.vinDoesNotMatchCarId = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
|
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||||
|
{
|
||||||
|
carId: store.getters.vehicle.carId,
|
||||||
|
glassArray: store.getters.damage.glassToReplace,
|
||||||
|
zipCode: zip,
|
||||||
|
vin: vinLookup.vin
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
this.navigateForward(partsData);
|
||||||
|
},
|
||||||
|
navigateForward(partsData){
|
||||||
|
if(partsData.data.partsOrQuestions.partQuestions.length){
|
||||||
|
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data);
|
||||||
|
return;
|
||||||
|
} else if(!partsData.data.partsOrQuestions.partQuestions.length && partsData.data.partsOrQuestions.parts.length > 1) {
|
||||||
|
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CONTINUING_WITH_SINGLE_PART, this.$route);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateZip(zip) {
|
||||||
|
return baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
|
storeActions.VALIDATE_ZIP,
|
||||||
|
{ zip }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
forwardButtonAction(){
|
lookupVin(plate, state) {
|
||||||
|
return baseMixin.methods.dispatchNonBlockingStoreAction(
|
||||||
|
storeActions.LOOKUP_VIN_BY_PLATE,
|
||||||
|
{ plate, state }
|
||||||
|
);
|
||||||
},
|
},
|
||||||
updateStore() {
|
updateStore() {
|
||||||
// if(vehicleDamage){
|
// if(vehicleDamage){
|
||||||
|
|
@ -103,7 +157,7 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, null);
|
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, null);
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, null);
|
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, null);
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, null);
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, null);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
|
|
@ -111,6 +165,6 @@ export default {
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,18 @@ const routingTable = [
|
||||||
scenario: navigationScenarios.CLICKED_BACK,
|
scenario: navigationScenarios.CLICKED_BACK,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CONTINUING_WITH_PARTS_QUESTION,
|
||||||
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CONTINUING_WITH_SINGLE_PART,
|
||||||
|
destinationFmgPageValue: fmgPageValues.REVEAL,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,6 @@ export const state = {
|
||||||
eventBus: [],
|
eventBus: [],
|
||||||
pageData: {}
|
pageData: {}
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
|
||||||
zip: null,
|
|
||||||
},
|
|
||||||
customer: {
|
|
||||||
emailAddress: null,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export Mutations
|
// Export Mutations
|
||||||
|
|
@ -226,6 +220,15 @@ export const actions = {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
lookupVinByPlate(context, { plate }) {
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.LookupVinByPlate.method,
|
||||||
|
endpoint: endpoints.LookupVinByPlate.url,
|
||||||
|
payload: {
|
||||||
|
plate: plate,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
getVehicleMakes(context, { year }) {
|
getVehicleMakes(context, { year }) {
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetVehicleMakes.method,
|
method: endpoints.GetVehicleMakes.method,
|
||||||
|
|
@ -270,6 +273,12 @@ export const actions = {
|
||||||
payload: {},
|
payload: {},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
validateZip(context, {zip}) {
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
methods: endpoints.ValidateZip.method,
|
||||||
|
endpoint: `${endpoints.ValidateZip.url}/${zip}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// DEPENDENCY ACTIONS
|
// DEPENDENCY ACTIONS
|
||||||
resetVehicleAndDependencies(context) {
|
resetVehicleAndDependencies(context) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue