Updating only recal modal link when appropriate

This commit is contained in:
brydon1 2023-09-12 14:24:37 -04:00
parent df94c4dda1
commit be499757b0
2 changed files with 16 additions and 2 deletions

View file

@ -469,6 +469,20 @@ export function setupModalLinks(context) {
});
}
/**
*
* @param context
* @param desiredTarget
*/
export function setupModalLink(context, desiredTarget) {
context.$nextTick(() => {
const element = document.querySelector(`[modalTarget=${desiredTarget}]`);
if (element) {
element.addEventListener('click', () => context.$refs[desiredTarget].openModal());
}
});
}
/**
*
* @param copy

View file

@ -112,7 +112,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
// Import Supporting Files
import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
import { fetchCmsContentForPage, setupModalLinks, setupModalLink, processIfStatements } from '@/helpers/cms-content-helper.js';
import settleAllPromises from '@/helpers/layout-helper.js';
import { getDamageString } from '@/helpers/damage-helper.js';
import { useMainStore } from '@/store/index.js';
@ -317,7 +317,7 @@ export default {
},
nextStepsBody(newValue, oldValue) {
if (newValue !== oldValue){
setupModalLinks(this);
setupModalLink(this, "RecalModal");
}
}
},