CASH-845: more ironing out to ensure appointmentType stays accurate
This commit is contained in:
parent
7193090020
commit
c1220f9d00
4 changed files with 40 additions and 34 deletions
|
|
@ -148,7 +148,6 @@
|
|||
:timeSlotsForSelectedDate="timeSlotsForSelectedDate"
|
||||
:estimatedServiceMinutesMinimum="estimatedServiceMinutesMinimum"
|
||||
:estimatedServiceMinutesMaximum="estimatedServiceMinutesMaximum"
|
||||
@appointmentTypeUpdated="updateAppointmentType"
|
||||
@waitListRequested="handleWaitListRequested"
|
||||
@time-slot-modal-closed="timeSlotModalClosed" />
|
||||
</fieldset>
|
||||
|
|
@ -167,7 +166,10 @@ import {
|
|||
MONTHS_OF_YEAR,
|
||||
DAYS_OF_WEEK,
|
||||
} from "@/digital-components/date-picker/mixins/constants";
|
||||
import { PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants";
|
||||
import {
|
||||
AppointmentTypeStrings,
|
||||
PREMIUM_FEE_PART_TYPE,
|
||||
} from "@/constants/schedule-constants";
|
||||
import {
|
||||
selectableDaysOptions,
|
||||
requiredParameter,
|
||||
|
|
@ -877,9 +879,6 @@ export default {
|
|||
handleWaitListRequested(value) {
|
||||
this.$emit("waitListRequested", value);
|
||||
},
|
||||
updateAppointmentType(type) {
|
||||
this.$emit("appointmentTypeUpdated", type);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
modelValue(newValue) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import { storeActions } from "@/constants/store-actions";
|
||||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
import {
|
||||
RouteCodeFlags,
|
||||
} from "@/constants/schedule-constants";
|
||||
|
||||
export async function getAlertReasons(ctu) {
|
||||
const alertReasons = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
|
|
@ -60,3 +63,13 @@ export function militaryToTwelveHourTime(timeString) {
|
|||
|
||||
return `${hours}:${minutes} ${meridianNotation}`;
|
||||
}
|
||||
|
||||
export function isDropOffRouteCode(routeCode) {
|
||||
if (!routeCode) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) ||
|
||||
routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@
|
|||
:estimatedServiceMinutesMinimum="getServiceMinutesMin"
|
||||
:estimatedServiceMinutesMaximum="getServiceMinutesMax"
|
||||
@timeSlotSelected="updateTimeSlot"
|
||||
@appointmentTypeUpdated="updateAppointmentType"
|
||||
:displayWaitList="displayWaitList"
|
||||
@waitListRequested="handleWaitListRequested" />
|
||||
<navbar
|
||||
|
|
@ -219,6 +218,7 @@ import {
|
|||
calcDaysBetweenDates,
|
||||
convertDateStringToDate,
|
||||
sumDateString,
|
||||
isDropOffRouteCode,
|
||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||
|
||||
import { DAYS_OF_WEEK } from "@/digital-components/date-picker/mixins/constants";
|
||||
|
|
@ -1576,11 +1576,15 @@ export default {
|
|||
this.includePricingByDayUpcharge = false;
|
||||
}
|
||||
},
|
||||
updateTimeSlot(timeSlot) {
|
||||
this.selectedTimeSlotInfo = timeSlot;
|
||||
updateTimeSlot(timeSlotObj) {
|
||||
this.selectedTimeSlotInfo = timeSlotObj;
|
||||
if (this.appointmentType !== AppointmentTypeStrings.MOBILE) {
|
||||
// update apptType based on routeCode to determine if it should be dropoff or inshop
|
||||
this.appointmentType = this.getInShopOrDropOffApptType(timeSlotObj.timeSlot.routeCode);
|
||||
}
|
||||
},
|
||||
updateAppointmentType(type) {
|
||||
this.appointmentType = type;
|
||||
getInShopOrDropOffApptType(routeCode) {
|
||||
return (isDropOffRouteCode(routeCode)) ? AppointmentTypeStrings.DROP_OFF : AppointmentTypeStrings.IN_SHOP;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -1618,7 +1622,13 @@ export default {
|
|||
if (newValue === AppointmentTypeStrings.MOBILE) {
|
||||
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||
} else {
|
||||
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||
if (this.selectedTimeSlotInfo?.timeSlot?.routeCode) {
|
||||
// update appointmentType based on routeCode to determine if it should be dropoff or inshop
|
||||
this.appointmentType = this.getInShopOrDropOffApptType(this.selectedTimeSlotInfo.timeSlot.routeCode);
|
||||
} else {
|
||||
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ import store from "@/store";
|
|||
// Helpers
|
||||
import { deepClone } from "@/helpers/object-helper";
|
||||
import {
|
||||
convertDateStringToDate,
|
||||
isDropOffRouteCode,
|
||||
militaryToTwelveHourTime,
|
||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||
|
|
@ -199,7 +199,7 @@ export default {
|
|||
// This is planned to be used again for drop-off
|
||||
// Wrote this to be ready for that eventuality, is untested and no HTML work done yet
|
||||
|
||||
// if (this.selectedRouteCode == null || !this.isDropOffRouteCode(this.selectedRouteCode)) {
|
||||
// if (this.selectedRouteCode == null || !isDropOffRouteCode(this.selectedRouteCode)) {
|
||||
// return null;
|
||||
// } else {
|
||||
// appointmentTypeCmsWidgetName =
|
||||
|
|
@ -355,7 +355,7 @@ export default {
|
|||
}
|
||||
const dropOffQuestionAnswers = this.timeSlotsForSelectedDate.timeSlots
|
||||
.filter((timeSlot) => {
|
||||
return this.isDropOffRouteCode(timeSlot.id);
|
||||
return isDropOffRouteCode(timeSlot.id);
|
||||
})
|
||||
.map((timeSlot) => {
|
||||
let buttonLabelValue;
|
||||
|
|
@ -405,7 +405,7 @@ export default {
|
|||
return this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||
},
|
||||
shouldDisplayDropOffAlert() {
|
||||
return this.isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop);
|
||||
return isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop);
|
||||
},
|
||||
dropOffTimeSlotAlertCMSWidgetName() {
|
||||
if (this.selectedAnswerForDropOffOrInshop.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||
|
|
@ -455,7 +455,7 @@ export default {
|
|||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||
return timeSlotsForSelectedDate
|
||||
.filter((timeSlot) => {
|
||||
return !this.isDropOffRouteCode(timeSlot.id);
|
||||
return !isDropOffRouteCode(timeSlot.id);
|
||||
})
|
||||
.map((timeSlot) => {
|
||||
const readableTime = militaryToTwelveHourTime(timeSlot.startTime);
|
||||
|
|
@ -509,7 +509,7 @@ export default {
|
|||
// Mobile Only
|
||||
this.selectedAnswerForTimeSlots = this.addPremiumFlagToInput(routeCodeFromParent);
|
||||
} else {
|
||||
if (this.isDropOffRouteCode(routeCodeFromParent)) {
|
||||
if (isDropOffRouteCode(routeCodeFromParent)) {
|
||||
this.selectedAnswerForDropOffOrInshop = routeCodeFromParent;
|
||||
} else {
|
||||
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
||||
|
|
@ -580,15 +580,6 @@ export default {
|
|||
successMessageElement.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
},
|
||||
isDropOffRouteCode(routeCode) {
|
||||
if (!routeCode) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) ||
|
||||
routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)
|
||||
);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
waitListRequested(newVal) {
|
||||
|
|
@ -617,17 +608,10 @@ export default {
|
|||
},
|
||||
selectedAnswerForDropOffOrInshop(newValue) {
|
||||
if (newValue == PICK_A_TIME_BUTTON_VALUE) {
|
||||
// Inshop selected
|
||||
this.selectedRouteCode = null;
|
||||
this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.IN_SHOP);
|
||||
} else if (newValue) {
|
||||
// Dropoff selected
|
||||
this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.DROP_OFF);
|
||||
this.selectedRouteCode = newValue;
|
||||
} else {
|
||||
// none selected
|
||||
this.selectedAnswerForTimeSlots = null;
|
||||
this.$emit("appointmentTypeUpdated", null);
|
||||
this.selectedRouteCode = newValue;
|
||||
}
|
||||
},
|
||||
selectedAnswerForTimeSlots(newValue) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue