CSR-748 Handle back buttons
This commit is contained in:
parent
99166d2883
commit
8075df60ad
6 changed files with 78 additions and 31 deletions
|
|
@ -170,7 +170,6 @@ export default {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
console.log("forwardButtonAction")
|
|
||||||
if (this.isRepair) {
|
if (this.isRepair) {
|
||||||
console.log("REPAIRRR")
|
console.log("REPAIRRR")
|
||||||
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
|
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import servicePackageQuestion from "./service-package-question/service-package-q
|
||||||
import textBlock from "@/common-components/text-block/text-block";
|
import textBlock from "@/common-components/text-block/text-block";
|
||||||
import modal from "@/common-components/modal/modal";
|
import modal from "@/common-components/modal/modal";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
|
||||||
|
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
@ -155,6 +156,9 @@ export default {
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
backButtonAction() {
|
||||||
|
vehicleQuestionsMixin.methods.backButtonAction(this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
|
|
|
||||||
|
|
@ -243,22 +243,31 @@ export default {
|
||||||
// save to store lineItems.glassParts
|
// save to store lineItems.glassParts
|
||||||
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||||
|
|
||||||
self.$router.navigateWithSaving(self.navigationScenarios.HAS_NO_MORE_QUESTIONS, self.$route);
|
self.$router.navigateWithSaving(
|
||||||
|
self.navigationScenarios.HAS_NO_MORE_QUESTIONS,
|
||||||
|
self.$route
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
// Can't use `this` because navigateForward is also called from quote
|
||||||
|
backButtonAction(vm) {
|
||||||
|
const self = vm ?? this;
|
||||||
const partsOrQuestions = (
|
const partsOrQuestions = (
|
||||||
this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ??
|
self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ??
|
||||||
this.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS)
|
self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS) ??
|
||||||
|
self.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS) ??
|
||||||
|
self.$store.getters.pageData(fmgPageValues.CAPABILITY_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 = navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS;
|
let backNavigationScenario = self.$store.getters.vehicle.vin
|
||||||
|
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||||
|
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||||
|
|
||||||
const currentPage = this.$route.query.fmgPage;
|
const currentPage = self.$route.query.fmgPage;
|
||||||
if (
|
if (
|
||||||
hasCapabilityQuestions &&
|
hasCapabilityQuestions &&
|
||||||
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
||||||
|
|
@ -282,7 +291,9 @@ export default {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.navigateWithoutSaving(backNavigationScenario, this.$route);
|
console.log({ backNavigationScenario });
|
||||||
|
|
||||||
|
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,14 @@ const navigationScenarios = {
|
||||||
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
||||||
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
||||||
HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS",
|
HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS",
|
||||||
CLICKED_BACK_WITH_NO_QUESTIONS: "CLICKED_BACK_WITH_NO_QUESTIONS",
|
|
||||||
CLICKED_BACK_WITH_PART_QUESTIONS: "CLICKED_BACK_WITH_PART_QUESTIONS",
|
CLICKED_BACK_WITH_PART_QUESTIONS: "CLICKED_BACK_WITH_PART_QUESTIONS",
|
||||||
CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE",
|
CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE",
|
||||||
CLICKED_BACK_WITH_MOLDING_QUESTIONS: "CLICKED_BACK_WITH_MOLDING_QUESTIONS",
|
CLICKED_BACK_WITH_MOLDING_QUESTIONS: "CLICKED_BACK_WITH_MOLDING_QUESTIONS",
|
||||||
|
CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS",
|
||||||
|
|
||||||
|
// Quote
|
||||||
|
CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS",
|
||||||
|
CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS"
|
||||||
};
|
};
|
||||||
|
|
||||||
export { navigationScenarios };
|
export { navigationScenarios };
|
||||||
|
|
|
||||||
|
|
@ -247,9 +247,13 @@ const routingTable = function (store) {
|
||||||
fmgPageValue: fmgPageValues.PART_QUESTIONS,
|
fmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
|
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
||||||
|
|
@ -280,9 +284,13 @@ const routingTable = function (store) {
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
|
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
|
@ -301,9 +309,13 @@ const routingTable = function (store) {
|
||||||
fmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
fmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
|
@ -326,9 +338,13 @@ const routingTable = function (store) {
|
||||||
fmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
fmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
|
@ -347,6 +363,35 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fmgPageValue: fmgPageValues.QUOTE,
|
||||||
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -362,21 +362,6 @@ export const mutations = {
|
||||||
updateTriggeredSiteEntry(state, wasSiteEntryTriggered) {
|
updateTriggeredSiteEntry(state, wasSiteEntryTriggered) {
|
||||||
state.applicationUser.triggeredSiteEntry = wasSiteEntryTriggered;
|
state.applicationUser.triggeredSiteEntry = wasSiteEntryTriggered;
|
||||||
},
|
},
|
||||||
// START GA click event mutations
|
|
||||||
// updateCurrentlySelectedValues(state, groupName, value) {
|
|
||||||
// state.gaClickInformation.currentlySelectedValues[groupName] = value;
|
|
||||||
// },
|
|
||||||
// updateFiredGaClickEventValues(state, groupName, value) {
|
|
||||||
// state.gaClickInformation.firedGaClickEventValues[groupName] = value;
|
|
||||||
// },
|
|
||||||
// updateLastFocusedInputGroup(state, groupName) {
|
|
||||||
// state.gaClickInformation.lastFocusedInputGroup = groupName;
|
|
||||||
// },
|
|
||||||
// updateWasLastFocusedInputMultiselect(state, wasLastFocusedInputMultiselect) {
|
|
||||||
// state.gaClickInformation.wasLastFocusedInputMultiselect =
|
|
||||||
// wasLastFocusedInputMultiselect;
|
|
||||||
// },
|
|
||||||
// END GA click event mutations
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Export Getters
|
// Export Getters
|
||||||
|
|
@ -393,10 +378,10 @@ export const getters = {
|
||||||
eventBus: (state) => state.applicationUser.eventBus,
|
eventBus: (state) => state.applicationUser.eventBus,
|
||||||
damage: (state) => state.order.damage,
|
damage: (state) => state.order.damage,
|
||||||
hasAnyNonWindshieldGlassParts: (state) => {
|
hasAnyNonWindshieldGlassParts: (state) => {
|
||||||
const nonWindshieldItems = state.order.damage.glassToReplace.filter(
|
const nonWindshieldItems = state.order.damage.glassToReplace?.filter(
|
||||||
(glassToReplace) => glassToReplace.glassLocation != "Windshield"
|
(glassToReplace) => glassToReplace.glassLocation != "Windshield"
|
||||||
);
|
);
|
||||||
return !!nonWindshieldItems.length;
|
return !!nonWindshieldItems?.length;
|
||||||
},
|
},
|
||||||
lineItems: (state) => state.order.lineItems,
|
lineItems: (state) => state.order.lineItems,
|
||||||
pageData: (state) => (page) => {
|
pageData: (state) => (page) => {
|
||||||
|
|
@ -465,7 +450,6 @@ export const getters = {
|
||||||
state.applicationUser.experiments
|
state.applicationUser.experiments
|
||||||
.map((x) => x.settings)
|
.map((x) => x.settings)
|
||||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
|
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
|
||||||
// gaClickInformation: (state) => state.gaClickInformation,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue