diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index c7d4f8cd..9121ee67 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -32,7 +32,7 @@ @@ -66,16 +66,7 @@ export default { mixins: [BaseFormMixin], data() { return { - customerQuestions: { - addressQuestions: { - streetAddress: "", - city: "", - state: "", - zipCode: "", - }, - firstName: "", - lastName: "", - }, + customerQuestions: this.getPolicyHolderDetailsFromStore() }; }, setup() { @@ -107,6 +98,32 @@ export default { backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, + + forwardButtonAction() + { + this.mainStore.updatePolicyHolderDetails(this.customerQuestions); + return this.navigateForward(); + }, + + navigateForward() { + this.$router.navigate( + this.navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS, + this.$route + ); + }, + getPolicyHolderDetailsFromStore() { + return { + addressQuestions : + { + streetAddress: this.mainStore.order.customer.address.streetAddress, + city: this.mainStore.order.customer.address.city, + state: this.mainStore.order.customer.address.state, + zipCode: this.mainStore.order.customer.address.zipCode, + }, + firstName : this.mainStore.order.customer.firstName, + lastName : this.mainStore.order.customer.lastName, + } + }, }, components: { siteHeader, diff --git a/src/store/index.js b/src/store/index.js index 69477fcb..4b25b865 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -665,6 +665,15 @@ export const useMainStore = defineStore({ this.order.customer.phoneNumber = welcomePageModel?.phoneNumber; this.order.customer.emailAddress = welcomePageModel?.email; }, + updatePolicyHolderDetails(customerQuestions) + { + this.order.customer.address.streetAddress = customerQuestions.addressQuestions.streetAddress; + this.order.customer.address.city = customerQuestions.addressQuestions.city; + this.order.customer.address.state = customerQuestions.addressQuestions.state; + this.order.customer.address.zipCode = customerQuestions.addressQuestions.zipCode; + this.order.customer.firstName = customerQuestions.firstName; + this.order.customer.lastName = customerQuestions.lastName; + }, savePartQuestionAnswers(partQuestionAnswersArray) { // if part question answers have changed, reset subsequent question answers const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(