commit
This commit is contained in:
parent
5eb4c2f9ee
commit
ef9c7af480
4 changed files with 30 additions and 31 deletions
|
|
@ -35,6 +35,10 @@ const endpoints = {
|
||||||
url: "/parts/api/v1/parts/parts",
|
url: "/parts/api/v1/parts/parts",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
|
GetCapabilityQuestions: {
|
||||||
|
url: "/parts/api/v1/parts/capability-questions",
|
||||||
|
method: "GET",
|
||||||
|
},
|
||||||
GetVehicle: {
|
GetVehicle: {
|
||||||
url: "/vehicle/api/v1/vehicle/lookup",
|
url: "/vehicle/api/v1/vehicle/lookup",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ export default {
|
||||||
const footerInfoBox = document.querySelector(".footer#infoBox");
|
const footerInfoBox = document.querySelector(".footer#infoBox");
|
||||||
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
||||||
},
|
},
|
||||||
|
savePageDataToStore(page, data) {
|
||||||
|
useMainStore().updatePageData({ page: page, data: data});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// store will be accessible globally as its id + 'Store'
|
// store will be accessible globally as its id + 'Store'
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||||
import { storeMutations } from "@/constants/store-mutations.js";
|
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||||
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
import { useMainStore } from "../store";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
|
||||||
import store from "@/store";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -356,9 +352,9 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// TODO KO Delete `shouldGoToHeritageQuote`
|
|
||||||
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
// Can't use `this` because navigateForward is also called from vin-pages-mixin
|
||||||
async navigateForward(partsOrQuestions, vm, shouldGoToHeritageQuote) {
|
async navigateForward(partsOrQuestions, vm) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
const currentPage = self.$route.query.issPage;
|
const currentPage = self.$route.query.issPage;
|
||||||
|
|
||||||
|
|
@ -370,9 +366,7 @@ export default {
|
||||||
|
|
||||||
if (hasPartQuestions && this.currentPageComesBeforePage(currentPage, issPageValues.PART_QUESTIONS))
|
if (hasPartQuestions && this.currentPageComesBeforePage(currentPage, issPageValues.PART_QUESTIONS))
|
||||||
{
|
{
|
||||||
self.$router.navigate(
|
self.$router.navigate(self.navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, self.$route,
|
||||||
self.navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
|
||||||
self.$route,
|
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{ partsOrQuestions: partsOrQuestions }
|
{ partsOrQuestions: partsOrQuestions }
|
||||||
|
|
@ -394,7 +388,7 @@ export default {
|
||||||
) {
|
) {
|
||||||
// if any childpart questions
|
// if any childpart questions
|
||||||
// go to molding-questions page and pass the partsData
|
// go to molding-questions page and pass the partsData
|
||||||
self.$router.navigateWithSaving(
|
self.$router.navigate(
|
||||||
self.navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
self.navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||||
self.$route,
|
self.$route,
|
||||||
{},
|
{},
|
||||||
|
|
@ -412,13 +406,7 @@ export default {
|
||||||
for (let partOrQuestion of partsOrQuestions) {
|
for (let partOrQuestion of partsOrQuestions) {
|
||||||
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
if (this.hasCapabilityQuestions([partOrQuestion])) {
|
||||||
let capabilityQuestionsForGlassLocation = (
|
let capabilityQuestionsForGlassLocation = (
|
||||||
await baseMixin.methods.dispatchStoreAction(
|
await self.mainStore.getCapabilityQuestions(useMainStore().vehicle.carId, partOrQuestion.parts[0].partNumber)
|
||||||
storeActions.GET_CAPABILITY_QUESTIONS,
|
|
||||||
{
|
|
||||||
carId: store.getters.vehicle.carId,
|
|
||||||
partNumber: partOrQuestion.parts[0].partNumber,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
capabilityQuestionsForGlassLocation.forEach((question) => {
|
capabilityQuestionsForGlassLocation.forEach((question) => {
|
||||||
|
|
@ -434,7 +422,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.$router.navigateWithSaving(
|
self.$router.navigate(
|
||||||
self.navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
self.navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||||
self.$route,
|
self.$route,
|
||||||
{},
|
{},
|
||||||
|
|
@ -446,32 +434,30 @@ export default {
|
||||||
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
|
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
|
||||||
|
|
||||||
// save to store lineItems.glassParts
|
// save to store lineItems.glassParts
|
||||||
this.mainStore.updateGlassParts(collectedGlassParts);
|
self.mainStore.updateGlassParts(collectedGlassParts);
|
||||||
|
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
self.$router.navigate(self.navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,self.$route);
|
||||||
self.$route
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Can't use `this` because navigateForward is also called from quote
|
|
||||||
navigateBack(vm) {
|
navigateBack(vm) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
const partsOrQuestions = (
|
const partsOrQuestions = (
|
||||||
self.$store.getters.pageData(issPageValues.CAPABILITY_QUESTIONS) ??
|
self.mainStore.pageData(issPageValues.CAPABILITY_QUESTIONS) ??
|
||||||
self.$store.getters.pageData(issPageValues.MOLDING_QUESTIONS) ??
|
self.mainStore.pageData(issPageValues.MOLDING_QUESTIONS) ??
|
||||||
self.$store.getters.pageData(issPageValues.VEHICLE_PARTS) ??
|
self.mainStore.pageData(issPageValues.VEHICLE_PARTS) ??
|
||||||
self.$store.getters.pageData(issPageValues.PART_QUESTIONS)
|
self.mainStore.pageData(issPageValues.PART_QUESTIONS)
|
||||||
)?.partsOrQuestions;
|
)?.partsOrQuestions;
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
||||||
const hasGlassLocationWithMultipleParts =
|
const hasGlassLocationWithMultipleParts =
|
||||||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||||
let backNavigationScenario = self.$store.getters.vehicle.vin
|
let backNavigationScenario = self.mainStore.vehicle.vin
|
||||||
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||||
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||||
|
|
||||||
const currentPage = self.$route.query.fmgPage;
|
const currentPage = self.$route.query.issPage;
|
||||||
if (
|
if (
|
||||||
hasCapabilityQuestions &&
|
hasCapabilityQuestions &&
|
||||||
this.currentPageComesAfterPage(currentPage, issPageValues.CAPABILITY_QUESTIONS)
|
this.currentPageComesAfterPage(currentPage, issPageValues.CAPABILITY_QUESTIONS)
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,12 @@ export const useMainStore = defineStore({
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getCapabilityQuestions(carId, partNumber) {
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetCapabilityQuestions.method,
|
||||||
|
endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
setVehicle() {
|
setVehicle() {
|
||||||
return globalMethods
|
return globalMethods
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue