Updated method of disabling policy number field based on conversation with Jeremy

This commit is contained in:
Jason Wheeler 2023-04-27 12:37:12 -04:00
parent 8a487f2db0
commit e6d23b6339
3 changed files with 14 additions and 79 deletions

View file

@ -143,6 +143,7 @@
{
case "policynumber":
this.mainStore.order.policy.policyNumber = value;
this.mainStore.issConfig.disabledFields.policyNumber = true;
break;
case "lossdate":

View file

@ -14,7 +14,7 @@
isRequired
ref="policyNumber"
disableAutoFill
:isDisabled="this.isClientPassed"
:isDisabled="isPolicyHolderEnabled"
validationRules="policy-number-required" />
</div>
</div>
@ -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,

View file

@ -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)
{