From 14f53103ee17474073f02b37cb6173647cf4f32d Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 6 May 2022 12:57:40 -0400 Subject: [PATCH] Add insurance verified alert. --- src/helpers/damage-helper.js | 26 +++++++++++++++++++++++++- src/layouts/vin-lookup/vin-lookup.vue | 24 ++++++++++++++++-------- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index e56761dc5..a9b14b98d 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -3,9 +3,33 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; export function getDamageString() { - return store.getters.damage.glassToReplace.length > 1 ? "match" : store.getters.damage.glassToReplace[0].location; + const damageLocations = store.getters.damage.glassToReplace; + let returnString; + if(damageLocations.length > 1){ + returnString = "match" + } else { + switch(damageLocations[0]?.location) { + case "Windshield": + returnString = "windshield" + break; + case "Driver": + case "Passenger": + returnString = "side window" + break; + case "Rear": + returnString = "rear window" + } + } + return returnString; } + export function getIsWindshieldOnly () { + const damageLocations = store.getters.damage.glassToReplace; + const returnString = damageLocations.length === 1 && damageLocations[0]?.location === "Windshield" ? "windshield" : "glass"; + console.log(damageLocations); + return returnString; + } + export async function isGlassAvailableForCarId(carId){ const newGlassOptions = await baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 0072708f4..adabb7fcc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -102,6 +102,14 @@ alertClass="alert-warning" cmsWidgetName="PerfectMatchNewVinAlert" /> + - @@ -169,7 +170,7 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import { errorMessages } from "@/constants/error-messages"; -import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; +import { getDamageString, getIsWindshieldOnly, isGlassAvailableForCarId } from "@/helpers/damage-helper"; import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; @@ -260,6 +261,13 @@ export default { return this.getCmsContent("PerfectMatchNewVinAlert", "BodyText").replaceAll("{custom:damage}", getDamageString()) }, + PerfectMatchNewVinAlertReadOnlyHeader () { + return this.getCmsContent("PerfectMatchNewVinAlertReadOnly", "HeadlineText"); + }, + PerfectMatchNewVinAlertReadOnlyBody () { + return this.getCmsContent("PerfectMatchNewVinAlertReadOnly", "BodyText").replaceAll("{custom:damage}", + getIsWindshieldOnly()) + }, isVinFieldReadOnly(){ return this.$store.getters.payment.insuranceCoverage.isVerified; },