display service duration

This commit is contained in:
Katie Kroell 2024-03-04 15:38:08 -05:00
parent aebbd6b9e6
commit 9ddc157ed3

View file

@ -29,6 +29,10 @@
class="appointment-text text-center text-color--black lh-base"
v-html="appointmentWordingText">
</div>
<div
class="appointment-text text-center text-color--black lh-base mt-2"
v-html="appointmentWordingText2">
</div>
</div>
<siteFooter
v-if="carrierUrl"
@ -49,12 +53,13 @@ import siteHeader from '@/iss-components/site-header/site-header.vue';
import vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
// Supporting files
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { fetchCmsContentForPage, processIfStatements } from '@/helpers/cms-content-helper';
import settleAllPromises from '@/helpers/layout-helper';
import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { useMainStore } from '@/store';
import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate } from '@/helpers/date-helper.js';
import { get12HourTimeFormat, get12HourTimeMobileFormat, convertDateStringToDate,
getDisplayTextForDurationLength } from '@/helpers/date-helper.js';
import { toTitleCase } from '@/helpers/text-helper.js';
export default {
@ -128,9 +133,15 @@ export default {
mobileWordingText() {
return this.getCmsContent('MobileWordingWidget', 'BodyText');
},
mobileWordingText2() {
return this.getCmsContent('MobileWordingWidget', 'BodyText2');
},
dropOffAndInShopWordingText() {
return this.getCmsContent('DropOffAndInShopWordingWidget', 'BodyText');
},
dropOffAndInShopWordingText2() {
return this.getBodyText2FromCms('DropOffAndInShopWordingWidget');
},
serviceLocationAddress() {
return this.mainStore.order.serviceLocation.address;
},
@ -167,7 +178,56 @@ export default {
return `<br/>${this.providerAddress},<br/> ${this.providerCity}, ${this.providerState} ${this.providerZipCode}<br/>`;
},
appointmentWordingText() {
return this.formatWordingText(this.appointmentType);
switch (this.appointmentType) {
case 'MOBILE':
return this.mobileWordingText?.replaceAll(
'{custom:address}',
this.serviceLocationFullAddress
);
case 'DROP OFF':
return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}',
this.providerFullAddress
);
case 'INSHOP':
return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}',
this.providerFullAddress
);
default:
return null;
}
},
appointmentWordingText2() {
switch (this.appointmentType) {
case 'MOBILE':
return this.mobileWordingText2;
case 'DROP OFF':
return this.dropOffAndInShopWordingText2;
case 'INSHOP':
return this.dropOffAndInShopWordingText2?.replaceAll(
'{custom:inShopDuration}',
this.inShopAppointmentDuration
);
default:
return null;
}
},
mobileAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'MOBILE';
},
inShopAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'INSHOP';
},
dropOffAppointment() {
return this.mainStore.order.serviceLocation.appointmentType.toUpperCase() === 'DROP OFF';
},
inShopAppointmentDuration() {
const inshopDurationTime = getDisplayTextForDurationLength(
this.mainStore.order.schedule.jobMinMinutes,
this.mainStore.order.schedule.jobMaxMinutes
);
return inshopDurationTime;
}
},
mounted() {
@ -192,23 +252,17 @@ export default {
return null;
}
},
formatWordingText(appointmentType) {
switch (appointmentType) {
case 'MOBILE':
return this.mobileWordingText?.replaceAll(
'{custom:address}',
this.serviceLocationFullAddress
);
case 'DROP OFF':
return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}',
this.providerFullAddress
);
case 'INSHOP':
return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}',
this.providerFullAddress
);
processIfStatements,
getBodyText2FromCms(cmsWidgetName) {
const body2Text = this.getCmsContent(cmsWidgetName, 'BodyText2');
return this.processIfStatements(body2Text, 'custom', this.getCustomValueFromString);
},
getCustomValueFromString(str) {
switch (str) {
case 'inShopAppointment':
return this.inShopAppointment;
case 'dropOffAppointment':
return this.dropOffAppointment;
default:
return null;
}