add timeSlotModalQuestion to schedule
This commit is contained in:
parent
f7c46b96c0
commit
a20e8e2aaf
3 changed files with 60 additions and 18 deletions
|
|
@ -29,7 +29,25 @@
|
|||
class="text-link-small"
|
||||
:customSelectableDatesCallback="getAvailableDatesMethod"
|
||||
validationRules="date-required"
|
||||
@date-clicked="openInshopTimeSlotsModal" />
|
||||
@dateClicked="openInshopTimeSlotsModal" />
|
||||
<timeSlotModalQuestion
|
||||
ref="timeSlotModalQuestion"
|
||||
v-model="selectedTimeSlotInfo"
|
||||
customComponentId="timeSlotModalQuestion"
|
||||
cmsWidgetName="TimeSlotModalQuestion"
|
||||
mobilePremiumCmsWidgetName="MobilePremiumTimeSlotModal"
|
||||
mobileCmsWidgetName="MobileTimeSlotModal"
|
||||
dropoffCmsWidgetName="DropOffTimeSlotModal"
|
||||
sameDayDropOffCmsWidgetName="SameDayDropOffTimeSlotModal"
|
||||
overnightDropOffCmsWidgetName="OvernightDropOffTimeSlotModal"
|
||||
:selectedDate="selectedDate"
|
||||
:appointmentType="appointmentType"
|
||||
:premiumAppointmentFee="mobilePremiumAppointmentFee"
|
||||
:timeSlotsForSelectedDate="timeSlotsForSelectedDate"
|
||||
:estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum"
|
||||
:estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum"
|
||||
validationRules="time-slot-selection-required"
|
||||
@timeSlotModalClosed="timeSlotModalClosed" />
|
||||
<siteFooter
|
||||
ref="navbar"
|
||||
class="mt-5"
|
||||
|
|
@ -69,6 +87,7 @@ import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
|||
import errorMessages from '@/constants/error-messages';
|
||||
import { required } from '@/helpers/validation-rules';
|
||||
import { useMainStore } from '@/store';
|
||||
import timeSlotModalQuestion from './time-slot-modal-question/time-slot-modal-question.vue';
|
||||
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule('date-required', required(errorMessages.DATE_REQUIRED));
|
||||
|
|
@ -180,6 +199,7 @@ export default {
|
|||
siteSubHeader,
|
||||
locationAlerts,
|
||||
datePicker,
|
||||
timeSlotModalQuestion,
|
||||
siteFooter,
|
||||
textBlock,
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
|
|
@ -238,7 +258,12 @@ export default {
|
|||
return { mainStore };
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
selectedDate: this.getSelectedDate(),
|
||||
selectedTimeSlotInfo: this.getSelectedTimeSlotInfo(),
|
||||
selectableDatesData: [],
|
||||
mobilePremiumAppointmentFee: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
ChangeShopLinkText() {
|
||||
|
|
@ -406,22 +431,14 @@ export default {
|
|||
supportingItems.push(this.mobilePremiumAppointmentFee);
|
||||
}
|
||||
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
|
||||
supportingItems,
|
||||
false
|
||||
);
|
||||
this.mainStore.saveSupportingItemsSuppressingStateResetting(supportingItems);
|
||||
} else {
|
||||
// if it's not a mobile and/or premium early bird, then make sure we remove any that may have been added
|
||||
const removeEarlyBirdIndex = supportingItems.findIndex((item) => item.partType === PREMIUM_FEE_PART_TYPE);
|
||||
|
||||
if (removeEarlyBirdIndex >= 0) {
|
||||
supportingItems.splice(removeEarlyBirdIndex, 1);
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
|
||||
supportingItems,
|
||||
false
|
||||
);
|
||||
this.mainStore.saveSupportingItemsSuppressingStateResetting(supportingItems);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -429,7 +446,9 @@ export default {
|
|||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
forwardButtonAction() {
|
||||
// validate and save here
|
||||
this.updateSupportingItems();
|
||||
this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot);
|
||||
|
||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ const getDefaultState = () => ({
|
|||
startTime: null,
|
||||
endTime: null,
|
||||
routeCode: null,
|
||||
jobMaxMinutes: null
|
||||
jobMaxMinutes: null,
|
||||
jobMinMinutes: null
|
||||
},
|
||||
referralNumber: null,
|
||||
referralDate: null,
|
||||
|
|
@ -999,7 +1000,8 @@ export const useMainStore = defineStore({
|
|||
startTime: schedule.startTime,
|
||||
endTime: schedule.endTime,
|
||||
routeCode: schedule.routeCode,
|
||||
jobMaxMinutes: schedule.jobMaxMinutes
|
||||
jobMaxMinutes: schedule.jobMaxMinutes,
|
||||
jobMinMinutes: schedule.jobMinMinutes
|
||||
},
|
||||
referralDate: this.order.referralDate,
|
||||
referralNumber: this.order.referralNumber?.toString(),
|
||||
|
|
@ -1193,7 +1195,7 @@ export const useMainStore = defineStore({
|
|||
this.order.schedule.endTime = null;
|
||||
this.order.schedule.routeCode = null;
|
||||
this.order.schedule.jobMaxMinutes = null;
|
||||
// this.order.schedule.jobMinMinutes = null;
|
||||
this.order.schedule.jobMinMinutes = null;
|
||||
|
||||
// premium appointment fee used on schedule page also needs reset when schedule is reset
|
||||
const { supportingItems } = this.order.lineItems;
|
||||
|
|
@ -1398,6 +1400,10 @@ export const useMainStore = defineStore({
|
|||
this.order.lineItems.glassParts = glassParts;
|
||||
},
|
||||
saveSupportingItems(supportingItems) {
|
||||
// TODO: RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES
|
||||
this.order.lineItems.supportingItems = supportingItems;
|
||||
},
|
||||
saveSupportingItemsSuppressingStateResetting(supportingItems) {
|
||||
this.order.lineItems.supportingItems = supportingItems;
|
||||
},
|
||||
saveVaps(vaps) {
|
||||
|
|
@ -1477,6 +1483,21 @@ export const useMainStore = defineStore({
|
|||
});
|
||||
},
|
||||
|
||||
// Schedule Actions
|
||||
saveSchedule(scheduleInfo) {
|
||||
this.updateSchedule(scheduleInfo);
|
||||
},
|
||||
updateSchedule(scheduleInfo) {
|
||||
if (scheduleInfo) {
|
||||
this.order.schedule.date = scheduleInfo.date;
|
||||
this.order.schedule.startTime = scheduleInfo.startTime;
|
||||
this.order.schedule.endTime = scheduleInfo.endTime;
|
||||
this.order.schedule.routeCode = scheduleInfo.routeCode;
|
||||
this.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes;
|
||||
this.order.schedule.jobMinMinutes = scheduleInfo.jobMinMinutes;
|
||||
}
|
||||
},
|
||||
|
||||
// Analytics Actions
|
||||
logExperimentExposure({ userId, sessionKey, pageName, experiment }) {
|
||||
return globalMethods.callHttpClient({
|
||||
|
|
|
|||
|
|
@ -799,7 +799,8 @@ describe('Store', () => {
|
|||
startTime: getRandomString(6, 6),
|
||||
endTime: getRandomString(6, 6),
|
||||
routeCode: getRandomString(6, 6),
|
||||
jobMaxMinutes: getRandomString(6, 6)
|
||||
jobMaxMinutes: getRandomString(6, 6),
|
||||
jobMinMinutes: getRandomString(6, 6)
|
||||
};
|
||||
store.order.schedule = schedule;
|
||||
globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({}));
|
||||
|
|
@ -815,7 +816,8 @@ describe('Store', () => {
|
|||
startTime: schedule.startTime,
|
||||
endTime: schedule.endTime,
|
||||
routeCode: schedule.routeCode,
|
||||
jobMaxMinutes: schedule.jobMaxMinutes
|
||||
jobMaxMinutes: schedule.jobMaxMinutes,
|
||||
jobMinMinutes: schedule.jobMinMinutes
|
||||
})
|
||||
})
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in a new issue