move policy lookup call to welcome-page, navigation from welcome-page
This commit is contained in:
parent
b344e263d0
commit
3b7dffd82a
4 changed files with 98 additions and 57 deletions
|
|
@ -90,13 +90,10 @@ export default {
|
|||
let resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
});
|
||||
|
||||
},
|
||||
created(){
|
||||
this.getVehiclesfromPolicyLookup();
|
||||
},
|
||||
methods:
|
||||
{
|
||||
backButtonAction() {
|
||||
|
|
@ -124,6 +121,7 @@ export default {
|
|||
this.$route
|
||||
);
|
||||
},
|
||||
|
||||
getPolicyHolderDetailsFromStore() {
|
||||
return {
|
||||
addressQuestions :
|
||||
|
|
@ -137,47 +135,7 @@ export default {
|
|||
firstName : this.mainStore.order.customer.firstName,
|
||||
lastName : this.mainStore.order.customer.lastName,
|
||||
}
|
||||
},
|
||||
async getPolicyLookupResponse(){
|
||||
const policyLookupResponse = this.mainStore.getCoveragePolicyInfo({
|
||||
accountNumber:this.mainStore.order.accountNumber.toString(),
|
||||
policyNumber:this.mainStore.order.policy.policyNumber,
|
||||
dateOfLoss:this.mainStore.order.policy.dateOfLoss});
|
||||
|
||||
// Settle promises and get results
|
||||
const promisePolicyLookupResultMap = [
|
||||
{
|
||||
resultKey: "policyLookupResponse",
|
||||
promise: policyLookupResponse,
|
||||
}
|
||||
];
|
||||
const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap);
|
||||
return policyLookupResultMap.policyLookupResponse;
|
||||
},
|
||||
async getVehiclesfromPolicyLookup()
|
||||
{
|
||||
//call coverage policy lookup if isCoverageEnabled flag enabled
|
||||
if(this.isCoverageEnabled){
|
||||
const policyLookupResponse = await this.getPolicyLookupResponse();
|
||||
if(policyLookupResponse!=null){
|
||||
var policy = policyLookupResponse.policies?.[0];
|
||||
if(policy!=null){
|
||||
//populate policy holder details from policy lookup
|
||||
this.mainStore.order.customer.address.streetAddress = policy.insureds?.[0]?.address;
|
||||
this.mainStore.order.customer.address.city=policy.insureds?.[0]?.city;
|
||||
this.mainStore.order.customer.address.state=policy.insureds?.[0]?.state;
|
||||
this.mainStore.order.customer.address.zipCode=policy.insureds?.[0]?.zipCode;
|
||||
this.mainStore.order.customer.firstName = policy.insureds?.[0]?.firstName;
|
||||
this.mainStore.order.customer.lastName = policy.insureds?.[0]?.lastName;
|
||||
|
||||
this.customerQuestions = this.getPolicyHolderDetailsFromStore();
|
||||
//populate vehicles
|
||||
this.vehiclesFound= policy.vehicles;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
isCoverageEnabled(){
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ export default {
|
|||
mixins: [BaseFormMixin],
|
||||
data() {
|
||||
return {
|
||||
welcomePageModel: this.getWelcomePageModelFromStore()
|
||||
welcomePageModel: this.getWelcomePageModelFromStore(),
|
||||
vehiclesFound: [],
|
||||
};
|
||||
},
|
||||
setup() {
|
||||
|
|
@ -238,15 +239,81 @@ export default {
|
|||
{
|
||||
async forwardButtonAction() {
|
||||
this.mainStore.updatePolicyData(this.welcomePageModel);
|
||||
return this.navigateForward();
|
||||
|
||||
const policyLookupResponse = this.mainStore.getCoveragePolicyInfo({
|
||||
accountNumber:this.mainStore.order.accountNumber.toString(),
|
||||
policyNumber:this.mainStore.order.policy.policyNumber,
|
||||
dateOfLoss:this.mainStore.order.policy.dateOfLoss
|
||||
});
|
||||
|
||||
// Settle promises and get results
|
||||
const promisePolicyLookupResultMap = [
|
||||
{
|
||||
resultKey: "policyLookupResponse",
|
||||
promise: policyLookupResponse,
|
||||
}
|
||||
];
|
||||
|
||||
const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap);
|
||||
const policyInfo = policyLookupResultMap.policyLookupResponse;
|
||||
|
||||
return this.navigateForward(policyInfo);
|
||||
},
|
||||
|
||||
navigateForward() {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD,
|
||||
this.$route
|
||||
);
|
||||
navigateForward(policyInfo) {
|
||||
const policy = policyInfo.policies?.[0];
|
||||
|
||||
// if policy lookup is unsuccessful, navigate to policy-holder-details page
|
||||
if (!policy) {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
// if policy lookup is successful, but no vehicles are associated with the policy
|
||||
// navigate to vehicle-selection page (manual entry)
|
||||
else if (!this.vehiclesFound) {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
// if policy lookup is successful and vehicles are found, navigate to
|
||||
else {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES,
|
||||
this.$route,
|
||||
{},
|
||||
{},
|
||||
this.vehiclesFound
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
async getVehiclesfromPolicyLookup()
|
||||
{
|
||||
//call coverage policy lookup if isCoverageEnabled flag enabled
|
||||
if(this.isCoverageEnabled){
|
||||
const policyLookupResponse = await this.getPolicyLookupResponse();
|
||||
if(policyLookupResponse!=null){
|
||||
var policy = policyLookupResponse.policies?.[0];
|
||||
if(policy!=null){
|
||||
//populate policy holder details from policy lookup
|
||||
this.mainStore.order.customer.address.streetAddress = policy.insureds?.[0]?.address;
|
||||
this.mainStore.order.customer.address.city=policy.insureds?.[0]?.city;
|
||||
this.mainStore.order.customer.address.state=policy.insureds?.[0]?.state;
|
||||
this.mainStore.order.customer.address.zipCode=policy.insureds?.[0]?.zipCode;
|
||||
this.mainStore.order.customer.firstName = policy.insureds?.[0]?.firstName;
|
||||
this.mainStore.order.customer.lastName = policy.insureds?.[0]?.lastName;
|
||||
|
||||
//populate vehicles
|
||||
this.vehiclesFound= policy.vehicles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
getWelcomePageModelFromStore() {
|
||||
return {
|
||||
policyNumber : this.mainStore.order.policy.policyNumber,
|
||||
|
|
@ -306,7 +373,10 @@ export default {
|
|||
isPolicyHolderEnabled()
|
||||
{
|
||||
return !!this.mainStore.issConfig.disabledFields.policyNumber;
|
||||
}
|
||||
},
|
||||
isCoverageEnabled(){
|
||||
return this.mainStore.issConfig.isCoverageEnabled;
|
||||
},
|
||||
},
|
||||
components: {
|
||||
siteHeader,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ const navigationScenarios = {
|
|||
// Entry
|
||||
MOVE_FORWARD_ENTRY_PAGE: "MOVE_FORWARD_ENTRY_PAGE",
|
||||
|
||||
// Welcome
|
||||
CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES",
|
||||
CLICKED_FORWARD_WITH_NO_POLICY: "CLICKED_FORWARD_WITH_NO_POLICY",
|
||||
CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES",
|
||||
|
||||
// YMMS
|
||||
SELECTED_YEAR: "SELECTED_YEAR",
|
||||
SELECTED_MAKE: "SELECTED_MAKE",
|
||||
|
|
@ -46,8 +51,8 @@ const navigationScenarios = {
|
|||
//Provider Preference
|
||||
CLICKED_FORWARD_WITH_SAFELITE: "CLICKED_FORWARD_WITH_SAFELITE",
|
||||
CLICKED_FORWARD_WITH_TPA_ENABLED: "CLICKED_FORWARD_WITH_TPA_ENABLED",
|
||||
CLICKED_FORWARD_WITH_TPA_DISABLED: "CLICKED_FORWARD_WITH_TPA_DISABLED"
|
||||
|
||||
CLICKED_FORWARD_WITH_TPA_DISABLED: "CLICKED_FORWARD_WITH_TPA_DISABLED",
|
||||
CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES"
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -375,9 +375,17 @@ const routingTable = function(store) {
|
|||
destinationIssPageValue: issPageValues.WELCOME_PAGE
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES,
|
||||
destinationIssPageValue: issPageValues.POLICY_VEHICLES
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_POLICY,
|
||||
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
|
||||
}
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_POLICY_AND_NO_VEHICLES,
|
||||
destinationIssPageValue: issPageValues.VEHICLE_SELECTION
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue