CASH-79: add Save Progress success alert message

This commit is contained in:
Adam Caouette 2025-01-13 10:01:42 -05:00
parent ba32c8e417
commit 14b899453f

View file

@ -2,14 +2,21 @@
<div class="save-progress-modal-question"> <div class="save-progress-modal-question">
<buttonMain <buttonMain
ref="buttonMain" ref="buttonMain"
v-if="!isProgressSaved"
:buttonText="buttonText" :buttonText="buttonText"
loaderColor="white" loaderColor="white"
:suppressLoader="true" :suppressLoader="true"
@click-event="openModal" /> @click-event="openModal" />
<alert
class="my-4"
v-else
cmsWidgetName="SaveProgressModalAlertWidget"
alertClass="alert-success" />
<modal <modal
:ref="modalName" :ref="modalName"
:headerText="modalHeaderText" :headerText="modalHeaderText"
suppressPageScroll suppressPageScroll
:onModalClosedCallback="onModalClosed"
:footerButtonText="modalButtonText" :footerButtonText="modalButtonText"
@footer-button-event="saveProgress"> @footer-button-event="saveProgress">
<p class="modal-body">{{ modalBodyText }}</p> <p class="modal-body">{{ modalBodyText }}</p>
@ -27,6 +34,7 @@ import saveProgressQuestion from "@/fmg-components/save-progress-modal-question/
import modal from "@/digital-components/modal/modal"; import modal from "@/digital-components/modal/modal";
import { storeActions } from "@/constants/store-actions.js"; import { storeActions } from "@/constants/store-actions.js";
import buttonMain from "@/ux-components/button-main/button-main"; import buttonMain from "@/ux-components/button-main/button-main";
import alert from "@/ux-components/alert/alert";
export default { export default {
name: "save-progress-modal-question", name: "save-progress-modal-question",
@ -34,6 +42,7 @@ export default {
data() { data() {
return { return {
userInput: "", userInput: "",
isProgressSaved: false,
}; };
}, },
props: { props: {
@ -69,15 +78,18 @@ export default {
this.modal.openModal(); this.modal.openModal();
this.modal.resetButtonStyle(); this.modal.resetButtonStyle();
}, },
closeModal() { // onModalClosed() {
this.modal.closeModal(); // this.isProgressSaved = true;
}, // },
async saveProgress() { async saveProgress() {
console.log("Saving Progress! userInput is: ", this.userInput); console.log("Saving Progress! userInput is: ", this.userInput);
// save email address to store // save email address to store
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.userInput, false); await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.userInput, false);
// hide save progress button; show success message alert
this.isProgressSaved = true;
// TODO send store call to send to new API (that triggers an email send) // TODO send store call to send to new API (that triggers an email send)
// TODO hide button trigger and replace with success message // TODO hide button trigger and replace with success message
@ -88,6 +100,7 @@ export default {
modal, modal,
buttonMain, buttonMain,
saveProgressQuestion, saveProgressQuestion,
alert,
}, },
}; };
</script> </script>