From 72236e4ed35ab0b626196a33d4aaecb757dc24ca Mon Sep 17 00:00:00 2001 From: "US\\katie.kroell" Date: Thu, 13 Apr 2023 14:39:36 -0400 Subject: [PATCH 01/22] displau textLink with state and zip --- .../service-location/service-location.vue | 67 ++++++++++++++----- .../service-zip-modal-question.vue | 62 +++++++++++++++++ 2 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 36fe02e1..693084d7 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -4,7 +4,8 @@
- + { vm.setCmsContent(resultMap.cmsContent); }); }, + setup() { + const mainStore = useMainStore(); + return { mainStore }; + }, + data() { + return { + serviceZip: this.mainStore.order.customer.address.zipCode, + serviceZipState: this.mainStore.order.customer.address.state, + isServiceZipServiceable: null, + }; + }, computed: { questionText() { return this.getCmsContent("ServiceTypeQuestionWidget", "QuestionText"); }, answersFromCms() { return this.getCmsContent("ServiceTypeQuestionWidget", "Answers"); - }, + }, + serviceZipCodeQuestion: { + get: function() { + return { + serviceZip: this.serviceZip, + serviceZipState: this.serviceZipState, + }; + }, + set: function (newValue) { + if (newValue.serviceZip !== this.serviceZip) { + //this.resetMobileLocation(); + //this.selectedAppointmentType = null; + //this.providerNumber = null; + } + this.serviceZip = newValue.serviceZip; + this.serviceZipState = newValue.serviceZipState; + }, + } }, methods: { arePagePrerequisiteValid() { @@ -97,6 +124,14 @@ export default { async forwardButtonAction() {}, resetDependentState() {}, }, + components: { + siteFooter, + siteHeader, + siteSubHeader, + buttonQuestion, + Form, + serviceZipModalQuestion, + }, }; diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue new file mode 100644 index 00000000..1e990ae9 --- /dev/null +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -0,0 +1,62 @@ + + + + + From e10a366c3bc6fb2d7913c613f4bc5165c9b01131 Mon Sep 17 00:00:00 2001 From: "US\\katie.kroell" Date: Thu, 13 Apr 2023 16:42:22 -0400 Subject: [PATCH 02/22] WIP --- src/layouts/service-location/service-location.vue | 7 +++++-- .../service-zip-modal-question.vue | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 693084d7..69aaf3de 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -5,7 +5,10 @@
+ v-model="serviceZipCodeQuestion" + ref="serviceZipCodeQuestion" + linkWidgetName="ServiceZipLinkWidget" + modalWidgetName="ServiceZipModalWidget" /> From 1db55ced76b088cfeef67d71cf002b0776694f48 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 17 Apr 2023 14:36:19 -0400 Subject: [PATCH 04/22] modal content --- .../service-zip-modal-question.vue | 55 +++++++++++++++++-- .../service-zip-question.vue | 49 +++++++++++++++++ 2 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.vue diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index f332f983..78a50011 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -12,17 +12,31 @@
+ @footer-button-event="setZipCode" > + + + \ No newline at end of file From 09ed0819ff69d1a39a47324545a24f9100efd654 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 17 Apr 2023 16:16:00 -0400 Subject: [PATCH 05/22] WIP --- src/helpers/service-location-helper.js | 44 +++++++++++++++++++ .../service-zip-modal-question.vue | 38 +++++++++++++++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/helpers/service-location-helper.js diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js new file mode 100644 index 00000000..62b0f6db --- /dev/null +++ b/src/helpers/service-location-helper.js @@ -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); +} \ No newline at end of file diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index 78a50011..16491057 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -38,9 +38,14 @@ import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-que import modal from "@/digital-components/modal/modal.vue" import alert from "@/ux-components/alert/alert"; +// import { +// getPricedMobileFeePart, +// getServiceabilityDetails, +// } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; + export default { name: "service-zip-modal-question", - emits: ["update:modalValue"], + emits: ["update:modalValue", "updated-mobile-fee-part", "updated-contains-military-base"], data() { return { internalModel: this.copyModel(this.modelValue), @@ -56,6 +61,10 @@ export default { serviceZipState: "", }) }, + mobileFeePart: { + type: Object, + default: () => ({}), + }, modalWidgetName: String, }, setup() { @@ -119,6 +128,33 @@ export default { this.internalModel.serviceZip = this.modelValue.serviceZip; 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: { modelValue(newValue) { From 8ab399e91857284515993abe65bf8dbf0f22d962 Mon Sep 17 00:00:00 2001 From: Kroell Date: Tue, 18 Apr 2023 18:06:40 -0400 Subject: [PATCH 06/22] serviceability details method --- src/helpers/service-location-helper.js | 30 -------------------------- src/store/index.js | 13 ++++++++++- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js index 62b0f6db..9008a8c5 100644 --- a/src/helpers/service-location-helper.js +++ b/src/helpers/service-location-helper.js @@ -1,36 +1,7 @@ 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, { @@ -39,6 +10,5 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) { }, false ); - return Promise.resolve(serviceabilityDetails); } \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index 4b6ac5b6..2924666d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -433,7 +433,18 @@ export const useMainStore = defineStore({ capabilityAnswerResults: capabilityQuestionAnswersForPart, }, }); - }, + }, + + getServiceabilityDetails({ serviceZipCode }) { + const lineItems = this.order.lineItems; + const lineItemsToSend = [...lineItems.supportingItems]; + const encodedLineItems = encodeURIComponent(JSON.stringify(lineItemsToSend)); + return globalMethods.callHttpClient({ + method: endpoints.GetServiceabilityDetails.method, + endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&lineItems=${encodedLineItems}`, + }); + }, + lookupVehicleByVin(vin) { return globalMethods.callHttpClient({ method: endpoints.LookupVehicleByVin.method, From dae64e0ef4164be9b93607d7a763dd9e955d1598 Mon Sep 17 00:00:00 2001 From: Kroell Date: Wed, 19 Apr 2023 12:28:45 -0400 Subject: [PATCH 07/22] unit test for service-zip-question --- .../service-zip-question.spec.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js b/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js new file mode 100644 index 00000000..b3276a7a --- /dev/null +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question.spec.js @@ -0,0 +1,40 @@ +import { shallowMount } from "@vue/test-utils"; +import serviceZipQuestion from "./service-zip-question"; + +describe("service-zip-question.vue", () => { + it("Should get the modelValue", async () => { + // Arrange + const text = "test"; + const wrapper = shallowMount(serviceZipQuestion, { + props: { + modelValue: text, + }, + attachTo: document.body, + }); + + // Act + const modelValueText = wrapper.vm.value; + wrapper.vm.value = "test also"; + + // Assert + expect(modelValueText).toEqual("test"); + }); + + it("Should emit to set value", async () => { + // Arrange + const text = "test"; + const wrapper = shallowMount(serviceZipQuestion, { + props: { + modelValue: text, + }, + attachTo: document.body, + }); + + // Act + const modelValueText = wrapper.vm.value; + wrapper.vm.value = "test also"; + + // Assert + expect(wrapper.emitted("update:modelValue")).toEqual([["test also"]]); + }); +}); \ No newline at end of file From 5ed736cf3514535f9524c3c160d20d3e72fe3467 Mon Sep 17 00:00:00 2001 From: Kroell Date: Wed, 19 Apr 2023 12:29:25 -0400 Subject: [PATCH 08/22] serviceability details --- src/constants/endpoints.js | 6 +++++- src/helpers/service-location-helper.js | 3 +-- .../service-location/service-location.vue | 21 ++++++++++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 69da2eae..4df09c86 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -46,7 +46,11 @@ const endpoints = { GetPartFromCapabilityAnswer: { url: "/parts/api/v1/parts/part-from-capability-answer", method: "POST", -}, + }, + GetServiceabilityDetails: { + url: "/location/api/v1/location/serviceability-details", + method: "GET", + }, GetVehicle: { url: "/vehicle/api/v1/vehicle/lookup", method: "GET", diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js index 9008a8c5..ca8841c8 100644 --- a/src/helpers/service-location-helper.js +++ b/src/helpers/service-location-helper.js @@ -2,8 +2,7 @@ import { useMainStore } from '@/store'; import baseMixin from "@/mixins/base-mixin.js"; export async function getServiceabilityDetails(serviceZipCode, lineItems) { - const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction( - useMainStore.GET_SERVICEABILITY_DETAILS, + const serviceabilityDetails = await useMainStore().getServiceabilityDetails( { serviceZipCode: serviceZipCode, lineItems: lineItems, diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 69aaf3de..02b0f0e4 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -40,15 +40,17 @@