Merge pull request #1109 from Safelite/feature/CSR-1137
CSR-1137 | Updating button-question and other minor changes
This commit is contained in:
commit
484c434c63
8 changed files with 55 additions and 31 deletions
|
|
@ -52,7 +52,7 @@ https://safelite.atlassian.net/wiki/spaces/DC/pages/76644418/Button+Question+Com
|
||||||
:isWide="isWide"
|
:isWide="isWide"
|
||||||
:validationRules="validationRules"
|
:validationRules="validationRules"
|
||||||
:textPosition="textPosition"
|
:textPosition="textPosition"
|
||||||
:additionalButtonStyling="additionalButtonStyling"
|
:additionalButtonData="additionalButtonData"
|
||||||
:lastValuePushedToGa="lastValuePushedToGa"
|
:lastValuePushedToGa="lastValuePushedToGa"
|
||||||
:setLastValuePushedToGa="setLastValuePushedToGa"
|
:setLastValuePushedToGa="setLastValuePushedToGa"
|
||||||
:suppressError="suppressError"
|
:suppressError="suppressError"
|
||||||
|
|
@ -126,7 +126,7 @@ export default {
|
||||||
suppressError: Boolean,
|
suppressError: Boolean,
|
||||||
useTextForValue: Boolean,
|
useTextForValue: Boolean,
|
||||||
valueToLogType: String,
|
valueToLogType: String,
|
||||||
additionalButtonStyling: String,
|
additionalButtonData: Object,
|
||||||
isSmallQuestionText: Boolean,
|
isSmallQuestionText: Boolean,
|
||||||
customButtonQuestionId: String,
|
customButtonQuestionId: String,
|
||||||
logDisplayedValuesEvent: {
|
logDisplayedValuesEvent: {
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@
|
||||||
<script>
|
<script>
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import loader from "@/ux-components/loader/loader";
|
import loader from "@/ux-components/loader/loader";
|
||||||
|
import store from "@/store";
|
||||||
import { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR } from "./mixins/constants";
|
import { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR } from "./mixins/constants";
|
||||||
import { selectableDaysOptions, requiredParameter, forceTwoDigitString } from "./mixins/helpers";
|
import { selectableDaysOptions, requiredParameter, forceTwoDigitString } from "./mixins/helpers";
|
||||||
|
|
||||||
|
|
@ -244,7 +245,8 @@ export default {
|
||||||
let myPromise = new Promise((resolve, reject) => {
|
let myPromise = new Promise((resolve, reject) => {
|
||||||
const response = config.customSelectableDatesCallback(
|
const response = config.customSelectableDatesCallback(
|
||||||
initialViewStartDate,
|
initialViewStartDate,
|
||||||
initialViewEndDate
|
initialViewEndDate,
|
||||||
|
store.getters.order.serviceLocation.appointmentType
|
||||||
);
|
);
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
|
@ -523,7 +525,8 @@ export default {
|
||||||
async updateSelectableDates(monthStart, monthEnd) {
|
async updateSelectableDates(monthStart, monthEnd) {
|
||||||
const moreSelectableDates = await this.customSelectableDatesCallback(
|
const moreSelectableDates = await this.customSelectableDatesCallback(
|
||||||
monthStart,
|
monthStart,
|
||||||
monthEnd
|
monthEnd,
|
||||||
|
this.$store.getters.order.serviceLocation.appointmentType
|
||||||
);
|
);
|
||||||
moreSelectableDates.days.forEach((selectableDate) => {
|
moreSelectableDates.days.forEach((selectableDate) => {
|
||||||
const index = this.selectableDatesData.findIndex(
|
const index = this.selectableDatesData.findIndex(
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
:groupName="groupName"
|
:groupName="groupName"
|
||||||
buttonTypeString="listButtonHorizontal"
|
buttonTypeString="listButtonHorizontal"
|
||||||
v-model="selectedValues"
|
v-model="selectedValues"
|
||||||
additionalButtonStyling="listButtonHorizontalStrong"
|
:additionalButtonData="{ additionalButtonStyling: 'listButtonHorizontalStrong' }"
|
||||||
isRequired />
|
isRequired />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,14 @@ import store from "@/store";
|
||||||
defineRule("date-required", required(errorMessages.DATE_REQUIRED));
|
defineRule("date-required", required(errorMessages.DATE_REQUIRED));
|
||||||
defineRule("time-slot-selection-required", required(errorMessages.DATE_REQUIRED));
|
defineRule("time-slot-selection-required", required(errorMessages.DATE_REQUIRED));
|
||||||
|
|
||||||
const getAvailableDates = async (startDate, endDate) => {
|
const getAvailableDates = async (startDate, endDate, appointmentType) => {
|
||||||
// USING DATES PASSED, MAKE AN API CALL
|
// USING DATES PASSED, MAKE AN API CALL
|
||||||
const newShopTimeSlotsResponse = await baseMixin.methods.dispatchStoreAction(
|
const newShopTimeSlotsResponse = await baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.GET_SHOP_TIME_SLOTS,
|
storeActions.GET_SHOP_TIME_SLOTS,
|
||||||
{
|
{
|
||||||
startDate: startDate,
|
startDate: startDate,
|
||||||
endDate: endDate,
|
endDate: endDate,
|
||||||
shopAppointmentType: "mobile", // TODO - PASS THIS IN FROM PREVIOUS PAGE?
|
shopAppointmentType: appointmentType,
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -257,7 +257,11 @@ export default {
|
||||||
// NEED TODO - WHAT ARE PAGE REQ'S FOR THIS PAGE?
|
// NEED TODO - WHAT ARE PAGE REQ'S FOR THIS PAGE?
|
||||||
},
|
},
|
||||||
async getAvailableDatesMethod(startDate, endDate) {
|
async getAvailableDatesMethod(startDate, endDate) {
|
||||||
const newShopTimeSlots = await getAvailableDates(startDate, endDate);
|
const newShopTimeSlots = await getAvailableDates(
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
this.appointmentType
|
||||||
|
);
|
||||||
// ADD API CALL RESULTS TO EXISTING DATE DATA
|
// ADD API CALL RESULTS TO EXISTING DATE DATA
|
||||||
this.selectableDatesData.days = this.selectableDatesData.days.concat(
|
this.selectableDatesData.days = this.selectableDatesData.days.concat(
|
||||||
newShopTimeSlots.days
|
newShopTimeSlots.days
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
@footer-button-event="closeModal">
|
@footer-button-event="closeModal">
|
||||||
<textBlock
|
<textBlock
|
||||||
v-show="inshopAppointmentDurationTextWithTime"
|
v-show="durationTextBlockCopy"
|
||||||
:customText="inshopAppointmentDurationTextWithTime"
|
:customText="durationTextBlockCopy"
|
||||||
justifyText="center"
|
justifyText="center"
|
||||||
typeStyle="small"
|
typeStyle="small"
|
||||||
class="duration-text-block" />
|
class="duration-text-block" />
|
||||||
|
|
@ -90,13 +90,18 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
modelValue() {
|
modelValue() {
|
||||||
this.selectedTimeSlot = this.modelValue;
|
this.selectedTimeSlot = this.modelValue;
|
||||||
|
// Run component validation that is used at parent level
|
||||||
this.handleChange(this.modelValue);
|
this.handleChange(this.modelValue);
|
||||||
},
|
},
|
||||||
|
// dateAndTimeSlotData(newValue, oldValue) {
|
||||||
|
// const numberOfOptions = newValue?.timeSlots.length;
|
||||||
|
// console.log('running');
|
||||||
|
// if (numberOfOptions === 1) {
|
||||||
|
// this.selectedTimeSlot = newValue.timeSlots[0].id;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
appointmentDurationTextFromCms() {
|
|
||||||
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
|
||||||
},
|
|
||||||
supplementalInformationBlock() {
|
supplementalInformationBlock() {
|
||||||
let appointmentTypeCmsWidgetName;
|
let appointmentTypeCmsWidgetName;
|
||||||
let cmsFieldName = "BodyText";
|
let cmsFieldName = "BodyText";
|
||||||
|
|
@ -127,6 +132,29 @@ export default {
|
||||||
dropoffDisclaimerText() {
|
dropoffDisclaimerText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
dropOffDurationText() {
|
||||||
|
return this.getCmsContent(this.dropoffCmsWidgetName, "SubheaderText");
|
||||||
|
},
|
||||||
|
inshopDurationText() {
|
||||||
|
const inshopDurationTextWithoutTime = this.getCmsContent(
|
||||||
|
this.cmsWidgetName,
|
||||||
|
"SubheaderText"
|
||||||
|
);
|
||||||
|
const inshopDurationTime = this.getDisplayTextForDurationLength(
|
||||||
|
this.estimatedServiceMinutesMinimum,
|
||||||
|
this.estimatedServiceMinutesMaximum
|
||||||
|
);
|
||||||
|
return `${inshopDurationTextWithoutTime} ${inshopDurationTime}`;
|
||||||
|
},
|
||||||
|
durationTextBlockCopy() {
|
||||||
|
if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
|
||||||
|
return null;
|
||||||
|
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
||||||
|
return this.inshopDurationText;
|
||||||
|
} else {
|
||||||
|
return this.dropOffDurationText;
|
||||||
|
}
|
||||||
|
},
|
||||||
shouldShowDropoffDisclaimerText() {
|
shouldShowDropoffDisclaimerText() {
|
||||||
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
||||||
},
|
},
|
||||||
|
|
@ -145,21 +173,6 @@ export default {
|
||||||
// Ex. Tuesday, April 23
|
// Ex. Tuesday, April 23
|
||||||
return `${weekdayName}, ${month} ${numberDayOfMonth}`;
|
return `${weekdayName}, ${month} ${numberDayOfMonth}`;
|
||||||
},
|
},
|
||||||
inshopAppointmentDurationTextWithTime() {
|
|
||||||
if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let durationSubHeaderText = this.appointmentDurationTextFromCms + " ";
|
|
||||||
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
|
||||||
durationSubHeaderText += "All day";
|
|
||||||
} else {
|
|
||||||
durationSubHeaderText += this.getDisplayTextForDurationLength(
|
|
||||||
this.estimatedServiceMinutesMinimum,
|
|
||||||
this.estimatedServiceMinutesMaximum
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return durationSubHeaderText;
|
|
||||||
},
|
|
||||||
availableTimeSlots() {
|
availableTimeSlots() {
|
||||||
if (this.dateAndTimeSlotData === null) {
|
if (this.dateAndTimeSlotData === null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default {
|
||||||
textPosition: String,
|
textPosition: String,
|
||||||
screenReaderOnlyText: String,
|
screenReaderOnlyText: String,
|
||||||
isWide: Boolean,
|
isWide: Boolean,
|
||||||
additionalButtonStyling: String,
|
additionalButtonData: Object,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
selectedValue: {
|
selectedValue: {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,9 @@ describe("list-button-horizontal.vue", () => {
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mockData: {
|
mockData: {
|
||||||
propsData: {
|
propsData: {
|
||||||
additionalButtonStyling: "listButtonHorizontalStrong",
|
additionalButtonData: {
|
||||||
|
additionalButtonStyling: "listButtonHorizontalStrong",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ export default {
|
||||||
mixins: [inputButtonWrapperMixin],
|
mixins: [inputButtonWrapperMixin],
|
||||||
computed: {
|
computed: {
|
||||||
isStrongStyling() {
|
isStrongStyling() {
|
||||||
return this.additionalButtonStyling === "listButtonHorizontalStrong";
|
return (
|
||||||
|
this.additionalButtonData?.additionalButtonStyling === "listButtonHorizontalStrong"
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue