From e6d23b6339ea2ba04a3653842171dda3eaa6b1ba Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Thu, 27 Apr 2023 12:37:12 -0400 Subject: [PATCH] Updated method of disabling policy number field based on conversation with Jeremy --- src/layouts/entry-page/entry-page.vue | 1 + src/layouts/welcome-page/welcome-page.vue | 84 +++-------------------- src/store/index.js | 8 ++- 3 files changed, 14 insertions(+), 79 deletions(-) diff --git a/src/layouts/entry-page/entry-page.vue b/src/layouts/entry-page/entry-page.vue index c1a2d011..238978fa 100644 --- a/src/layouts/entry-page/entry-page.vue +++ b/src/layouts/entry-page/entry-page.vue @@ -143,6 +143,7 @@ { case "policynumber": this.mainStore.order.policy.policyNumber = value; + this.mainStore.issConfig.disabledFields.policyNumber = true; break; case "lossdate": diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 858288dd..3757e2e4 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -14,7 +14,7 @@ isRequired ref="policyNumber" disableAutoFill - :isDisabled="this.isClientPassed" + :isDisabled="isPolicyHolderEnabled" validationRules="policy-number-required" /> @@ -108,7 +108,7 @@ v-model="welcomePageModel.damageState" ref="state" inputId="8fdf9dc2e13e430eb57529499dceb3eb" - :options="stateOptions" + :options="getStates" validationRules="loss-state-required" isRequired disableAutoFill @@ -167,7 +167,7 @@ import { required, regex } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import BaseFormMixin from '@/mixins/base-form-mixin.js'; import { useMainStore } from '@/store'; -import { issPageValues } from "@/router/router-constants/issPage-values" +import { states } from "@/constants/states" //define validation rules defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED)); @@ -235,11 +235,6 @@ export default { methods: { async forwardButtonAction() { - if (this.isClientPassed) - { - this.welcomePageModel.isPolicyNumberDisabled = "true"; - } - this.mainStore.updatePolicyData(this.welcomePageModel); return this.navigateForward(); }, @@ -286,63 +281,6 @@ export default { { return this.getCmsContent("GlassOnlyQuestion", "QuestionText"); }, - stateOptions: { - get: function () { - return { - AL: "Alabama", - AK: "Alaska", - AZ: "Arizona", - AR: "Arkansas", - CA: "California", - CO: "Colorado", - CT: "Connecticut", - DE: "Delaware", - DC: "District Of Columbia", - FL: "Florida", - GA: "Georgia", - HI: "Hawaii", - ID: "Idaho", - IL: "Illinois", - IN: "Indiana", - IA: "Iowa", - KS: "Kansas", - KY: "Kentucky", - LA: "Louisiana", - ME: "Maine", - MD: "Maryland", - MA: "Massachusetts", - MI: "Michigan", - MN: "Minnesota", - MS: "Mississippi", - MO: "Missouri", - MT: "Montana", - NE: "Nebraska", - NV: "Nevada", - NH: "New Hampshire", - NJ: "New Jersey", - NM: "New Mexico", - NY: "New York", - NC: "North Carolina", - ND: "North Dakota", - OH: "Ohio", - OK: "Oklahoma", - OR: "Oregon", - PA: "Pennsylvania", - RI: "Rhode Island", - SC: "South Carolina", - SD: "South Dakota", - TN: "Tennessee", - TX: "Texas", - UT: "Utah", - VT: "Vermont", - VA: "Virginia", - WA: "Washington", - WV: "West Virginia", - WI: "Wisconsin", - WY: "Wyoming", - }; - }, - }, displayDamageCityQuestion(){ return !!this.getCmsContent("DamageCityQuestion","QuestionText"); }, @@ -360,19 +298,13 @@ export default { return true; } }, - isClientPassed() + getStates() { + return states; + }, + isPolicyHolderEnabled() { - const visitedPolicyHolderPage = this.mainStore.pageData(issPageValues.POLICY_HOLDER_DETAILS) ? true : false; - - if(this.mainStore.issConfig.isAuthenticated) - if ((!visitedPolicyHolderPage && this.mainStore.order.policy.policyNumber) || this.mainStore.order.policy.isPolicyNumberDisabled ) - { - return true; - } - return false; + return !!this.mainStore.issConfig.disabledFields.policyNumber; } - - }, components: { siteHeader, diff --git a/src/store/index.js b/src/store/index.js index eb65b52d..ebdc829c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -48,7 +48,6 @@ const getDefaultState = () => { damageState: null, damageCity: null, isDamageGlassOnly: null, - isPolicyNumberDisabled: null }, customer: { address: { @@ -105,7 +104,10 @@ const getDefaultState = () => { isAuthenticated: false, // Indicates if user is authenticated or not. enableTPAFlow: false, // Indicates if the TPA flow is supported for this client. returnURL: null, - returnURL2: null + returnURL2: null, + disabledFields: { + policyNumber: null + } } }; }; @@ -717,6 +719,7 @@ export const useMainStore = defineStore({ this.issConfig.enableTPAFlow = false; this.issConfig.returnURL = null; this.issConfig.returnURL2 = null; + this.issConfig.disabledFields.policyNumber = null; }, updateVehicleYear(year) { @@ -815,7 +818,6 @@ export const useMainStore = defineStore({ this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly; this.order.customer.phoneNumber = welcomePageModel?.phoneNumber; this.order.customer.emailAddress = welcomePageModel?.email; - this.order.policy.isPolicyNumberDisabled = welcomePageModel?.isPolicyNumberDisabled; }, updatePolicyHolderDetails(customerQuestions) {