Fix issue where answer was not auto selected

If it was not in the initial three questions it didn't load correctly
This commit is contained in:
Scott Kiener 2025-07-16 15:19:15 -04:00
parent 59cf55a7fd
commit c4aa209413

View file

@ -14,6 +14,7 @@
ref="shopQuestionModal" ref="shopQuestionModal"
:headerText="modalHeaderText" :headerText="modalHeaderText"
:onModalClosedCallback="onModalClosed" :onModalClosedCallback="onModalClosed"
:onModalOpenedCallback="updateSelectedAnswer"
:footerButtonText="modalFooterText" :footerButtonText="modalFooterText"
:footerButtonDisabled=" :footerButtonDisabled="
displayInvalidZipAlert || displayNoShopsAlert || !localSelectedProviderNumber displayInvalidZipAlert || displayNoShopsAlert || !localSelectedProviderNumber
@ -165,9 +166,11 @@ export default {
openModal() { openModal() {
// Reset local state from parent // Reset local state from parent
this.localShopProviderData = this.shopProviderDataFromParent; this.localShopProviderData = this.shopProviderDataFromParent;
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
this.localZipCode = this.zipCodeFromParent; this.localZipCode = this.zipCodeFromParent;
this.answers = []; this.answers = [];
// This will be set once the modal is open (updateSelectedAnswer()) to ensure that the
// correct answer is selected
this.localSelectedProviderNumber = null;
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex( const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent (provider) => provider.providerNumber == this.selectedProviderNumberFromParent
@ -183,6 +186,9 @@ export default {
this.$refs.shopQuestionModal.openModal(); this.$refs.shopQuestionModal.openModal();
}, },
updateSelectedAnswer() {
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
},
updateShopListWithNextShops(numberToGet = 3) { updateShopListWithNextShops(numberToGet = 3) {
//gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED; --This needs to actually fire on initial display, can never happen here //gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED; --This needs to actually fire on initial display, can never happen here