Final touches
This commit is contained in:
parent
06b186397c
commit
272ec08bc5
5 changed files with 49 additions and 19 deletions
|
|
@ -10,8 +10,8 @@ import { useMainStore } from '@/store';
|
|||
*/
|
||||
export function getStringWithCustomValues(str, customValueMap) {
|
||||
let newString = str;
|
||||
Object.entries(customValueMap).forEach((key, value) => {
|
||||
newString = newString.replaceAll(`{custom:${key}}`, value);
|
||||
Object.keys(customValueMap).forEach((key) => {
|
||||
newString = newString.replaceAll(`{custom:${key}}`, customValueMap[key]);
|
||||
});
|
||||
return newString;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 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 { getDamageString } from '@/helpers/damage-helper.js';
|
||||
import { useMainStore } from '@/store/index.js';
|
||||
|
|
|
|||
|
|
@ -280,6 +280,25 @@ export default {
|
|||
this.selectedProviderNumber = newProviders?.length === 1 ?? false
|
||||
? 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() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
isPrimary
|
||||
:buttonText="forwardButtonText"
|
||||
loaderColor="white"
|
||||
class="w-100 mb-4"
|
||||
class="w-100 mb-5"
|
||||
@clickEvent="forwardButtonAction" />
|
||||
<hr class="mb-0" />
|
||||
<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';
|
||||
|
||||
// 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 BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||
import widgetFields from '@/constants/cms-widget-fields.js';
|
||||
|
|
@ -104,15 +104,6 @@ import { toTitleCase, toDisplayPhoneNumber, formatAddress, formatAmountInDollars
|
|||
|
||||
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 {
|
||||
name: 'tpa-submit',
|
||||
components: {
|
||||
|
|
@ -176,12 +167,17 @@ export default {
|
|||
return this.getCmsContent(this.widget.orderDetails, widgetFields.CONTENT_GROUP_WIDGET.HEADER_TEXT);
|
||||
},
|
||||
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() {
|
||||
const { isVerified } = useMainStore().order.payment.insuranceCoverage;
|
||||
const { currentDeductible } = useMainStore().order;
|
||||
return isVerified ? this.formatAmountInDollars(currentDeductible) : VERIFYING_COVERAGE;
|
||||
return this.isVerified ? this.formatAmountInDollars(this.currentDeductible) : VERIFYING_COVERAGE;
|
||||
},
|
||||
forwardButtonText() {
|
||||
return this.getCmsContent(this.widget.footer, widgetFields.FOOTER_WIDGET.FORWARD_BUTTON_TEXT);
|
||||
|
|
@ -239,6 +235,19 @@ export default {
|
|||
navigate(scenario) {
|
||||
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,
|
||||
toDisplayPhoneNumber,
|
||||
toTitleCase,
|
||||
|
|
|
|||
|
|
@ -1324,7 +1324,9 @@ export const useMainStore = defineStore({
|
|||
state: serviceLocationInfo.provider?.address?.state,
|
||||
zipCode: serviceLocationInfo.provider?.address?.zipCode,
|
||||
zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu
|
||||
}
|
||||
},
|
||||
companyName: serviceLocationInfo.provider?.companyName,
|
||||
phoneNumber: serviceLocationInfo.provider?.phoneNumber
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue