diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 6a5873e83..509988c6e 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -17,6 +17,7 @@ const storeMutations = { UPDATE_VEHICLE_IMAGE_COLOR: "updateVehicleImageColor", UPDATE_VEHICLE_VIN: "updateVehicleVin", UPDATE_VEHICLE: "updateVehicle", + UPDATE_VEHICLE_CAN_SAFELITE_SERVICE: "updateVehicleCanSafeliteService", UPDATE_IS_REPAIR: "updateIsRepair", UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips", diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index bab3a92e8..da4ee6689 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -140,7 +140,7 @@ export default { modelOptions: [], styleOptions: [], displayNoServiceAlert: false, - canSafeliteService: false, + canSafeliteService: this.canSafeliteServiceFromStore(), }; }, @@ -316,6 +316,9 @@ export default { }, watch: { + serviceZipCode(newValue, oldValue) { + this.resetAlert(); + }, async selectedYear(year) { this.resetAlert(); this.makeOptions = []; @@ -323,6 +326,7 @@ export default { this.selectedModel = null; this.selectedStyle = null; this.vehicleSubType = null; + this.canSafeliteService = false; this.carId = null; if (year) { const result = await this.getMakeOptions(year); @@ -496,6 +500,7 @@ export default { vehicleSubType: this.vehicleSubType, carId: this.carId, category: this.category, + canSafeliteService: this.canSafeliteService, imageUrl: this.imageUrl, imageVifNumber: this.imageVifNumber, imageVifColor: this.imageVifColor, @@ -553,6 +558,9 @@ export default { selectedStylefromStore() { return store.getters.externalParameterVehicle.style ?? store.getters.vehicle.style; }, + canSafeliteServiceFromStore() { + return store.getters.vehicle.canSafeliteService ?? false; + }, async getMakeOptions(year) { return await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.GET_VEHICLE_MAKES, diff --git a/src/store/index.js b/src/store/index.js index aaee4c996..08307ec12 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -65,6 +65,7 @@ const getDefaultState = () => { carId: null, category: null, vin: null, + canSafeliteService: null, imageUrl: null, imageVifNumber: null, imageColor: null, @@ -221,6 +222,9 @@ export const mutations = { updateVehicleCategory(state, category) { state.order.vehicle.category = category; }, + updateVehicleCanSafeliteService(state, canSafeliteService) { + state.order.vehicle.canSafeliteService = canSafeliteService; + }, updateVehicleImageUrl(state, imageUrl) { state.order.vehicle.imageUrl = imageUrl; }, @@ -2357,6 +2361,7 @@ export const actions = { vehicleSubType, carId, category, + canSafeliteService, imageUrl, imageVifNumber, imageVifColor, @@ -2379,6 +2384,7 @@ export const actions = { context.commit(storeMutations.UPDATE_VEHICLE_SUBTYPE, vehicleSubType); context.commit(storeMutations.UPDATE_CAR_ID, carId); context.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, category); + context.commit(storeMutations.UPDATE_VEHICLE_CAN_SAFELITE_SERVICE, canSafeliteService); context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, imageUrl); context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, imageVifNumber); context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, imageVifColor);