diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 0dcaf6d3f..52e6d47a6 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -65,7 +65,9 @@ const storeActions = { "resetMoldingAndCapabilityQuestionAnswersIfNeeded", SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers", - SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections", + SAVE_PAYMENT_TYPE: "savePaymentType", + SAVE_SUPPORTING_ITEMS: "saveSupportingItems", + SAVE_VAPS: "saveVaps", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index ca3ea642e..4760a98a3 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -56,8 +56,6 @@ const storeMutations = { RESET_DAMAGE_STATE: "resetDamageState", RESET_REGISTRATION_STATE: "resetRegistrationState", RESET_GLASS_PARTS_STATE: "resetGlassPartsState", - RESET_SUPPORTING_ITEMS_STATE: "resetSupportingItemsState", - RESET_VAPS_STATE: "resetVapsState", RESET_STATE: "resetState", RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise", diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 962c8ae1e..424b864d8 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -21,7 +21,7 @@ ref="servicePackage" cashCmsWidgetName="CashServicePackageQuestionWidget" insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget" - v-model="selectedPackage" + v-model="selectedVaps" groupName="ServicePackageQuestion" :availableLineItems="availableLineItems" :isInsuranceSelected="isInsuranceSelected" /> @@ -117,7 +117,7 @@ export default { data() { return { isInsuranceSelected: null, - selectedPackage: null, + selectedVaps: null, availableLineItems: null, supportingItems: null, }; @@ -140,16 +140,18 @@ export default { backButtonAction() { vehicleQuestionsMixin.methods.navigateBack(this); }, - async forwardButtonAction() { - await this.dispatchStoreAction( - this.storeActions.SAVE_QUOTE_PAGE_SELECTIONS, - { - isInsuranceSelected: this.isInsuranceSelected, - vapsItemsToAdd: this.selectedPackage, - supportingItemsToAdd: this.supportingItems, - }, + forwardButtonAction() { + this.dispatchStoreAction( + this.storeActions.SAVE_PAYMENT_TYPE, + this.isInsuranceSelected, false ); + this.dispatchStoreAction( + this.storeActions.SAVE_SUPPORTING_ITEMS, + this.supportingItems, + false + ); + this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false); //return this.navigateForward(); }, diff --git a/src/store/index.js b/src/store/index.js index 29bd7c0c6..873295a10 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -302,12 +302,6 @@ export const mutations = { state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null; state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null; }, - resetSupportingItemsState(state) { - state.order.lineItems.supportingItems = null; - }, - resetVapsState(state) { - state.order.lineItems.vaps = null; - }, resetState(state) { Object.assign(state, getDefaultState()); }, @@ -590,19 +584,17 @@ export const actions = { resetDamageAndDependencies(context) { context.commit(storeMutations.RESET_DAMAGE_STATE); context.commit(storeMutations.RESET_GLASS_PARTS_STATE); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); - context.commit(storeMutations.RESET_VAPS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); + context.commit(storeMutations.UPDATE_VAPS, null); }, resetRegistrationAndDependencies(context) { context.commit(storeMutations.RESET_REGISTRATION_STATE); context.commit(storeMutations.RESET_GLASS_PARTS_STATE); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); - context.commit(storeMutations.RESET_VAPS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); }, resetPartsAndDependencies(context) { context.commit(storeMutations.RESET_GLASS_PARTS_STATE); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); - context.commit(storeMutations.RESET_VAPS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); }, resetState(context) { context.commit(storeMutations.RESET_STATE); @@ -1173,6 +1165,7 @@ export const actions = { if (isDamageChanging) { //Reset dependent state when changing context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); + context.commit(storeMutations.UPDATE_VAPS, null); // Save new values context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair); @@ -1264,7 +1257,7 @@ export const actions = { if (havePartQuestionAnswersChanged) { context.commit(storeMutations.UPDATE_GLASS_PARTS, null); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_PAGE_DATA, { @@ -1310,7 +1303,7 @@ export const actions = { if (haveSelectedVehiclePartsChanged) { context.commit(storeMutations.UPDATE_GLASS_PARTS, null); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_PAGE_DATA, { @@ -1340,7 +1333,7 @@ export const actions = { if (haveMoldingQuestionAnswersChanged) { context.commit(storeMutations.UPDATE_GLASS_PARTS, null); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, @@ -1368,7 +1361,7 @@ export const actions = { if (haveCapabilityQuestionAnswersChanged) { context.commit(storeMutations.UPDATE_GLASS_PARTS, null); - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null); } //Save new values @@ -1377,16 +1370,14 @@ export const actions = { capabilityQuestionAnswers ); }, - // Quote Page - saveQuotePageSelections( - context, - { isInsuranceSelected, vapsItemsToAdd, supportingItemsToAdd } - ) { - context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE); - context.commit(storeMutations.RESET_VAPS_STATE); - context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsuranceSelected); - context.commit(storeMutations.UPDATE_VAPS, vapsItemsToAdd); - context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItemsToAdd); + savePaymentType(context, isInsurance) { + context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance); + }, + saveSupportingItems(context, supportingItems) { + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); + }, + saveVaps(context, vaps) { + context.commit(storeMutations.UPDATE_VAPS, vaps); }, // Price order actions // PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED