diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 5a9eca92f..8f8ae1106 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -132,7 +132,7 @@ export default { }, async forwardButtonAction() { - var windshieldChipCount = this.selectedWindshieldOptions.selectedWindshieldChipCount && this.isWindshieldDamageLocation ? + const windshieldChipCount = this.selectedWindshieldOptions.selectedWindshieldChipCount && this.isWindshieldDamageLocation ? this.selectedWindshieldOptions.selectedWindshieldChipCount[0] : null; store.commit(this.storeMutations.UPDATE_IS_REPAIR, this.isWindshieldRepair); @@ -143,7 +143,7 @@ export default { store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, this.selectedGlassToReplace()); - var partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS, + const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS, { carId: store.getters.vehicle.carId, glassArray: this.selectedGlassToReplace()}, false); this.navigateForward(partsData); @@ -158,14 +158,12 @@ export default { //found multiple parts for a single glass location (Windshield, Driver, Passenger, Rear) if (partsData.data.partsOrQuestions){ - var multiParts = false; - partsData.data.partsOrQuestions.forEach(pq => { - if (pq.parts != null && pq.parts.length > 1){ + for (var i = 0; i < partsData.data.partsOrQuestions.length; i++){ + if (partsData.data.partsOrQuestions[i].parts != null && partsData.data.partsOrQuestions[i].parts.length > 1){ this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data); - multiParts = true; + return; } - }); - if (multiParts) return; + } } //if not a repair then there should only be 1 part and no problem questions at this point so save the part to the store. @@ -177,7 +175,7 @@ export default { }, selectedGlassToReplace() { - var selectedGlassToReplace = []; + const selectedGlassToReplace = []; if (this.isWindshieldDamageLocation && !this.isWindshieldRepair){ this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(wsItem => { selectedGlassToReplace.push({ location: damageLocationsParts.WINDSHIELD, name: wsItem}); diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3540d3bf8..58bd128a9 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -61,19 +61,14 @@ const routingTable = [ scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, destinationFmgPageValue: fmgPageValues.REVEAL, }, - ], - }, - { - fmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, - }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, }, + { + scenario: navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, + }, ], }, { @@ -89,19 +84,6 @@ const routingTable = [ }, ], }, - { - fmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - maps: [ - { - scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, - }, - { - scenario: navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, - destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, - }, - ], - }, ]; export { routingTable }; diff --git a/src/store/index.js b/src/store/index.js index 41daf3955..d81d1c523 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -68,6 +68,9 @@ export const mutations = { }, updateIsRepair(state, isRepair){ state.order.damage.isRepair = isRepair; + if (!isRepair){ + this.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null); + } }, updateNumberOfChips(state, numberOfChips){ state.order.damage.numberOfChips = numberOfChips;