'Final' check-in before submitting to QA
This commit is contained in:
parent
d84607ba7a
commit
d276a24b87
5 changed files with 73 additions and 46 deletions
|
|
@ -42,7 +42,8 @@ export default {
|
|||
setup(props) {
|
||||
const fieldOptions = {
|
||||
type: "text",
|
||||
value: props.modelValue,
|
||||
value: props.modelValue,
|
||||
initialValue: props.modelValue,
|
||||
};
|
||||
|
||||
const {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
:aria-required="isRequired"
|
||||
autocomplete="off"
|
||||
:class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']"
|
||||
:validationRules="validationRules"
|
||||
:validationRules="validationRules"
|
||||
/>
|
||||
<div v-show="errorMessage" class="row mt-2 form-test-error">
|
||||
<span role="alert">{{ errorMessage }}</span>
|
||||
|
|
@ -57,6 +57,7 @@ export default {
|
|||
const fieldOptions = {
|
||||
type: "text",
|
||||
value: props.modelValue,
|
||||
initialValue: props.modelValue,
|
||||
};
|
||||
|
||||
const {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<template>
|
||||
<Form
|
||||
@submit="onSubmit"
|
||||
@invalid-submit="onInvalidSubmit"
|
||||
ref="theForm"
|
||||
v-slot="{ meta }"
|
||||
autocomplete="off" >
|
||||
<Form ref="theForm" @submit="onSubmit" @invalid-submit="onInvalidSubmit" v-slot="{ meta }" autocomplete="off">
|
||||
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage=false />
|
||||
|
|
@ -126,8 +121,11 @@ export default {
|
|||
displayVinNotFoundAlert: false,
|
||||
displayMatchedDifferentVehicleAlert: false,
|
||||
displayVinLookupByHomeAddressNotAllowedAlert: false,
|
||||
previousCarIdFound: "",
|
||||
customAlertData: {},
|
||||
previouslyEnteredCarId: "",
|
||||
isSelectedGlassAvailableForVehicle: false,
|
||||
customAlertData: {},
|
||||
showServiceZipField: this.getServiceZipFromStore(),
|
||||
isZipServicable: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -189,14 +187,16 @@ export default {
|
|||
|
||||
// Validate if the original or service zip provided is serviceable
|
||||
const zipValidation = this.serviceZip ? await this.validateZip(this.serviceZip) : await this.validateZip(this.customerQuestions.addressQuestions.zip);
|
||||
if (!zipValidation.data.isServiceable) {
|
||||
this.isZipServicable = zipValidation.data.isServiceable;
|
||||
if (!this.isZipServicable) {
|
||||
this.displayNonServiceableZipAlert = true;
|
||||
this.showServiceZipField = true;
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
}
|
||||
|
||||
const carEntered = store.getters.vehicle;
|
||||
const carsFound = vinLookup.data.vinVehicles;
|
||||
const carsFound = vinLookup.data.vinVehicles;
|
||||
|
||||
if (carsFound.length == 0) {
|
||||
// No VINs found
|
||||
this.displayVinNotFoundAlert = true;
|
||||
|
|
@ -204,34 +204,41 @@ export default {
|
|||
return;
|
||||
} else if (carsFound.length == 1) {
|
||||
const carFound = carsFound[0].vehicle;
|
||||
this.isCarIdDifferent = carFound.carId !== carEntered.carId;
|
||||
|
||||
if (carEntered.carId == carFound.carId || carFound.carId == this.previousCarIdFound) {
|
||||
// update data
|
||||
this.updateVehicleInfo(carFound.vin, carFound);
|
||||
this.updateCustomerInfo();
|
||||
|
||||
// navigate forward
|
||||
this.navigateForward(carEntered, carsFound);
|
||||
} else {
|
||||
if (this.isCarIdDifferent && carFound.carId !== this.previouslyEnteredCarId) {
|
||||
// Display Alert
|
||||
this.previouslyEnteredCarId = carFound.carId;
|
||||
this.customAlertData.vehicleInfo = carFound;
|
||||
this.displayMatchedDifferentVehicleAlert = true;
|
||||
|
||||
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(carFound.carId);
|
||||
|
||||
// Update button "Continue with..."
|
||||
this.$refs.funnelFooter.updateButtonText(`Continue with ${carFound.year} ${carFound.make} ${carFound.model}`);
|
||||
this.$refs.funnelFooter.removeLoader();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isZipServicable) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.previousCarIdFound = carFound.carId;
|
||||
|
||||
} else if (vinLookup.data.vinVehicles.length > 1) {
|
||||
// update data if the zip or service zip is servicable
|
||||
this.updateVehicleInfo(carFound.vin, carFound);
|
||||
this.updateCustomerInfo();
|
||||
|
||||
} else if (carsFound.length > 1) {
|
||||
if (!this.isZipServicable) {
|
||||
return;
|
||||
}
|
||||
|
||||
// navigate forward
|
||||
this.navigateForward(carEntered, carsFound);
|
||||
// update data if the zip or service zip is servicable
|
||||
this.updateCustomerInfo();
|
||||
}
|
||||
|
||||
|
||||
this.navigateForward(carEntered, carsFound);
|
||||
},
|
||||
resetWarningsAndErrors() {
|
||||
this.displayVinNotFoundAlert = false;
|
||||
|
|
@ -241,25 +248,26 @@ export default {
|
|||
},
|
||||
async navigateForward(carEntered, carsFound) {
|
||||
if (carsFound.length == 1) {
|
||||
// get the damage options for the car that was found
|
||||
const carFound = carsFound[0].vehicle;
|
||||
|
||||
// if the car entered is the same as the car found or the selected glass is available for the car that was found
|
||||
if (carEntered.carId == carFound.carId || isGlassAvailableForCarId(carFound.carId)) {
|
||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||
this.$router.navigateAfterSave(
|
||||
this.navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS,
|
||||
this.$route, {}, {
|
||||
displayVehicleChangeAlert: true
|
||||
}, {}
|
||||
);
|
||||
} else {
|
||||
// if not then navigate to the "vehicle-damage" page
|
||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, this.$route, {}, { displayVehicleChangeAlert: true }, {});
|
||||
}
|
||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||
}
|
||||
} else if (carsFound.length > 1) {
|
||||
// if multiple cars were found
|
||||
if (carsFound.find(car => car.carId === carEntered.carId)) {
|
||||
// and one of them matches the car id entered
|
||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||
} else {
|
||||
// and there is no match, navigate to "address-vehicle" page
|
||||
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound);
|
||||
// and there is no match, navigate to "address-vehicles" page
|
||||
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES,
|
||||
this.$route, {}, {},
|
||||
carsFound);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,11 +304,11 @@ export default {
|
|||
store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, this.customerQuestions.addressQuestions.streetAddress);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_CITY, this.customerQuestions.addressQuestions.city);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_STATE, this.customerQuestions.addressQuestions.state);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zipCode);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zip);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName);
|
||||
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName);
|
||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip);
|
||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.email);
|
||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.emailAddress);
|
||||
},
|
||||
|
||||
},
|
||||
|
|
@ -345,6 +353,14 @@ export default {
|
|||
this.displayNonServiceableZipAlert = false;
|
||||
},
|
||||
},
|
||||
showServiceZipField: {
|
||||
handler(newValue) {
|
||||
// if the Service Zip field is ever hidden, clear out it's value
|
||||
if (!newValue) {
|
||||
this.serviceZip = "";
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
funnelHeader,
|
||||
|
|
|
|||
|
|
@ -146,6 +146,15 @@ export default ({
|
|||
},
|
||||
methods: {
|
||||
setupAddressLookup() {
|
||||
|
||||
if (this.addressModel.streetAddress !== null &
|
||||
this.addressModel.city !== null &
|
||||
this.addressModel.state !== null &
|
||||
this.addressModel.zip !== null) {
|
||||
|
||||
this.showAddressFields = true;
|
||||
}
|
||||
|
||||
const addressField1 = document.getElementById("autocomplete");
|
||||
const self = this;
|
||||
|
||||
|
|
|
|||
|
|
@ -147,14 +147,14 @@ export const mutations = {
|
|||
updateServiceLocationZipCode(state, serviceLocationZipCode){
|
||||
state.order.serviceLocation.zipCode = serviceLocationZipCode;
|
||||
},
|
||||
updateRegistrationCity(state, serviceCity){
|
||||
state.order.serviceLocation.city = serviceCity;
|
||||
updateRegistrationCity(state, registrationCity){
|
||||
state.order.vehicle.registration.city = registrationCity;
|
||||
},
|
||||
updateRegistrationFirstName(state, firstName){
|
||||
state.order.serviceLocation.firstName = firstName;
|
||||
state.order.vehicle.registration.firstName = firstName;
|
||||
},
|
||||
updateRegistrationLastName(state, lastName){
|
||||
state.order.serviceLocation.lastName = lastName;
|
||||
state.order.vehicle.registration.lastName = lastName;
|
||||
},
|
||||
updateCustomerEmailAddress(state, customerEmailAddress){
|
||||
state.order.customer.emailAddress = customerEmailAddress;
|
||||
|
|
|
|||
Loading…
Reference in a new issue