coverage-statement WIP

This commit is contained in:
Katie Kroell 2023-07-12 17:16:33 -04:00
parent ceac399c12
commit 618c7c0ef2

View file

@ -12,6 +12,43 @@
v-html="coverageStatementSubHeader"
class="d-flex justify-content-center text-black">
</h5>
<div>
<p class="d-flex justify-content-center">
<span v-html="secondaryText"></span>
<span class="text"></span>
</p>
</div>
<div>
<p class="d-flex justify-content-center secondary-text" v-if="verifiedDeductible">
{{ formattedDeductible }}
</p>
<div>
<p class="d-flex justify-content-center secondary-text" v-if="verifiedITAC">
{{ formattedServicePrice }}
</p>
<p v-if="verifiedITAC">Your deductible is: {{ formattedDeductible }}</p>
</div>
</div>
<alert
ref="verifiedITACAlert"
v-if="verifiedITAC"
class="mb-4"
cmsWidgetName="VerifiedITACAlert"
alertClass="alert-success"
v-bind:isDismissible="false">
</alert>
<p
v-html="explanatoryText"
id="explanatory">
</p>
<div
v-html="nextStepsHeader"
class="fw-bold text-black mb-2">
</div>
<div
v-html="nextStepsBody"
id="nextStepsBody">
</div>
<!-- <textBlock
cmsWidgetName="verifyingCoverageStatement"
typeStyle="h5"
@ -21,12 +58,12 @@
<!-- <div>
<p v-html="continueWithSchedulingBodyText" class="mt-0 small" ></p>
</div> -->
<textBlock
<!-- <textBlock
cmsWidgetName="whatHappensNextCopy"
class="mt-4 mb-2 fw-bold"
id="coverage-statement-text-block" />
id="coverage-statement-text-block" /> -->
<div>
<p class="small" v-html="bodyText" ref="coverageStatementBodyText"></p>
<!-- <p class="small" v-html="bodyText" ref="coverageStatementBodyText"></p> -->
</div>
<steeringText cmsWidgetName="MASteeringText" ></steeringText>
@ -45,6 +82,7 @@
</div>
</div>
<recalModal ref="RecalModal" cmsWidgetName="RecalModal" />
<contentGroupModal ref="DeductibleModal" cmsWidgetName="DeductibleModal" />
</Form>
</template>
<script>
@ -58,7 +96,9 @@ import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header.vue'
import textBlock from "@/digital-components/text-block/text-block";
import recalModal from '@/layouts/coverage-statement/recal-modal/recal-modal.vue';
import steeringText from "@/iss-components/steering-text/steering-text.vue";
import { issPageValues } from "@/router/router-constants/issPage-values";
import alert from "@/ux-components/alert/alert";
import contentGroupModal from '@/iss-components/content-group-modal/content-group-modal';
// Import Supporting Files
import { fetchCmsContentForPage, setupModalLinks } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
@ -72,6 +112,52 @@ const store = useMainStore();
export default {
name: 'coverage-statement',
mixins: [baseFormMixin, vehicleQuestionsMixin],
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
const supportingItemsPromise = await store.getSupportingItems();
// Settle promises and get results
const promiseResultMap = [
{
resultKey: 'cmsContent',
promise: cmsContentPromise,
},
{
resultKey: 'supportingItems',
promise: supportingItemsPromise,
},
];
if (useMainStore().isClaimRegistrationRequired){
const registerClaimResponse = await useMainStore().registerClaim();
promiseResultMap.push({
resultKey: 'registerClaim',
promise: registerClaimResponse,
});
}
const resultMap = await settleAllPromises(promiseResultMap);
const clonedGlassParts = store.order.lineItems.glassParts
? JSON.parse(JSON.stringify(store.order.lineItems.glassParts))
: [];
const availableLineItems = [
...resultMap.supportingItems,
...clonedGlassParts,
];
const pricingResults = await store.getPriceOrderItems(availableLineItems);
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.pricedGlassParts = clonedGlassParts;
vm.supportingItems = resultMap.supportingItems;
vm.availableLineItems = pricingResults;
});
},
components: {
siteFooter,
siteHeader,
@ -79,17 +165,43 @@ export default {
Form,
textBlock,
recalModal,
steeringText
steeringText,
alert,
contentGroupModal
},
mounted() {
setupModalLinks(this);
//this.getPriceInfo();
},
data() {
return {
//isVerified: store.order.payment.insuranceCoverage.isVerified,
//isVerified: true,
supportingItems: [],
pricedGlassParts: [],
availableLineItems: [],
}
},
computed: {
coverageStatementSubHeader() {
const subheader = this.getSubheaderTextFromCms("SiteSubHeaderWidget");
return subheader;
},
secondaryText() {
const secondaryText = this.getSecondaryTextFromCms("SiteSubHeaderWidget");
return secondaryText;
},
explanatoryText() {
const explanatoryText = this.getExplantoryTextFromCms("ExplanatoryTextWidget");
return explanatoryText;
},
nextStepsHeader() {
const header = this.getHeaderTextFromCms("NextStepsWidget");
return header;
},
nextStepsBody() {
let body = this.getBodyTextFromCms("NextStepsWidget").replaceAll("{custom:damage}", this.damageText);
return body;
},
// coverageStatementContent() {
// if (!this.cmsWidgetName) return [];
// const cmsContent = [];
@ -111,23 +223,23 @@ export default {
// if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
// return {};
// }
bodyText() {
if (useMainStore().damage.isRepair) {
return this.unverifiedNonADASRepairBodyText;
}
else {
let parts = useMainStore().lineItems.glassParts;
// bodyText() {
// if (useMainStore().damage.isRepair) {
// return this.unverifiedNonADASRepairBodyText;
// }
// else {
// let parts = useMainStore().lineItems.glassParts;
// if ADAS, display ADASNextSteps
if (parts != null && parts.filter(part => part.requiresRecalibration).length > 0) {
return this.unverifiedADASNextStepsBodyText;
}
// if non-ADAS, display NonADASNextSteps
else {
return this.unverifiedNonADASNextStepsBodyText;
}
}
},
// // if ADAS, display ADASNextSteps
// if (parts != null && parts.filter(part => part.requiresRecalibration).length > 0) {
// return this.unverifiedADASNextStepsBodyText;
// }
// // if non-ADAS, display NonADASNextSteps
// else {
// return this.unverifiedNonADASNextStepsBodyText;
// }
// }
// },
continueWithSchedulingBodyText() {
return this.getCmsContent("continueWithSchedulingCopy", "BodyText");
},
@ -152,11 +264,13 @@ export default {
// },
vehicleDeductible() {
if (this.coverageVerified) {
if (this.store.order.damage.isRepair) {
return this.store.order.policy.deductible.repair;
if (store.order.damage.isRepair) {
const repairDeductible = store.order.policy.deductible.repair
return repairDeductible;
}
else {
return this.store.order.policy.deductible.replace;
const replaceDeductible = store.order.policy.deductible.replace;
return replaceDeductible;
}
}
//console.log(this.selectedVehicle[0].coverages[0].deductible);
@ -164,74 +278,92 @@ export default {
//console.log(!this.selectedVehiclePolicyInfo[0].coverages[0]);
//return deductible;
},
formattedDeductible() {
return this.getDeductibleString(this.vehicleDeductible);
},
isDeductibleZero() {
return this.vehicleDeductible === 0;
},
deductibleOverZero() {
return this.vehicleDeductible > 0;
},
coverageVerified() {
return this.isVerified;
// const isVerified = store.order.payment.insuranceCoverage.isVerified;
// return isVerified;
return true;
//return this.isVerified;
},
coverageUnverified() {
return !this.isVerified;
return false;
//return !this.isVerified;
},
verifiedNoComp() {
return store.order.policy.noCompensation;
// if (!this.policyVehicles.coverages || this.policyVehicles.noCoverage === true) {
// return true;
// }
if (this.coverageVerified) {
return store.order.policy.noCompensation;
}
},
verifiedITAC() {
//this.getPriceInfo();
return this.ITAC;
if (this.coverageVerified) {
if (this.vehicleDeductible > this.totalServicePrice) {
return true;
}
}
},
verifiedDeductible() {
return true;
if (this.coverageVerified) {
if (this.totalServicePrice > this.vehicleDeductible) {
return true;
}
}
},
ADASReplace() {
let parts = store.order.lineItems.glassParts;
if (parts.filter(part => part.requiresRecalibration).length > 0) {
return true;
if (!store.order.damage.isRepair) {
let parts = store.order.lineItems.glassParts;
if (parts != null && parts.filter(part => part.requiresRecalibration).length > 0) {
return true;
}
}
},
nonADASReplace() {
return !this.ADASReplace;
if (!store.order.damage.isRepair) {
return !this.ADASReplace;
}
},
nonADASRepair() {
if (store.order.damage.isRepair) {
return true;
}
},
},
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
totalServicePrice() {
let total = 0;
this.availableLineItems.forEach((lineItem) => {
total += this.getTotalLineItemPrice(lineItem);
})
return total;
},
formattedServicePrice() {
return this.getServicePriceString(this.totalServicePrice);
},
costSavings() {
return this.getITACCostSavings(this.vehicleDeductible, this.totalServicePrice);
// Settle promises and get results
const promiseResultMap = [
{
resultKey: 'cmsContent',
promise: cmsContentPromise,
},
];
if (useMainStore().isClaimRegistrationRequired){
const registerClaimResponse = await useMainStore().registerClaim();
promiseResultMap.push({
resultKey: 'registerClaim',
promise: registerClaimResponse,
});
}
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
});
},
},
methods: {
arePagePrerequisitesValid() {
if (useMainStore().vehicle.vin) {
return true;
}
return false;
},
openModalAction(modalName) {
this.$refs[modalName.args].openModal();
},
processIfStatements,
getHeaderTextFromCms(cmsWidgetName) {
const header = this.getCmsContent(cmsWidgetName, 'HeaderText');
return this.processIfStatements(header, "custom", this.getCustomValueFromString);
},
getSubheaderTextFromCms(cmsWidgetName) {
const subHeader = this.getCmsContent(cmsWidgetName, 'SubHeaderText');
return this.processIfStatements(subHeader, "custom", this.getCustomValueFromString);
@ -244,11 +376,9 @@ export default {
const secondaryText = this.getCmsContent(cmsWidgetName, "SecondaryText");
return this.processIfStatements(secondaryText, "custom", this.getCustomValueFromString);
},
arePagePrerequisitesValid() {
if (useMainStore().vehicle.vin) {
return true;
}
return false;
getExplantoryTextFromCms(cmsWidgetName) {
const explanatoryText = this.getCmsContent(cmsWidgetName, "BodyText");
return this.processIfStatements(explanatoryText, "custom", this.getCustomValueFromString);
},
getCustomValueFromString(str) {
switch (str) {
@ -270,6 +400,23 @@ export default {
return null;
}
},
getTotalLineItemPrice(lineItem) {
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
},
getDeductibleString(deductible) {
console.log(this.vehicleDeductible);
console.log(this.deductibleOverZero);
const formattedDeductibleFloat = parseFloat(deductible).toFixed(2);
return '$' + formattedDeductibleFloat;
},
getServicePriceString(price) {
const formattedPriceFloat = parseFloat(price).toFixed(2);
return '$' + formattedPriceFloat;
},
getITACCostSavings(vehicleDeductible, totalServicePrice) {
const savings = vehicleDeductible - totalServicePrice;
return savings;
}
},
};
</script>
@ -297,4 +444,12 @@ p strong {
p.small{
margin-bottom:0;
}
.secondary-text {
color: $green;
font-size: 32px;
font-weight: 300;
margin-bottom: 24px;
}
</style>