Merge pull request #473 from Safelite/feature/richardson/SSR-679

Mobile Time Slot updates
This commit is contained in:
brich1212safe 2023-10-09 09:16:05 -04:00 committed by GitHub
commit 9925fb5b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 8 deletions

View file

@ -51,7 +51,8 @@ const errorMessages = Object.freeze({
MAKE_REQUIRED: 'Please select your vehicle make', MAKE_REQUIRED: 'Please select your vehicle make',
MODEL_REQUIRED: 'Please select your vehicle model', MODEL_REQUIRED: 'Please select your vehicle model',
STYLE_REQUIRED: 'Please select your vehicle style', STYLE_REQUIRED: 'Please select your vehicle style',
MOBILE_LOCATION_REQUIRED: 'Please enter your service address' MOBILE_LOCATION_REQUIRED: 'Please enter your service address',
DATE_REQUIRED: 'Please select a date'
}); });
export default errorMessages; export default errorMessages;

View file

@ -1,7 +1,7 @@
<template> <template>
<div <div
class="date-picker text-center" class="date-picker text-center"
:class="calendarViewDirection"> :class="[calendarViewDirection, { 'has-error': errors.length > 0 }]">
<fieldset <fieldset
id="date-picker-fieldset" id="date-picker-fieldset"
ref="datePickerFieldset"> ref="datePickerFieldset">
@ -83,7 +83,7 @@
id="date-of-month-error" id="date-of-month-error"
class="row form-test-error"> class="row form-test-error">
<ErrorMessage <ErrorMessage
name="date-of-month" :name="customComponentId"
class="small mt-1"> class="small mt-1">
</ErrorMessage> </ErrorMessage>
</div> </div>

View file

@ -223,6 +223,15 @@ export default {
preSelectedDate preSelectedDate
}); });
const premiumFeePromise = useMainStore().getMobilePremiumFee();
const premiumFeeWithPricePromise = premiumFeePromise.then((result) => {
if (result.data) {
return useMainStore().priceOrderItemsAndSaveServerData(result.data);
}
return result.data;
});
const alertReasonsPromise = locationAlerts.methods.loadInitialData( const alertReasonsPromise = locationAlerts.methods.loadInitialData(
useMainStore().order.serviceLocation.zipCodeCtu, useMainStore().order.serviceLocation.zipCodeCtu,
useMainStore().order.serviceLocation.provider?.address?.zipCodeCtu useMainStore().order.serviceLocation.provider?.address?.zipCodeCtu
@ -241,6 +250,10 @@ export default {
{ {
resultKey: 'datePickerInitialData', resultKey: 'datePickerInitialData',
promise: datePickerInitialDataPromise promise: datePickerInitialDataPromise
},
{
resultKey: 'premiumFeeWithPrice',
promise: premiumFeeWithPricePromise
} }
]; ];
@ -250,7 +263,7 @@ export default {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData); vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons); vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
vm.setData(resultMap.datePickerInitialData.initialShopTimeSlotsResponse); vm.setData(resultMap.datePickerInitialData.initialShopTimeSlotsResponse, resultMap.premiumFeeWithPrice);
vm.updateFooterButtonText(vm.selectedTimeSlotInfo); vm.updateFooterButtonText(vm.selectedTimeSlotInfo);
}); });
}, },
@ -324,8 +337,11 @@ export default {
return serviceLocationPreReqs && paymentInfo && supportingItems && damageInfo; return serviceLocationPreReqs && paymentInfo && supportingItems && damageInfo;
}, },
setData(initialShopTimeSlotsResponse) { setData(initialShopTimeSlotsResponse, premiumFeeWithPriceResponse) {
this.selectableDatesData = initialShopTimeSlotsResponse; this.selectableDatesData = initialShopTimeSlotsResponse;
this.mobilePremiumAppointmentFee = premiumFeeWithPriceResponse
? premiumFeeWithPriceResponse[0]
: null;
}, },
async getAvailableDatesMethod(startDate, endDate) { async getAvailableDatesMethod(startDate, endDate) {
const newShopTimeSlots = await getAvailableDates( const newShopTimeSlots = await getAvailableDates(

View file

@ -163,7 +163,10 @@ export default {
let appointmentTypeCmsWidgetName; let appointmentTypeCmsWidgetName;
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) { if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
return null; return null;
} if (this.appointmentType === AppointmentTypeStrings.MOBILE) { }
if (this.appointmentType === AppointmentTypeStrings.MOBILE
|| this.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC) {
appointmentTypeCmsWidgetName = this.selectedRouteCode?.includes(PREMIUM_TIME_SLOT_ID_FLAG) appointmentTypeCmsWidgetName = this.selectedRouteCode?.includes(PREMIUM_TIME_SLOT_ID_FLAG)
? this.mobilePremiumCmsWidgetName ? this.mobilePremiumCmsWidgetName
: this.mobileCmsWidgetName; : this.mobileCmsWidgetName;
@ -271,7 +274,8 @@ export default {
return `${inshopDurationTextWithoutTime} ${inshopDurationTime}`; return `${inshopDurationTextWithoutTime} ${inshopDurationTime}`;
}, },
durationTextBlockCopy() { durationTextBlockCopy() {
if (this.appointmentType === AppointmentTypeStrings.MOBILE) { if (this.appointmentType === AppointmentTypeStrings.MOBILE
|| this.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC) {
return null; return null;
} if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) { } if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
return this.inshopDurationText; return this.inshopDurationText;
@ -316,7 +320,8 @@ export default {
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) { if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
return this.getAvailableTimeSlotsForDropOff(this.timeSlotsForSelectedDate.timeSlots); return this.getAvailableTimeSlotsForDropOff(this.timeSlotsForSelectedDate.timeSlots);
} if (this.appointmentType === AppointmentTypeStrings.MOBILE) { } if (this.appointmentType === AppointmentTypeStrings.MOBILE
|| this.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC) {
return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots); return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots);
} }
return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots); return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots);

View file

@ -621,7 +621,16 @@ export const useMainStore = defineStore({
} }
}); });
}, },
getMobilePremiumFee() {
const damageType = this.damage.isRepair ? 'Repair' : 'Replace';
const paymentType = this.order.payment.isInsurance ? 'Insurance' : 'Cash';
return globalMethods.callHttpClient({
method: endpoints.GetMobilePremiumFee.method,
endpoint: `${endpoints.GetMobilePremiumFee.url}/${paymentType}/${damageType}`,
logApiCall: true
});
},
getMobileTimeSlots(startDate, endDate) { getMobileTimeSlots(startDate, endDate) {
const { order } = this; const { order } = this;
const { vehicle } = this.order; const { vehicle } = this.order;