This commit is contained in:
Leah Schumann 2023-03-15 09:47:20 -04:00
parent 82e6d7c305
commit 4d8dc49f97
6 changed files with 92 additions and 46 deletions

View file

@ -78,6 +78,10 @@ const endpoints = {
url: "/parts/api/v1/parts/mobile-fee", url: "/parts/api/v1/parts/mobile-fee",
method: "GET", method: "GET",
}, },
GetServiceabilityDetails: {
url: "/location/serviceability-details",
method: "GET",
},
GetSupportingItems: { GetSupportingItems: {
url: "/parts/api/v1/parts/supporting-items", url: "/parts/api/v1/parts/supporting-items",
method: "POST", method: "POST",

View file

@ -30,7 +30,6 @@ export async function getPricedMobileFeePart(serviceZipCode) {
} }
export async function getServiceabilityDetails(serviceZipCode, lineItems) { export async function getServiceabilityDetails(serviceZipCode, lineItems) {
// Get the Mobile Fee Part // Get the Mobile Fee Part
const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction( const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_SERVICEABILITY_DETAILS, storeActions.GET_SERVICEABILITY_DETAILS,
@ -40,6 +39,6 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) {
}, },
false false
); );
const temp = Promise.resolve(serviceabilityDetails)
return Promise.resolve(serviceabilityDetails); return Promise.resolve(serviceabilityDetails);
} }

View file

@ -90,7 +90,7 @@ export default {
default: () => ({}), default: () => ({}),
}, },
isZipServiceableMobile: Boolean, isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean, isZipServiceableInshop: Boolean,
linkWidgetName: String, linkWidgetName: String,
modalWidgetName: String, modalWidgetName: String,
alertNonServiceableZipWidgetName: String, alertNonServiceableZipWidgetName: String,

View file

