Just needs styling tweaks and de-mocked

This commit is contained in:
Leah Schumann 2023-04-18 08:32:43 -04:00
parent 4def7c421e
commit d2ed91e919
3 changed files with 49 additions and 24 deletions

View file

@ -66,12 +66,12 @@
modalWidgetName="MobileLocationModalWidget" /> modalWidgetName="MobileLocationModalWidget" />
<shopQuestion <shopQuestion
ref="shopQuestion" ref="shopQuestion"
v-show=" v-if="selectedAppointmentType === 'Inshop' || selectedAppointmentType === 'Dropoff'"
selectedAppointmentType === 'Dropoff' || selectedAppointmentType === 'Inshop' v-model="selectedShop"
"
:isDropoff="isDropoff" :isDropoff="isDropoff"
:serviceZipCode="zipCode" :serviceZipCode="zipCode"
:selectedAppointmentType="selectedAppointmentType" :selectedAppointmentType="selectedAppointmentType"
:shopQuestionInitialData="shopQuestionInitialData"
cmsWidgetName="ShopQuestionWidget" /> cmsWidgetName="ShopQuestionWidget" />
<contentGroupModal ref="RecalModal" cmsWidgetName="RecalModal" /> <contentGroupModal ref="RecalModal" cmsWidgetName="RecalModal" />
<funnel-footer <funnel-footer
@ -147,6 +147,8 @@ export default {
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
selectedAppointmentType: "", selectedAppointmentType: "",
providerNumber: null, providerNumber: null,
shopQuestionInitialData: null,
selectedShop: "",
}; };
}, },
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
@ -194,9 +196,9 @@ export default {
vm.setData( vm.setData(
resultMap.zipCodeData, resultMap.zipCodeData,
resultMap.serviceabilityDetails, resultMap.serviceabilityDetails,
resultMap.mobileFeePart resultMap.mobileFeePart,
resultMap.shopQuestionInitialData
); );
vm.$refs.shopQuestion.initializeComponent(resultMap.shopQuestionInitialData);
}); });
}, },
computed: { computed: {
@ -264,15 +266,16 @@ export default {
return this.isGlassServiceableInshop; return this.isGlassServiceableInshop;
} }
}, },
isDualOrStaticRecalibration() { // Specifically check for isRecalibrationServiceableMobile === false, not null or true.
const supportingItems = store.getters.lineItems.supportingItems; requiresInshopRecalibration() {
return (
return supportingItems.some( this.isServiceableInshop &&
(item) => item.partNumber === "RECAL STATIC" || item.partNumber === "RECAL DUAL" this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile === false
); );
}, },
displayRecalibrationWarning() { displayRecalibrationWarning() {
return this.isDualOrStaticRecalibration; return this.requiresInshopRecalibration;
}, },
displayServiceableInshopOnly() { displayServiceableInshopOnly() {
return ( return (
@ -293,6 +296,9 @@ export default {
isDropoff() { isDropoff() {
return this.selectedAppointmentType === "Dropoff"; return this.selectedAppointmentType === "Dropoff";
}, },
isMobile() {
return this.selectedAppointmentType === "Mobile";
},
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
@ -302,7 +308,7 @@ export default {
store.getters.payment.isInsurance !== null store.getters.payment.isInsurance !== null
); );
}, },
setData(zipCodeData, serviceabilityDetails, mobileFeePart) { setData(zipCodeData, serviceabilityDetails, mobileFeePart, shopQuestionInitialData) {
if (zipCodeData) { if (zipCodeData) {
this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase; this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase;
} }
@ -314,6 +320,10 @@ export default {
if (mobileFeePart) { if (mobileFeePart) {
this.mobileFeePart = mobileFeePart; this.mobileFeePart = mobileFeePart;
} }
if (shopQuestionInitialData) {
this.shopQuestionInitialData = shopQuestionInitialData;
}
}, },
setContainsMilitaryBase(val) { setContainsMilitaryBase(val) {
if (this.zipContainsMilitaryBase !== val) { if (this.zipContainsMilitaryBase !== val) {

View file

@ -9,17 +9,19 @@
alertClass="alert-info" alertClass="alert-info"
v-bind:isDismissible="false" /> v-bind:isDismissible="false" />
<buttonQuestion <buttonQuestion
ref="buttonQuestion"
buttonTypeString="shopListButton" buttonTypeString="shopListButton"
:buttonTypeObject="shopListButton" :buttonTypeObject="shopListButton"
class="radioQuestion" class="radioQuestion"
:questionText="questionText" :questionText="questionText"
:answers="answers" :answers="answers"
groupName="ChooseShop" groupName="chooseShop"
textPosition="text-start" textPosition="text-start"
v-model="selectedValue" v-model="selectedValue"
isRequired isRequired
validationRules="option-required"/> validationRules="option-required" />
<textLink v-if="displaySeeMoreLocationsLink" <textLink
v-if="displaySeeMoreLocationsLink"
ref="showMoreShopsLink" ref="showMoreShopsLink"
class="show-more-shops-link" class="show-more-shops-link"
id="showMoreShopsId" id="showMoreShopsId"
@ -60,7 +62,7 @@ export default {
availability: "high", availability: "high",
answers: [], answers: [],
shopIndex: 0, shopIndex: 0,
displaySeeMoreLocationsLink: true, displaySeeMoreLocationsLink: false,
}; };
}, },
props: { props: {
@ -69,6 +71,10 @@ export default {
serviceZipCode: String, serviceZipCode: String,
selectedAppointmentType: String, selectedAppointmentType: String,
cmsWidgetName: String, cmsWidgetName: String,
shopQuestionInitialData: {
type: Object,
required: true,
},
validationRules: String, validationRules: String,
}, },
components: { components: {
@ -101,10 +107,6 @@ export default {
serviceZipCode: this.serviceZipCode, serviceZipCode: this.serviceZipCode,
}); });
}, },
initializeComponent(initialData) {
this.shops = initialData;
this.getNextShopsFromList();
},
async updateShopList() { async updateShopList() {
const result = await this.dispatchStoreAction(storeActions.GET_PROVIDER_LOCATIONS, { const result = await this.dispatchStoreAction(storeActions.GET_PROVIDER_LOCATIONS, {
serviceZipCode: this.serviceZipCode, serviceZipCode: this.serviceZipCode,
@ -171,7 +173,14 @@ export default {
}, },
}, },
selectedAppointmentType: { selectedAppointmentType: {
async handler() { async handler(newValue, oldValue) {
if (oldValue == undefined) {
this.shops = this.shopQuestionInitialData;
this.getNextShopsFromList();
this.displaySeeMoreLocationsLink = true;
return;
}
await this.$nextTick(); await this.$nextTick();
const container = document.getElementsByClassName( const container = document.getElementsByClassName(
@ -180,7 +189,13 @@ export default {
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" }); container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
this.resetShopList(); this.resetShopList();
this.selectedValue = "";
this.$refs.buttonQuestion.resetField();
}, },
immediate: true,
}, },
}, },
}; };