From ce73fdd1dc763d1ec5004a38f161ca7abbe6a68b Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Wed, 20 Aug 2025 10:37:00 -0400 Subject: [PATCH] CASH-1423 | Vehicle page big truck fixed Do not save zip or vehicle until validation has passed Fix conditional error causing you to be able to continue even without providers --- src/layouts/vehicle/vehicle.vue | 59 +++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index aa16dfad4..90cd9160c 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -486,6 +486,37 @@ export default { }, async forwardButtonAction() { await this.dispatchStoreAction(storeActions.RESET_SUBMITTED_STATE); + let zipCodeData; + if (this.isBigTruck) { + zipCodeData = await this.getZipCodeData(this.serviceZipCode); + + // check the location endpoint to verify this zip can service a heavy truck + var closestShops = await this.dispatchStoreActionWithLogging( + storeActions.GET_CLOSEST_APPLICABLE_SHOPS, + { zip: this.serviceZipCode, carId: this.carId }, + "vehicle" + ); + if (!closestShops?.data?.providers || closestShops.data.providers.length === 0) { + this.displayNoServiceAlert = true; + if (store.getters.externalParameterState?.isExternalParameter) { + return baseMixin.methods.ResetExternalParamsAndHideModal(); + } + return this.$refs.navbar.removeLoader(); + } + } + + if (zipCodeData) { + await this.dispatchStoreAction( + storeActions.SAVE_SERVICE_ZIP_CODE_INFO, + { + zipCode: this.serviceZipCode, + state: zipCodeData.state, + zipCodeCtu: zipCodeData.zipCodeCtu, + }, + false + ); + } + this.dispatchStoreAction( storeActions.SAVE_VEHICLE, { @@ -506,34 +537,6 @@ export default { false ); - if (this.isBigTruck) { - const zipCodeData = await this.getZipCodeData(this.serviceZipCode); - await this.dispatchStoreAction( - storeActions.SAVE_SERVICE_ZIP_CODE_INFO, - { - zipCode: this.serviceZipCode, - state: zipCodeData.state, - zipCodeCtu: zipCodeData.zipCodeCtu, - }, - false - ); - - // check the location endpoint to verify this zip can service a heavy truck - var closestShops = await this.dispatchStoreActionWithLogging( - storeActions.GET_CLOSEST_APPLICABLE_SHOPS, - { zip: this.serviceZipCode, carId: this.carId }, - "vehicle" - ); - - if (!closestShops || closestShops.data?.providers?.length === 0) { - this.displayNoServiceAlert = true; - if (store.getters.externalParameterState?.isExternalParameter) { - return baseMixin.methods.ResetExternalParamsAndHideModal(); - } - return this.$refs.navbar.removeLoader(); - } - } - this.$router.navigateWithSaving( this.navigationScenarios.CLICKED_FORWARD, this.pageName