CASH-77: update where saveQuote is called to allow for loading icon and delay until complete
This commit is contained in:
parent
7bd2dd3b27
commit
3823ab8d7f
3 changed files with 26 additions and 20 deletions
|
|
@ -37,6 +37,7 @@ 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";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import { saveQuote } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "save-progress-modal-question",
|
name: "save-progress-modal-question",
|
||||||
|
|
@ -88,13 +89,16 @@ export default {
|
||||||
// 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);
|
||||||
|
|
||||||
|
// send store call to send to new API (that triggers an email send)
|
||||||
|
await saveQuote({ pageNameToLog: this.pageName });
|
||||||
|
|
||||||
// hide save progress button; show success message alert
|
// hide save progress button; show success message alert
|
||||||
this.isProgressSaved = true;
|
this.isProgressSaved = true;
|
||||||
|
|
||||||
|
// communicate to parent the new status
|
||||||
|
this.$emit("save-progress-saved");
|
||||||
|
|
||||||
this.modal.closeModal();
|
this.modal.closeModal();
|
||||||
|
|
||||||
// send store call to send to new API (that triggers an email send)
|
|
||||||
this.$emit("save-progress");
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ 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";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import { saveQuote } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "save-progress-popup-question",
|
name: "save-progress-popup-question",
|
||||||
|
|
@ -99,15 +100,14 @@ export default {
|
||||||
// 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);
|
||||||
|
|
||||||
|
// send store call to send to new API (that triggers an email send)
|
||||||
|
await saveQuote({ pageNameToLog: this.pageName });
|
||||||
|
|
||||||
// hide save progress button; show success message alert
|
// hide save progress button; show success message alert
|
||||||
this.isProgressSaved = true;
|
this.isProgressSaved = true;
|
||||||
|
|
||||||
// send store call to send to new API (that triggers an email send)
|
// communicate to parent the new status
|
||||||
this.$emit("save-progress");
|
this.$emit("save-progress-saved");
|
||||||
|
|
||||||
// send call to close popup
|
|
||||||
this.closeModal();
|
|
||||||
this.$emit("close-save-progress-popup");
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,9 @@
|
||||||
<saveProgressModalQuestion
|
<saveProgressModalQuestion
|
||||||
modalWidgetName="SaveProgressModalWidget"
|
modalWidgetName="SaveProgressModalWidget"
|
||||||
modalName="SaveProgressModal"
|
modalName="SaveProgressModal"
|
||||||
v-if="!isEmailInStoreOnPageLoad"
|
v-if="showSaveProgressModal"
|
||||||
@save-progress="saveProgress" />
|
pageName="quote"
|
||||||
|
@save-progress-saved="updateSaveProgressAsSaved" />
|
||||||
|
|
||||||
<textBlock
|
<textBlock
|
||||||
cmsWidgetName="quoteDisclaimer"
|
cmsWidgetName="quoteDisclaimer"
|
||||||
|
|
@ -98,9 +99,10 @@
|
||||||
<saveProgressPopupQuestion
|
<saveProgressPopupQuestion
|
||||||
modalWidgetName="SaveProgressPopupWidget"
|
modalWidgetName="SaveProgressPopupWidget"
|
||||||
modalName="SaveProgressPopup"
|
modalName="SaveProgressPopup"
|
||||||
v-if="!isEmailInStoreOnPageLoad && showSaveProgressPopup"
|
pageName="quote"
|
||||||
|
v-if="showSaveProgressPopup"
|
||||||
:showSaveProgressPopup="showSaveProgressPopup"
|
:showSaveProgressPopup="showSaveProgressPopup"
|
||||||
@save-progress="saveProgress"
|
@save-progress-saved="updateSaveProgressAsSaved"
|
||||||
@close-save-progress-popup="closeSaveProgressPopup" />
|
@close-save-progress-popup="closeSaveProgressPopup" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -209,6 +211,7 @@ export default {
|
||||||
const emailFromStore = store.getters.order.customer.emailAddress;
|
const emailFromStore = store.getters.order.customer.emailAddress;
|
||||||
const isEmailInStoreOnPageLoad = emailFromStore?.length > 0;
|
const isEmailInStoreOnPageLoad = emailFromStore?.length > 0;
|
||||||
const showSaveProgressPopup = isEmailInStoreOnPageLoad ? false : true;
|
const showSaveProgressPopup = isEmailInStoreOnPageLoad ? false : true;
|
||||||
|
const showSaveProgressModal = isEmailInStoreOnPageLoad ? false : true;
|
||||||
|
|
||||||
const lineItems = deepClone(store.getters.order.lineItems);
|
const lineItems = deepClone(store.getters.order.lineItems);
|
||||||
lineItems.vaps = lineItems.vaps ?? [];
|
lineItems.vaps = lineItems.vaps ?? [];
|
||||||
|
|
@ -290,8 +293,8 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next(async (vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.isEmailInStoreOnPageLoad = isEmailInStoreOnPageLoad;
|
|
||||||
vm.showSaveProgressPopup = showSaveProgressPopup;
|
vm.showSaveProgressPopup = showSaveProgressPopup;
|
||||||
|
vm.showSaveProgressModal = showSaveProgressModal;
|
||||||
vm.addableVaps = addableVaps;
|
vm.addableVaps = addableVaps;
|
||||||
vm.lineItems = lineItems;
|
vm.lineItems = lineItems;
|
||||||
vm.availableLineItems = pricingResults;
|
vm.availableLineItems = pricingResults;
|
||||||
|
|
@ -438,8 +441,9 @@ export default {
|
||||||
servicePackage: null,
|
servicePackage: null,
|
||||||
holdParentAccountNumber: null,
|
holdParentAccountNumber: null,
|
||||||
holdBillToAccountNumber: null,
|
holdBillToAccountNumber: null,
|
||||||
isEmailInStoreOnPageLoad: null,
|
|
||||||
showSaveProgressPopup: null,
|
showSaveProgressPopup: null,
|
||||||
|
showSaveProgressModal: null,
|
||||||
|
isSaveProgressComplete: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -529,10 +533,8 @@ export default {
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
vehicleQuestionsMixin.methods.navigateBack(this);
|
vehicleQuestionsMixin.methods.navigateBack(this);
|
||||||
},
|
},
|
||||||
saveProgress() {
|
updateSaveProgressAsSaved() {
|
||||||
this.isEmailInStoreOnPageLoad = true;
|
this.showSaveProgressModal = false;
|
||||||
this.showSaveProgressPopup = false;
|
|
||||||
saveQuote({ pageNameToLog: "quote" });
|
|
||||||
},
|
},
|
||||||
closeSaveProgressPopup() {
|
closeSaveProgressPopup() {
|
||||||
this.showSaveProgressPopup = false;
|
this.showSaveProgressPopup = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue