In progress
This commit is contained in:
parent
6ffe811336
commit
fd633102cc
2 changed files with 86 additions and 77 deletions
|
|
@ -90,7 +90,8 @@ import cartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue';
|
|||
// Supporting files
|
||||
import {
|
||||
fetchCmsContentForPage,
|
||||
processIfStatements
|
||||
processIfStatements,
|
||||
getStringWithCustomValues
|
||||
} from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { Form } from 'vee-validate';
|
||||
|
|
@ -141,6 +142,31 @@ export default {
|
|||
const submittedOrder = mainStore.getSubmittedOrder();
|
||||
return { mainStore, submittedOrder };
|
||||
},
|
||||
data() {
|
||||
var { vehicle, serviceLocation } = this.submittedOrder;
|
||||
return{
|
||||
appointmentType: serviceLocation.appointmentType,
|
||||
serviceLocationAddress: serviceLocation.address,
|
||||
serviceLocationAddress2: serviceLocation.address2,
|
||||
serviceLocationCity: serviceLocation.city,
|
||||
serviceLocationState: serviceLocation.state,
|
||||
serviceLocationZipCode: serviceLocation.zipCode,
|
||||
widgets: {
|
||||
emailConfirmation: 'EmailConfirmationWordingWidget',
|
||||
orderConfirmation: 'OrderConfirmationContent',
|
||||
mobile: 'MobileWordingWidget'
|
||||
},
|
||||
customValueMap: {
|
||||
inShopAppointment: (serviceLocation.appointmentType === AppointmentTypeStrings.IN_SHOP),
|
||||
dropOffAppointment: false,
|
||||
vehicleYear: vehicle.year,
|
||||
vehicleMake: vehicle.make,
|
||||
vehicleModel: vehicle.model,
|
||||
address: '100 Pine Tract Rd.', // TODO fix
|
||||
inShopDuration: '12 minutes' //TODO
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
carrierName() {
|
||||
return this.mainStore.issConfig.clientName;
|
||||
|
|
@ -149,18 +175,8 @@ export default {
|
|||
return this.mainStore.issConfig.successReturnURL;
|
||||
},
|
||||
confirmationEmailText() {
|
||||
return this.getCmsContent(
|
||||
'EmailConfirmationWordingWidget',
|
||||
'BodyText'
|
||||
)
|
||||
?.replaceAll(
|
||||
'{custom:CUSTOMER_PORTAL_URL}',
|
||||
applicationConfig.CUSTOMER_PORTAL_URL
|
||||
)
|
||||
?.replaceAll(
|
||||
'{custom:CUSTOMER_PORTAL_LOGIN_TOKEN}',
|
||||
this.submittedOrder.customerPortalLoginToken
|
||||
)
|
||||
var content = this.getCmsContent('EmailConfirmationWordingWidget','BodyText')
|
||||
return getStringWithCustomValues(content, this.customValueMap)
|
||||
?.replaceAll('<', '<')
|
||||
?.replaceAll('>', '>');
|
||||
},
|
||||
|
|
@ -193,38 +209,29 @@ export default {
|
|||
});
|
||||
},
|
||||
appointmentTimeFormatted() {
|
||||
const formattedTime = this.formatAppointmentTime(this.appointmentType);
|
||||
return formattedTime;
|
||||
return this.formatAppointmentTime(this.appointmentType);
|
||||
},
|
||||
mobileWordingText() {
|
||||
return this.getCmsContent('MobileWordingWidget', 'BodyText');
|
||||
//return this.getCmsContent('MobileWordingWidget', 'BodyText');
|
||||
var content = this.getCmsContent('MobileWordingWidget','BodyText');
|
||||
return getStringWithCustomValues(content, this.customValueMap);
|
||||
},
|
||||
mobileWordingText2() {
|
||||
return this.getCmsContent('MobileWordingWidget', 'BodyText2');
|
||||
},
|
||||
dropOffAndInShopWordingText() {
|
||||
return this.getCmsContent(
|
||||
'DropOffAndInShopWordingWidget',
|
||||
'BodyText'
|
||||
);
|
||||
// return this.getCmsContent(
|
||||
// 'DropOffAndInShopWordingWidget',
|
||||
// 'BodyText'
|
||||
// );
|
||||
var content = this.getCmsContent('DropOffAndInShopWordingWidget','BodyText');
|
||||
return getStringWithCustomValues(content, this.customValueMap);
|
||||
},
|
||||
dropOffAndInShopWordingText2() {
|
||||
return this.getBodyText2FromCms('DropOffAndInShopWordingWidget');
|
||||
},
|
||||
serviceLocationAddress() {
|
||||
return this.submittedOrder.serviceLocation.address;
|
||||
},
|
||||
serviceLocationAddress2() {
|
||||
return this.submittedOrder.serviceLocation.address2;
|
||||
},
|
||||
serviceLocationCity() {
|
||||
return this.submittedOrder.serviceLocation.city;
|
||||
},
|
||||
serviceLocationState() {
|
||||
return this.submittedOrder.serviceLocation.state;
|
||||
},
|
||||
serviceLocationZipCode() {
|
||||
return this.submittedOrder.serviceLocation.zipCode;
|
||||
// var content = this.getCmsContent('DropOffAndInShopWordingWidget','BodyText2');
|
||||
// return getStringWithCustomValues(content, this.customValueMap);
|
||||
//return this.getBodyText2FromCms('DropOffAndInShopWordingWidget');
|
||||
return this.getTextFromCmsWithCustomValues('DropOffAndInShopWordingWidget', 'BodyText2');
|
||||
},
|
||||
serviceLocationFullAddress() {
|
||||
// eslint-disable-next-line max-len
|
||||
|
|
@ -256,42 +263,24 @@ export default {
|
|||
: '';
|
||||
},
|
||||
appointmentWordingText() {
|
||||
switch (this.appointmentType) {
|
||||
case AppointmentTypeStrings.MOBILE:
|
||||
case AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP:
|
||||
return this.mobileWordingText?.replaceAll(
|
||||
'{custom:address}',
|
||||
this.serviceLocationFullAddress
|
||||
);
|
||||
case AppointmentTypeStrings.DROP_OFF:
|
||||
return this.dropOffAndInShopWordingText?.replaceAll(
|
||||
'{custom:address}',
|
||||
this.providerFullAddress
|
||||
);
|
||||
case AppointmentTypeStrings.IN_SHOP:
|
||||
return this.dropOffAndInShopWordingText?.replaceAll(
|
||||
'{custom:address}',
|
||||
this.providerFullAddress
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
const wordingMap = {
|
||||
[AppointmentTypeStrings.MOBILE]: this.mobileWordingText,
|
||||
[AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP]: this.mobileWordingText,
|
||||
[AppointmentTypeStrings.DROP_OFF]: this.dropOffAndInShopWordingText,
|
||||
[AppointmentTypeStrings.IN_SHOP]: this.dropOffAndInShopWordingText
|
||||
};
|
||||
|
||||
return wordingMap[this.appointmentType] || null;
|
||||
},
|
||||
appointmentWordingText2() {
|
||||
switch (this.appointmentType) {
|
||||
case AppointmentTypeStrings.MOBILE:
|
||||
case AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP:
|
||||
return this.mobileWordingText2;
|
||||
case AppointmentTypeStrings.DROP_OFF:
|
||||
return this.dropOffAndInShopWordingText2;
|
||||
case AppointmentTypeStrings.IN_SHOP:
|
||||
return this.dropOffAndInShopWordingText2?.replaceAll(
|
||||
'{custom:inShopDuration}',
|
||||
this.inShopAppointmentDuration
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
const wordingMap = {
|
||||
[AppointmentTypeStrings.MOBILE]: this.mobileWordingText2,
|
||||
[AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP]: this.mobileWordingText2,
|
||||
[AppointmentTypeStrings.DROP_OFF]: this.dropOffAndInShopWordingText2,
|
||||
[AppointmentTypeStrings.IN_SHOP]: this.dropOffAndInShopWordingText2
|
||||
};
|
||||
|
||||
return wordingMap[this.appointmentType] || null;
|
||||
},
|
||||
mobileAppointment() {
|
||||
return (
|
||||
|
|
@ -418,12 +407,16 @@ export default {
|
|||
}
|
||||
},
|
||||
processIfStatements,
|
||||
getBodyText2FromCms(cmsWidgetName) {
|
||||
const body2Text = this.getCmsContent(cmsWidgetName, 'BodyText2');
|
||||
return this.processIfStatements(
|
||||
body2Text,
|
||||
getTextFromCmsWithCustomValues(widgetName, widgetField) {
|
||||
const rawText = this.getCmsContent(widgetName, widgetField);
|
||||
return processIfStatements(
|
||||
rawText,
|
||||
'custom',
|
||||
this.getCustomValueFromString
|
||||
//this.getCustomValueFromString
|
||||
(v) => {
|
||||
console.log(v);
|
||||
return this.customValueMap[v];
|
||||
}
|
||||
);
|
||||
},
|
||||
getCustomValueFromString(str) {
|
||||
|
|
@ -432,6 +425,22 @@ export default {
|
|||
return this.inShopAppointment;
|
||||
case 'dropOffAppointment':
|
||||
return this.dropOffAppointment;
|
||||
case 'vehicleMake':
|
||||
return 'Test Make'; //this.submittedOrder.vehicle.make;
|
||||
case 'vehicleModel':
|
||||
return 'Test model';//this.submittedOrder.vehicle.model;
|
||||
case 'vehicleYear':
|
||||
return '1000';//this.submittedOrder.vehicle.year;
|
||||
case 'email':
|
||||
return 'test@email.com';//this.submittedOrder.customer.emailAddress;
|
||||
case 'address':
|
||||
return 'a';
|
||||
case 'inShopDuration':
|
||||
return this.inShopAppointmentDuration;
|
||||
case 'CUSTOMER_PORTAL_URL':
|
||||
return applicationConfig.CUSTOMER_PORTAL_URL;
|
||||
case 'CUSTOMER_PORTAL_LOGIN_TOKEN':
|
||||
return this.submittedOrder.customerPortalLoginToken;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -419,8 +419,8 @@ export const useMainStore = defineStore({
|
|||
experimentSettings: (state) => state.applicationUser.experiments
|
||||
.filter((x) => !!x.isActive)
|
||||
.map((x) => x.settings)
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
|
||||
submittedOrder: () => JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER))
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {}//,
|
||||
//submittedOrder: () => JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER))
|
||||
},
|
||||
actions:
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue