CSR-1137 | Tech review changes
This commit is contained in:
parent
dd502e41ba
commit
6ca3d916ba
2 changed files with 51 additions and 42 deletions
|
|
@ -23,14 +23,14 @@
|
||||||
v-model="selectedDate"
|
v-model="selectedDate"
|
||||||
:customSelectableDatesCallback="getAvailableDates" />
|
:customSelectableDatesCallback="getAvailableDates" />
|
||||||
<!-- todayOverrideDateString="2023-08-06T03:00:00" -->
|
<!-- todayOverrideDateString="2023-08-06T03:00:00" -->
|
||||||
<time-slot-selection-modal
|
<time-slot-modal-question
|
||||||
ref="timeSlotModal"
|
ref="timeSlotModalQuestion"
|
||||||
|
cmsWidgetName="TimeSlotModalQuestion"
|
||||||
v-model="selectedTimeSlotId"
|
v-model="selectedTimeSlotId"
|
||||||
:dateAndTimeSlotData="DateAndTimeSlotDataForTimeslotModal"
|
:dateAndTimeSlotData="TimeSlotsForSelectedDate"
|
||||||
:estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum"
|
:estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum"
|
||||||
:estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum"
|
:estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum"/>
|
||||||
@timeSlotSaved="updateAppointmentDateAndTime" />
|
<button @click="openInshopTimeSlotsModal">Click for timeslots</button>
|
||||||
<button @click="openInshopTimeslotsModal">Click for timeslots</button>
|
|
||||||
<funnel-footer
|
<funnel-footer
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
|
|
@ -49,7 +49,7 @@ import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-heade
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import datePicker from "@/digital-components/date-picker/date-picker";
|
import datePicker from "@/digital-components/date-picker/date-picker";
|
||||||
import timeSlotSelectionModal from "./time-slot-selection-modal/time-slot-selection-modal";
|
import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
|
@ -74,12 +74,6 @@ export default {
|
||||||
return {
|
return {
|
||||||
selectedDate: null,
|
selectedDate: null,
|
||||||
selectedTimeSlotId: null,
|
selectedTimeSlotId: null,
|
||||||
appointmentDateAndTime: {
|
|
||||||
date: null,
|
|
||||||
startTime: null,
|
|
||||||
endTime: null,
|
|
||||||
id: null,
|
|
||||||
},
|
|
||||||
selectableDatesData: [],
|
selectableDatesData: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -110,12 +104,29 @@ export default {
|
||||||
// Splits content when brackets are found in text so that text can be looped through and router-link can be injected when needed
|
// Splits content when brackets are found in text so that text can be looped through and router-link can be injected when needed
|
||||||
return this.splitCopyOnCMSPlaceHolder(this.ChangeShopLinkText);
|
return this.splitCopyOnCMSPlaceHolder(this.ChangeShopLinkText);
|
||||||
},
|
},
|
||||||
DateAndTimeSlotDataForTimeslotModal() {
|
TimeSlotsForSelectedDate() {
|
||||||
if (this.selectedDate === null) {
|
if (this.selectedDate === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return this.selectableDatesData.find(selectableDate => selectableDate.dateString === this.selectedDate.dateString);
|
return this.selectableDatesData.find(selectableDate => selectableDate.dateString === this.selectedDate.dateString);
|
||||||
}
|
},
|
||||||
|
appointmentDateAndTime() {
|
||||||
|
if (!this.selectedTimeSlotId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const timeSlotSelectedObject = this.getTimeSlotObjectFromTimeSlotId(this.selectedTimeSlotId);
|
||||||
|
if (timeSlotSelectedObject) {
|
||||||
|
return {
|
||||||
|
date: this.selectedDate.dateString,
|
||||||
|
startTime: timeSlotSelectedObject.startTime,
|
||||||
|
endTime: timeSlotSelectedObject.endTime,
|
||||||
|
id: this.selectedTimeSlotId,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doesCopyContainRouterLink,
|
doesCopyContainRouterLink,
|
||||||
|
|
@ -164,18 +175,11 @@ export default {
|
||||||
});
|
});
|
||||||
return responseData;
|
return responseData;
|
||||||
},
|
},
|
||||||
openInshopTimeslotsModal() {
|
openInshopTimeSlotsModal() {
|
||||||
this.$refs["timeSlotModal"].openModal();
|
this.$refs["timeSlotModalQuestion"].openModal();
|
||||||
},
|
|
||||||
updateAppointmentDateAndTime() {
|
|
||||||
let timeSlotSelectedObject = this.getTimeSlotObjectFromTimeSlotId(this.selectedTimeSlotId);
|
|
||||||
this.appointmentDateAndTime.date = this.selectedDate.dateString;
|
|
||||||
this.appointmentDateAndTime.startTime = timeSlotSelectedObject.startTime;
|
|
||||||
this.appointmentDateAndTime.endTime = timeSlotSelectedObject.endTime;
|
|
||||||
this.appointmentDateAndTime.id = this.selectedTimeSlotId;
|
|
||||||
},
|
},
|
||||||
getTimeSlotObjectFromTimeSlotId(timeSlotId) {
|
getTimeSlotObjectFromTimeSlotId(timeSlotId) {
|
||||||
let timeSlots = this.selectableDatesData.find(selectableDate => selectableDate.dateString === this.selectedDate.dateString).timeSlots;
|
const timeSlots = this.selectableDatesData.find(selectableDate => selectableDate.dateString === this.selectedDate.dateString).timeSlots;
|
||||||
return timeSlots.find(timeSlot => timeSlot.id === timeSlotId);
|
return timeSlots.find(timeSlot => timeSlot.id === timeSlotId);
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
|
|
@ -199,7 +203,7 @@ export default {
|
||||||
Form,
|
Form,
|
||||||
loadingModal,
|
loadingModal,
|
||||||
datePicker,
|
datePicker,
|
||||||
timeSlotSelectionModal,
|
timeSlotModalQuestion,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,23 @@
|
||||||
ref="timeSlots"
|
ref="timeSlots"
|
||||||
class="time-slots-modal"
|
class="time-slots-modal"
|
||||||
:headerText="dateSelectedReadableDate"
|
:headerText="dateSelectedReadableDate"
|
||||||
footerButtonText="Save time slot"
|
:footerButtonText="footerCloseButtonText"
|
||||||
allowManualFooterDisableOverride
|
allowManualFooterDisableOverride
|
||||||
:isFooterDisabledManualOverride="currentlySelectedTimeSlot === null"
|
:isFooterDisabledManualOverride="selectedTimeSlot === null"
|
||||||
:onModalOpenedCallback="onModalOpened"
|
:onModalOpenedCallback="onModalOpened"
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
@footer-button-event="closeModal">
|
@footer-button-event="closeModal">
|
||||||
<textBlock
|
<textBlock
|
||||||
cmsWidgetName="appointmentDuration"
|
:customText="appointmentDurationTextWithTime"
|
||||||
:customText="durationSubHeaderText"
|
|
||||||
justifyText="center"
|
justifyText="center"
|
||||||
typeStyle="small"
|
typeStyle="small"
|
||||||
class="mb-5" />
|
class="mb-5" />
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
class="radioQuestion"
|
class="radioQuestion"
|
||||||
:answers="availableTimeslots"
|
:answers="availableTimeSlots"
|
||||||
groupName="ChooseTimeSlot"
|
groupName="ChooseTimeSlot"
|
||||||
textPosition="text-center"
|
textPosition="text-center"
|
||||||
v-model="currentlySelectedTimeSlot"
|
v-model="selectedTimeSlot"
|
||||||
isRequired />
|
isRequired />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -34,38 +33,45 @@ import buttonQuestion from "@/digital-components/button-question/button-question
|
||||||
import { daysOfWeek, monthsOfYear } from "@/constants/scheduling.js";
|
import { daysOfWeek, monthsOfYear } from "@/constants/scheduling.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "timeSlotSelectionModal",
|
name: "timeSlotModalQuestion",
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
|
cmsWidgetName: String,
|
||||||
dateAndTimeSlotData: Object,
|
dateAndTimeSlotData: Object,
|
||||||
estimatedServiceMinutesMinimum: Number,
|
estimatedServiceMinutesMinimum: Number,
|
||||||
estimatedServiceMinutesMaximum: Number,
|
estimatedServiceMinutesMaximum: Number,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
currentlySelectedTimeSlot: null,
|
selectedTimeSlot: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue() {
|
modelValue() {
|
||||||
this.currentlySelectedTimeSlot = this.modelValue;
|
this.selectedTimeSlot = this.modelValue;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
appointmentDurationTextFromCms() {
|
||||||
|
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
||||||
|
},
|
||||||
|
footerCloseButtonText() {
|
||||||
|
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
||||||
|
},
|
||||||
dateSelectedReadableDate() {
|
dateSelectedReadableDate() {
|
||||||
if (this.dateAndTimeSlotData === null) {
|
if (this.dateAndTimeSlotData === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// This conversion ensures we don't get get GMT induced date changes
|
// This conversion ensures we don't get get GMT induced date changes
|
||||||
let dateObject = new Date (`${this.dateAndTimeSlotData.dateString}T00:00:00`);
|
const dateObject = new Date (`${this.dateAndTimeSlotData.dateString}T00:00:00`);
|
||||||
const weekdayName = daysOfWeek[dateObject.getDay()];
|
const weekdayName = daysOfWeek[dateObject.getDay()];
|
||||||
const month = monthsOfYear[dateObject.getMonth()];
|
const month = monthsOfYear[dateObject.getMonth()];
|
||||||
const numberDayOfMonth = dateObject.getDate();
|
const numberDayOfMonth = dateObject.getDate();
|
||||||
// Ex. Tuesday, April 23
|
// Ex. Tuesday, April 23
|
||||||
return `${weekdayName}, ${month} ${numberDayOfMonth}`;
|
return `${weekdayName}, ${month} ${numberDayOfMonth}`;
|
||||||
},
|
},
|
||||||
durationSubHeaderText() {
|
appointmentDurationTextWithTime() {
|
||||||
let durationSubHeaderText = "Duration: ";
|
let durationSubHeaderText = this.appointmentDurationTextFromCms + " ";
|
||||||
if (this.estimatedServiceMinutesMaximum >= 120) {
|
if (this.estimatedServiceMinutesMaximum >= 120) {
|
||||||
durationSubHeaderText += `${this.estimatedServiceMinutesMinimum / 60} - ${
|
durationSubHeaderText += `${this.estimatedServiceMinutesMinimum / 60} - ${
|
||||||
this.estimatedServiceMinutesMaximum / 60} hours`;
|
this.estimatedServiceMinutesMaximum / 60} hours`;
|
||||||
|
|
@ -74,7 +80,7 @@ export default {
|
||||||
}
|
}
|
||||||
return durationSubHeaderText;
|
return durationSubHeaderText;
|
||||||
},
|
},
|
||||||
availableTimeslots() {
|
availableTimeSlots() {
|
||||||
if (this.dateAndTimeSlotData === null) {
|
if (this.dateAndTimeSlotData === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -100,13 +106,12 @@ export default {
|
||||||
},
|
},
|
||||||
// fires any time the footer button is used, is fired before "onModalClosed"
|
// fires any time the footer button is used, is fired before "onModalClosed"
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.$emit("update:modelValue", this.currentlySelectedTimeSlot);
|
this.$emit("update:modelValue", this.selectedTimeSlot);
|
||||||
this.$refs["timeSlots"].closeModal();
|
this.$refs["timeSlots"].closeModal();
|
||||||
this.$emit("timeSlotSaved");
|
|
||||||
},
|
},
|
||||||
// fires any time the modal is closed, AFTER "closeModal" fires if footer button is used
|
// fires any time the modal is closed, AFTER "closeModal" fires if footer button is used
|
||||||
onModalClosed() {
|
onModalClosed() {
|
||||||
this.currentlySelectedTimeSlot = this.modelValue;
|
this.selectedTimeSlot = this.modelValue;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Loading…
Reference in a new issue