thm-p3-configurator 0.0.412 → 0.0.413
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -196,6 +196,55 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
196
196
|
}
|
|
197
197
|
return (0, _openingHours.copyTimeToDate)(new Date(appointment.time), new Date(appointment.date));
|
|
198
198
|
}, [(_appointment$time$get = appointment === null || appointment === void 0 || (_appointment$time = appointment.time) === null || _appointment$time === void 0 || (_appointment$time$get2 = _appointment$time.getTime) === null || _appointment$time$get2 === void 0 ? void 0 : _appointment$time$get2.call(_appointment$time)) !== null && _appointment$time$get !== void 0 ? _appointment$time$get : appointment === null || appointment === void 0 ? void 0 : appointment.time, (_appointment$date$get = appointment === null || appointment === void 0 || (_appointment$date = appointment.date) === null || _appointment$date === void 0 || (_appointment$date$get2 = _appointment$date.getTime) === null || _appointment$date$get2 === void 0 ? void 0 : _appointment$date$get2.call(_appointment$date)) !== null && _appointment$date$get !== void 0 ? _appointment$date$get : appointment === null || appointment === void 0 ? void 0 : appointment.date]);
|
|
199
|
+
const openingstijden = branchById === null || branchById === void 0 ? void 0 : branchById.openingstijden;
|
|
200
|
+
const filterAppointmentDate = (0, _react.useCallback)(date => (0, _openingHours.isAppointmentDateSelectable)(openingstijden, date), [openingstijden]);
|
|
201
|
+
const appointmentIncludeDates = (0, _react.useMemo)(() => (0, _openingHours.getAppointmentIncludeDates)(openingstijden), [openingstijden]);
|
|
202
|
+
const appointmentTimeBounds = (0, _react.useMemo)(() => appointment !== null && appointment !== void 0 && appointment.date ? (0, _openingHours.getAppointmentTimeBounds)(openingstijden, new Date(appointment.date)) : {
|
|
203
|
+
minTime: null,
|
|
204
|
+
maxTime: null
|
|
205
|
+
}, [openingstijden, appointment === null || appointment === void 0 ? void 0 : appointment.date]);
|
|
206
|
+
const isTimePickerDisabled = !(appointment !== null && appointment !== void 0 && appointment.date) || appointmentTimeBounds.minTime && appointmentTimeBounds.maxTime && appointmentTimeBounds.minTime > appointmentTimeBounds.maxTime;
|
|
207
|
+
(0, _react.useEffect)(() => {
|
|
208
|
+
if (!openingstijden) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (appointment !== null && appointment !== void 0 && appointment.date) {
|
|
212
|
+
const date = new Date(appointment.date);
|
|
213
|
+
if (!(0, _openingHours.isAppointmentDateSelectable)(openingstijden, date)) {
|
|
214
|
+
dispatch({
|
|
215
|
+
type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_DATE,
|
|
216
|
+
payload: {
|
|
217
|
+
date: null
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
dispatch({
|
|
221
|
+
type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_TIME,
|
|
222
|
+
payload: {
|
|
223
|
+
time: null
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const bounds = (0, _openingHours.getAppointmentTimeBounds)(openingstijden, date);
|
|
229
|
+
if (bounds.minTime && bounds.maxTime && bounds.minTime > bounds.maxTime) {
|
|
230
|
+
dispatch({
|
|
231
|
+
type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_TIME,
|
|
232
|
+
payload: {
|
|
233
|
+
time: null
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (appointment !== null && appointment !== void 0 && appointment.time && !(0, _openingHours.isTimeWithinBounds)(new Date(appointment.time), bounds)) {
|
|
239
|
+
dispatch({
|
|
240
|
+
type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_TIME,
|
|
241
|
+
payload: {
|
|
242
|
+
time: null
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, [openingstijden, appointment === null || appointment === void 0 ? void 0 : appointment.date, dispatch]);
|
|
199
248
|
const authSession = (0, _AuthSessionContext.useAuthSession)();
|
|
200
249
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
201
250
|
const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
|
|
@@ -980,6 +1029,9 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
980
1029
|
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
981
1030
|
}, /*#__PURE__*/_react.default.createElement(_DatePickerInput.default, {
|
|
982
1031
|
onChange: value => {
|
|
1032
|
+
if (openingstijden && value && !(0, _openingHours.isAppointmentDateSelectable)(openingstijden, value)) {
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
983
1035
|
dispatch({
|
|
984
1036
|
type: _OrderSessionContext.orderSessionActions.SET_APPOINTMENT_DATE,
|
|
985
1037
|
payload: {
|
|
@@ -997,6 +1049,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
997
1049
|
label: "Datum",
|
|
998
1050
|
initialValue: appointment !== null && appointment !== void 0 && appointment.date ? new Date(appointment === null || appointment === void 0 ? void 0 : appointment.date) : null,
|
|
999
1051
|
isStrict: false,
|
|
1052
|
+
filterDate: filterAppointmentDate,
|
|
1053
|
+
includeDates: appointmentIncludeDates,
|
|
1000
1054
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['date']
|
|
1001
1055
|
}), /*#__PURE__*/_react.default.createElement(_TimePickerInput.default, {
|
|
1002
1056
|
key: "appointment-time-".concat((_ref5 = (_appointment$date$get3 = appointment === null || appointment === void 0 || (_appointment$date2 = appointment.date) === null || _appointment$date2 === void 0 || (_appointment$date2$ge = _appointment$date2.getTime) === null || _appointment$date2$ge === void 0 ? void 0 : _appointment$date2$ge.call(_appointment$date2)) !== null && _appointment$date$get3 !== void 0 ? _appointment$date$get3 : appointment === null || appointment === void 0 ? void 0 : appointment.date) !== null && _ref5 !== void 0 ? _ref5 : 'none'),
|
|
@@ -1011,6 +1065,9 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
1011
1065
|
name: 'Tijd',
|
|
1012
1066
|
label: "Tijd",
|
|
1013
1067
|
isStrict: false,
|
|
1068
|
+
isDisabled: isTimePickerDisabled,
|
|
1069
|
+
minTime: appointmentTimeBounds.minTime,
|
|
1070
|
+
maxTime: appointmentTimeBounds.maxTime,
|
|
1014
1071
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['time']
|
|
1015
1072
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
1016
1073
|
className: (0, _helpers__.withStyle)('col-12 col-md-6')
|
|
@@ -10,6 +10,7 @@ exports.default = void 0;
|
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactRouter = require("react-router");
|
|
13
|
+
require("react-datepicker/src/stylesheets/datepicker-cssmodules.scss");
|
|
13
14
|
var _ThemeContext = require("../__context__/ThemeContext");
|
|
14
15
|
var _helpers__ = require("../__helpers__");
|
|
15
16
|
var _useBranchTheme = require("../__hooks__/useBranchTheme");
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
Datepicker
|
|
3
3
|
========================================================================== */
|
|
4
|
-
/* Above sibling inputs (e.g. date popper vs time field below); lib default is z-index: 1 */
|
|
5
4
|
.react-datepicker-popper {
|
|
6
5
|
z-index: 1070 !important;
|
|
7
6
|
}
|
|
8
7
|
|
|
8
|
+
.react-datepicker__time-list-item--disabled {
|
|
9
|
+
display: none !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
9
12
|
.react-datepicker__header:not(.react-datepicker__header--has-time-select) {
|
|
10
13
|
border-top-right-radius: 0;
|
|
11
14
|
}
|