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

View file

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