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"
|
:timeSlotsForSelectedDate="timeSlotsForSelectedDate"
|
||||||
:estimatedServiceMinutesMinimum="estimatedServiceMinutesMinimum"
|
:estimatedServiceMinutesMinimum="estimatedServiceMinutesMinimum"
|
||||||
:estimatedServiceMinutesMaximum="estimatedServiceMinutesMaximum"
|
:estimatedServiceMinutesMaximum="estimatedServiceMinutesMaximum"
|
||||||
@appointmentTypeUpdated="updateAppointmentType"
|
|
||||||
@waitListRequested="handleWaitListRequested"
|
@waitListRequested="handleWaitListRequested"
|
||||||
@time-slot-modal-closed="timeSlotModalClosed" />
|
@time-slot-modal-closed="timeSlotModalClosed" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
@ -167,7 +166,10 @@ import {
|
||||||
MONTHS_OF_YEAR,
|
MONTHS_OF_YEAR,
|
||||||
DAYS_OF_WEEK,
|
DAYS_OF_WEEK,
|
||||||
} from "@/digital-components/date-picker/mixins/constants";
|
} 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 {
|
import {
|
||||||
selectableDaysOptions,
|
selectableDaysOptions,
|
||||||
requiredParameter,
|
requiredParameter,
|
||||||
|
|
@ -877,9 +879,6 @@ export default {
|
||||||
handleWaitListRequested(value) {
|
handleWaitListRequested(value) {
|
||||||
this.$emit("waitListRequested", value);
|
this.$emit("waitListRequested", value);
|
||||||
},
|
},
|
||||||
updateAppointmentType(type) {
|
|
||||||
this.$emit("appointmentTypeUpdated", type);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import {
|
||||||
|
RouteCodeFlags,
|
||||||
|
} from "@/constants/schedule-constants";
|
||||||
|
|
||||||
export async function getAlertReasons(ctu) {
|
export async function getAlertReasons(ctu) {
|
||||||
const alertReasons = await baseMixin.methods.dispatchStoreActionWithLogging(
|
const alertReasons = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
|
@ -60,3 +63,13 @@ export function militaryToTwelveHourTime(timeString) {
|
||||||
|
|
||||||
return `${hours}:${minutes} ${meridianNotation}`;
|
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"
|
:estimatedServiceMinutesMinimum="getServiceMinutesMin"
|
||||||
:estimatedServiceMinutesMaximum="getServiceMinutesMax"
|
:estimatedServiceMinutesMaximum="getServiceMinutesMax"
|
||||||
@timeSlotSelected="updateTimeSlot"
|
@timeSlotSelected="updateTimeSlot"
|
||||||
@appointmentTypeUpdated="updateAppointmentType"
|
|
||||||
:displayWaitList="displayWaitList"
|
:displayWaitList="displayWaitList"
|
||||||
@waitListRequested="handleWaitListRequested" />
|
@waitListRequested="handleWaitListRequested" />
|
||||||
<navbar
|
<navbar
|
||||||
|
|
@ -219,6 +218,7 @@ import {
|
||||||
calcDaysBetweenDates,
|
calcDaysBetweenDates,
|
||||||
convertDateStringToDate,
|
convertDateStringToDate,
|
||||||
sumDateString,
|
sumDateString,
|
||||||
|
isDropOffRouteCode,
|
||||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||||
|
|
||||||
import { DAYS_OF_WEEK } from "@/digital-components/date-picker/mixins/constants";
|
import { DAYS_OF_WEEK } from "@/digital-components/date-picker/mixins/constants";
|
||||||
|
|
@ -1576,11 +1576,15 @@ export default {
|
||||||
this.includePricingByDayUpcharge = false;
|
this.includePricingByDayUpcharge = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateTimeSlot(timeSlot) {
|
updateTimeSlot(timeSlotObj) {
|
||||||
this.selectedTimeSlotInfo = timeSlot;
|
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) {
|
getInShopOrDropOffApptType(routeCode) {
|
||||||
this.appointmentType = type;
|
return (isDropOffRouteCode(routeCode)) ? AppointmentTypeStrings.DROP_OFF : AppointmentTypeStrings.IN_SHOP;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -1617,9 +1621,15 @@ export default {
|
||||||
handler(newValue, oldValue) {
|
handler(newValue, oldValue) {
|
||||||
if (newValue === AppointmentTypeStrings.MOBILE) {
|
if (newValue === AppointmentTypeStrings.MOBILE) {
|
||||||
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
this.appointmentType = AppointmentTypeStrings.MOBILE;
|
||||||
|
} else {
|
||||||
|
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 {
|
} else {
|
||||||
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
this.appointmentType = AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ import store from "@/store";
|
||||||
// Helpers
|
// Helpers
|
||||||
import { deepClone } from "@/helpers/object-helper";
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
import {
|
import {
|
||||||
convertDateStringToDate,
|
isDropOffRouteCode,
|
||||||
militaryToTwelveHourTime,
|
militaryToTwelveHourTime,
|
||||||
} from "@/layouts/schedule/helpers/schedule-helper";
|
} from "@/layouts/schedule/helpers/schedule-helper";
|
||||||
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||||
|
|
@ -199,7 +199,7 @@ export default {
|
||||||
// This is planned to be used again for drop-off
|
// 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
|
// 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;
|
// return null;
|
||||||
// } else {
|
// } else {
|
||||||
// appointmentTypeCmsWidgetName =
|
// appointmentTypeCmsWidgetName =
|
||||||
|
|
@ -355,7 +355,7 @@ export default {
|
||||||
}
|
}
|
||||||
const dropOffQuestionAnswers = this.timeSlotsForSelectedDate.timeSlots
|
const dropOffQuestionAnswers = this.timeSlotsForSelectedDate.timeSlots
|
||||||
.filter((timeSlot) => {
|
.filter((timeSlot) => {
|
||||||
return this.isDropOffRouteCode(timeSlot.id);
|
return isDropOffRouteCode(timeSlot.id);
|
||||||
})
|
})
|
||||||
.map((timeSlot) => {
|
.map((timeSlot) => {
|
||||||
let buttonLabelValue;
|
let buttonLabelValue;
|
||||||
|
|
@ -405,7 +405,7 @@ export default {
|
||||||
return this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
return this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF;
|
||||||
},
|
},
|
||||||
shouldDisplayDropOffAlert() {
|
shouldDisplayDropOffAlert() {
|
||||||
return this.isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop);
|
return isDropOffRouteCode(this.selectedAnswerForDropOffOrInshop);
|
||||||
},
|
},
|
||||||
dropOffTimeSlotAlertCMSWidgetName() {
|
dropOffTimeSlotAlertCMSWidgetName() {
|
||||||
if (this.selectedAnswerForDropOffOrInshop.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
if (this.selectedAnswerForDropOffOrInshop.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
|
|
@ -455,7 +455,7 @@ export default {
|
||||||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||||
return timeSlotsForSelectedDate
|
return timeSlotsForSelectedDate
|
||||||
.filter((timeSlot) => {
|
.filter((timeSlot) => {
|
||||||
return !this.isDropOffRouteCode(timeSlot.id);
|
return !isDropOffRouteCode(timeSlot.id);
|
||||||
})
|
})
|
||||||
.map((timeSlot) => {
|
.map((timeSlot) => {
|
||||||
const readableTime = militaryToTwelveHourTime(timeSlot.startTime);
|
const readableTime = militaryToTwelveHourTime(timeSlot.startTime);
|
||||||
|
|
@ -509,7 +509,7 @@ export default {
|
||||||
// Mobile Only
|
// Mobile Only
|
||||||
this.selectedAnswerForTimeSlots = this.addPremiumFlagToInput(routeCodeFromParent);
|
this.selectedAnswerForTimeSlots = this.addPremiumFlagToInput(routeCodeFromParent);
|
||||||
} else {
|
} else {
|
||||||
if (this.isDropOffRouteCode(routeCodeFromParent)) {
|
if (isDropOffRouteCode(routeCodeFromParent)) {
|
||||||
this.selectedAnswerForDropOffOrInshop = routeCodeFromParent;
|
this.selectedAnswerForDropOffOrInshop = routeCodeFromParent;
|
||||||
} else {
|
} else {
|
||||||
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
this.selectedAnswerForDropOffOrInshop = PICK_A_TIME_BUTTON_VALUE;
|
||||||
|
|
@ -580,15 +580,6 @@ export default {
|
||||||
successMessageElement.scrollIntoView({ behavior: "smooth" });
|
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: {
|
watch: {
|
||||||
waitListRequested(newVal) {
|
waitListRequested(newVal) {
|
||||||
|
|
@ -617,17 +608,10 @@ export default {
|
||||||
},
|
},
|
||||||
selectedAnswerForDropOffOrInshop(newValue) {
|
selectedAnswerForDropOffOrInshop(newValue) {
|
||||||
if (newValue == PICK_A_TIME_BUTTON_VALUE) {
|
if (newValue == PICK_A_TIME_BUTTON_VALUE) {
|
||||||
// Inshop selected
|
|
||||||
this.selectedRouteCode = null;
|
this.selectedRouteCode = null;
|
||||||
this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.IN_SHOP);
|
|
||||||
} else if (newValue) {
|
|
||||||
// Dropoff selected
|
|
||||||
this.$emit("appointmentTypeUpdated", AppointmentTypeStrings.DROP_OFF);
|
|
||||||
this.selectedRouteCode = newValue;
|
|
||||||
} else {
|
} else {
|
||||||
// none selected
|
|
||||||
this.selectedAnswerForTimeSlots = null;
|
this.selectedAnswerForTimeSlots = null;
|
||||||
this.$emit("appointmentTypeUpdated", null);
|
this.selectedRouteCode = newValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectedAnswerForTimeSlots(newValue) {
|
selectedAnswerForTimeSlots(newValue) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue