CASH-845: fix preselected dates to work with new schedule code
This commit is contained in:
parent
2f322bdf9b
commit
819e1df086
1 changed files with 12 additions and 12 deletions
|
|
@ -397,6 +397,7 @@ export default {
|
||||||
showPricingByDay: null,
|
showPricingByDay: null,
|
||||||
selectableDatesInshop: [],
|
selectableDatesInshop: [],
|
||||||
selectableDatesMobile: [],
|
selectableDatesMobile: [],
|
||||||
|
preSelectedDate: null,
|
||||||
|
|
||||||
streetAddress: this.getServiceAddressFromStore(),
|
streetAddress: this.getServiceAddressFromStore(),
|
||||||
apartmentNumberOrBusinessName: this.getServiceAddress2FromStore(),
|
apartmentNumberOrBusinessName: this.getServiceAddress2FromStore(),
|
||||||
|
|
@ -466,11 +467,11 @@ export default {
|
||||||
let appointmentType = store.getters.order.serviceLocation.appointmentType;
|
let appointmentType = store.getters.order.serviceLocation.appointmentType;
|
||||||
|
|
||||||
// Check to see if date should be pre-selected
|
// Check to see if date should be pre-selected
|
||||||
let preSelectedSlot = await store.getters.order.schedule;
|
let scheduleFromStore = await store.getters.order.schedule;
|
||||||
let preSelectedDate;
|
let preSelectedDate;
|
||||||
|
|
||||||
if (preSelectedSlot.date && preSelectedSlot.date.length > 0) {
|
if (scheduleFromStore.date && scheduleFromStore.date.length > 0) {
|
||||||
preSelectedDate = preSelectedSlot.date;
|
preSelectedDate = scheduleFromStore.date;
|
||||||
|
|
||||||
if (appointmentType === AppointmentTypeStrings.MOBILE) {
|
if (appointmentType === AppointmentTypeStrings.MOBILE) {
|
||||||
preSelectedDate += "-mobile";
|
preSelectedDate += "-mobile";
|
||||||
|
|
@ -479,7 +480,7 @@ export default {
|
||||||
// Check to see if pre-selected date should have pricing by day upcharge
|
// Check to see if pre-selected date should have pricing by day upcharge
|
||||||
if (showPricingByDay) {
|
if (showPricingByDay) {
|
||||||
// is this preSelectedDate a higher priced pricingByDay day?
|
// is this preSelectedDate a higher priced pricingByDay day?
|
||||||
const dayIndex = convertDateStringToDate(preSelectedSlot?.date).getDay();
|
const dayIndex = convertDateStringToDate(scheduleFromStore?.date).getDay();
|
||||||
const dayObject = DAYS_OF_WEEK[dayIndex];
|
const dayObject = DAYS_OF_WEEK[dayIndex];
|
||||||
if (dayObject.isPricingByDayUpchargeDay) {
|
if (dayObject.isPricingByDayUpchargeDay) {
|
||||||
includePricingByDayUpcharge = true;
|
includePricingByDayUpcharge = true;
|
||||||
|
|
@ -588,7 +589,7 @@ export default {
|
||||||
vm.pricingByDayBasePrice = pricingByDayBasePrice;
|
vm.pricingByDayBasePrice = pricingByDayBasePrice;
|
||||||
vm.pricingByDayUpcharge = pricingByDayUpcharge;
|
vm.pricingByDayUpcharge = pricingByDayUpcharge;
|
||||||
vm.showPricingByDay = showPricingByDay;
|
vm.showPricingByDay = showPricingByDay;
|
||||||
|
vm.preSelectedDate = preSelectedDate;
|
||||||
vm.appointmentType = appointmentType;
|
vm.appointmentType = appointmentType;
|
||||||
vm.setData(
|
vm.setData(
|
||||||
resultMap.zipCodeData,
|
resultMap.zipCodeData,
|
||||||
|
|
@ -1139,7 +1140,7 @@ export default {
|
||||||
selectableDatesSetting: "custom",
|
selectableDatesSetting: "custom",
|
||||||
initialViewRowsToShow: NUMBER_OF_CALENDAR_ROWS_TO_SHOW_FOR_INITIAL_VIEW,
|
initialViewRowsToShow: NUMBER_OF_CALENDAR_ROWS_TO_SHOW_FOR_INITIAL_VIEW,
|
||||||
getSelectableDatesCallback: getScheduleApiResponse,
|
getSelectableDatesCallback: getScheduleApiResponse,
|
||||||
// preSelectedDate: preSelectedDate,
|
preSelectedDate: this.preSelectedDate,
|
||||||
providerNumber: this.selectedProvider?.providerNumber,
|
providerNumber: this.selectedProvider?.providerNumber,
|
||||||
zipCode: this.zipCode,
|
zipCode: this.zipCode,
|
||||||
includeMobileTimeSlots: this.isServiceableMobile,
|
includeMobileTimeSlots: this.isServiceableMobile,
|
||||||
|
|
@ -1154,7 +1155,7 @@ export default {
|
||||||
datePickerInitialData.initialShopTimeSlotsResponse.mobileTimeSlotsData;
|
datePickerInitialData.initialShopTimeSlotsResponse.mobileTimeSlotsData;
|
||||||
this.setDisplayWaitList();
|
this.setDisplayWaitList();
|
||||||
|
|
||||||
// TODO - CHECK FOR A PRESELECTED DATE!!! DON'T NEED TO DO THE BELOW IF THERE'S A PRESELECTED...?
|
if (this.preSelectedDate) this.selectedDate = this.preSelectedDate;
|
||||||
|
|
||||||
if (!this.selectedDate) {
|
if (!this.selectedDate) {
|
||||||
// if no date is preselected on load, then select the first available
|
// if no date is preselected on load, then select the first available
|
||||||
|
|
@ -1415,17 +1416,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setDisplayWaitList() {
|
setDisplayWaitList() {
|
||||||
|
const dateString = this.isMobileSelected
|
||||||
|
? this.selectableDatesMobile?.days[0]?.date
|
||||||
|
: this.selectableDatesInshop?.days[0]?.date;
|
||||||
if (
|
if (
|
||||||
experimentMixin.methods.hasSettingEqualTo(
|
experimentMixin.methods.hasSettingEqualTo(
|
||||||
experimentSettings.DISPLAY_WAITLIST,
|
experimentSettings.DISPLAY_WAITLIST,
|
||||||
"true"
|
"true"
|
||||||
) &&
|
) &&
|
||||||
this.selectableDatesMobile.days &&
|
dateString
|
||||||
this.selectableDatesInshop.days
|
|
||||||
) {
|
) {
|
||||||
const dateString = this.isMobileSelected
|
|
||||||
? this.selectableDatesMobile?.days[0]?.date
|
|
||||||
: this.selectableDatesInshop?.days[0]?.date;
|
|
||||||
const [year, month, day] = dateString.split("-").map(Number);
|
const [year, month, day] = dateString.split("-").map(Number);
|
||||||
const targetDate = new Date(year, month - 1, day);
|
const targetDate = new Date(year, month - 1, day);
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue