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" class="appointment-text text-center text-color--black lh-base"
v-html="appointmentWordingText"> v-html="appointmentWordingText">
</div> </div>
<div
class="appointment-text text-center text-color--black lh-base mt-2"
v-html="appointmentWordingText2">
</div>
</div> </div>
<siteFooter <siteFooter
v-if="carrierUrl" 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 vehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
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 } from '@/helpers/cms-content-helper';
import settleAllPromises from '@/helpers/layout-helper'; import settleAllPromises from '@/helpers/layout-helper';
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 { useMainStore } from '@/store'; 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'; import { toTitleCase } from '@/helpers/text-helper.js';
export default { export default {
@ -128,9 +133,15 @@ export default {
mobileWordingText() { mobileWordingText() {
return this.getCmsContent('MobileWordingWidget', 'BodyText'); return this.getCmsContent('MobileWordingWidget', 'BodyText');
}, },
mobileWordingText2() {
return this.getCmsContent('MobileWordingWidget', 'BodyText2');
},
dropOffAndInShopWordingText() { dropOffAndInShopWordingText() {
return this.getCmsContent('DropOffAndInShopWordingWidget', 'BodyText'); return this.getCmsContent('DropOffAndInShopWordingWidget', 'BodyText');
}, },
dropOffAndInShopWordingText2() {
return this.getBodyText2FromCms('DropOffAndInShopWordingWidget');
},
serviceLocationAddress() { serviceLocationAddress() {
return this.mainStore.order.serviceLocation.address; return this.mainStore.order.serviceLocation.address;
}, },
@ -167,7 +178,56 @@ export default {
return `<br/>${this.providerAddress},<br/> ${this.providerCity}, ${this.providerState} ${this.providerZipCode}<br/>`; return `<br/>${this.providerAddress},<br/> ${this.providerCity}, ${this.providerState} ${this.providerZipCode}<br/>`;
}, },
appointmentWordingText() { 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() { mounted() {
@ -192,23 +252,17 @@ export default {
return null; return null;
} }
}, },
formatWordingText(appointmentType) { processIfStatements,
switch (appointmentType) { getBodyText2FromCms(cmsWidgetName) {
case 'MOBILE': const body2Text = this.getCmsContent(cmsWidgetName, 'BodyText2');
return this.mobileWordingText?.replaceAll( return this.processIfStatements(body2Text, 'custom', this.getCustomValueFromString);
'{custom:address}', },
this.serviceLocationFullAddress getCustomValueFromString(str) {
); switch (str) {
case 'DROP OFF': case 'inShopAppointment':
return this.dropOffAndInShopWordingText?.replaceAll( return this.inShopAppointment;
'{custom:address}', case 'dropOffAppointment':
this.providerFullAddress return this.dropOffAppointment;
);
case 'INSHOP':
return this.dropOffAndInShopWordingText?.replaceAll(
'{custom:address}',
this.providerFullAddress
);
default: default:
return null; return null;
} }