refactored logic with update requirements
This commit is contained in:
saumyaChaturvedi123 2023-04-27 15:34:19 +05:30
parent 91729e94c1
commit 8a487f2db0
2 changed files with 9 additions and 23 deletions

View file

@ -237,12 +237,7 @@ export default {
async forwardButtonAction() { async forwardButtonAction() {
if (this.isClientPassed) if (this.isClientPassed)
{ {
//if disabled state is broken maliciously and policy number is changed, do not update new policy number this.welcomePageModel.isPolicyNumberDisabled = "true";
if (this.welcomePageModel.policyNumber != this.mainStore.order.policy.policyNumber)
{
this.welcomePageModel.policyNumber = this.mainStore.order.policy.policyNumber
}
this.mainStore.order.policy.isPolicyNumberDisabled = true;
} }
this.mainStore.updatePolicyData(this.welcomePageModel); this.mainStore.updatePolicyData(this.welcomePageModel);
@ -265,6 +260,7 @@ export default {
isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly, isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly,
phoneNumber : this.mainStore.order.customer.phoneNumber, phoneNumber : this.mainStore.order.customer.phoneNumber,
email : this.mainStore.order.customer.emailAddress, email : this.mainStore.order.customer.emailAddress,
isPolicyNumberDisabled: this.mainStore.order.policy.isPolicyNumberDisabled,
} }
}, },
}, },
@ -366,24 +362,14 @@ export default {
}, },
isClientPassed() isClientPassed()
{ {
const visitedPolicyHolderPage = this.mainStore.pageData(issPageValues.POLICY_HOLDER_DETAILS) ? true : false;
const visitedPolicyHolderPage = this.mainStore.pageData(issPageValues.POLICY_HOLDER_DETAILS) ? true : false;
if(this.mainStore.issConfig.isAuthenticated) if(this.mainStore.issConfig.isAuthenticated)
{ if ((!visitedPolicyHolderPage && this.mainStore.order.policy.policyNumber) || this.mainStore.order.policy.isPolicyNumberDisabled )
if (!visitedPolicyHolderPage){ //checking if the page is loaded for the first time {
if(this.mainStore.order.policy.policyNumber ) return true;
{
return true;
}
}else
{
if (this.mainStore.order.policy.isPolicyNumberDisabled)
{
return true;
}
} }
} return false;
} }

View file

@ -48,7 +48,7 @@ const getDefaultState = () => {
damageState: null, damageState: null,
damageCity: null, damageCity: null,
isDamageGlassOnly: null, isDamageGlassOnly: null,
isPolicyNumberDisabled: false isPolicyNumberDisabled: null
}, },
customer: { customer: {
address: { address: {