CSR-803: fix navigate back scenarios involving multiple -questions pages
This commit is contained in:
parent
de51a2728f
commit
08f722c6d6
1 changed files with 23 additions and 15 deletions
|
|
@ -459,23 +459,31 @@ export default {
|
||||||
},
|
},
|
||||||
// Can't use `this` because navigateForward is also called from quote
|
// Can't use `this` because navigateForward is also called from quote
|
||||||
navigateBack(vm) {
|
navigateBack(vm) {
|
||||||
const self = vm ?? this;
|
|
||||||
const partsOrQuestions = (
|
|
||||||
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
|
|
||||||
self.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS) ??
|
|
||||||
self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS) ??
|
|
||||||
self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)
|
|
||||||
)?.partsOrQuestions;
|
|
||||||
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
|
|
||||||
const hasGlassLocationWithMultipleParts =
|
|
||||||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
|
||||||
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 self = vm ?? this;
|
||||||
const currentPage = self.$route.query.fmgPage;
|
const currentPage = self.$route.query.fmgPage;
|
||||||
|
|
||||||
|
const pageDataCapabilityQuestions = self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
|
||||||
|
const pageDataMoldingQuestions = self.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
|
||||||
|
const pageDataVehicleParts = self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS);
|
||||||
|
const pageDataPartQuestions = self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS);
|
||||||
|
|
||||||
|
const currentPartsOrQuestions = (
|
||||||
|
(currentPage !== fmgPageValues.CAPABILITY_QUESTIONS ? pageDataCapabilityQuestions : null) ??
|
||||||
|
(currentPage !== fmgPageValues.MOLDING_QUESTIONS ? pageDataMoldingQuestions : null) ??
|
||||||
|
(currentPage !== fmgPageValues.VEHICLE_PARTS ? pageDataVehicleParts : null) ??
|
||||||
|
(currentPage !== fmgPageValues.PARTS_QUESTIONS ? pageDataPartQuestions : null)
|
||||||
|
)?.partsOrQuestions;
|
||||||
|
|
||||||
|
const hasPartQuestions = this.hasPartQuestions(currentPartsOrQuestions);
|
||||||
|
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(currentPartsOrQuestions);
|
||||||
|
const hasChildPartQuestions = this.hasChildPartQuestions(currentPartsOrQuestions);
|
||||||
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(currentPartsOrQuestions);
|
||||||
|
|
||||||
|
let backNavigationScenario = self.$store.getters.vehicle.vin
|
||||||
|
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||||
|
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
hasCapabilityQuestions &&
|
hasCapabilityQuestions &&
|
||||||
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue