diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 6c206946..47d6a0a9 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -33,7 +33,11 @@ const errorMessages = { LOSS_CITY_REQUIRED: "Please enter a city", LOSS_STATE_REQUIRED: "Please select an option", LOSS_DATE_REQUIRED: "Please enter a loss date", - DAMAGE_OPTION_REQUIRED: "Please select an option" + DAMAGE_OPTION_REQUIRED: "Please select an option", + + POLICYHOLDER_FIRST_NAME_REQUIRED: "Please enter the policyholder first name", + POLICYHOLDER_LAST_NAME_REQUIRED: "Please enter the policyholder last name", + }; export { errorMessages }; \ No newline at end of file diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index b1fb2a8a..9121ee67 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -1,37 +1,137 @@ - \ No newline at end of file + + 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, + siteSubHeader, + textboxQuestion, + addressQuestions, + siteFooter, + Form, + }, +} + \ No newline at end of file diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 0b411a64..5e04a9da 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -215,7 +215,7 @@ navigateForward() { this.$router.navigate( - this.navigationScenarios.WELCOME_PAGE, + this.navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE, this.$route ); }, diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 262af6e7..f8848107 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -8,7 +8,8 @@ const navigationScenarios = { SELECTED_MAKE: "SELECTED_MAKE", SELECTED_MODEL: "SELECTED_MODEL", SELECTED_STYLE: "SELECTED_STYLE", - WELCOME_PAGE: "WELCOME_PAGE", + CLICKED_FORWARD_WELCOME_PAGE: "CLICKED_FORWARD_WELCOME_PAGE", + CLICKED_FORWARD_POLICY_HOLDER_DETAILS: "CLICKED_FORWARD_POLICY_HOLDER_DETAILS", // Vin selection CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN", diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 273fccb4..d66ae872 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -301,11 +301,24 @@ const routingTable = function(store) { destinationIssPageValue: issPageValues.WELCOME_PAGE }, { - scenario: navigationScenarios.WELCOME_PAGE, + scenario: navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE, destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS }, ], }, + { + issPageValue: issPageValues.POLICY_HOLDER_DETAILS, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationIssPageValue: issPageValues.WELCOME_PAGE + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS, + destinationIssPageValue: issPageValues.VEHICLE_YEAR + }, + ], + }, ]; }; diff --git a/src/router/router.spec.js b/src/router/router.spec.js index 42275bf1..67962988 100644 --- a/src/router/router.spec.js +++ b/src/router/router.spec.js @@ -15,7 +15,7 @@ describe("Router", () => { it("Should push next view when navigating locally", () => { - let scenario = navigationScenarios.WELCOME_PAGE; + let scenario = navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE; let currentRoute = { query: { issPage: issPageValues.WELCOME_PAGE }}; router.push = jest.fn(); 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(