diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 7083d7c0..be5d5370 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -90,6 +90,15 @@ export function getGlassList(glassPieces) { return names.toLowerCase(); } +export function includesWindshieldReplacement() { + const mainStore = useMainStore(); + const windshieldMatches = + mainStore.damage.glassToReplace?.filter( + (glassToReplace) => glassToReplace.glassLocation === damageLocationsSelected.WINDSHIELD + ) ?? []; + return windshieldMatches.length > 0; +} + /** * Commented code are copied directly from DigitalConsumer.FixMyGlass * and have not been adjusted for ISS. diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index b92bb837..d5c492d8 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -1,3 +1,4 @@ +import { includesWindshieldReplacement } from '@/helpers/damage-helper'; import issPageValues from '@/router/router-constants/issPage-values'; import navigationScenarios from '@/router/router-constants/navigation-scenarios'; import { useMainStore } from '@/store'; @@ -457,6 +458,8 @@ export default { let backNavigationScenario = ''; if (self.mainStore.order.damage.isRepair) { backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_REPAIR; + } else if (!includesWindshieldReplacement()) { + backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS; } else { backNavigationScenario = self.mainStore.vehicle.vin ? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 6f17494d..d6fba845 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -61,6 +61,7 @@ const navigationScenarios = Object.freeze({ CLICKED_BACK_WITH_MOLDING_QUESTIONS: 'CLICKED_BACK_WITH_MOLDING_QUESTIONS', CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: 'CLICKED_BACK_WITH_CAPABILITY_QUESTIONS', CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: 'CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS', + CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS: 'CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS', CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: 'CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS', // Schedule diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c3075d3f..eec16cf3 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -536,6 +536,10 @@ const routingTable = () => [ scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN_AND_NO_MORE_QUESTIONS, + destinationIssPageValue: issPageValues.VEHICLE_DAMAGE + }, { scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP