WIP
This commit is contained in:
parent
82e6d7c305
commit
4d8dc49f97
6 changed files with 92 additions and 46 deletions
|
|
@ -78,6 +78,10 @@ const endpoints = {
|
|||
url: "/parts/api/v1/parts/mobile-fee",
|
||||
method: "GET",
|
||||
},
|
||||
GetServiceabilityDetails: {
|
||||
url: "/location/serviceability-details",
|
||||
method: "GET",
|
||||
},
|
||||
GetSupportingItems: {
|
||||
url: "/parts/api/v1/parts/supporting-items",
|
||||
method: "POST",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ export async function getPricedMobileFeePart(serviceZipCode) {
|
|||
}
|
||||
|
||||
export async function getServiceabilityDetails(serviceZipCode, lineItems) {
|
||||
|
||||
// Get the Mobile Fee Part
|
||||
const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.GET_SERVICEABILITY_DETAILS,
|
||||
|
|
@ -40,6 +39,6 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) {
|
|||
},
|
||||
false
|
||||
);
|
||||
const temp = Promise.resolve(serviceabilityDetails)
|
||||
|
||||
return Promise.resolve(serviceabilityDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default {
|
|||
default: () => ({}),
|
||||
},
|
||||
isZipServiceableMobile: Boolean,
|
||||
isZipServiceableInShop: Boolean,
|
||||
isZipServiceableInshop: Boolean,
|
||||
linkWidgetName: String,
|
||||
modalWidgetName: String,
|
||||
alertNonServiceableZipWidgetName: String,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
alertClass="alert-warning" />
|
||||
<serviceTypeQuestion
|
||||
v-model="selectedServiceType"
|
||||
:isGlassServiceableInshop="isGlassServiceableInshop"
|
||||
:isRecalibrationServiceableInshop="isRecalibrationServiceableInshop"
|
||||
:isGlassServiceableMobile="isGlassServiceableMobile"
|
||||
:isRecalibrationServiceableMobile="isRecalibrationServiceableMobile"
|
||||
ref="serviceTypeQuestion"
|
||||
groupName="ServiceTypeQuestion"
|
||||
cmsWidgetName="ServiceTypeQuestionWidget"
|
||||
|
|
@ -76,8 +80,8 @@ export default {
|
|||
state: this.getServiceStateFromStore(),
|
||||
zipCode: this.getServiceZipCodeFromStore(),
|
||||
isVehicleProtected: null,
|
||||
isGlassServiceableInShop: null,
|
||||
isRecalibrationServiceableInShop: null,
|
||||
isGlassServiceableInshop: null,
|
||||
isRecalibrationServiceableInshop: null,
|
||||
isGlassServiceableMobile: null,
|
||||
isRecalibrationServiceableMobile: null,
|
||||
mobileFeePart: null,
|
||||
|
|
@ -199,12 +203,7 @@ export default {
|
|||
}
|
||||
|
||||
if (serviceabilityDetails) {
|
||||
this.isGlassServiceableInShop = serviceabilityDetails.isGlassServiceableInShop;
|
||||
this.isRecalibrationServiceableInShop =
|
||||
serviceabilityDetails.isRecalibrationServiceableInShop;
|
||||
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
|
||||
this.isRecalibrationServiceableMobile =
|
||||
serviceabilityDetails.isRecalibrationServiceableMobile;
|
||||
this.setServiceabilityDetails(serviceabilityDetails);
|
||||
}
|
||||
|
||||
if (mobileFeePart) {
|
||||
|
|
@ -233,6 +232,14 @@ export default {
|
|||
|
||||
this.isVehicleProtected = null;
|
||||
},
|
||||
setServiceabilityDetails(serviceabilityDetails) {
|
||||
this.isGlassServiceableInshop = serviceabilityDetails.isGlassServiceableInshop;
|
||||
this.isRecalibrationServiceableInshop =
|
||||
serviceabilityDetails.isRecalibrationServiceableInshop;
|
||||
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
|
||||
this.isRecalibrationServiceableMobile =
|
||||
serviceabilityDetails.isRecalibrationServiceableMobile;
|
||||
},
|
||||
backButtonAction() {
|
||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
|
|
@ -241,13 +248,23 @@ export default {
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
zipCode(current, previous) {
|
||||
if (current !== previous) {
|
||||
baseMixin.methods.getZipCodeData(current).then((r) => {
|
||||
this.zipContainsMilitaryBase = r.containsMilitaryBase;
|
||||
zipCode: {
|
||||
async handler(newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
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: {
|
||||
alert,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ export default {
|
|||
validationRules: String,
|
||||
cmsWidgetName: String,
|
||||
isGlassServiceableMobile: Boolean,
|
||||
isGlassServiceableInShop: Boolean,
|
||||
isRecalibrationServiceableInShop: Boolean,
|
||||
isGlassServiceableInshop: Boolean,
|
||||
isRecalibrationServiceableInshop: Boolean,
|
||||
isRecalibrationServiceableMobile: Boolean,
|
||||
},
|
||||
setup() {
|
||||
|
|
@ -49,40 +49,54 @@ export default {
|
|||
},
|
||||
answersToDisplay() {
|
||||
let filteredAnswers;
|
||||
if (
|
||||
this.isGlassServiceableMobile &&
|
||||
this.isRecalibrationServiceableMobile &&
|
||||
this.isGlassServiceableInShop &&
|
||||
this.isRecalibrationServiceableInShop
|
||||
) {
|
||||
if (this.serviceability == "All") {
|
||||
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
|
||||
) {
|
||||
} else if (this.serviceability == "MobileOnly") {
|
||||
filteredAnswers = this.answersFromCms.filter((answer) => answer.Name == "Mobile");
|
||||
} else if (
|
||||
!this.isGlassServiceableInShop &&
|
||||
!this.isRecalibrationServiceableInShop &&
|
||||
!this.isGlassServiceableMobile &&
|
||||
!this.isRecalibrationServiceableMobile
|
||||
) {
|
||||
} else if (this.serviceability == "InshopOnly") {
|
||||
filteredAnswers = this.answersFromCms.filter(
|
||||
(answer) => answer.Name == "Inshop" || answer.Name == "DropOff"
|
||||
);
|
||||
} else if (this.serviceability == "None") {
|
||||
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: {
|
||||
get: function () {
|
||||
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: {
|
||||
buttonQuestion,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -931,8 +931,9 @@ export const actions = {
|
|||
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/4fe1fb89-dd56-4e4a-9af2-96bd1ab77847", // ForcedInshop
|
||||
//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
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue