Mobile Options based on iTAC flag

flag should include !(no comp) as well based on coverage statement page.
This commit is contained in:
Bill Richardson 2023-09-29 09:43:35 -04:00
parent b134b278d8
commit 16296c7423
7 changed files with 40 additions and 19 deletions

View file

@ -1,6 +1,7 @@
const AppointmentTypeStrings = {
IN_SHOP: 'Inshop',
MOBILE: 'Mobile',
MOBILE_INSURANCE: 'Mobile-Insurance',
DROP_OFF: 'Dropoff'
};
const PREMIUM_FEE_PART_TYPE = 'EARLY BIRD';

View file

@ -140,8 +140,6 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to?.query?.issPage);
const wipersPromise = await useMainStore().getWipers();
const rainDefensePromise = await useMainStore().getRainDefense();
const supportingItemsPromise = await useMainStore().getSupportingItems();
// Settle promises and get results
@ -150,14 +148,6 @@ export default {
resultKey: 'cmsContent',
promise: cmsContentPromise
},
{
resultKey: 'wipers',
promise: wipersPromise
},
{
resultKey: 'rainDefense',
promise: rainDefensePromise
},
{
resultKey: 'supportingItems',
promise: supportingItemsPromise
@ -169,9 +159,7 @@ export default {
? JSON.parse(JSON.stringify(useMainStore().order.lineItems.glassParts))
: [];
const availableLineItems = [
resultMap.rainDefense,
...(resultMap.supportingItems ?? []),
...(resultMap.wipers ?? []),
...(clonedGlassParts ?? [])
];
@ -357,6 +345,7 @@ export default {
return this.navigateForward();
},
async navigateForward() {
useMainStore().updatePolicyITACFlag(this.verifiedITAC);
if (this.unverified || this.verifiedDeductible) {
this.mainStore.saveSupportingItems(this.supportingItems);
this.$router.navigate(

View file

@ -51,13 +51,15 @@ export default {
return this.getCmsContent(this.cmsWidgetName, 'Answers');
},
answersToDisplay() {
const shouldShowMobile = this.isServiceableMobile;
const shouldShowMobile = this.isServiceableMobile && this.isITAC;
const shouldShowMobileInsurance = this.isServiceableMobile && !this.isITAC;
const shouldShowInshop = this.isServiceableInshop;
const shouldShowDropoff = this.isServiceableInshop && !useMainStore().damage.isRepair;
return this.answersFromCms
? this.answersFromCms.filter((answer) => (
(answer.Name === AppointmentTypeStrings.IN_SHOP && shouldShowInshop)
|| (answer.Name === AppointmentTypeStrings.MOBILE && shouldShowMobile)
|| (answer.Name === AppointmentTypeStrings.MOBILE_INSURANCE && shouldShowMobileInsurance)
|| (answer.Name === AppointmentTypeStrings.DROP_OFF && shouldShowDropoff)
))
: [];
@ -70,6 +72,9 @@ export default {
this.$emit('update:modelValue', newValue);
}
},
isITAC() {
return useMainStore().policy.isITAC;
},
isMobileOnly() {
return this.isServiceableMobile && !this.isServiceableInshop;
}
@ -80,9 +85,14 @@ export default {
// If there is only one option to display and that option is 'Mobile' then select it
if (
newValue.length === 1
&& newValue.findIndex((answer) => answer.Name === 'Mobile') !== -1
&& newValue.findIndex((answer) => (answer.Name === AppointmentTypeStrings.MOBILE
|| answer.Name === AppointmentTypeStrings.MOBILE_INSURANCE)) !== -1
) {
this.selectedValues = 'Mobile';
if (this.isITAC) {
this.selectedValues = AppointmentTypeStrings.MOBILE;
} else {
this.selectedValues = AppointmentTypeStrings.MOBILE_INSURANCE;
}
}
},
immediate: true
@ -90,7 +100,11 @@ export default {
isMobileOnly: {
handler(newValue) {
if (newValue) {
this.selectedValues = 'Mobile';
if (this.isITAC) {
this.selectedValues = AppointmentTypeStrings.MOBILE;
} else {
this.selectedValues = AppointmentTypeStrings.MOBILE_INSURANCE;
}
}
}
}

View file

@ -31,6 +31,7 @@
</span>
</div>
<textBlock
v-if="isITAC"
:customText="mobileFeeText"
cmsWidgetName="MobileFeeDisclaimerWidget"
typeStyle="caption" />
@ -81,6 +82,7 @@ import addressQuestions from '@/iss-components/address-questions/address-questio
import vehicleProtectedQuestion from '@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question.vue';
// Helpers
import { useMainStore } from '@/store';
import {
getPricedMobileFeePart,
getServiceabilityDetails,
@ -167,6 +169,9 @@ export default {
};
},
computed: {
isITAC() {
return useMainStore().policy.isITAC;
},
mobileLocationLinkPromptText() {
return this.getCmsContent(this.linkWidgetName, 'HeaderText');
},

View file

@ -59,7 +59,7 @@
cmsWidgetName="AppointmentTypeQuestionWidget"
validationRules="option-required" />
<mobileLocationModalQuestions
v-if="selectedAppointmentType === 'Mobile'"
v-if="isMobileLocationDisplayed"
ref="mobileLocationQuestions"
v-model="mobileLocationQuestions"
customComponentId="mobileLocationQuestions"
@ -94,6 +94,7 @@
</template>
<script>
// Import Supporting Files
import { AppointmentTypeStrings } from '@/constants/schedule-constants.js';
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import settleAllPromises from '@/helpers/layout-helper';
import { required } from '@/helpers/validation-rules';
@ -260,7 +261,8 @@ export default {
this.isVehicleProtected = newValue.isVehicleProtected;
if (newValue.zipCode !== this.zipCode) {
if (!this.selectedAppointmentType === 'Mobile') {
if (!(this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_INSURANCE)) {
this.selectedAppointmentType = null;
}
this.selectedProvider = null;
@ -289,6 +291,10 @@ export default {
isAppointmentTypeDisplayed() {
return this.zipCode && !this.displayNoShopsAlert;
},
isMobileLocationDisplayed() {
return this.selectedAppointmentType === AppointmentTypeStrings.MOBILE
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_INSURANCE;
},
requiresInshopRecalibration() {
// Specifically check for isRecalibrationServiceableMobile === false, not null or true.
return (

View file

@ -48,6 +48,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import textLink from '@/ux-components/text-link/text-link.vue';
// Supporting files
import { AppointmentTypeStrings } from '@/constants/schedule-constants.js';
import baseMixin from '@/mixins/base-mixin.js';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
@ -141,7 +142,7 @@ export default {
await nextTick();
if (newValue !== 'Mobile') {
if (newValue !== AppointmentTypeStrings.MOBILE && newValue !== AppointmentTypeStrings.MOBILE_INSURANCE) {
this.getNextShopsFromList();
}
}

View file

@ -60,6 +60,7 @@ const getDefaultState = () => ({
repair: null, // numerical value; how much customer owes on deductible in repair case
replace: null // numerical value; how much customer owes on deductible in replace case,
},
isITAC: null,
vehicles: [],
endorsementQuestionAnswers: null
},
@ -1263,6 +1264,9 @@ export const useMainStore = defineStore({
this.order.customer.lastName = customerQuestions.lastName;
this.order.serviceLocation.zipCode = customerQuestions.addressQuestions.zipCode;
},
updatePolicyITACFlag(isITAC) {
this.order.policy.isITAC = isITAC;
},
savePartQuestionAnswers(partQuestionAnswersArray) {
// if part question answers have changed, reset subsequent question answers
const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue(this.order.damage.partQuestionAnswers, 'result');
@ -1670,6 +1674,7 @@ export const useMainStore = defineStore({
this.order.policy.damageCause = null;
this.order.policy.damageCity = null;
this.order.policy.damageState = null;
this.order.policy.isITAC = null;
this.order.customer.phoneNumber = null;
this.order.customer.emailAddress = null;
this.order.customer.firstName = null;