Finalizing dupe check addition to welcome page

This commit is contained in:
brydon1 2023-09-15 15:59:58 -04:00
parent 509496b59a
commit a8ddd811e3
5 changed files with 80 additions and 38 deletions

View file

@ -90,24 +90,28 @@ export default {
return this.getCmsContent(this.widget.existingOrNewQuestion, 'QuestionText'); return this.getCmsContent(this.widget.existingOrNewQuestion, 'QuestionText');
}, },
answersFromCms() { answersFromCms() {
return this.getCmsContent(this.widget.existingOrNewQuestion, 'Answers'); return this.getCmsContent(this.widget.existingOrNewQuestion, 'Answers') ?? [];
}, },
testAnswers() { duplicateOrders() {
return [ const duplicateOrderText = 'Finish Existing Claim';
{ const orders = useMainStore().applicationUser.duplicateOrders;
Text: 'Finish Existing Claim', return orders.map(o => {
Name: "1", const vehicle = !!o.vehicleYear && !!o.vehicleMake && !!o.vehicleModel
SubText: "2013 Honda Civic, 09/23/2023" ? `${o.vehicleYear} ${o.vehicleMake} ${o.vehicleModel}`
}, : null;
{ const subtext = !!vehicle
Text: 'Finish Existing Claim', ? `${vehicle}, ${o.dateOfLoss}`
Name: "2", : o.dateOfLoss;
SubText: "08/01/2022"
} return {
]; Text: duplicateOrderText,
Name: o.referralNumber,
SubText: subtext
};
});
}, },
answers(){ answers() {
return [...this.testAnswers, this.answersFromCms]; return [...this.duplicateOrders, ...this.answersFromCms];
} }
}, },
methods: { methods: {
@ -131,7 +135,7 @@ export default {
{}, {},
policyVehicles policyVehicles
); );
} else {policyVehicles } else {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES, this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
this.$route this.$route
@ -150,7 +154,7 @@ export default {
<style lang="scss"> <style lang="scss">
.duplicate-check-subheader { .duplicate-check-subheader {
.subheader-secondary { .subheader-secondary {
margin-top: map-get($spacers, 3); margin-top: map-get($spacers, 2);
} }
p { p {
span { span {
@ -162,8 +166,8 @@ export default {
.question-text { .question-text {
justify-content: left; justify-content: left;
display: inline-flex !important; display: inline-flex !important;
margin-top: map-get($spacers, 5); margin-top: map-get($spacers, 4);
margin-bottom: map-get($spacers, 3); margin-bottom: map-get($spacers, 2);
} }
} }

View file

@ -49,7 +49,6 @@ import policyVehiclesQuestion from '@/layouts/policy-vehicles/policy-vehicles-qu
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js';
import { Form } from 'vee-validate'; import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
import issPageValues from '@/router/router-constants/issPage-values.js';
import vehicleSelectionOptions from '@/constants/vehicle-selection-options.js'; import vehicleSelectionOptions from '@/constants/vehicle-selection-options.js';
import endorsementOptions from '@/constants/endorsement-options.js'; import endorsementOptions from '@/constants/endorsement-options.js';
import globalRules from '@/constants/global-rules.js'; import globalRules from '@/constants/global-rules.js';
@ -73,7 +72,7 @@ export default {
}); });
}, },
data() { data() {
const policyVehicles = useMainStore().pageData(issPageValues.POLICY_VEHICLES); const policyVehicles = useMainStore().order.policy.vehicles;
return { return {
policyVehicles, policyVehicles,
selectedVehicleVin: '', selectedVehicleVin: '',

View file

@ -243,6 +243,7 @@ export default {
return { return {
welcomePageModel: this.getWelcomePageModelFromStore(), welcomePageModel: this.getWelcomePageModelFromStore(),
vehiclesFound: [], vehiclesFound: [],
duplicates: [],
rules: { rules: {
policyNumber: 'policy-number-required', policyNumber: 'policy-number-required',
policyZip: 'policy-zip-required|policy-zip-format', policyZip: 'policy-zip-required|policy-zip-format',
@ -298,6 +299,22 @@ export default {
async forwardButtonAction() { async forwardButtonAction() {
this.mainStore.updatePolicyData(this.welcomePageModel); this.mainStore.updatePolicyData(this.welcomePageModel);
const duplicateCheckResponse = useMainStore().getDuplicates({
accountNumber: this.mainStore.order.accountNumber.toString(),
policyNumber: this.mainStore.order.policy.policyNumber,
dateOfLoss: this.mainStore.order.policy.dateOfLoss
});
const duplicatePromiseResultMap = [
{
resultKey: 'duplicateCheckResponse',
promise: duplicateCheckResponse
}
];
const duplicateResultMap = await settleAllPromises(duplicatePromiseResultMap);
this.mainStore.applicationUser.duplicateOrders = duplicateResultMap.duplicateCheckResponse ?? [];
this.duplicates = duplicateResultMap.duplicateCheckResponse;
// call coverage policy lookup if isCoverageEnabled flag enabled // call coverage policy lookup if isCoverageEnabled flag enabled
if (this.isCoverageEnabled) { if (this.isCoverageEnabled) {
const policyLookupResponse = useMainStore().getCoveragePolicyInfo({ const policyLookupResponse = useMainStore().getCoveragePolicyInfo({
@ -307,16 +324,15 @@ export default {
zipCode: this.mainStore.order.policy.policyZipCode zipCode: this.mainStore.order.policy.policyZipCode
}); });
// Settle promises and get results const policyPromiseResultMap = [
const promisePolicyLookupResultMap = [
{ {
resultKey: 'policyLookupResponse', resultKey: 'policyLookupResponse',
promise: policyLookupResponse promise: policyLookupResponse
} }
]; ];
const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap); const policyResultMap = await settleAllPromises(policyPromiseResultMap);
const policyInfo = policyLookupResultMap.policyLookupResponse; const policyInfo = policyResultMap.policyLookupResponse;
// if policy lookup fails, navigate directly to policy-holder-details page // if policy lookup fails, navigate directly to policy-holder-details page
if (!policyInfo) { if (!policyInfo) {
@ -346,15 +362,22 @@ export default {
}, },
navigateForward(policy) { navigateForward(policy) {
if (policy) { if (this.duplicates?.length > 0 ?? false) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
this.$route,
{},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
);
}
else if (policy) {
if (this.vehiclesFound) { if (this.vehiclesFound) {
// if policy lookup is successful and vehicles are found, navigate to policy-vehicles page // if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES, this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
this.$route, this.$route,
{}, {},
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }, { [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
this.vehiclesFound
); );
} else { } else {
// if policy lookup is successful, but no vehicles are associated with the policy // if policy lookup is successful, but no vehicles are associated with the policy

View file

@ -127,7 +127,8 @@ const getDefaultState = () => ({
savedSessionId: null, savedSessionId: null,
crmCustomerId: null, crmCustomerId: null,
lastPageVisited: null, lastPageVisited: null,
triggeredSiteEntry: false triggeredSiteEntry: false,
duplicateOrders: []
}, },
issConfig: { issConfig: {
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
@ -452,6 +453,22 @@ export const useMainStore = defineStore({
}); });
}); });
}, },
// TODO when endpoint finished replace dummy data with api call
getDuplicates({accountNumber, policyNumber, dateOfLoss}) {
return [
{
referralNumber: "12345",
vehicleYear: "2013",
vehicleMake: "Honda",
vehicleModel: "Civic",
dateOfLoss: "09/23/2023"
},
{
referralNumber: "34210",
dateOfLoss: "08/01/2022"
}
];
},
async lookupVinByPlate(licensePlate, licenseState) { async lookupVinByPlate(licensePlate, licenseState) {
try { try {
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({

View file

@ -157,14 +157,13 @@ $spacer: 1rem;
$spacers: ( $spacers: (
0: 0, 0: 0,
1: $spacer * 0.25, 1: $spacer * 0.25,
/* 4px */ 2: $spacer * 0.5, /* 8px */ 2: $spacer * 0.5,
/* 8px */ 3: $spacer * 0.75, /* 12px */ 3: $spacer * 0.75,
/* 12px */ 4: $spacer * 1, /* 16px */ 4: $spacer * 1,
/* 16px */ 5: $spacer * 1.5, /* 24px */ 5: $spacer * 1.5,
/* 24px */ 6: $spacer * 2, /* 32px */ 6: $spacer * 2,
/* 32px */ 7: $spacer * 2.5, /* 40px */ 7: $spacer * 2.5,
/* 40px */ 8: $spacer * 3, /* 48px */ 8: $spacer * 3,
/* 48px */
); );
//Grid breakpoints //Grid breakpoints