This commit is contained in:
Leah Schumann 2023-03-15 08:27:37 -04:00
parent f8dc7f12f8
commit 1a1cfc426a
3 changed files with 52 additions and 12 deletions

View file

@ -60,7 +60,7 @@ import baseMixin from "@/mixins/base-mixin.js";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-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"; import store from "@/store";
export default { export default {
@ -72,7 +72,7 @@ export default {
city: this.getServiceCityFromStore(), city: this.getServiceCityFromStore(),
state: this.getServiceStateFromStore(), state: this.getServiceStateFromStore(),
zipCode: this.getServiceZipCodeFromStore(), zipCode: this.getServiceZipCodeFromStore(),
isVehicleProtected: null, isVehicleProtected: null,
isGlassServiceableInShop: null, isGlassServiceableInShop: null,
isRecalibrationServiceableInShop: null, isRecalibrationServiceableInShop: null,
isGlassServiceableMobile: null, isGlassServiceableMobile: null,
@ -85,7 +85,7 @@ export default {
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode); const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
const lineItems = store.getters.order.lineItems; const lineItems = store.getters.order.lineItems;
@ -131,7 +131,11 @@ export default {
// Call the "next" function to complete the transition to this page. // Call the "next" function to complete the transition to this page.
next((vm) => { next((vm) => {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
vm.setData(resultMap.zipCodeData, resultMap.serviceabilityDetails, resultMap.mobileFeePart); vm.setData(
resultMap.zipCodeData,
resultMap.serviceabilityDetails,
resultMap.mobileFeePart
);
}); });
}, },
computed: { computed: {
@ -186,16 +190,18 @@ export default {
store.getters.payment.isInsurance !== null store.getters.payment.isInsurance !== null
); );
}, },
setData(zipCodeData, mobileFeePart) { setData(zipCodeData, serviceabilityDetails, mobileFeePart) {
if (zipCodeData) { if (zipCodeData) {
this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase; this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase;
} }
if (serviceabilityDetails) { if (serviceabilityDetails) {
this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop; this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop;
this.isRecalibrationServiceableInShop = serviceabilityDetails.isRecalibrationServiceableInShop; this.isRecalibrationServiceableInShop =
serviceabilityDetails.isRecalibrationServiceableInShop;
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile; this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
this.isRecalibrationServiceableMobile = serviceabilityDetails.isRecalibrationServiceableMobile; this.isRecalibrationServiceableMobile =
serviceabilityDetails.isRecalibrationServiceableMobile;
} }
if (mobileFeePart) { if (mobileFeePart) {

View file

@ -49,12 +49,36 @@ export default {
}, },
answersToDisplay() { answersToDisplay() {
let filteredAnswers; let filteredAnswers;
if (this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile && this.isGlassServiceableInShop && this.isRecalibrationServiceableInShop) { if (
this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile &&
this.isGlassServiceableInShop &&
this.isRecalibrationServiceableInShop
) {
filteredAnswers = this.answersFromCms; filteredAnswers = this.answersFromCms;
} else if (this.isGlassServiceableMobile && this.isRecalibrationServiceableMobile && !this.isGlassServiceableInShop && !this.isRecalibrationServiceableInShop) { } else if (
filteredAnswers = this.answersFromCms.filter(answer => answer.Name == "InShop" || answer.Name == "DropOff"); this.isGlassServiceableMobile &&
} else if (this.isGlassServiceableInShop && this.isRecalibrationServiceableInShop && !this.isGlassServiceableMobile && !this.isRecalibrationServiceableMobile) { this.isRecalibrationServiceableMobile &&
filteredAnswers = this.answersFromCms.filter(answer => answer.Name == "Mobile"); !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; return filteredAnswers;

View file

@ -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) { getSupportingItems(context) {
const glassPartsArray = context.getters.lineItems.glassParts ?? []; const glassPartsArray = context.getters.lineItems.glassParts ?? [];
const carId = context.getters.vehicle.carId; const carId = context.getters.vehicle.carId;