Final touches

This commit is contained in:
Michaela Brydon 2024-01-03 17:47:23 -05:00
parent 06b186397c
commit 272ec08bc5
5 changed files with 49 additions and 19 deletions

View file

@ -10,8 +10,8 @@ import { useMainStore } from '@/store';
*/ */
export function getStringWithCustomValues(str, customValueMap) { export function getStringWithCustomValues(str, customValueMap) {
let newString = str; let newString = str;
Object.entries(customValueMap).forEach((key, value) => { Object.keys(customValueMap).forEach((key) => {
newString = newString.replaceAll(`{custom:${key}}`, value); newString = newString.replaceAll(`{custom:${key}}`, customValueMap[key]);
}); });
return newString; return newString;
} }

View file

@ -118,7 +118,7 @@ import loadingModal from '@/iss-components/loading-modal/loading-modal.vue';
import textBlock from '@/digital-components/text-block/text-block.vue'; import textBlock from '@/digital-components/text-block/text-block.vue';
// Import Supporting Files // Import Supporting Files
import { fetchCmsContentForPage, setupModalLinks, setupModalLink, processIfStatements } from '@/helpers/cms-content-helper.js'; import { fetchCmsContentForPage, setupModalLinks, processIfStatements } from '@/helpers/cms-content-helper.js';
import settleAllPromises from '@/helpers/layout-helper.js'; import settleAllPromises from '@/helpers/layout-helper.js';
import { getDamageString } from '@/helpers/damage-helper.js'; import { getDamageString } from '@/helpers/damage-helper.js';
import { useMainStore } from '@/store/index.js'; import { useMainStore } from '@/store/index.js';

View file

@ -280,6 +280,25 @@ export default {
this.selectedProviderNumber = newProviders?.length === 1 ?? false this.selectedProviderNumber = newProviders?.length === 1 ?? false
? newProviders[0]?.providerNumber ?? '' ? newProviders[0]?.providerNumber ?? ''
: ''; : '';
},
selectedProviderNumber(newNumber) {
const provider = this.providers?.find((p) => p.providerNumber === newNumber);
if (provider) {
useMainStore().updateServiceLocation({
provider: {
providerNumber: provider.providerNumber,
address: {
streetAddress: provider.address.streetAddress,
city: provider.address.city,
state: provider.address.state,
zipCode: provider.address.zipCode,
zipCodeCtu: provider.address.zipCodeCtu
},
companyName: provider.companyName,
phoneNumber: provider.phoneNumber
}
});
}
} }
}, },
beforeUpdate() { beforeUpdate() {

View file

@ -34,7 +34,7 @@
isPrimary isPrimary
:buttonText="forwardButtonText" :buttonText="forwardButtonText"
loaderColor="white" loaderColor="white"
class="w-100 mb-4" class="w-100 mb-5"
@clickEvent="forwardButtonAction" /> @clickEvent="forwardButtonAction" />
<hr class="mb-0" /> <hr class="mb-0" />
<div id="serviceSummarySection"> <div id="serviceSummarySection">
@ -95,7 +95,7 @@ import deductibleBox from '@/layouts/tpa-submit/deductible-box/deductible-box.vu
import siteFooter from '@/iss-components/site-footer/site-footer.vue'; import siteFooter from '@/iss-components/site-footer/site-footer.vue';
// Supporting files // Supporting files
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import { fetchCmsContentForPage, processIfStatements, getStringWithCustomValues } 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 widgetFields from '@/constants/cms-widget-fields.js'; import widgetFields from '@/constants/cms-widget-fields.js';
@ -104,15 +104,6 @@ import { toTitleCase, toDisplayPhoneNumber, formatAddress, formatAmountInDollars
const VERIFYING_COVERAGE = 'Verifying coverage'; const VERIFYING_COVERAGE = 'Verifying coverage';
// TODO move functions to general location
function getStringWithCustomValues(str, customValueMap) {
let newString = str;
Object.entries(customValueMap).forEach((key, value) => {
newString = newString.replaceAll(`{custom:${key}}`, value);
});
return newString;
}
export default { export default {
name: 'tpa-submit', name: 'tpa-submit',
components: { components: {
@ -176,12 +167,17 @@ export default {
return this.getCmsContent(this.widget.orderDetails, widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT); return this.getCmsContent(this.widget.orderDetails, widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT);
}, },
orderDetailsBody() { orderDetailsBody() {
return this.getCmsContent(this.widget.orderDetails, widgetFields.CONTENT_GROUP_WIDGET.BODY_TEXT); const orderDetailsBodyText = this.getCmsContent(this.widget.orderDetails, widgetFields.CONTENT_GROUP_WIDGET.BODY_TEXT);
return this.processIfStatements(orderDetailsBodyText, 'custom', this.getCustomValueFromString);
},
isVerified() {
return useMainStore().order.payment.insuranceCoverage.isVerified;
},
currentDeductible() {
return useMainStore().order.currentDeductible;
}, },
deductibleBoxValue() { deductibleBoxValue() {
const { isVerified } = useMainStore().order.payment.insuranceCoverage; return this.isVerified ? this.formatAmountInDollars(this.currentDeductible) : VERIFYING_COVERAGE;
const { currentDeductible } = useMainStore().order;
return isVerified ? this.formatAmountInDollars(currentDeductible) : VERIFYING_COVERAGE;
}, },
forwardButtonText() { forwardButtonText() {
return this.getCmsContent(this.widget.footer, widgetFields.FOOTER_WIDGET.FORWARD_BUTTON_TEXT); return this.getCmsContent(this.widget.footer, widgetFields.FOOTER_WIDGET.FORWARD_BUTTON_TEXT);
@ -239,6 +235,19 @@ export default {
navigate(scenario) { navigate(scenario) {
this.$router.navigate(scenario, this.$route); this.$router.navigate(scenario, this.$route);
}, },
getCustomValueFromString(str) {
switch (str) {
case 'deductibleAboveZero':
return this.isVerified && this.currentDeductible !== 0;
case 'zeroDeductible':
return this.isVerified && this.currentDeductible === 0;
case 'verifyingCoverage':
return !this.isVerified;
default:
return null;
}
},
processIfStatements,
getStringWithCustomValues, getStringWithCustomValues,
toDisplayPhoneNumber, toDisplayPhoneNumber,
toTitleCase, toTitleCase,

View file

@ -1324,7 +1324,9 @@ export const useMainStore = defineStore({
state: serviceLocationInfo.provider?.address?.state, state: serviceLocationInfo.provider?.address?.state,
zipCode: serviceLocationInfo.provider?.address?.zipCode, zipCode: serviceLocationInfo.provider?.address?.zipCode,
zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu
} },
companyName: serviceLocationInfo.provider?.companyName,
phoneNumber: serviceLocationInfo.provider?.phoneNumber
}; };
}, },