Some more tweaking for consistency
This commit is contained in:
parent
ad0bc339ed
commit
5c4d5993d1
2 changed files with 34 additions and 27 deletions
|
|
@ -79,11 +79,13 @@ defineRule("date-required", required(errorMessages.DATE_REQUIRED));
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("time-slot-selection-required", (value) => {
|
defineRule("time-slot-selection-required", (value) => {
|
||||||
if (value.date == null ||
|
if (
|
||||||
|
value.date == null ||
|
||||||
value.startTime == null ||
|
value.startTime == null ||
|
||||||
value.endTime == null ||
|
value.endTime == null ||
|
||||||
value.routeCode == null ||
|
value.routeCode == null ||
|
||||||
value.estimatedServiceMinutesMaximum) {
|
value.estimatedServiceMinutesMaximum
|
||||||
|
) {
|
||||||
return errorMessages.DATE_REQUIRED;
|
return errorMessages.DATE_REQUIRED;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -357,10 +359,7 @@ export default {
|
||||||
funnelFooterButtonText += ` at ${this.getDisplayTextForMilitaryTime(
|
funnelFooterButtonText += ` at ${this.getDisplayTextForMilitaryTime(
|
||||||
timeSlot.startTime,
|
timeSlot.startTime,
|
||||||
true
|
true
|
||||||
)} - ${this.getDisplayTextForMilitaryTime(
|
)} - ${this.getDisplayTextForMilitaryTime(timeSlot.endTime, true)}`;
|
||||||
timeSlot.endTime,
|
|
||||||
true
|
|
||||||
)}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$refs.funnelFooter.updateButtonText(funnelFooterButtonText);
|
this.$refs.funnelFooter.updateButtonText(funnelFooterButtonText);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<modal
|
<modal
|
||||||
ref="timeSlots"
|
:ref="modalName"
|
||||||
class="time-slots-modal"
|
|
||||||
:headerText="dateSelectedReadableDate"
|
:headerText="dateSelectedReadableDate"
|
||||||
:footerButtonText="footerCloseButtonText"
|
:footerButtonText="footerCloseButtonText"
|
||||||
:onModalOpenedCallback="onModalOpened"
|
:onModalOpenedCallback="onModalOpened"
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
@isModalOpened="setModalStatus"
|
@isModalOpened="setModalStatus"
|
||||||
@footer-button-event="setTimeSlot">
|
@footer-button-event="setTimeSlot"
|
||||||
|
class="time-slots-modal">
|
||||||
<template v-if="isModalOpened">
|
<template v-if="isModalOpened">
|
||||||
<textBlock
|
<textBlock
|
||||||
v-show="durationTextBlockCopy"
|
v-show="durationTextBlockCopy"
|
||||||
|
|
@ -84,11 +84,13 @@ export default {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
id: null,
|
routeCode: null,
|
||||||
isPremiumAppointment: null,
|
date: null,
|
||||||
|
startTime: null,
|
||||||
|
endTime: null,
|
||||||
|
jobMaxMinutes: null,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
cmsWidgetName: String,
|
cmsWidgetName: String,
|
||||||
mobileCmsWidgetName: String,
|
mobileCmsWidgetName: String,
|
||||||
mobilePremiumCmsWidgetName: String,
|
mobilePremiumCmsWidgetName: String,
|
||||||
|
|
@ -139,18 +141,10 @@ export default {
|
||||||
errors,
|
errors,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
modelValue: {
|
|
||||||
handler(newValue) {
|
|
||||||
this.internalModel = deepClone(newValue);
|
|
||||||
this.handleChange(newValue);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
availableTimeSlots(newValue) {
|
|
||||||
this.autoSelectTimeSlotIfOnlyOneIsAvailable(newValue);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
|
modalName() {
|
||||||
|
return "timeSlots";
|
||||||
|
},
|
||||||
selectedValue: {
|
selectedValue: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
|
|
@ -161,16 +155,13 @@ export default {
|
||||||
},
|
},
|
||||||
selectedTimeSlotId: {
|
selectedTimeSlotId: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.selectedValue?.id;
|
return this.selectedValue?.routeCode;
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
// Button Question only supports Number, or String data types so we must get the full object to emit
|
// Button Question only supports Number, or String data types so we must get the full object to emit
|
||||||
this.selectedValue = this.getSelectedTimeSlotObject(newValue);
|
this.selectedValue = this.getSelectedTimeSlotObject(newValue);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
modal() {
|
|
||||||
return this.$refs["timeSlots"];
|
|
||||||
},
|
|
||||||
supplementalInformationBlock() {
|
supplementalInformationBlock() {
|
||||||
let appointmentTypeCmsWidgetName;
|
let appointmentTypeCmsWidgetName;
|
||||||
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
||||||
|
|
@ -279,10 +270,12 @@ export default {
|
||||||
this.cmsWidgetName,
|
this.cmsWidgetName,
|
||||||
cmsWidgetFieldMappings.DURATION
|
cmsWidgetFieldMappings.DURATION
|
||||||
);
|
);
|
||||||
|
|
||||||
const inshopDurationTime = this.getDisplayTextForDurationLength(
|
const inshopDurationTime = this.getDisplayTextForDurationLength(
|
||||||
this.estimatedServiceMinutesMinimum,
|
this.estimatedServiceMinutesMinimum,
|
||||||
this.estimatedServiceMinutesMaximum
|
this.estimatedServiceMinutesMaximum
|
||||||
);
|
);
|
||||||
|
|
||||||
return `${inshopDurationTextWithoutTime} ${inshopDurationTime}`;
|
return `${inshopDurationTextWithoutTime} ${inshopDurationTime}`;
|
||||||
},
|
},
|
||||||
durationTextBlockCopy() {
|
durationTextBlockCopy() {
|
||||||
|
|
@ -308,6 +301,7 @@ export default {
|
||||||
if (!this.dateAndTimeSlotData) {
|
if (!this.dateAndTimeSlotData) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedDate = this.dateAndTimeSlotData.date;
|
const selectedDate = this.dateAndTimeSlotData.date;
|
||||||
const todaysDate = new Date().toISOString().split("T")[0];
|
const todaysDate = new Date().toISOString().split("T")[0];
|
||||||
return selectedDate === todaysDate;
|
return selectedDate === todaysDate;
|
||||||
|
|
@ -338,6 +332,9 @@ export default {
|
||||||
return this.getAvailableTimeSlotsForInshop(this.dateAndTimeSlotData.timeSlots);
|
return this.getAvailableTimeSlotsForInshop(this.dateAndTimeSlotData.timeSlots);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
modal() {
|
||||||
|
return this.$refs["timeSlots"];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModal() {
|
openModal() {
|
||||||
|
|
@ -479,6 +476,17 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
modelValue: {
|
||||||
|
handler(newValue) {
|
||||||
|
this.internalModel = deepClone(newValue);
|
||||||
|
this.handleChange(newValue);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
availableTimeSlots(newValue) {
|
||||||
|
this.autoSelectTimeSlotIfOnlyOneIsAvailable(newValue);
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
modal,
|
modal,
|
||||||
textBlock,
|
textBlock,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue