CASH-152: go back to just using one component for datePicker due to conflicts with 2
This commit is contained in:
parent
b61e6e619a
commit
5bfbd71c93
3 changed files with 141 additions and 76 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="date-picker text-center" :class="calendarViewDirection">
|
<div class="date-picker text-center" :class="`${calendarViewDirection} ${isPricingByDayClass}`">
|
||||||
<fieldset id="date-picker-fieldset" ref="datePickerFieldset">
|
<fieldset id="date-picker-fieldset" ref="datePickerFieldset">
|
||||||
<legend class="sr-only">Select a day and time</legend>
|
<legend class="sr-only">Select a day and time</legend>
|
||||||
<div
|
<div
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
:id="`${month.monthLabel}-${date.dateNum.toString()}`" />
|
:id="`${month.monthLabel}-${date.dateNum.toString()}`" />
|
||||||
<label :for="`${month.monthLabel}-${date.dateNum.toString()}`">
|
<label :for="`${month.monthLabel}-${date.dateNum.toString()}`">
|
||||||
<span>{{ date.dateNum.toString() }}</span>
|
<span>{{ date.dateNum.toString() }}</span>
|
||||||
<span v-if="showPricingByDay && date.isSelectable">
|
<span v-if="isPricingByDayExperiment && showPricingByDay && date.isSelectable" class="price">
|
||||||
{{ date.priceString }}
|
{{ date.priceString }}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -163,6 +163,7 @@ export default {
|
||||||
showPricingByDay: Boolean,
|
showPricingByDay: Boolean,
|
||||||
baseDayPrice: Number,
|
baseDayPrice: Number,
|
||||||
pricingByDayUpcharge: Number,
|
pricingByDayUpcharge: Number,
|
||||||
|
isPricingByDayExperiment: Boolean,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const uuid = uuidv4();
|
const uuid = uuidv4();
|
||||||
|
|
@ -214,6 +215,9 @@ export default {
|
||||||
if (this.selectableDatesSetting === "custom") return "future";
|
if (this.selectableDatesSetting === "custom") return "future";
|
||||||
return "past";
|
return "past";
|
||||||
},
|
},
|
||||||
|
isPricingByDayClass() {
|
||||||
|
return this.isPricingByDayExperiment ? "pricing-by-day" : "";
|
||||||
|
},
|
||||||
selectedDate: {
|
selectedDate: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
|
|
@ -795,7 +799,7 @@ export default {
|
||||||
|
|
||||||
.grid-item {
|
.grid-item {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0;
|
margin: 10px 3px;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|
||||||
|
|
@ -830,13 +834,12 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.month-year {
|
.month-year {
|
||||||
grid-area: 1 / 1 / 2 / 8;
|
grid-area: 1 / 1 / 2 / 5;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
letter-spacing: 0.75px;
|
letter-spacing: 0.75px;
|
||||||
}
|
}
|
||||||
.legend {
|
.legend {
|
||||||
display: none;
|
|
||||||
grid-area: 1 / 5 / 2 / 8;
|
grid-area: 1 / 5 / 2 / 8;
|
||||||
.legend-circle {
|
.legend-circle {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
@ -855,27 +858,43 @@ export default {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: flex-start;
|
align-items: center;
|
||||||
outline: none;
|
outline: none;
|
||||||
width: 100%;
|
height: 1.5rem;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition:
|
transition:
|
||||||
height ease 250ms,
|
height ease 250ms,
|
||||||
opacity ease 250ms;
|
opacity ease 250ms;
|
||||||
|
|
||||||
color: $gray-500;
|
|
||||||
background-color: $gray-100;
|
|
||||||
|
|
||||||
input[type="radio"] {
|
input[type="radio"] {
|
||||||
position: absolute; //override bootstrap
|
position: absolute; //override bootstrap
|
||||||
height: 0;
|
height: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
&:checked + label {
|
&:focus-visible + label {
|
||||||
background: $blue-100;
|
box-shadow: 0 0 0 2.5px $blue;
|
||||||
border: 2px solid $blue;
|
}
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
|
&:focus + label,
|
||||||
|
&:checked:focus + label {
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 3px #fff,
|
||||||
|
0 0 0 5.5px #1574a1;
|
||||||
|
background-color: $blue;
|
||||||
|
color: $white;
|
||||||
|
&.current-day {
|
||||||
|
&:after {
|
||||||
|
background-color: $white;
|
||||||
|
}
|
||||||
|
.first-day {
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:checked + label {
|
||||||
|
color: $white;
|
||||||
|
background: $blue;
|
||||||
&:after {
|
&:after {
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
}
|
}
|
||||||
|
|
@ -894,28 +913,17 @@ export default {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
|
||||||
width: 2.5rem;
|
|
||||||
font-size: 8px;
|
|
||||||
background: pink;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
label {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 2.5rem;
|
min-width: 2.5rem;
|
||||||
height: 3rem;
|
width: 2.5rem;
|
||||||
width: 100%;
|
height: 2.5rem;
|
||||||
font-size: 0.75rem;
|
|
||||||
line-height: 1.2;
|
|
||||||
justify-content: flex-start;
|
|
||||||
padding: 0.25rem;
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
margin-top: 0.25rem;
|
|
||||||
&.small {
|
&.small {
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: $gray-550;
|
color: $gray-550;
|
||||||
|
|
@ -947,17 +955,23 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selectable-day {
|
&.selectable-day {
|
||||||
background-color: $white;
|
|
||||||
label {
|
label {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
cursor: pointer;
|
background-color: $blue-100;
|
||||||
|
border: 1px solid $blue;
|
||||||
span {
|
min-width: 2.5rem;
|
||||||
text-decoration: underline;
|
width: 2.5rem;
|
||||||
}
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.unavailable-day {
|
||||||
|
label {
|
||||||
|
color: $gray-500;
|
||||||
|
background-color: $gray-100;
|
||||||
|
border: none;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.unavailable-day:not(&.sunday) {
|
&.unavailable-day:not(&.sunday) {
|
||||||
label {
|
label {
|
||||||
&::before {
|
&::before {
|
||||||
|
|
@ -978,11 +992,12 @@ export default {
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
margin-top: 0.2rem;
|
|
||||||
width: 0.25rem;
|
width: 0.25rem;
|
||||||
height: 0.25rem;
|
height: 0.25rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: $black;
|
background-color: $black;
|
||||||
|
position: absolute;
|
||||||
|
top: 28px;
|
||||||
}
|
}
|
||||||
.first-day {
|
.first-day {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
|
|
@ -1073,7 +1088,82 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.pricing-by-day { // pricing by day override styles
|
||||||
|
.calendar-grid-container .grid-item {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.month-year {
|
||||||
|
grid-area: 1 / 1 / 2 / 8;
|
||||||
|
}
|
||||||
|
.legend {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.radio-wrapper {
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
height: 3rem;
|
||||||
|
color: $gray-500;
|
||||||
|
background-color: $gray-100;
|
||||||
|
|
||||||
|
input[type="radio"] {
|
||||||
|
&:focus-visible + label {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus + label,
|
||||||
|
&:checked:focus + label {
|
||||||
|
box-shadow: none;
|
||||||
|
background-color: $white;
|
||||||
|
color: $blue;
|
||||||
|
}
|
||||||
|
&:checked + label {
|
||||||
|
background: $blue-100;
|
||||||
|
border: 2px solid $blue;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: $blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
flex-direction: column;
|
||||||
|
height: 3rem;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding: 0.25rem;
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.selectable-day {
|
||||||
|
background-color: $white;
|
||||||
|
label {
|
||||||
|
background-color: $white;
|
||||||
|
border: none;
|
||||||
|
min-width: initial;
|
||||||
|
width: initial;
|
||||||
|
height: -webkit-fill-available;
|
||||||
|
border-radius: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
span {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.current-day {
|
||||||
|
label:after {
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-link {
|
.btn-link {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -662,7 +662,6 @@ function setupMocks({ customMountOptions }) {
|
||||||
|
|
||||||
wrapper.vm.setCmsContent = jest.fn();
|
wrapper.vm.setCmsContent = jest.fn();
|
||||||
wrapper.vm.$refs.datePicker.initializeComponent = jest.fn();
|
wrapper.vm.$refs.datePicker.initializeComponent = jest.fn();
|
||||||
wrapper.vm.$refs.datePickerForPricingByDay.initializeComponent = jest.fn();
|
|
||||||
wrapper.vm.$refs.locationAlerts.initializeComponent = jest.fn();
|
wrapper.vm.$refs.locationAlerts.initializeComponent = jest.fn();
|
||||||
wrapper.vm.$refs.navbar.updateButtonText = jest.fn();
|
wrapper.vm.$refs.navbar.updateButtonText = jest.fn();
|
||||||
wrapper.vm.$refs.timeSlotModalQuestion.openModal = jest.fn();
|
wrapper.vm.$refs.timeSlotModalQuestion.openModal = jest.fn();
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,6 @@
|
||||||
</template>
|
</template>
|
||||||
<locationAlerts cmsWidgetPrefix="LocationAlert-" ref="locationAlerts" />
|
<locationAlerts cmsWidgetPrefix="LocationAlert-" ref="locationAlerts" />
|
||||||
<datePickerForPricingByDay
|
<datePickerForPricingByDay
|
||||||
v-show="isPricingByDayExperiment"
|
|
||||||
customComponentId="dateQuestion"
|
|
||||||
selectableDatesSetting="custom"
|
|
||||||
ref="datePickerForPricingByDay"
|
|
||||||
v-model="selectedDate"
|
|
||||||
class="text-link-small"
|
|
||||||
:customSelectableDatesCallback="getAvailableDatesMethod"
|
|
||||||
validationRules="date-required"
|
|
||||||
:baseDayPrice="baseDayPrice"
|
|
||||||
:pricingByDayUpcharge="pricingByDayUpcharge"
|
|
||||||
:showPricingByDay="showPricingByDay"
|
|
||||||
@date-clicked="handleDateClicked" />
|
|
||||||
<datePicker
|
|
||||||
v-show="!isPricingByDayExperiment"
|
|
||||||
customComponentId="dateQuestion"
|
customComponentId="dateQuestion"
|
||||||
selectableDatesSetting="custom"
|
selectableDatesSetting="custom"
|
||||||
ref="datePicker"
|
ref="datePicker"
|
||||||
|
|
@ -40,7 +26,11 @@
|
||||||
class="text-link-small"
|
class="text-link-small"
|
||||||
:customSelectableDatesCallback="getAvailableDatesMethod"
|
:customSelectableDatesCallback="getAvailableDatesMethod"
|
||||||
validationRules="date-required"
|
validationRules="date-required"
|
||||||
@date-clicked="openInshopTimeSlotsModal" />
|
:baseDayPrice="baseDayPrice"
|
||||||
|
:pricingByDayUpcharge="pricingByDayUpcharge"
|
||||||
|
:showPricingByDay="showPricingByDay"
|
||||||
|
:isPricingByDayExperiment="isPricingByDayExperiment"
|
||||||
|
@date-clicked="handleDateClicked" />
|
||||||
<timeSlotModalQuestion
|
<timeSlotModalQuestion
|
||||||
ref="timeSlotModalQuestion"
|
ref="timeSlotModalQuestion"
|
||||||
customComponentId="timeSlotModalQuestion"
|
customComponentId="timeSlotModalQuestion"
|
||||||
|
|
@ -87,7 +77,6 @@ import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
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 datePickerForPricingByDay from "@/experiment-components/date-picker-for-pricing-by-day";
|
import datePickerForPricingByDay from "@/experiment-components/date-picker-for-pricing-by-day";
|
||||||
import locationAlerts from "@/layouts/schedule/location-alerts/location-alerts";
|
import locationAlerts from "@/layouts/schedule/location-alerts/location-alerts";
|
||||||
import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question";
|
import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question";
|
||||||
|
|
@ -303,27 +292,16 @@ export default {
|
||||||
store.getters.order.serviceLocation.provider?.address?.zipCodeCtu
|
store.getters.order.serviceLocation.provider?.address?.zipCodeCtu
|
||||||
);
|
);
|
||||||
|
|
||||||
// While Pricing By Day Experiment is ongoing, there are two different datePickers, but only one will load
|
// While Pricing By Day Experiment is ongoing, using the updated datePicker
|
||||||
let datePickerInitialDataPromise;
|
const datePickerInitialDataPromise = await datePickerForPricingByDay.methods.loadInitialData({
|
||||||
if (isPricingByDayExperiment) {
|
// setup config options for date-picker
|
||||||
datePickerInitialDataPromise = await datePickerForPricingByDay.methods.loadInitialData({
|
selectableDatesSetting: "custom",
|
||||||
// setup config options for date-picker
|
initialViewRowsToShow: 5,
|
||||||
selectableDatesSetting: "custom",
|
customSelectableDatesCallback: getAvailableDates,
|
||||||
initialViewRowsToShow: 5,
|
preSelectedDate: preSelectedDate,
|
||||||
customSelectableDatesCallback: getAvailableDates,
|
baseDayPrice: baseDayPrice,
|
||||||
preSelectedDate: preSelectedDate,
|
pricingByDayUpcharge: pricingByDayUpcharge,
|
||||||
baseDayPrice: baseDayPrice,
|
});
|
||||||
pricingByDayUpcharge: pricingByDayUpcharge,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
datePickerInitialDataPromise = await datePicker.methods.loadInitialData({
|
|
||||||
// setup config options for date-picker
|
|
||||||
selectableDatesSetting: "custom",
|
|
||||||
initialViewRowsToShow: 5,
|
|
||||||
customSelectableDatesCallback: getAvailableDates,
|
|
||||||
preSelectedDate: preSelectedDate,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const premiumFeePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const premiumFeePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_MOBILE_PREMIUM_FEE,
|
storeActions.GET_MOBILE_PREMIUM_FEE,
|
||||||
|
|
@ -371,7 +349,6 @@ export default {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
|
vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData);
|
||||||
vm.$refs.datePickerForPricingByDay.initializeComponent(resultMap.datePickerInitialData);
|
|
||||||
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
|
vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons);
|
||||||
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
|
vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse;
|
||||||
vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice
|
vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice
|
||||||
|
|
@ -735,7 +712,6 @@ export default {
|
||||||
funnelSubHeader,
|
funnelSubHeader,
|
||||||
Form,
|
Form,
|
||||||
loadingModal,
|
loadingModal,
|
||||||
datePicker,
|
|
||||||
datePickerForPricingByDay,
|
datePickerForPricingByDay,
|
||||||
locationAlerts,
|
locationAlerts,
|
||||||
timeSlotModalQuestion,
|
timeSlotModalQuestion,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue