From d7843ec8f03cf0818921cb582e8a0e7678a4695f Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:08:37 -0500 Subject: [PATCH 1/5] CSR-1886 set mobile ctu --- .../service-location/service-location.vue | 28 +++++++++---------- src/store/index.js | 3 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index bfec46932..fe515e1fc 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -480,19 +480,6 @@ export default { async forwardButtonAction() { this.navigatingForward = true; - // clear items not needed for appointmentType - if (this.selectedAppointmentType == AppointmentTypeStrings.IN_SHOP) { - // if we have a provider.zipCodeCtu that's different than the servicelocation.zipCodeCtu then they - // may have selected a shop in a different ctu. change the servicelocation zip/ctu if different - if (this.zipCodeCtu != this.selectedProvider.address.zipCodeCtu) { - this.zipCodeCtu = this.selectedProvider.address.zipCodeCtu; - this.zipCode = this.selectedProvider.address.zipCode; - } - - this.city = null; - this.streetAddress = null; - } - if ( this.selectedAppointmentType == AppointmentTypeStrings.MOBILE && this.selectedProvider && @@ -505,6 +492,19 @@ export default { this.selectedProvider.address.zipCodeCtu = null; } + var ctu = this.zipCodeCtu; + if (this.selectedAppointmentType == AppointmentTypeStrings.IN_SHOP) { + // if we have a provider.zipCodeCtu that's different than the servicelocation.zipCodeCtu then they + // may have selected a shop in a different ctu. change the servicelocation zip/ctu if different + if (this.zipCodeCtu != this.selectedProvider.address.zipCodeCtu) { + ctu = this.selectedProvider.address.zipCodeCtu; + } + + this.city = null; + this.streetAddress = null; + } + + await this.dispatchStoreAction( this.storeActions.SAVE_SERVICE_LOCATION, { @@ -513,7 +513,7 @@ export default { city: this.city, state: this.state, zipCode: this.zipCode, - zipCodeCtu: this.zipCodeCtu, + zipCodeCtu: ctu, appointmentType: this.selectedAppointmentType, isVehicleProtected: this.isVehicleProtected, provider: { diff --git a/src/store/index.js b/src/store/index.js index 2be04b362..f023bd708 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -911,9 +911,10 @@ export const actions = { }, validateZip(context, { payload: { zip }, pageNameToLog }) { + const damageType = context.getters.damage.isRepair ? "Repair" : "Replace"; return globalMethods.callHttpClient({ methods: endpoints.ValidateZip.method, - endpoint: `${endpoints.ValidateZip.url}/${zip}`, + endpoint: `${endpoints.ValidateZip.url}/${zip}/${damageType}`, logApiCall: true, pageNameToLog: pageNameToLog, }); From e4770742e85b0c98a76e0f4571879da9149f5a0a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 5 Jan 2024 06:41:09 -0500 Subject: [PATCH 2/5] CSR-1886 prettier --- src/layouts/service-location/service-location.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index fe515e1fc..4e890e531 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -504,7 +504,6 @@ export default { this.streetAddress = null; } - await this.dispatchStoreAction( this.storeActions.SAVE_SERVICE_LOCATION, { From 046c00252ee0b7df55b81c9b10b7dfe9120dba2f Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 5 Jan 2024 07:03:30 -0500 Subject: [PATCH 3/5] CSR-1886 broken test --- src/store/index.js | 1 + src/store/store.spec.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index f023bd708..501e017f2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -912,6 +912,7 @@ export const actions = { validateZip(context, { payload: { zip }, pageNameToLog }) { const damageType = context.getters.damage.isRepair ? "Repair" : "Replace"; + console.log("dt:" + damageType); return globalMethods.callHttpClient({ methods: endpoints.ValidateZip.method, endpoint: `${endpoints.ValidateZip.url}/${zip}/${damageType}`, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 2d5d4578c..4b6a16d98 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -571,6 +571,11 @@ describe("Actions", () => { it("validateZip action", async () => { // Arrange const context = state; + context.getters = { + damage: { + isRepair: "false", + } + }; // Act globalMethods.callHttpClient.mockImplementation(() => { From bdf1f484ae3b6d0dbcd9f5d9874972277138e25f Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 5 Jan 2024 07:04:11 -0500 Subject: [PATCH 4/5] CSR-1886 remove logging --- src/store/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 501e017f2..f023bd708 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -912,7 +912,6 @@ export const actions = { validateZip(context, { payload: { zip }, pageNameToLog }) { const damageType = context.getters.damage.isRepair ? "Repair" : "Replace"; - console.log("dt:" + damageType); return globalMethods.callHttpClient({ methods: endpoints.ValidateZip.method, endpoint: `${endpoints.ValidateZip.url}/${zip}/${damageType}`, From 7e3d637466c2b74ce151f34b21be4ecb8ce28bcd Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 5 Jan 2024 08:09:26 -0500 Subject: [PATCH 5/5] CSR-1886 more pretty --- src/store/store.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 4b6a16d98..990e52f4f 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -574,7 +574,7 @@ describe("Actions", () => { context.getters = { damage: { isRepair: "false", - } + }, }; // Act