WIP
This commit is contained in:
parent
1db55ced76
commit
09ed0819ff
2 changed files with 81 additions and 1 deletions
44
src/helpers/service-location-helper.js
Normal file
44
src/helpers/service-location-helper.js
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { useMainStore } from '@/store';
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
|
export async function getPricedMobileFeePart(serviceZipCode) {
|
||||||
|
if (!serviceZipCode) {
|
||||||
|
return Promise.resolve(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const zipCodeData = await baseMixin.methods.getZipCodeData(serviceZipCode);
|
||||||
|
|
||||||
|
// Get the Mobile Fee Part
|
||||||
|
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
|
||||||
|
useMainStore.GET_MOBILE_FEE_PART,
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get the Mobile Fee Part Price
|
||||||
|
const pricingResults = await baseMixin.methods.dispatchStoreAction(
|
||||||
|
useMainStore.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
|
{
|
||||||
|
availableLineItems: [mobileFeePart.data],
|
||||||
|
serviceZipCode: serviceZipCode,
|
||||||
|
serviceZipCodeCtu: zipCodeData.zipCodeCtu,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
return Promise.resolve(pricingResults[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getServiceabilityDetails(serviceZipCode, lineItems) {
|
||||||
|
// Get the Mobile Fee Part
|
||||||
|
const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction(
|
||||||
|
useMainStore.GET_SERVICEABILITY_DETAILS,
|
||||||
|
{
|
||||||
|
serviceZipCode: serviceZipCode,
|
||||||
|
lineItems: lineItems,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
return Promise.resolve(serviceabilityDetails);
|
||||||
|
}
|
||||||
|
|
@ -38,9 +38,14 @@ import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-que
|
||||||
import modal from "@/digital-components/modal/modal.vue"
|
import modal from "@/digital-components/modal/modal.vue"
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
|
||||||
|
// import {
|
||||||
|
// getPricedMobileFeePart,
|
||||||
|
// getServiceabilityDetails,
|
||||||
|
// } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
emits: ["update:modalValue"],
|
emits: ["update:modalValue", "updated-mobile-fee-part", "updated-contains-military-base"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalModel: this.copyModel(this.modelValue),
|
internalModel: this.copyModel(this.modelValue),
|
||||||
|
|
@ -56,6 +61,10 @@ export default {
|
||||||
serviceZipState: "",
|
serviceZipState: "",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
mobileFeePart: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
modalWidgetName: String,
|
modalWidgetName: String,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
|
@ -119,6 +128,33 @@ export default {
|
||||||
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
||||||
this.resetsOnZipInput();
|
this.resetsOnZipInput();
|
||||||
},
|
},
|
||||||
|
// async setZipCode() {
|
||||||
|
// if (this.internalModel.serviceZip !== this.modelValue.serviceZip) {
|
||||||
|
// this.resetAlerts();
|
||||||
|
// const zipCodeData = await this.getZipCodeData(this.internalModel.serviceZip);
|
||||||
|
// if (!zipCodeData.isValid) {
|
||||||
|
// this.displayInvalidZipAlert = true;
|
||||||
|
// this.focusOnZipInput();
|
||||||
|
// this.resetModalButtonStyle();
|
||||||
|
// } else {
|
||||||
|
// this.internalModel.serviceZipState = zipCodeData.serviceZipState;
|
||||||
|
// // retrieve mobile fee part
|
||||||
|
// const serviceZipCode = this.internalModel.serviceZip;
|
||||||
|
// const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
||||||
|
// // retrieve serviceability details
|
||||||
|
// const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode);
|
||||||
|
// // update content related to service zip code
|
||||||
|
// this.$emit("updated-mobile-fee-part", mobileFeePart);
|
||||||
|
// this.$emit("updated-serviceability", serviceabilityDetails.data);
|
||||||
|
// this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
|
||||||
|
// // Update the page level model
|
||||||
|
// this.$emit("update:modelValue", this.internalModel);
|
||||||
|
// this.closeModal();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// this.closeModal();
|
||||||
|
// }
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue