Refactoring lpl vue
This commit is contained in:
parent
95add315a0
commit
f43e6733bf
3 changed files with 33 additions and 3 deletions
|
|
@ -53,6 +53,21 @@ export async function navigateToHeritageFunnel() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function navigateAfterSaveToHeritageFunnel(currentRoute) {
|
||||||
|
const currentComponent = currentRoute.matched[0].components;
|
||||||
|
currentComponent.default.methods.resetDependentState();
|
||||||
|
// Create the order (or save existing order) when navigating to Heritage Funnel.
|
||||||
|
await saveOrder();
|
||||||
|
|
||||||
|
router.navigateToExternalUrl(
|
||||||
|
externalUrls.HERITAGE_FUNNEL,
|
||||||
|
{
|
||||||
|
corid: store.getters.order.referralCorrelationId,
|
||||||
|
src: "concept-funnel"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Logic for getting the last "valid" page a user visited.
|
Logic for getting the last "valid" page a user visited.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper";
|
import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper";
|
||||||
import { required, regex } from "@/helpers/validation-rules";
|
import { required, regex } from "@/helpers/validation-rules";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED));
|
defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED));
|
||||||
|
|
@ -199,7 +199,7 @@ export default {
|
||||||
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||||
{
|
{
|
||||||
carId: vinLookup.data.vehicle.carId,
|
carId: vinLookup.data.vehicle.carId,
|
||||||
glassArray: store.getters.damage.glassToReplace ? store.getters.damage.glassToReplace : [],
|
glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace,
|
||||||
zipCode: this.serviceZip ? this.serviceZip : this.registrationZip,
|
zipCode: this.serviceZip ? this.serviceZip : this.registrationZip,
|
||||||
vin: vinLookup.data.vin
|
vin: vinLookup.data.vin
|
||||||
},
|
},
|
||||||
|
|
@ -212,7 +212,7 @@ export default {
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data);
|
this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, partsData.data);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
navigateToHeritageFunnel();
|
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -229,6 +229,9 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
updateCustomerInfo(vin, vehicleInfo, registrationState) {
|
updateCustomerInfo(vin, vehicleInfo, registrationState) {
|
||||||
|
if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){
|
||||||
|
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
|
}
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin);
|
store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin);
|
||||||
store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year);
|
store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year);
|
||||||
store.commit(storeMutations.UPDATE_MAKE, vehicleInfo.make);
|
store.commit(storeMutations.UPDATE_MAKE, vehicleInfo.make);
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,21 @@ export const mutations = {
|
||||||
updateRegistrationZipCode(state, reistrationZipCode){
|
updateRegistrationZipCode(state, reistrationZipCode){
|
||||||
state.order.vehicle.registration.zipCode = reistrationZipCode;
|
state.order.vehicle.registration.zipCode = reistrationZipCode;
|
||||||
},
|
},
|
||||||
|
updateRegistrationAddress(state, reistrationAddress){
|
||||||
|
state.order.vehicle.registration.address = reistrationAddress;
|
||||||
|
},
|
||||||
updateServiceLocationZip(state, serviceLocationZip){
|
updateServiceLocationZip(state, serviceLocationZip){
|
||||||
state.order.serviceLocation.zip = serviceLocationZip;
|
state.order.serviceLocation.zip = serviceLocationZip;
|
||||||
},
|
},
|
||||||
|
updateRegistrationCity(state, serviceCity){
|
||||||
|
state.order.serviceLocation.city = serviceCity;
|
||||||
|
},
|
||||||
|
updateRegistrationFirstName(state, firstName){
|
||||||
|
state.order.serviceLocation.firstName = firstName;
|
||||||
|
},
|
||||||
|
updateRegistrationLastName(state, lastName){
|
||||||
|
state.order.serviceLocation.lastName = lastName;
|
||||||
|
},
|
||||||
updateCustomerEmailAddress(state, customerEmailAddress){
|
updateCustomerEmailAddress(state, customerEmailAddress){
|
||||||
state.order.customer.emailAddress = customerEmailAddress;
|
state.order.customer.emailAddress = customerEmailAddress;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue