diff --git a/src/fmg-components/funnel-footer/funnel-footer.vue b/src/fmg-components/funnel-footer/funnel-footer.vue index 2a6119681..f1900596b 100644 --- a/src/fmg-components/funnel-footer/funnel-footer.vue +++ b/src/fmg-components/funnel-footer/funnel-footer.vue @@ -34,6 +34,7 @@ import buttonMain from "@/ux-components/button-main/button-main"; export default { name: "funnelFooter", + emits: ["BackClicked", "ForwardClicked"], // <--- should remove oodles of warnings in dev tools props: { isForwardActionDisabled: Boolean, isBackButtonHidden: { type: Boolean, default: false }, diff --git a/src/fmg-components/funnel-header/menu-modal/menu-modal.vue b/src/fmg-components/funnel-header/menu-modal/menu-modal.vue index fd0c96cb8..cc06b2710 100644 --- a/src/fmg-components/funnel-header/menu-modal/menu-modal.vue +++ b/src/fmg-components/funnel-header/menu-modal/menu-modal.vue @@ -66,7 +66,7 @@
@@ -406,6 +405,11 @@ export default { } }, }, + modelValue: { + handler() { + this.setupAddressLookup(); + }, + }, }, components: { textboxQuestion, diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index f9529ccec..ba81a973f 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -1,13 +1,8 @@ import { storeActions } from "@/constants/store-actions"; import baseMixin from "@/mixins/base-mixin.js"; -export async function getPricedMobileFeePart( - serviceZipCode, - serviceType, - parentAccountNumber, - billToAccountNumber -) { - if (!serviceZipCode || !serviceType || !parentAccountNumber) { +export async function getPricedMobileFeePart(serviceZipCode) { + if (!serviceZipCode) { return Promise.resolve(null); } @@ -16,11 +11,7 @@ export async function getPricedMobileFeePart( // Get the Mobile Fee Part const mobileFeePart = await baseMixin.methods.dispatchStoreAction( storeActions.GET_MOBILE_FEE_PART, - { - serviceType: serviceType, - parentAccountNumber: parentAccountNumber, - billToAccountNumber: billToAccountNumber, - }, + null, false ); diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js index ab0ba6573..fbea693b9 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js @@ -93,6 +93,32 @@ const mockMixin = { }, }; +const mockGetPricedMobileFeePart = (mockServiceZipCode) => { + let mobileFeePart = {}; + + if (mockServiceZipCode === "43235") { + mobileFeePart = { + partNumber: "MOBILE FEE", + description: "MOBILE FEE", + partType: "FEE", + laborAmount: 49.99, + sellingPrice: 0, + kitPrice: 0, + }; + } + + return Promise.resolve(mobileFeePart); +}; + +jest.mock( + "@/layouts/service-location/helpers/service-location-helper/service-location-helper", + () => ({ + getPricedMobileFeePart: jest.fn((mockServiceZipCode) => { + return mockGetPricedMobileFeePart(mockServiceZipCode); + }), + }) +); + describe("mobile-location-modal-questions.vue", () => { it("Should copy the modelValue to the internalModel when the component is mounted", async () => { // Arrange diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index f504eeb30..ac1be453d 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -56,13 +56,15 @@ import modal from "@/digital-components/modal/modal"; import alert from "@/ux-components/alert/alert"; import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions"; import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question"; +import store from "@/store"; // Helpers import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "mobile-location-modal-questions", - emits: ["update:modelValue", "updated-zip-code"], // The component emits an event + emits: ["update:modelValue", "set-mobile-fee-part"], data() { return { internalModel: deepClone(this.modelValue), @@ -158,15 +160,13 @@ export default { values: { state: updatedServiceZipCodeInfo.state, zipCode: updatedServiceZipCodeInfo.zipCode, + isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected, }, }); }, resetModalButtonStyle() { this.$refs[this.modalName].resetButtonStyle(); }, - onAddressUpdated(updatedServiceZipCodeInfo) { - this.resetComponent(updatedServiceZipCodeInfo); - }, async setMobileLocation() { // Validate the Zip Code const zipCodeData = await this.getZipCodeData( @@ -177,6 +177,14 @@ export default { this.displayInvalidZipAlert = true; this.resetModalButtonStyle(); } else { + // retrieve mobile fee part + const serviceZipCode = this.internalModel.addressQuestions.zipCode; + + const mobileFeePart = await getPricedMobileFeePart(serviceZipCode); + + // emit it to parent + this.$emit("set-mobile-fee-part", mobileFeePart); + // Update the page level model this.$emit("update:modelValue", this.internalModel); this.closeModal(); @@ -189,8 +197,9 @@ export default { this.internalModel = deepClone(newValue); this.resetComponent({ - state: newValue.state, - zipCode: newValue.zipCode, + state: newValue.addressQuestions.state, + zipCode: newValue.addressQuestions.zipCode, + isVehicleProtected: newValue.isVehicleProtected, }); }, deep: true, diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index fbe7aa448..0653e91f0 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -41,6 +41,22 @@ jest.mock( }) ); +jest.spyOn(baseMixin.methods, "getZipCodeData").mockImplementation((serviceZipCode) => { + return new Promise((resolve) => { + let mockContainsMilitaryBase = false; + if (serviceZipCode === 45433 || serviceZipCode === "45433") { + mockContainsMilitaryBase = true; + } + resolve({ + containsMilitaryBase: mockContainsMilitaryBase, + isValid: true, + isServiceable: true, + state: "OH", + zipCodeCtu: "01820", + }); + }); +}); + jest.mock("@/store", () => ({ commit: jest.fn(), dispatch: jest.fn(), @@ -291,6 +307,24 @@ describe("service-location.vue", () => { // Assert expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions); }); + + test("displays military zip message when zip is updated", () => { + // Arrange + const { wrapper } = setupMocks({}); + wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn(); + expect(wrapper.vm.zipContainsMilitaryBase).toBe(false); + + const newServiceZipCodeQuestion = { + zipCode: "45433", + state: "OH", + }; + + // Assert + wrapper.setData({ zipCode: newServiceZipCodeQuestion.zipCode }); + wrapper.vm.$nextTick(() => { + expect(wrapper.vm.zipContainsMilitaryBase).toBe(true); + }); + }); }); describe("updating mobile location", () => { diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 84bdd31c9..105b8cdc1 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -8,6 +8,8 @@ +
@@ -36,6 +44,7 @@