Merge pull request #865 from Safelite/bugfix/CSR-803-fix-navigate-back
Bugfix/CSR-803 fix navigate back
This commit is contained in:
commit
ceb7ff50fc
1 changed files with 34 additions and 11 deletions
|
|
@ -462,24 +462,47 @@ export default {
|
||||||
// Can't use `this` because navigateForward is also called from quote
|
// Can't use `this` because navigateForward is also called from quote
|
||||||
async navigateBack(vm) {
|
async navigateBack(vm) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
const partsOrQuestions = (
|
const currentPage = self.$route.query.fmgPage;
|
||||||
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
|
const pageDataCapabilityQuestions = self.$store.getters.pageData(
|
||||||
self.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS) ??
|
fmgPageValues.CAPABILITY_QUESTIONS
|
||||||
self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS) ??
|
);
|
||||||
self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)
|
const pageDataMoldingQuestions = self.$store.getters.pageData(
|
||||||
)?.partsOrQuestions;
|
fmgPageValues.MOLDING_QUESTIONS
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
);
|
||||||
|
const pageDataVehicleParts = self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS);
|
||||||
|
const pageDataPartQuestions = self.$store.getters.pageData(
|
||||||
|
fmgPageValues.PART_QUESTIONS
|
||||||
|
);
|
||||||
|
|
||||||
|
let currentPartsOrQuestions = null;
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentPage !== fmgPageValues.CAPABILITY_QUESTIONS &&
|
||||||
|
!!pageDataCapabilityQuestions
|
||||||
|
) {
|
||||||
|
currentPartsOrQuestions = pageDataCapabilityQuestions?.partsOrQuestions;
|
||||||
|
} else if (
|
||||||
|
currentPage !== fmgPageValues.MOLDING_QUESTIONS &&
|
||||||
|
!!pageDataMoldingQuestions
|
||||||
|
) {
|
||||||
|
currentPartsOrQuestions = pageDataMoldingQuestions?.partsOrQuestions;
|
||||||
|
} else if (currentPage !== fmgPageValues.VEHICLE_PARTS && !!pageDataVehicleParts) {
|
||||||
|
currentPartsOrQuestions = pageDataVehicleParts?.partsOrQuestions;
|
||||||
|
} else if (currentPage !== fmgPageValues.PARTS_QUESTIONS && !!pageDataPartQuestions) {
|
||||||
|
currentPartsOrQuestions = pageDataPartQuestions?.partsOrQuestions;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasPartQuestions = this.hasPartQuestions(currentPartsOrQuestions);
|
||||||
const hasGlassLocationWithMultipleParts =
|
const hasGlassLocationWithMultipleParts =
|
||||||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
this.hasGlassLocationWithMultipleParts(currentPartsOrQuestions);
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(currentPartsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(currentPartsOrQuestions);
|
||||||
const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
|
const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
|
||||||
|
|
||||||
let backNavigationScenario = self.$store.getters.vehicle.vin
|
let backNavigationScenario = self.$store.getters.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;
|
|
||||||
if (
|
if (
|
||||||
hasCapabilityQuestions &&
|
hasCapabilityQuestions &&
|
||||||
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue