diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index d5967f8c0..5120685bc 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -60,7 +60,7 @@ import baseMixin from "@/mixins/base-mixin.js"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; -import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { getPricedMobileFeePart, getServiceabilityDetails } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; import store from "@/store"; export default { @@ -72,7 +72,7 @@ export default { city: this.getServiceCityFromStore(), state: this.getServiceStateFromStore(), zipCode: this.getServiceZipCodeFromStore(), - isVehicleProtected: null, + isVehicleProtected: null, isGlassServiceableInShop: null, isRecalibrationServiceableInShop: null, isGlassServiceableMobile: null, @@ -85,7 +85,7 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - + const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode); const lineItems = store.getters.order.lineItems; @@ -131,7 +131,11 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - vm.setData(resultMap.zipCodeData, resultMap.serviceabilityDetails, resultMap.mobileFeePart); + vm.setData( + resultMap.zipCodeData, + resultMap.serviceabilityDetails, + resultMap.mobileFeePart + ); }); }, computed: { @@ -186,16 +190,18 @@ export default { store.getters.payment.isInsurance !== null ); }, - setData(zipCodeData, mobileFeePart) { + setData(zipCodeData, serviceabilityDetails, mobileFeePart) { if (zipCodeData) { this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase; } if (serviceabilityDetails) { this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop; - this.isRecalibrationServiceableInShop = serviceabilityDetails.isRecalibrationServiceableInShop; + this.isRecalibrationServiceableInShop = + serviceabilityDetails.isRecalibrationServiceableInShop; this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile; - this.isRecalibrationServiceableMobile = serviceabilityDetails.isRecalibrationServiceableMobile; + this.isRecalibrationServiceableMobile = + serviceabilityDetails.isRecalibrationServiceableMobile; } if (mobileFeePart) { diff --git a/src/layouts/service-location/service-type-question/service-type-question.vue b/src/layouts/service-location/service-type-question/service-type-question.vue index 5dda61d71..f3f73415e 100644 --- a/src/layouts/service-location/service-type-question/service-type-question.vue +++ b/src/layouts/service-location/service-type-question/service-type-question.vue @@ -49,12 +49,36 @@ export default { }, answersToDisplay() { let filteredAnswers; - if (this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile && this.isGlassServiceableInShop && this.isRecalibrationServiceableInShop) { + if ( + this.isGlassServiceableMobile && + this.isRecalibrationServiceableMobile && + this.isGlassServiceableInShop && + this.isRecalibrationServiceableInShop + ) { filteredAnswers = this.answersFromCms; - } else if (this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile && !this.isGlassServiceableInShop && !this.isRecalibrationServiceableInShop) { - filteredAnswers = this.answersFromCms.filter(answer => answer.Name == "InShop" || answer.Name == "DropOff"); - } else if (this.isGlassServiceableInShop && this.isRecalibrationServiceableInShop && !this.isGlassServiceableMobile && !this.isRecalibrationServiceableMobile) { - filteredAnswers = this.answersFromCms.filter(answer => answer.Name == "Mobile"); + } else if ( + this.isGlassServiceableMobile && + this.isRecalibrationServiceableMobile && + !this.isGlassServiceableInShop && + !this.isRecalibrationServiceableInShop + ) { + filteredAnswers = this.answersFromCms.filter( + (answer) => answer.Name == "InShop" || answer.Name == "DropOff" + ); + } else if ( + this.isGlassServiceableInShop && + this.isRecalibrationServiceableInShop && + !this.isGlassServiceableMobile && + !this.isRecalibrationServiceableMobile + ) { + filteredAnswers = this.answersFromCms.filter((answer) => answer.Name == "Mobile"); + } else if ( + !this.isGlassServiceableInShop && + !this.isRecalibrationServiceableInShop && + !this.isGlassServiceableMobile && + !this.isRecalibrationServiceableMobile + ) { + filteredAnswers = []; } return filteredAnswers; diff --git a/src/store/index.js b/src/store/index.js index 9458b993d..1cdd77e80 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -926,6 +926,16 @@ export const actions = { }); }, + getServiceabilityDetails(context, { serviceZipCode, lineItems }) { + return globalMethods.callMockHttpClient({ + method: endpoints.GetServiceabilityDetails.method, + //TODO: Remove Mocky Endpoints + endpoint: "https://run.mocky.io/v3/59e1a644-cf16-4f08-8069-1ab2a1e38f79", // NoShopsAvailable + //endpoint: "https://run.mocky.io/v3/4fe1fb89-dd56-4e4a-9af2-96bd1ab77847" // ForcedInShop + //endpoint: "https://run.mocky.io/v3/e2eaa097-6ea5-4906-af53-901edaa94939", // ForcedMobile + }); + }, + getSupportingItems(context) { const glassPartsArray = context.getters.lineItems.glassParts ?? []; const carId = context.getters.vehicle.carId;