thm-p3-configurator 0.0.412 → 0.0.414
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.
- package/dist/src/shared/__api__/mutations.js +4 -0
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +57 -0
- package/dist/src/shared/__containers__/StyleWrapper.js +1 -0
- package/dist/src/shared/__context__/OrderSessionContext.js +36 -5
- package/dist/src/shared/__helpers__/singleOrderVehicleReceipt.js +117 -0
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +22 -8
- package/dist/src/shared/__style__/components/_datepicker.scss +4 -1
- package/package.json +1 -1
|
@@ -188,6 +188,7 @@ const useCreateSingleOrderMutation = () => {
|
|
|
188
188
|
let {
|
|
189
189
|
licensePlate,
|
|
190
190
|
model,
|
|
191
|
+
answers,
|
|
191
192
|
cart,
|
|
192
193
|
customer,
|
|
193
194
|
channel,
|
|
@@ -204,6 +205,7 @@ const useCreateSingleOrderMutation = () => {
|
|
|
204
205
|
return _authenticatedProxyApi.authenticatedProxyApi.postSingleOrder({
|
|
205
206
|
licensePlate,
|
|
206
207
|
model,
|
|
208
|
+
answers,
|
|
207
209
|
cart,
|
|
208
210
|
customer,
|
|
209
211
|
channel,
|
|
@@ -237,6 +239,7 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
237
239
|
let {
|
|
238
240
|
licensePlate,
|
|
239
241
|
model,
|
|
242
|
+
answers,
|
|
240
243
|
cart,
|
|
241
244
|
customer,
|
|
242
245
|
channel,
|
|
@@ -253,6 +256,7 @@ const useCreateShopifyOrderMutation = () => {
|
|
|
253
256
|
return _authenticatedProxyApi.authenticatedProxyApi.postShopifyOrder({
|
|
254
257
|
licensePlate,
|
|
255
258
|
model,
|
|
259
|
+
answers,
|
|
256
260
|
cart,
|
|
257
261
|
customer,
|
|
258
262
|
channel,
|
|
@@ -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");
|
|
@@ -7,6 +7,7 @@ require("core-js/modules/es.string.search.js");
|
|
|
7
7
|
require("core-js/modules/es.weak-map.js");
|
|
8
8
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
10
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
10
11
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
11
12
|
require("core-js/modules/esnext.iterator.map.js");
|
|
12
13
|
require("core-js/modules/esnext.iterator.some.js");
|
|
@@ -24,6 +25,7 @@ require("core-js/modules/es.regexp.exec.js");
|
|
|
24
25
|
require("core-js/modules/es.string.search.js");
|
|
25
26
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
26
27
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
28
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
27
29
|
require("core-js/modules/esnext.iterator.map.js");
|
|
28
30
|
require("core-js/modules/esnext.iterator.some.js");
|
|
29
31
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -111,6 +113,32 @@ function _toPrimitive(t, r) {
|
|
|
111
113
|
}
|
|
112
114
|
const OrderSessionContext = /*#__PURE__*/(0, _react.createContext)();
|
|
113
115
|
OrderSessionContext.displayName = 'OrderSessionContext';
|
|
116
|
+
const resolveOptionLabel = function resolveOptionLabel() {
|
|
117
|
+
var _ref, _options$find$label, _options$find;
|
|
118
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
119
|
+
let value = arguments.length > 1 ? arguments[1] : undefined;
|
|
120
|
+
return (_ref = (_options$find$label = (_options$find = options.find(option => option.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : value) !== null && _ref !== void 0 ? _ref : null;
|
|
121
|
+
};
|
|
122
|
+
const buildSingleOrderVehicleContext = state => {
|
|
123
|
+
var _state$durationAnswer, _state$executionAnswe, _state$executionAnswe2;
|
|
124
|
+
if (!state.licensePlate && !state.model) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
licensePlate: state.licensePlate,
|
|
129
|
+
model: state.model,
|
|
130
|
+
answers: {
|
|
131
|
+
duration: (_state$durationAnswer = state.durationAnswer) !== null && _state$durationAnswer !== void 0 ? _state$durationAnswer : null,
|
|
132
|
+
execution1: (_state$executionAnswe = state.executionAnswer1) !== null && _state$executionAnswe !== void 0 ? _state$executionAnswe : null,
|
|
133
|
+
execution2: (_state$executionAnswe2 = state.executionAnswer2) !== null && _state$executionAnswe2 !== void 0 ? _state$executionAnswe2 : null
|
|
134
|
+
},
|
|
135
|
+
labels: {
|
|
136
|
+
duration: resolveOptionLabel(state.durationOptions, state.durationAnswer),
|
|
137
|
+
execution1: resolveOptionLabel(state.execution1Options, state.executionAnswer1),
|
|
138
|
+
execution2: resolveOptionLabel(state.execution2Options, state.executionAnswer2)
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
};
|
|
114
142
|
const INITIAL_ORDER_SESSION_STATE = {
|
|
115
143
|
isTouched: false,
|
|
116
144
|
existingDossierId: null,
|
|
@@ -629,6 +657,7 @@ const orderSessionReducer = (state, action) => {
|
|
|
629
657
|
}
|
|
630
658
|
case orderSessionActions.ADD_SINGLE_ORDER_PRODUCT:
|
|
631
659
|
{
|
|
660
|
+
var _existingProduct$vehi;
|
|
632
661
|
const {
|
|
633
662
|
articleNumber,
|
|
634
663
|
quantity,
|
|
@@ -636,13 +665,15 @@ const orderSessionReducer = (state, action) => {
|
|
|
636
665
|
productPriceInclVat,
|
|
637
666
|
brandNumber
|
|
638
667
|
} = action.payload;
|
|
668
|
+
const existingProduct = state.singleOrderCart.find(p => p.articleNumber === articleNumber);
|
|
639
669
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
640
670
|
singleOrderCart: [...state.singleOrderCart.filter(p => p.articleNumber !== articleNumber), {
|
|
641
671
|
articleNumber,
|
|
642
672
|
quantity,
|
|
643
673
|
productPrice,
|
|
644
674
|
productPriceInclVat,
|
|
645
|
-
brandNumber
|
|
675
|
+
brandNumber,
|
|
676
|
+
vehicleContext: (_existingProduct$vehi = existingProduct === null || existingProduct === void 0 ? void 0 : existingProduct.vehicleContext) !== null && _existingProduct$vehi !== void 0 ? _existingProduct$vehi : buildSingleOrderVehicleContext(state)
|
|
646
677
|
}],
|
|
647
678
|
isTouched: true
|
|
648
679
|
});
|
|
@@ -1407,11 +1438,11 @@ const initializeOrderSession = function initializeOrderSession() {
|
|
|
1407
1438
|
}
|
|
1408
1439
|
return cachedSession;
|
|
1409
1440
|
};
|
|
1410
|
-
const AuthSessionRuntimeSync =
|
|
1441
|
+
const AuthSessionRuntimeSync = _ref2 => {
|
|
1411
1442
|
var _branch$entityId;
|
|
1412
1443
|
let {
|
|
1413
1444
|
authMode = 'internal'
|
|
1414
|
-
} =
|
|
1445
|
+
} = _ref2;
|
|
1415
1446
|
const {
|
|
1416
1447
|
authenticated,
|
|
1417
1448
|
initialized,
|
|
@@ -1485,13 +1516,13 @@ const AuthSessionRuntimeSync = _ref => {
|
|
|
1485
1516
|
}, [authRuntime, authenticated, initialized, authHeaderBranchId, formula, module, isExternalAuthMode]);
|
|
1486
1517
|
return null;
|
|
1487
1518
|
};
|
|
1488
|
-
const OrderSessionController =
|
|
1519
|
+
const OrderSessionController = _ref3 => {
|
|
1489
1520
|
let {
|
|
1490
1521
|
children,
|
|
1491
1522
|
authMode = 'internal',
|
|
1492
1523
|
externalAuthSession = null,
|
|
1493
1524
|
externalAuthRuntime = null
|
|
1494
|
-
} =
|
|
1525
|
+
} = _ref3;
|
|
1495
1526
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
1496
1527
|
const isExternalAuthMode = authMode === 'external' || Boolean(externalAuthSession);
|
|
1497
1528
|
const runtimeMode = isExternalAuthMode ? 'external' : 'internal';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.json.stringify.js");
|
|
4
|
+
require("core-js/modules/es.string.trim.js");
|
|
5
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
exports.getSingleUsedVehicleContext = exports.buildSingleOrderVehicleReceipt = void 0;
|
|
13
|
+
require("core-js/modules/es.json.stringify.js");
|
|
14
|
+
require("core-js/modules/es.string.trim.js");
|
|
15
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
16
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
17
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
18
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
19
|
+
const getContextKey = context => {
|
|
20
|
+
var _context$licensePlate, _context$model, _context$answers;
|
|
21
|
+
if (!(context !== null && context !== void 0 && context.licensePlate) && !(context !== null && context !== void 0 && context.model)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return JSON.stringify({
|
|
25
|
+
licensePlate: (_context$licensePlate = context.licensePlate) !== null && _context$licensePlate !== void 0 ? _context$licensePlate : null,
|
|
26
|
+
model: (_context$model = context.model) !== null && _context$model !== void 0 ? _context$model : null,
|
|
27
|
+
answers: (_context$answers = context.answers) !== null && _context$answers !== void 0 ? _context$answers : {}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const formatArticles = function formatArticles() {
|
|
31
|
+
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
32
|
+
return items.map(_ref => {
|
|
33
|
+
let {
|
|
34
|
+
articleNumber,
|
|
35
|
+
quantity
|
|
36
|
+
} = _ref;
|
|
37
|
+
return quantity > 1 ? "".concat(articleNumber, " (").concat(quantity, "x)") : articleNumber;
|
|
38
|
+
}).join(', ');
|
|
39
|
+
};
|
|
40
|
+
const formatVehicleContext = (context, items) => {
|
|
41
|
+
var _context$labels, _context$answers2, _context$labels3, _context$answers3, _context$labels5, _context$answers4;
|
|
42
|
+
const lines = [];
|
|
43
|
+
if (context.licensePlate) {
|
|
44
|
+
lines.push("Kenteken: ".concat(context.licensePlate));
|
|
45
|
+
}
|
|
46
|
+
if (context.model) {
|
|
47
|
+
lines.push("Model: ".concat(context.model));
|
|
48
|
+
}
|
|
49
|
+
if ((_context$labels = context.labels) !== null && _context$labels !== void 0 && _context$labels.duration || (_context$answers2 = context.answers) !== null && _context$answers2 !== void 0 && _context$answers2.duration) {
|
|
50
|
+
var _context$labels$durat, _context$labels2;
|
|
51
|
+
lines.push("Looptijd: ".concat((_context$labels$durat = (_context$labels2 = context.labels) === null || _context$labels2 === void 0 ? void 0 : _context$labels2.duration) !== null && _context$labels$durat !== void 0 ? _context$labels$durat : context.answers.duration));
|
|
52
|
+
}
|
|
53
|
+
if ((_context$labels3 = context.labels) !== null && _context$labels3 !== void 0 && _context$labels3.execution1 || (_context$answers3 = context.answers) !== null && _context$answers3 !== void 0 && _context$answers3.execution1) {
|
|
54
|
+
var _context$labels$execu, _context$labels4;
|
|
55
|
+
lines.push("Uitvoering: ".concat((_context$labels$execu = (_context$labels4 = context.labels) === null || _context$labels4 === void 0 ? void 0 : _context$labels4.execution1) !== null && _context$labels$execu !== void 0 ? _context$labels$execu : context.answers.execution1));
|
|
56
|
+
}
|
|
57
|
+
if ((_context$labels5 = context.labels) !== null && _context$labels5 !== void 0 && _context$labels5.execution2 || (_context$answers4 = context.answers) !== null && _context$answers4 !== void 0 && _context$answers4.execution2) {
|
|
58
|
+
var _context$labels$execu2, _context$labels6;
|
|
59
|
+
lines.push("Uitvoering 2: ".concat((_context$labels$execu2 = (_context$labels6 = context.labels) === null || _context$labels6 === void 0 ? void 0 : _context$labels6.execution2) !== null && _context$labels$execu2 !== void 0 ? _context$labels$execu2 : context.answers.execution2));
|
|
60
|
+
}
|
|
61
|
+
lines.push("Artikelnummers: ".concat(formatArticles(items)));
|
|
62
|
+
return lines.join('\n');
|
|
63
|
+
};
|
|
64
|
+
const collectVehicleContextGroups = function collectVehicleContextGroups() {
|
|
65
|
+
let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
66
|
+
const groups = {};
|
|
67
|
+
const ungrouped = [];
|
|
68
|
+
for (const item of cart) {
|
|
69
|
+
var _groups$key;
|
|
70
|
+
const key = getContextKey(item.vehicleContext);
|
|
71
|
+
if (!key) {
|
|
72
|
+
ungrouped.push(item);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
groups[key] = (_groups$key = groups[key]) !== null && _groups$key !== void 0 ? _groups$key : {
|
|
76
|
+
context: item.vehicleContext,
|
|
77
|
+
items: []
|
|
78
|
+
};
|
|
79
|
+
groups[key].items.push(item);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
groups: Object.values(groups),
|
|
83
|
+
ungrouped
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
const getSingleUsedVehicleContext = exports.getSingleUsedVehicleContext = function getSingleUsedVehicleContext() {
|
|
87
|
+
let cart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
88
|
+
const {
|
|
89
|
+
groups,
|
|
90
|
+
ungrouped
|
|
91
|
+
} = collectVehicleContextGroups(cart);
|
|
92
|
+
return groups.length === 1 && ungrouped.length === 0 ? groups[0].context : null;
|
|
93
|
+
};
|
|
94
|
+
const buildSingleOrderVehicleReceipt = _ref2 => {
|
|
95
|
+
let {
|
|
96
|
+
cart = [],
|
|
97
|
+
userNote
|
|
98
|
+
} = _ref2;
|
|
99
|
+
const {
|
|
100
|
+
groups,
|
|
101
|
+
ungrouped
|
|
102
|
+
} = collectVehicleContextGroups(cart);
|
|
103
|
+
const sections = groups.map(_ref3 => {
|
|
104
|
+
let {
|
|
105
|
+
context,
|
|
106
|
+
items
|
|
107
|
+
} = _ref3;
|
|
108
|
+
return formatVehicleContext(context, items);
|
|
109
|
+
});
|
|
110
|
+
if (ungrouped.length) {
|
|
111
|
+
sections.push("Zonder voertuigfilter\nArtikelnummers: ".concat(formatArticles(ungrouped)));
|
|
112
|
+
}
|
|
113
|
+
const receipt = sections.length ? ['Zoekcontext losse order', ...sections].join('\n\n') : '';
|
|
114
|
+
const trimmedUserNote = userNote === null || userNote === void 0 ? void 0 : userNote.trim();
|
|
115
|
+
return [trimmedUserNote, receipt].filter(Boolean).join('\n\n');
|
|
116
|
+
};
|
|
117
|
+
exports.buildSingleOrderVehicleReceipt = buildSingleOrderVehicleReceipt;
|
|
@@ -37,6 +37,7 @@ var _FormulaContext = require("../../__context__/FormulaContext");
|
|
|
37
37
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
38
38
|
var _helpers__ = require("../../__helpers__");
|
|
39
39
|
var _singleOrderArticles = require("../../__helpers__/singleOrderArticles");
|
|
40
|
+
var _singleOrderVehicleReceipt = require("../../__helpers__/singleOrderVehicleReceipt");
|
|
40
41
|
function _interopRequireDefault(e) {
|
|
41
42
|
return e && e.__esModule ? e : {
|
|
42
43
|
default: e
|
|
@@ -331,7 +332,7 @@ const InternalSingleOrderPage = () => {
|
|
|
331
332
|
setCustomerErrors(errors);
|
|
332
333
|
};
|
|
333
334
|
const handleSubmit = async () => {
|
|
334
|
-
var _customerFormRef$curr, _response$data2;
|
|
335
|
+
var _customerFormRef$curr, _singleUsedVehicleCon, _singleUsedVehicleCon2, _singleUsedVehicleCon3, _singleUsedVehicleCon6, _singleUsedVehicleCon7, _response$data2;
|
|
335
336
|
const isValid = await ((_customerFormRef$curr = customerFormRef.current) === null || _customerFormRef$curr === void 0 ? void 0 : _customerFormRef$curr.validateForm());
|
|
336
337
|
if (!isValid) {
|
|
337
338
|
return;
|
|
@@ -358,11 +359,23 @@ const InternalSingleOrderPage = () => {
|
|
|
358
359
|
anderAfleveradres: customerPayload.anderAfleveradres
|
|
359
360
|
});
|
|
360
361
|
const apiCart = (0, _singleOrderArticles.buildSingleOrderApiCart)(singleOrderCart);
|
|
362
|
+
const singleUsedVehicleContext = (0, _singleOrderVehicleReceipt.getSingleUsedVehicleContext)(singleOrderCart);
|
|
363
|
+
const answers = (0, _helpers__.removeNullishProps)({
|
|
364
|
+
duration: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon === void 0 ? void 0 : _singleUsedVehicleCon.duration,
|
|
365
|
+
execution1: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon2 = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon2 === void 0 ? void 0 : _singleUsedVehicleCon2.execution1,
|
|
366
|
+
execution2: singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 || (_singleUsedVehicleCon3 = singleUsedVehicleContext.answers) === null || _singleUsedVehicleCon3 === void 0 ? void 0 : _singleUsedVehicleCon3.execution2
|
|
367
|
+
});
|
|
368
|
+
const hasAnswers = Object.keys(answers).length > 0;
|
|
369
|
+
const mergedInternalNote = (0, _singleOrderVehicleReceipt.buildSingleOrderVehicleReceipt)({
|
|
370
|
+
cart: singleOrderCart,
|
|
371
|
+
userNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
|
|
372
|
+
});
|
|
361
373
|
if (webshop) {
|
|
362
|
-
var _response$data;
|
|
374
|
+
var _singleUsedVehicleCon4, _singleUsedVehicleCon5, _response$data;
|
|
363
375
|
const response = await createShopifyOrder(_objectSpread({
|
|
364
|
-
licensePlate:
|
|
365
|
-
model:
|
|
376
|
+
licensePlate: (_singleUsedVehicleCon4 = singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 ? void 0 : singleUsedVehicleContext.licensePlate) !== null && _singleUsedVehicleCon4 !== void 0 ? _singleUsedVehicleCon4 : null,
|
|
377
|
+
model: (_singleUsedVehicleCon5 = singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 ? void 0 : singleUsedVehicleContext.model) !== null && _singleUsedVehicleCon5 !== void 0 ? _singleUsedVehicleCon5 : null,
|
|
378
|
+
answers: hasAnswers ? answers : undefined,
|
|
366
379
|
cart: apiCart,
|
|
367
380
|
vehicle: vehiclePayload,
|
|
368
381
|
customer: customerPayload,
|
|
@@ -370,7 +383,7 @@ const InternalSingleOrderPage = () => {
|
|
|
370
383
|
webshop,
|
|
371
384
|
branchId: selectedBranch,
|
|
372
385
|
channel,
|
|
373
|
-
internalNote:
|
|
386
|
+
internalNote: mergedInternalNote
|
|
374
387
|
}, businessContactPayload));
|
|
375
388
|
if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.entityId) {
|
|
376
389
|
setCreatedEntityId(response.data.data.entityId);
|
|
@@ -379,8 +392,9 @@ const InternalSingleOrderPage = () => {
|
|
|
379
392
|
}
|
|
380
393
|
const preferredDateTime = appointment !== null && appointment !== void 0 && appointment.date && appointment !== null && appointment !== void 0 && appointment.time ? (0, _helpers__.parseDateAndTimeToTimestamp)(appointment === null || appointment === void 0 ? void 0 : appointment.date, appointment === null || appointment === void 0 ? void 0 : appointment.time) : null;
|
|
381
394
|
const response = await createSingleOrder(_objectSpread({
|
|
382
|
-
licensePlate:
|
|
383
|
-
model:
|
|
395
|
+
licensePlate: (_singleUsedVehicleCon6 = singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 ? void 0 : singleUsedVehicleContext.licensePlate) !== null && _singleUsedVehicleCon6 !== void 0 ? _singleUsedVehicleCon6 : null,
|
|
396
|
+
model: (_singleUsedVehicleCon7 = singleUsedVehicleContext === null || singleUsedVehicleContext === void 0 ? void 0 : singleUsedVehicleContext.model) !== null && _singleUsedVehicleCon7 !== void 0 ? _singleUsedVehicleCon7 : null,
|
|
397
|
+
answers: hasAnswers ? answers : undefined,
|
|
384
398
|
cart: apiCart,
|
|
385
399
|
vehicle: vehiclePayload,
|
|
386
400
|
customer: customerPayload,
|
|
@@ -388,7 +402,7 @@ const InternalSingleOrderPage = () => {
|
|
|
388
402
|
branchId: selectedBranch,
|
|
389
403
|
channel,
|
|
390
404
|
preferredDateTime,
|
|
391
|
-
internalNote:
|
|
405
|
+
internalNote: mergedInternalNote
|
|
392
406
|
}, businessContactPayload));
|
|
393
407
|
if (response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && (_response$data2 = _response$data2.data) !== null && _response$data2 !== void 0 && _response$data2.entityId) {
|
|
394
408
|
setCreatedEntityId(response.data.data.entityId);
|
|
@@ -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
|
}
|