Merge branch 'develop' into rls-merge-2025.05.08-to-develop

This commit is contained in:
hiteshkumar87 2025-05-08 21:25:07 +05:30 committed by GitHub
commit b8a7c6a08e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 100 additions and 83 deletions

View file

@ -1,5 +1,4 @@
<template> <template>
<transition name="fade" mode="out-in">
<div class="mobile-location-questions"> <div class="mobile-location-questions">
<div class="text-center" :id="componentId"> <div class="text-center" :id="componentId">
<label <label
@ -66,7 +65,6 @@
</template> </template>
</modal> </modal>
</div> </div>
</transition>
</template> </template>
<script> <script>
@ -150,6 +148,7 @@ export default {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
isMobileSelected: false,
}), }),
}, },
mobileFeePart: { mobileFeePart: {
@ -169,17 +168,7 @@ export default {
return this.getCmsContent(this.linkWidgetName, "HeaderText"); return this.getCmsContent(this.linkWidgetName, "HeaderText");
}, },
mobileLocationLinkText() { mobileLocationLinkText() {
if ( if (this.isMobileAddressComplete()) {
this.addressModel.streetAddress &&
this.addressModel.streetAddress !== "" &&
this.addressModel.city &&
this.addressModel.city !== "" &&
this.addressModel.state &&
this.addressModel.state !== "" &&
this.addressModel.zipCode &&
this.addressModel.zipCode !== "" &&
this.internalModel.isVehicleProtected !== null
) {
return `${this.addressModel.streetAddress}\n${this.addressModel.city}, ${this.addressModel.state} ${this.addressModel.zipCode}`; return `${this.addressModel.streetAddress}\n${this.addressModel.city}, ${this.addressModel.state} ${this.addressModel.zipCode}`;
} }
return this.getCmsContent(this.linkWidgetName, "BodyText"); return this.getCmsContent(this.linkWidgetName, "BodyText");
@ -218,6 +207,19 @@ export default {
}, },
}, },
methods: { methods: {
isMobileAddressComplete() {
return (
this.addressModel.streetAddress &&
this.addressModel.streetAddress !== "" &&
this.addressModel.city &&
this.addressModel.city !== "" &&
this.addressModel.state &&
this.addressModel.state !== "" &&
this.addressModel.zipCode &&
this.addressModel.zipCode !== "" &&
this.internalModel.isVehicleProtected !== null
);
},
openModal() { openModal() {
this.modal.openModal(); this.modal.openModal();
}, },

View file

@ -343,6 +343,7 @@ describe("service-location.vue", () => {
zipCode: "43054", zipCode: "43054",
}, },
isVehicleProtected: true, isVehicleProtected: true,
isMobileSelected: true,
}; };
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
@ -355,6 +356,7 @@ describe("service-location.vue", () => {
zipCode: "61606", zipCode: "61606",
}, },
isVehicleProtected: null, isVehicleProtected: null,
isMobileSelected: false,
}; };
// Act // Act
@ -457,6 +459,7 @@ describe("service-location.vue", () => {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
isMobileSelected: false,
}; };
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
const newMobileLocationQuestions = { const newMobileLocationQuestions = {
@ -468,6 +471,7 @@ describe("service-location.vue", () => {
zipCode: "43054", zipCode: "43054",
}, },
isVehicleProtected: true, isVehicleProtected: true,
isMobileSelected: true,
}; };
wrapper.vm.closeModalAction = jest.fn(); wrapper.vm.closeModalAction = jest.fn();
@ -517,6 +521,7 @@ describe("service-location.vue", () => {
zipCode: "", zipCode: "",
}, },
isVehicleProtected: null, isVehicleProtected: null,
isMobileSelected: false,
mobileFeePart: null, mobileFeePart: null,
}; };
wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions;
@ -530,6 +535,7 @@ describe("service-location.vue", () => {
zipCode: "43081", zipCode: "43081",
}, },
isVehicleProtected: true, isVehicleProtected: true,
isMobileSelected: true,
mobileFeePart: null, mobileFeePart: null,
}; };
@ -593,6 +599,7 @@ describe("service-location.vue", () => {
zipCode: "43081", zipCode: "43081",
}, },
isVehicleProtected: "YesAnswer", isVehicleProtected: "YesAnswer",
isMobileSelected: true,
}; };
wrapper.vm.closeModalAction = jest.fn(); wrapper.vm.closeModalAction = jest.fn();
@ -1433,5 +1440,7 @@ function setupMocks({ mountOptionsMockData = {} }) {
const mountOptions = getMountOptions(mountOptionsMockData); const mountOptions = getMountOptions(mountOptionsMockData);
const wrapper = shallowMount(serviceLocation, mountOptions); const wrapper = shallowMount(serviceLocation, mountOptions);
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent; wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
wrapper.vm.$refs.mobileLocationQuestions.isMobileAddressComplete = jest.fn();
wrapper.vm.$refs.mobileLocationQuestions.openModal = jest.fn();
return { wrapper, apiPromise }; return { wrapper, apiPromise };
} }

View file

@ -89,7 +89,7 @@
<div class="col-md-6 col-xl-4"> <div class="col-md-6 col-xl-4">
<mobileLocationModalQuestions <mobileLocationModalQuestions
customComponentId="mobileLocationQuestions" customComponentId="mobileLocationQuestions"
v-if="selectedAppointmentType === 'Mobile'" v-show="selectedAppointmentType === 'Mobile'"
v-model="mobileLocationQuestions" v-model="mobileLocationQuestions"
:mobileFeePart="mobileFeePart" :mobileFeePart="mobileFeePart"
:mobileFeeApplies="mobileFeeApplies" :mobileFeeApplies="mobileFeeApplies"
@ -173,11 +173,12 @@ const MOBILE_FEE_PART_TYPE = "MOBILE FEE";
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule("mobile-location-required", (value) => { defineRule("mobile-location-required", (value) => {
if ( if (
!value.addressQuestions.streetAddress || value.isMobileSelected &&
(!value.addressQuestions.streetAddress ||
!value.addressQuestions.city || !value.addressQuestions.city ||
!value.addressQuestions.state || !value.addressQuestions.state ||
!value.addressQuestions.zipCode || !value.addressQuestions.zipCode ||
!value.isVehicleProtected !value.isVehicleProtected)
) { ) {
return errorMessages.MOBILE_LOCATION_REQUIRED; return errorMessages.MOBILE_LOCATION_REQUIRED;
} }
@ -301,6 +302,7 @@ export default {
zipCode: this.zipCode, zipCode: this.zipCode,
}, },
isVehicleProtected: this.isVehicleProtected, isVehicleProtected: this.isVehicleProtected,
isMobileSelected: this.selectedAppointmentType === "Mobile",
}; };
}, },
}, },
@ -784,6 +786,10 @@ export default {
this.selectedProvider = new Provider( this.selectedProvider = new Provider(
this.shopProviderData.mobileProviderNumber this.shopProviderData.mobileProviderNumber
); );
var mobileLocationQs = this.$refs.mobileLocationQuestions;
if (!mobileLocationQs.isMobileAddressComplete()) {
mobileLocationQs.openModal();
}
} else { } else {
this.selectedProvider = new Provider(); this.selectedProvider = new Provider();
} }