From 1649ea14077449503533cc4f99fa29c16402418a Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 7 Apr 2025 15:29:47 +0530 Subject: [PATCH 1/3] CASH-433 hide drop off option for big truck --- .../appointment-type-question.vue | 19 ++++++++++++++++--- .../service-location/service-location.vue | 13 +++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/layouts/service-location/appointment-type-question/appointment-type-question.vue b/src/layouts/service-location/appointment-type-question/appointment-type-question.vue index 64bf159ff..4c1c0d031 100644 --- a/src/layouts/service-location/appointment-type-question/appointment-type-question.vue +++ b/src/layouts/service-location/appointment-type-question/appointment-type-question.vue @@ -32,6 +32,7 @@ export default { cmsWidgetName: String, isServiceableMobile: Boolean, isServiceableInshop: Boolean, + isServiceableDropoff: Boolean, mobileFeeApplies: Boolean, }, computed: { @@ -45,7 +46,7 @@ export default { const shouldShowMobile = this.isServiceableMobile; const shouldShowInshop = this.isServiceableInshop; const shouldShowDropoff = - this.isServiceableInshop && !this.$store.getters.damage.isRepair; + this.isServiceableDropoff && !this.$store.getters.damage.isRepair; var answers = this.answersFromCms ? this.answersFromCms.filter((answer) => { @@ -77,6 +78,11 @@ export default { isMobileOnly() { return this.isServiceableMobile && !this.isServiceableInshop; }, + isInshopOnly() { + return ( + this.isServiceableInshop && !this.isServiceableMobile && !this.isServiceableDropoff + ); + }, }, watch: { answersToDisplay: { @@ -86,7 +92,7 @@ export default { newValue.length == 1 && newValue.findIndex((answer) => answer.Name == "Mobile") != -1 ) { - this.selectedValues = "Mobile"; + this.selectedValue = "Mobile"; } }, immediate: true, @@ -94,7 +100,14 @@ export default { isMobileOnly: { handler(newValue) { if (newValue) { - this.selectedValues = "Mobile"; + this.selectedValue = "Mobile"; + } + }, + }, + isInshopOnly: { + handler(newValue) { + if (newValue) { + this.selectedValue = "Inshop"; } }, }, diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index a85a5bd17..7b3163c87 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -76,6 +76,7 @@ v-show="isAppointmentTypeDisplayed" :isServiceableMobile="isServiceableMobile" :isServiceableInshop="isServiceableInshop" + :isServiceableDropoff="isServiceableDropoff" :isDisplayed="isAppointmentTypeDisplayed" :mobileFeeApplies="mobileFeeApplies" ref="appointmentTypeQuestion" @@ -196,6 +197,8 @@ export default { isVehicleProtected: this.getIsVehicleProtectedFromStore(), isGlassServiceableInshop: null, isRecalibrationServiceableInshop: null, + isGlassServiceableDropoff: null, + isRecalibrationServiceableDropoff: null, isGlassServiceableMobile: null, isRecalibrationServiceableMobile: null, selectedAppointmentType: this.getSelectedAppointmentType(), @@ -354,6 +357,13 @@ export default { return this.isGlassServiceableInshop; } }, + isServiceableDropoff() { + if (this.isRecalibrationServiceableDropoff !== null) { + return this.isGlassServiceableDropoff && this.isRecalibrationServiceableDropoff; + } else { + return this.isGlassServiceableDropoff; + } + }, isShopQuestionDisplayed() { return ( this.selectedAppointmentType === "Inshop" || @@ -559,6 +569,9 @@ export default { this.isGlassServiceableInshop = serviceabilityDetails.isGlassServiceableInshop; this.isRecalibrationServiceableInshop = serviceabilityDetails.isRecalibrationServiceableInshop; + this.isGlassServiceableDropoff = serviceabilityDetails.isGlassServiceableDropoff; + this.isRecalibrationServiceableDropoff = + serviceabilityDetails.isRecalibrationServiceableDropoff; this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile; this.isRecalibrationServiceableMobile = serviceabilityDetails.isRecalibrationServiceableMobile; From 937b6c3c47dc40dd935ddd6ec8e7342a1af09752 Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Wed, 9 Apr 2025 09:19:03 -0400 Subject: [PATCH 2/3] Update unit tests for appointment-type-question --- .../appointment-type-question.spec.js | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js b/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js index 63242df22..416d6918c 100644 --- a/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js +++ b/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js @@ -59,7 +59,7 @@ afterEach(() => { }); describe("appointment-type-question.vue", () => { - it("Should display all options if both in-shop and mobile are available", async () => { + it("Should display all options if in-shop, mobile, and dropoff are available", async () => { // Arrange/Act const { wrapper } = setupMocks({ mixins: [mockMixin], @@ -67,6 +67,7 @@ describe("appointment-type-question.vue", () => { cmsWidgetName: cmsWidgetName, isServiceableInshop: true, isServiceableMobile: true, + isServiceableDropoff: true, }, mountOptions: { attachTo: document.body, @@ -99,7 +100,7 @@ describe("appointment-type-question.vue", () => { ]); }); - it("Should display only the In-Shop and Drop-Off answers when only in-shop service is available", async () => { + it("Should display only the In-Shop answer when only in-shop service is available", async () => { // Arrange/Act const { wrapper } = setupMocks({ mixins: [mockMixin], @@ -107,6 +108,34 @@ describe("appointment-type-question.vue", () => { cmsWidgetName: cmsWidgetName, isServiceableInshop: true, isServiceableMobile: false, + isServiceableDropoff: false, + }, + mountOptions: { + attachTo: document.body, + }, + }); + + // Assert + expect(wrapper.vm.answersToDisplay).toEqual([ + { + AnswerImageUrl: "", + Name: "Inshop", + SubText: "", + SubWidgetName: "", + Text: "In-shop", + } + ]); + }); + + it("Should display only the In-Shop and Drop-Off answers when mobile service is not available", async () => { + // Arrange/Act + const { wrapper } = setupMocks({ + mixins: [mockMixin], + props: { + cmsWidgetName: cmsWidgetName, + isServiceableInshop: true, + isServiceableMobile: false, + isServiceableDropoff: true, }, mountOptions: { attachTo: document.body, @@ -140,6 +169,7 @@ describe("appointment-type-question.vue", () => { cmsWidgetName: cmsWidgetName, isServiceableInshop: false, isServiceableMobile: true, + isServiceableDropoff: false, }, mountOptions: { attachTo: document.body, @@ -172,6 +202,7 @@ describe("appointment-type-question.vue", () => { cmsWidgetName: cmsWidgetName, isServiceableInshop: true, isServiceableMobile: true, + isServiceableDropoff: true, }, mountOptions: { attachTo: document.body, @@ -205,6 +236,7 @@ describe("appointment-type-question.vue", () => { cmsWidgetName: cmsWidgetName, isServiceableInshop: false, isServiceableMobile: false, + isServiceableDropoff: false, }, mountOptions: { attachTo: document.body, From 38860acdac13911b77d63379a9d29c49cb647dfd Mon Sep 17 00:00:00 2001 From: Alex Humphries Date: Wed, 9 Apr 2025 09:23:47 -0400 Subject: [PATCH 3/3] Prettier formatting --- .../appointment-type-question/appointment-type-question.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js b/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js index 416d6918c..8ff7c9b1c 100644 --- a/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js +++ b/src/layouts/service-location/appointment-type-question/appointment-type-question.spec.js @@ -123,7 +123,7 @@ describe("appointment-type-question.vue", () => { SubText: "", SubWidgetName: "", Text: "In-shop", - } + }, ]); });