Mobile fee display and additional functional

This commit is contained in:
Leah Schumann 2023-02-24 08:57:04 -05:00
parent 2d01671fef
commit cb917807e7
4 changed files with 83 additions and 39 deletions

View file

@ -4,7 +4,6 @@
for="mobileLocationLinkPromptId" for="mobileLocationLinkPromptId"
:aria-label="mobileLocationLinkPromptText" :aria-label="mobileLocationLinkPromptText"
class="form-label fw-bold w-100 ps-4 pe-4 pt-4" class="form-label fw-bold w-100 ps-4 pe-4 pt-4"
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
v-html="mobileLocationLinkPromptText"></label> v-html="mobileLocationLinkPromptText"></label>
<div class="update-mobile-location-text-link"> <div class="update-mobile-location-text-link">
<textLink <textLink
@ -63,6 +62,7 @@ export default {
return { return {
internalModel: this.copyModel(this.modelValue), internalModel: this.copyModel(this.modelValue),
displayInvalidZipAlert: false, displayInvalidZipAlert: false,
modalName: "MobileLocationModalWidget",
mobileFee: "", mobileFee: "",
}; };
}, },
@ -78,26 +78,22 @@ export default {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
serviceZipCode: ""
}), }),
}, },
isZipServiceableMobile: Boolean, isZipServiceableMobile: Boolean,
isZipServiceableInShop: Boolean, isZipServiceableInShop: Boolean,
serviceZipCode: String,
linkWidgetName: String, linkWidgetName: String,
modalWidgetName: String, modalWidgetName: String,
mobileFeeDisclaimerWidgetName: String,
workspaceRequirementsWidgetName: String,
alertNonServiceableZipWidgetName: String, alertNonServiceableZipWidgetName: String,
alertInvalidZipWidgetName: String, alertInvalidZipWidgetName: String,
}, },
async mounted() { mounted() {
this.mobileFee = await this.getMobileFee(); this.getMobileFee().then((result) => {
this.mobileFee = result;
});
}, },
computed: { computed: {
mobileFeeText() {
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
},
mobileLocationLinkPromptText() { mobileLocationLinkPromptText() {
return this.getCmsContent(this.linkWidgetName, "HeaderText"); return this.getCmsContent(this.linkWidgetName, "HeaderText");
}, },
@ -119,12 +115,13 @@ export default {
modalHeaderText() { modalHeaderText() {
return this.getCmsContent(this.modalWidgetName, "HeaderText"); return this.getCmsContent(this.modalWidgetName, "HeaderText");
}, },
mobileFeeText() {
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
},
modalFooterText() { modalFooterText() {
return this.getCmsContent(this.modalWidgetName, "FooterText"); return this.getCmsContent(this.modalWidgetName, "FooterText");
}, },
modalName() {
return this.modalWidgetName;
},
addressModel: { addressModel: {
get: function () { get: function () {
return this.modelValue.addressQuestions; return this.modelValue.addressQuestions;
@ -143,12 +140,25 @@ export default {
zipCode: modelToCopy.addressQuestions.zipCode, zipCode: modelToCopy.addressQuestions.zipCode,
}, },
isVehicleProtected: modelToCopy.isVehicleProtected, isVehicleProtected: modelToCopy.isVehicleProtected,
isZipServiceableMobile: modelToCopy.isZipServiceableMobile, serviceZipCode: modelToCopy.serviceZipCode
isZipServiceableInShop: modelToCopy.isZipServiceableInShop,
}; };
}, },
setServiceZipCode(serviceZipCode) {
this.internalModel.serviceZipCode = serviceZipCode;
},
getServiceZipCodeFromStore() {
return this.$store.getters.order.serviceLocation.zipCode;
},
async getMobileFee() { async getMobileFee() {
if (!this.internalModel.serviceZipCode) {
return "";
}
const zipCodeData = await this.getZipCodeData(this.internalModel.serviceZipCode);
// Get the Mobile Fee Part // Get the Mobile Fee Part
const mobileFeePart = await baseMixin.methods.dispatchStoreAction( const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_FEE_PART, storeActions.GET_MOBILE_FEE_PART,
@ -159,7 +169,11 @@ export default {
// Get the Mobile Fee Part Price // Get the Mobile Fee Part Price
const pricingResults = await baseMixin.methods.dispatchStoreAction( const pricingResults = await baseMixin.methods.dispatchStoreAction(
storeActions.PRICE_ORDER_ITEMS, storeActions.PRICE_ORDER_ITEMS,
[mobileFeePart.data], {
availableLineItems: [mobileFeePart.data],
serviceZipCode: zipCodeData.zipCode,
zipCodeCtu: zipCodeData.zipCodeCtu
},
false false
); );
@ -206,8 +220,16 @@ export default {
this.displayInvalidZipAlert = true; this.displayInvalidZipAlert = true;
} else { } else {
// Update the page level model // Update the page level model
this.internalModel.serviceZipCode = this.internalModel.addressQuestions.zipCode;
this.$emit("update:modelValue", this.internalModel); this.$emit("update:modelValue", this.internalModel);
// Emit the update service zip code information to the parent to update the service zipcode details
this.$emit("updated-zip-code", {
zipCode: this.internalModel.addressQuestions.zipCode,
state: zipCodeData.state,
isServiceable: zipCodeData.isServiceable
});
this.closeModal(); this.closeModal();
} }
}, },
@ -216,6 +238,11 @@ export default {
modelValue(newValue) { modelValue(newValue) {
this.internalModel = this.copyModel(newValue); this.internalModel = this.copyModel(newValue);
}, },
"modelValue.serviceZipCode": {
async handler(newValue) {
this.mobileFee = await this.getMobileFee(newValue);
},
},
}, },
components: { components: {
textLink, textLink,

View file

@ -6,18 +6,15 @@
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" /> <funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
<serviceZipModalQuestion <serviceZipModalQuestion
v-model="serviceZipCodeQuestion" v-model="serviceZipCodeQuestion"
@service-zip-updated="resetMobileLocation" ref="serviceZipCodeQuestion"
linkWidgetName="ServiceZipLinkWidget" linkWidgetName="ServiceZipLinkWidget"
modalWidgetName="ServiceZipModalWidget" modalWidgetName="ServiceZipModalWidget" />
textboxQuestionWidgetName="ServiceZipQuestionWidget"
alertInvalidZipWidgetName="AlertInvalidZipWidget" />
<mobileLocationModalQuestions <mobileLocationModalQuestions
v-model="mobileLocationQuestions" v-model="mobileLocationQuestions"
@updated-zip-code="resetServiceZipCode"
ref="mobileLocationModalQuestions" ref="mobileLocationModalQuestions"
linkWidgetName="MobileLocationLinkWidget" linkWidgetName="MobileLocationLinkWidget"
modalWidgetName="MobileLocationModalWidget" modalWidgetName="MobileLocationModalWidget" />
mobileFeeDisclaimerWidgetName="MobileFeeDisclaimerWidget"
workspaceRequirementsWidgetName="WorkspaceRequirementsWidget" />
<funnel-footer <funnel-footer
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
ref="funnelFooter" ref="funnelFooter"
@ -40,7 +37,6 @@ import { Form } from "vee-validate";
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 store from "@/store";
export default { export default {
name: "service-location", name: "service-location",
@ -62,6 +58,7 @@ export default {
zipCode: this.getRegistrationZipFromStore(), zipCode: this.getRegistrationZipFromStore(),
}, },
isVehicleProtected: null, isVehicleProtected: null,
serviceZipCode: this.getServiceZipCodeFromStore(),
}, },
}; };
}, },
@ -111,7 +108,7 @@ export default {
getIsServiceableFromStore() { getIsServiceableFromStore() {
return this.$store.getters.order.serviceLocation.isServiceable; return this.$store.getters.order.serviceLocation.isServiceable;
}, },
resetMobileLocation() { resetMobileLocation(updatedServiceZipCode) {
this.mobileLocationQuestions = { this.mobileLocationQuestions = {
addressQuestions: { addressQuestions: {
streetAddress: "", streetAddress: "",
@ -121,10 +118,16 @@ export default {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
serviceZipCode: updatedServiceZipCode,
}; };
this.$refs.mobileLocationModalQuestions.resetComponent(); this.$refs.mobileLocationModalQuestions.resetComponent();
}, },
resetServiceZipCode(newValue) {
this.serviceZipCodeQuestion.state = newValue.state;
this.serviceZipCodeQuestion.zipCode = newValue.zipCode;
this.serviceZipCodeQuestion.isServiceable = newValue.isServiceable;
},
backButtonAction() { backButtonAction() {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
@ -132,6 +135,15 @@ export default {
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
}, },
}, },
watch: {
serviceZipCodeQuestion: {
handler(newValue, oldValue) {
if (newValue !== oldValue) {
this.resetMobileLocation(newValue.zipCode);
}
},
},
},
components: { components: {
serviceZipModalQuestion, serviceZipModalQuestion,
mobileLocationModalQuestions, mobileLocationModalQuestions,

View file

@ -138,11 +138,6 @@ export default {
this.internalModel.state = zipCodeData.state; this.internalModel.state = zipCodeData.state;
this.internalModel.isServiceable = zipCodeData.isServiceable; this.internalModel.isServiceable = zipCodeData.isServiceable;
// Notify the page that the service zip has been updated to clear Mobile Location form
if (this.internalModel.zipCode !== this.modelValue.zipCode) {
this.$emit("service-zip-updated");
}
// Update the page level model // Update the page level model
this.$emit("update:modelValue", this.internalModel); this.$emit("update:modelValue", this.internalModel);
@ -151,14 +146,14 @@ export default {
}, },
}, },
watch: { watch: {
modelValue(newValue) {
this.internalModel = this.copyModel(newValue);
},
"internalModel.zipCode": { "internalModel.zipCode": {
handler() { handler() {
this.resetsOnZipInput(); this.resetsOnZipInput();
}, },
}, },
modelValue(newValue) {
this.internalModel = this.copyModel(newValue);
},
}, },
components: { components: {
textLink, textLink,

View file

@ -1423,24 +1423,34 @@ export const actions = {
context.commit(storeMutations.UPDATE_VAPS, vaps); context.commit(storeMutations.UPDATE_VAPS, vaps);
}, },
// Price order actions // Price order actions
async priceOrderItems(context, availableLineItems) { async priceOrderItems(context, { availableLineItems, serviceZipCode, ctu }) {
const zipCodeToUse = serviceZipCode
? serviceZipCode
: context.getters.order.serviceLocation.zipCode;
const ctuToUse = ctu ? ctu : context.getters.order.serviceLocation.zipCodeCtu;
const availableLineItemsFormattedForRequest = const availableLineItemsFormattedForRequest =
getLineItemQueryStringForPricing(availableLineItems); getLineItemQueryStringForPricing(availableLineItems);
const vehicle = context.getters.order.vehicle; const vehicle = context.getters.order.vehicle;
let queryString = let queryString =
`ParentAccountNumber=${applicationConfig.CASH_ACCOUNT_NUMBER}` + `ParentAccountNumber=${applicationConfig.CASH_ACCOUNT_NUMBER}` +
`&CTU=${context.getters.order.serviceLocation.zipCodeCtu}` + `&CTU=${ctuToUse}` +
`&CarId=${vehicle.carId}` + `&CarId=${vehicle.carId}` +
`&Make=${vehicle.make}` + `&Make=${vehicle.make}` +
`&Model=${vehicle.model}` + `&Model=${vehicle.model}` +
`&Year=${vehicle.year}` + `&Year=${vehicle.year}` +
`&EON=${context.getters.order.eon}` + `&EON=${context.getters.order.eon}` +
`&ZipCode=${context.getters.order.serviceLocation.zipCode}` + `&ZipCode=${zipCodeToUse}` +
`${availableLineItemsFormattedForRequest}`; `${availableLineItemsFormattedForRequest}`;
const lineItemServerData = context.getters.order.lineItems.serverData; const lineItemServerData = context.getters.order.lineItems.serverData;
if (lineItemServerData) { if (lineItemServerData) {
queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`; queryString += `&ServerData=${encodeURIComponent(lineItemServerData)}`;
} }
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.PriceOrderItems.method, method: endpoints.PriceOrderItems.method,
endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`, endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`,