CSR-1137 | Merge conflicts

This commit is contained in:
Scott Kiener 2023-05-18 14:33:25 -04:00
parent 01e294d7fb
commit 85b9ce11e2
6 changed files with 68 additions and 67 deletions

View file

@ -306,8 +306,7 @@ export default {
const monthsAfterToLoadOffset = 12; // TO BE MADE "CONSTANTS"
const monthsBeforeToLoadOffset = 36; // TO BE MADE "CONSTANTS"
config.initialShopTimeSlotsResponse.forEach((selectableDate) => {
config.initialShopTimeSlotsResponse.days.forEach((selectableDate) => {
this.selectableDatesData.push(selectableDate);
});
@ -522,7 +521,7 @@ export default {
monthStart,
monthEnd
);
moreSelectableDates.forEach((selectableDate) => {
moreSelectableDates.days.forEach((selectableDate) => {
const index = this.selectableDatesData.findIndex(
(obj) => obj.dateString === selectableDate.dateString
);

View file

@ -21,10 +21,6 @@ const MONTHS_OF_YEAR = [
"December",
];
<<<<<<< HEAD:src/constants/scheduling.js
const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
const DAYS_OF_WEEK = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
export { monthsOfYear, daysOfWeek };
=======
export { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR };
>>>>>>> CSR-886:src/digital-components/date-picker/mixins/constants.js
export { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR, DAYS_OF_WEEK };

View file

@ -100,7 +100,7 @@ export default {
isFooterButtonDisabled() {
if (!this.meta.touched) {
return !this.meta.valid;
}
}
return !this.meta.dirty || !this.meta.valid;
},
},

View file

@ -46,9 +46,8 @@
:mobileEarlyBirdFee="mobileEarlyBirdFee"
:dateAndTimeSlotData="timeSlotsForSelectedDate"
:estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum"
:estimatedServiceMinutesMaximum="
selectableDatesData.estimatedServiceMinutesMaximum"
validationRules="time-slot-selection-required"/>
:estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum"
validationRules="time-slot-selection-required" />
<button @click="setAppointmentType('Inshop')">Set to Inshop</button>
<button @click="setAppointmentType('Mobile')">Set to Mobile</button>
<button @click="setAppointmentType('Dropoff')">Set to Dropoff</button>
@ -106,11 +105,11 @@ const getAvailableDates = async (startDate, endDate) => {
false
);
const newShopTimeSlots = newShopTimeSlotsResponse.data;
return convertApiResponse(newShopTimeSlots.days);
return convertApiResponse(newShopTimeSlots);
};
const convertApiResponse = (responseData) => {
// DATA CONVERSION
responseData?.forEach((date) => {
responseData?.days.forEach((date) => {
const dateString = date.date;
date.dateString = dateString;
const dateStringPieces = dateString.split("-");
@ -131,7 +130,6 @@ export default {
weatherAlerts: [],
mobileEarlyBirdFee: null,
TEMPORARYappointmentType: "Inshop",
};
},
async beforeRouteEnter(to, from, next) {
@ -142,19 +140,17 @@ export default {
selectableDatesSetting: "custom",
initialViewRowsToShow: 5,
customSelectableDatesCallback: getAvailableDates,
const earlyBirdPromise = baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_EARLY_BIRD_FEE
);
// Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing
// const pricingPromise = baseMixin.methods.dispatchStoreAction(
// storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
// {
// availableLineItems: [
// {partNumber: "EARLY BIRD"}
// ],
// },
// false
// );
// Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing
// const pricingPromise = baseMixin.methods.dispatchStoreAction(
// storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
// {
// availableLineItems: [
// {partNumber: "EARLY BIRD"}
// ],
// },
// false
// );
/* vvvvv SAVE THESE FOR TESTING PURPOSES FOR NOW vvvvv
@ -173,6 +169,9 @@ export default {
*/
});
const earlyBirdPromise = baseMixin.methods.dispatchStoreAction(
storeActions.GET_MOBILE_EARLY_BIRD_FEE
);
const alertReasonsPromise = getAlertReasons(store.getters.order.serviceLocation.zipCodeCtu);
// Settle promises and get results
@ -210,6 +209,7 @@ export default {
vm.mobileEarlyBirdFee.laborAmount = 15;
vm.mobileEarlyBirdFee.sellingPrice = 0;
vm.mobileEarlyBirdFee.kitPrice = 0;
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
// if (resultMap.earlyBird) {
// vm.mobileEarlyBirdFee = resultMap.pricingResults;
// }
@ -234,7 +234,7 @@ export default {
if (this.selectedDate === null) {
return null;
}
return this.selectableDatesData.find(
return this.selectableDatesData.days.find(
(selectableDate) => selectableDate.dateString === this.selectedDate.dateString
);
},
@ -267,20 +267,12 @@ export default {
// NEED TODO - WHAT ARE PAGE REQ'S FOR THIS PAGE?
},
async getAvailableDatesMethod(startDate, endDate) {
/* TODO - DO WE NEED TO KEEP AN AGGREGATE OF ALL DATES RETURNED
FOR TIMESLOTS in this.selectableDatesData? IS selectableDatesData EVEN NEEDED?
// // ADD API CALL RESULTS TO EXISTING DATE DATA
// this.selectableDatesData = this.selectableDatesData.concat(
// this.convertApiResponse(newShopTimeSlots.days)
// );
// // console.log("this.selectableDatesData is now: ", this.selectableDatesData);
// // RETURN AGGREGATE DATE DATA
// return this.selectableDatesData;
*/
return await getAvailableDates(startDate, endDate);
const newShopTimeSlots = await getAvailableDates(startDate, endDate);
// ADD API CALL RESULTS TO EXISTING DATE DATA
this.selectableDatesData.days = this.selectableDatesData.days.concat(
newShopTimeSlots.days
);
return newShopTimeSlots;
},
setData(alertReasonsData) {
if (alertReasonsData) {
@ -320,7 +312,7 @@ export default {
this.$refs["timeSlotModalQuestion"].openModal();
},
getTimeSlotObjectFromTimeSlotId(timeSlotId) {
const timeSlots = this.selectableDatesData.find(
const timeSlots = this.selectableDatesData.days.find(
(selectableDate) => selectableDate.dateString === this.selectedDate.dateString
).timeSlots;
return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId);

View file

@ -20,10 +20,13 @@
groupName="ChooseTimeSlot"
textPosition="text-center"
v-model="selectedTimeSlot"
isRequired
isRequired
validationRules="time-slot-required"
class="mt-5"/>
<div class="mt-1 mb-2" v-if="supplementalInformationBlock" v-html="supplementalInformationBlock"></div>
class="mt-5" />
<div
class="mt-1 mb-2"
v-if="supplementalInformationBlock"
v-html="supplementalInformationBlock"></div>
<textBlock
v-show="shouldShowDropoffDisclaimerText"
:customText="dropoffDisclaimerText"
@ -40,8 +43,9 @@ import textBlock from "@/digital-components/text-block/text-block";
import buttonQuestion from "@/digital-components/button-question/button-question";
import timeslotModalListButton from "./timeslot-modal-list-button/timeslot-modal-list-button";
import { daysOfWeek, monthsOfYear } from "@/constants/scheduling.js";
import {defineRule, useField} from "vee-validate";
// TODO: Move this somewhere more global
import { DAYS_OF_WEEK, MONTHS_OF_YEAR } from "@/digital-components/date-picker/mixins/constants.js";
import { defineRule, useField } from "vee-validate";
import { errorMessages } from "@/constants/error-messages";
import { required } from "@/helpers/validation-rules";
@ -52,7 +56,7 @@ defineRule("time-slot-required", required(errorMessages.OPTION_REQUIRED));
const AppointmentTypeStrings = {
IN_SHOP: "Inshop",
MOBILE: "Mobile",
DROP_OFF: "Dropoff"
DROP_OFF: "Dropoff",
};
export default {
@ -68,7 +72,7 @@ export default {
mobileEarlyBirdFee: Object,
estimatedServiceMinutesMinimum: Number,
estimatedServiceMinutesMaximum: Number,
validationRules: String
validationRules: String,
},
data() {
return {
@ -77,11 +81,10 @@ export default {
};
},
setup(props) {
const { handleChange } =
useField("time-slot-modal-question", props.validationRules);
const { handleChange } = useField("time-slot-modal-question", props.validationRules);
return {
handleChange
handleChange,
};
},
watch: {
@ -100,7 +103,10 @@ export default {
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
return null;
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
appointmentTypeCmsWidgetName = this.selectedTimeSlot === this.earlyBirdButtonText ? this.earlyBirdCmsWidgetName : this.mobileCmsWidgetName;
appointmentTypeCmsWidgetName =
this.selectedTimeSlot === this.earlyBirdButtonText
? this.earlyBirdCmsWidgetName
: this.mobileCmsWidgetName;
} else {
appointmentTypeCmsWidgetName = this.dropoffCmsWidgetName;
if (this.isSameDay) {
@ -133,8 +139,8 @@ export default {
}
// This conversion ensures we don't get get GMT induced date changes
const dateObject = new Date(`${this.dateAndTimeSlotData.dateString}T00:00:00`);
const weekdayName = daysOfWeek[dateObject.getDay()];
const month = monthsOfYear[dateObject.getMonth()];
const weekdayName = DAYS_OF_WEEK[dateObject.getDay()];
const month = MONTHS_OF_YEAR[dateObject.getMonth()];
const numberDayOfMonth = dateObject.getDate();
// Ex. Tuesday, April 23
return `${weekdayName}, ${month} ${numberDayOfMonth}`;
@ -147,7 +153,10 @@ export default {
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
durationSubHeaderText += "All day";
} else {
durationSubHeaderText += this.getDisplayTextForDurationLength(this.estimatedServiceMinutesMinimum, this.estimatedServiceMinutesMaximum);
durationSubHeaderText += this.getDisplayTextForDurationLength(
this.estimatedServiceMinutesMinimum,
this.estimatedServiceMinutesMaximum
);
}
return durationSubHeaderText;
},
@ -157,14 +166,16 @@ export default {
}
let availableTimeSlots;
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
availableTimeSlots = [{value: "Dropoff", buttonLabel: this.dropoffButtonText}]
availableTimeSlots = [{ value: "Dropoff", buttonLabel: this.dropoffButtonText }];
} else {
availableTimeSlots = this.dateAndTimeSlotData.timeSlots.map((timeslot) => {
let readableTime;
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
readableTime = this.getDisplayTextForMilitaryTime(timeslot.startTime);
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
readableTime = `${this.getDisplayTextForMilitaryTime(timeslot.startTime)} - ${this.getDisplayTextForMilitaryTime(timeslot.endTime)}`;
readableTime = `${this.getDisplayTextForMilitaryTime(
timeslot.startTime
)} - ${this.getDisplayTextForMilitaryTime(timeslot.endTime)}`;
}
return {
value: timeslot.id,
@ -172,13 +183,16 @@ export default {
};
});
}
if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
const offerPremium = this.dateAndTimeSlotData.timeSlots[0].offerPremium;
const hasEarlyBird = this.mobileEarlyBirdFee?.partType === "EARLY BIRD";
if (offerPremium && hasEarlyBird) {
availableTimeSlots.unshift({value: this.dateAndTimeSlotData.timeSlots[0].id + "-earlybird", buttonLabel: this.earlyBirdButtonText, buttonLabelSubCopy: this.getTotalLineItemPrice(this.mobileEarlyBirdFee)});
availableTimeSlots.unshift({
value: this.dateAndTimeSlotData.timeSlots[0].id + "-earlybird",
buttonLabel: this.earlyBirdButtonText,
buttonLabelSubCopy: this.getTotalLineItemPrice(this.mobileEarlyBirdFee),
});
}
}
return availableTimeSlots;
@ -218,7 +232,7 @@ export default {
displayTextForDurationLength = `${durationMinimum} - ${durationMaximum} minutes`;
}
return displayTextForDurationLength;
}
},
},
components: {
modal,

View file

@ -43,9 +43,9 @@ export default {
};
},
computed: {
formattedButtonLabelSubCopy() {
return this.buttonLabelSubCopy?.toFixed(2);
}
formattedButtonLabelSubCopy() {
return this.buttonLabelSubCopy?.toFixed(2);
},
},
methods: {
displayLoader() {