@ -19,6 +19,10 @@
alertClass="alert-warning" /> alertClass="alert-warning" />
<serviceTypeQuestion <serviceTypeQuestion
v-model="selectedServiceType" v-model="selectedServiceType"
:isGlassServiceableInshop="isGlassServiceableInshop"
:isRecalibrationServiceableInshop="isRecalibrationServiceableInshop"
:isGlassServiceableMobile="isGlassServiceableMobile"
:isRecalibrationServiceableMobile="isRecalibrationServiceableMobile"
ref="serviceTypeQuestion" ref="serviceTypeQuestion"
groupName="ServiceTypeQuestion" groupName="ServiceTypeQuestion"
cmsWidgetName="ServiceTypeQuestionWidget" cmsWidgetName="ServiceTypeQuestionWidget"
@ -76,8 +80,8 @@ export default {
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,
isRecalibrationServiceableMobile: null, isRecalibrationServiceableMobile: null,
mobileFeePart: null, mobileFeePart: null,
@ -199,12 +203,7 @@ export default {
} }
if (serviceabilityDetails) { if (serviceabilityDetails) {
this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop; this.setServiceabilityDetails(serviceabilityDetails);
this.isRecalibrationServiceableInShop =
serviceabilityDetails.isRecalibrationServiceableInShop;
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
this.isRecalibrationServiceableMobile =
serviceabilityDetails.isRecalibrationServiceableMobile;
} }
if (mobileFeePart) { if (mobileFeePart) {
@ -233,6 +232,14 @@ export default {
this.isVehicleProtected = null; this.isVehicleProtected = null;
}, },
setServiceabilityDetails(serviceabilityDetails) {
this.isGlassServiceableInshop = serviceabilityDetails.isGlassServiceableInshop;
this.isRecalibrationServiceableInshop =
serviceabilityDetails.isRecalibrationServiceableInshop;
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
this.isRecalibrationServiceableMobile =
serviceabilityDetails.isRecalibrationServiceableMobile;
},
backButtonAction() { backButtonAction() {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
@ -241,13 +248,23 @@ export default {
}, },
}, },
watch: { watch: {
zipCode(current, previous) { zipCode: {
if (current !== previous) { async handler(newValue, oldValue) {
baseMixin.methods.getZipCodeData(current).then((r) => { if (newValue !== oldValue) {
this.zipContainsMilitaryBase = r.containsMilitaryBase; baseMixin.methods.getZipCodeData(newValue).then((r) => {
this.zipContainsMilitaryBase = r.containsMilitaryBase;
});
}
const lineItems = store.getters.order.lineItems;
const serviceabilityDetails = await getServiceabilityDetails({
serviceZipCode: newValue,
lineItems: lineItems,
}); });
this.setServiceabilityDetails(serviceabilityDetails.data);
} }
}, }
}, },
components: { components: {
alert, alert,

View file

@ -29,8 +29,8 @@ export default {
validationRules: String, validationRules: String,
cmsWidgetName: String, cmsWidgetName: String,
isGlassServiceableMobile: Boolean, isGlassServiceableMobile: Boolean,
isGlassServiceableInShop: Boolean, isGlassServiceableInshop: Boolean,
isRecalibrationServiceableInShop: Boolean, isRecalibrationServiceableInshop: Boolean,
isRecalibrationServiceableMobile: Boolean, isRecalibrationServiceableMobile: Boolean,
}, },
setup() { setup() {
@ -49,40 +49,54 @@ export default {
}, },
answersToDisplay() { answersToDisplay() {
let filteredAnswers; let filteredAnswers;
if ( if (this.serviceability == "All") {
this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile &&
this.isGlassServiceableInShop &&
this.isRecalibrationServiceableInShop
) {
filteredAnswers = this.answersFromCms; filteredAnswers = this.answersFromCms;
} else if ( } else if (this.serviceability == "MobileOnly") {
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"); filteredAnswers = this.answersFromCms.filter((answer) => answer.Name == "Mobile");
} else if ( } else if (this.serviceability == "InshopOnly") {
!this.isGlassServiceableInShop && filteredAnswers = this.answersFromCms.filter(
!this.isRecalibrationServiceableInShop && (answer) => answer.Name == "Inshop" || answer.Name == "DropOff"
!this.isGlassServiceableMobile && );
!this.isRecalibrationServiceableMobile } else if (this.serviceability == "None") {
) {
filteredAnswers = []; filteredAnswers = [];
} }
return filteredAnswers; return filteredAnswers;
}, },
serviceability() {
let result;
if (
this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile &&
this.isGlassServiceableInshop &&
this.isRecalibrationServiceableInshop
) {
result = "All";
} else if (
!this.isGlassServiceableInshop &&
!this.isRecalibrationServiceableInshop &&
this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile
) {
result = "MobileOnly"
} else if (
this.isGlassServiceableInshop &&
this.isRecalibrationServiceableInshop &&
!this.isGlassServiceableMobile &&
!this.isRecalibrationServiceableMobile
) {
result = "InshopOnly"
} else if (
!this.isGlassServiceableInshop &&
!this.isRecalibrationServiceableInshop &&
!this.isGlassServiceableMobile &&
!this.isRecalibrationServiceableMobile
) {
result = "None"
}
return result;
},
selectedValues: { selectedValues: {
get: function () { get: function () {
return this.modelValue; return this.modelValue;
@ -92,6 +106,17 @@ export default {
}, },
}, },
}, },
watch: {
serviceability: {
handler(newValue, oldValue) {
if (newValue == "MobileOnly") {
this.selectedValues = "Mobile";
} else {
this.selectedValues = null;
}
}
}
},
components: { components: {
buttonQuestion, buttonQuestion,
}, },

View file

@ -931,8 +931,9 @@ export const actions = {
method: endpoints.GetServiceabilityDetails.method, method: endpoints.GetServiceabilityDetails.method,
//TODO: Remove Mocky Endpoints //TODO: Remove Mocky Endpoints
//endpoint: "https://run.mocky.io/v3/59e1a644-cf16-4f08-8069-1ab2a1e38f79", // NoShopsAvailable //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/4fe1fb89-dd56-4e4a-9af2-96bd1ab77847", // ForcedInshop
//endpoint: "https://run.mocky.io/v3/e2eaa097-6ea5-4906-af53-901edaa94939", // ForcedMobile //endpoint: "https://run.mocky.io/v3/e2eaa097-6ea5-4906-af53-901edaa94939", // ForcedMobile
endpoint: "https://run.mocky.io/v3/1811a1fe-12a7-48f3-939e-d10a9b77dd25", // All Options
}); });
}, },