thm-p3-configurator 0.0.262 → 0.0.264
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 +12 -6
- package/dist/src/shared/__components__/Form/DecimalInput.js +102 -0
- package/dist/src/shared/__containers__/ProductCartSide.js +13 -5
- package/dist/src/shared/__containers__/ProductsCartOverview.js +131 -14
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +15 -4
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +14 -4
- package/dist/src/shared/__context__/OrderSessionContext.js +24 -1
- package/dist/src/shared/__helpers__/cartTable.js +12 -5
- package/package.json +1 -1
|
@@ -190,7 +190,8 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
190
190
|
branchId,
|
|
191
191
|
formula,
|
|
192
192
|
discount,
|
|
193
|
-
isExitIntent = false
|
|
193
|
+
isExitIntent = false,
|
|
194
|
+
montageRate
|
|
194
195
|
} = _ref5;
|
|
195
196
|
return _authenticatedProxyApi.authenticatedProxyApi.postQuotation({
|
|
196
197
|
isExitIntent,
|
|
@@ -205,7 +206,8 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
205
206
|
cart,
|
|
206
207
|
selectBoardComputerUpdate,
|
|
207
208
|
customer: customer,
|
|
208
|
-
branchId
|
|
209
|
+
branchId,
|
|
210
|
+
montageRate
|
|
209
211
|
});
|
|
210
212
|
});
|
|
211
213
|
return {
|
|
@@ -240,7 +242,8 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
240
242
|
formula,
|
|
241
243
|
discount,
|
|
242
244
|
customerAgreed,
|
|
243
|
-
invoicePaymentByLeaseCompany
|
|
245
|
+
invoicePaymentByLeaseCompany,
|
|
246
|
+
montageRate
|
|
244
247
|
} = _ref6;
|
|
245
248
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointment({
|
|
246
249
|
appointment,
|
|
@@ -257,7 +260,8 @@ const useCreatePrivateAppointmentMutation = () => {
|
|
|
257
260
|
customer: customer,
|
|
258
261
|
branchId,
|
|
259
262
|
customerAgreed,
|
|
260
|
-
invoicePaymentByLeaseCompany
|
|
263
|
+
invoicePaymentByLeaseCompany,
|
|
264
|
+
montageRate
|
|
261
265
|
});
|
|
262
266
|
});
|
|
263
267
|
return {
|
|
@@ -291,7 +295,8 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
291
295
|
branchId,
|
|
292
296
|
formula,
|
|
293
297
|
discount,
|
|
294
|
-
customerAgreed
|
|
298
|
+
customerAgreed,
|
|
299
|
+
montageRate
|
|
295
300
|
} = _ref7;
|
|
296
301
|
return _authenticatedProxyApi.authenticatedProxyApi.postAppointmentRequest({
|
|
297
302
|
appointment,
|
|
@@ -307,7 +312,8 @@ const useCreatePrivateAppointmentRequestMutation = () => {
|
|
|
307
312
|
selectBoardComputerUpdate,
|
|
308
313
|
customer: customer,
|
|
309
314
|
branchId,
|
|
310
|
-
customerAgreed
|
|
315
|
+
customerAgreed,
|
|
316
|
+
montageRate
|
|
311
317
|
});
|
|
312
318
|
});
|
|
313
319
|
return {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
4
|
+
require("core-js/modules/es.weak-map.js");
|
|
5
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
6
|
+
require("core-js/modules/es.weak-map.js");
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
12
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _helpers__ = require("../../__helpers__");
|
|
15
|
+
var _ErrorMessage = _interopRequireDefault(require("./ErrorMessage"));
|
|
16
|
+
function _interopRequireDefault(e) {
|
|
17
|
+
return e && e.__esModule ? e : {
|
|
18
|
+
default: e
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function _getRequireWildcardCache(e) {
|
|
22
|
+
if ("function" != typeof WeakMap) return null;
|
|
23
|
+
var r = new WeakMap(),
|
|
24
|
+
t = new WeakMap();
|
|
25
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
26
|
+
return e ? t : r;
|
|
27
|
+
})(e);
|
|
28
|
+
}
|
|
29
|
+
function _interopRequireWildcard(e, r) {
|
|
30
|
+
if (!r && e && e.__esModule) return e;
|
|
31
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
32
|
+
default: e
|
|
33
|
+
};
|
|
34
|
+
var t = _getRequireWildcardCache(r);
|
|
35
|
+
if (t && t.has(e)) return t.get(e);
|
|
36
|
+
var n = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
},
|
|
39
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
40
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
41
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
42
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
43
|
+
}
|
|
44
|
+
return n.default = e, t && t.set(e, n), n;
|
|
45
|
+
}
|
|
46
|
+
const toDisplayValue = value => value === null || value === undefined ? '' : value.toString();
|
|
47
|
+
const DecimalInput = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
placeholder = '',
|
|
50
|
+
initialValue = '',
|
|
51
|
+
value,
|
|
52
|
+
name,
|
|
53
|
+
onClick = () => {},
|
|
54
|
+
isDisabled = false,
|
|
55
|
+
onChange = () => {},
|
|
56
|
+
isRequired = true,
|
|
57
|
+
form,
|
|
58
|
+
label,
|
|
59
|
+
errorMessage = '',
|
|
60
|
+
className = '',
|
|
61
|
+
min,
|
|
62
|
+
max,
|
|
63
|
+
step = '0.01',
|
|
64
|
+
inputMode = 'decimal',
|
|
65
|
+
pattern = '-?[0-9]*[.,]?[0-9]*'
|
|
66
|
+
} = _ref;
|
|
67
|
+
const [localValue, setLocalValue] = (0, _react.useState)(toDisplayValue(initialValue));
|
|
68
|
+
const hasControlledValue = value !== undefined;
|
|
69
|
+
const displayValue = hasControlledValue ? toDisplayValue(value) : localValue;
|
|
70
|
+
(0, _react.useEffect)(() => {
|
|
71
|
+
setLocalValue(toDisplayValue(initialValue));
|
|
72
|
+
}, [initialValue]);
|
|
73
|
+
const handleChange = newValue => {
|
|
74
|
+
setLocalValue(newValue);
|
|
75
|
+
onChange(newValue);
|
|
76
|
+
};
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: (0, _helpers__.withStyle)("form-group ".concat(className))
|
|
79
|
+
}, label && /*#__PURE__*/_react.default.createElement("label", {
|
|
80
|
+
htmlFor: name,
|
|
81
|
+
className: (0, _helpers__.withStyle)('form-label')
|
|
82
|
+
}, label, isRequired && /*#__PURE__*/_react.default.createElement("span", null, "*")), /*#__PURE__*/_react.default.createElement("input", {
|
|
83
|
+
placeholder: placeholder,
|
|
84
|
+
name: name,
|
|
85
|
+
type: "number",
|
|
86
|
+
inputMode: inputMode,
|
|
87
|
+
pattern: pattern,
|
|
88
|
+
min: min,
|
|
89
|
+
max: max,
|
|
90
|
+
step: step,
|
|
91
|
+
onClick: onClick,
|
|
92
|
+
form: form,
|
|
93
|
+
value: displayValue,
|
|
94
|
+
disabled: isDisabled,
|
|
95
|
+
onChange: e => handleChange(e.target.value),
|
|
96
|
+
required: isRequired,
|
|
97
|
+
className: "".concat((0, _helpers__.withStyle)('form-control'), " ").concat(errorMessage ? (0, _helpers__.withStyle)('is-invalid') : '')
|
|
98
|
+
}), errorMessage && /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
99
|
+
message: errorMessage
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
var _default = exports.default = DecimalInput;
|
|
@@ -92,7 +92,11 @@ const ProductCartSide = () => {
|
|
|
92
92
|
selectedExtras,
|
|
93
93
|
canAlterQuantity,
|
|
94
94
|
selectedBranch,
|
|
95
|
-
vehicleCodingDiscountPercentage
|
|
95
|
+
vehicleCodingDiscountPercentage,
|
|
96
|
+
consumerDiscounts,
|
|
97
|
+
discountAmount,
|
|
98
|
+
discountPercentage,
|
|
99
|
+
montageRate
|
|
96
100
|
} = order;
|
|
97
101
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
98
102
|
const cartInput = (0, _product.buildCartInput)({
|
|
@@ -102,7 +106,8 @@ const ProductCartSide = () => {
|
|
|
102
106
|
selectedBoardComputer,
|
|
103
107
|
selectedExtras,
|
|
104
108
|
isTowmotiveFormula: isTowmotive,
|
|
105
|
-
vehicleCodingDiscountPercentage
|
|
109
|
+
vehicleCodingDiscountPercentage,
|
|
110
|
+
consumerDiscounts
|
|
106
111
|
});
|
|
107
112
|
const {
|
|
108
113
|
cart,
|
|
@@ -118,7 +123,10 @@ const ProductCartSide = () => {
|
|
|
118
123
|
selectBoardComputerUpdate: selectedBoardComputer != null ? 'true' : 'false',
|
|
119
124
|
cart: cartInput ? JSON.stringify(cartInput) : undefined,
|
|
120
125
|
formula,
|
|
121
|
-
branchId: isToggled ? selectedBranch : undefined
|
|
126
|
+
branchId: isToggled ? selectedBranch : undefined,
|
|
127
|
+
discountAmount,
|
|
128
|
+
discountPercentage,
|
|
129
|
+
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
122
130
|
});
|
|
123
131
|
const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === 'MC');
|
|
124
132
|
let mainProducts = [];
|
|
@@ -275,7 +283,7 @@ const ProductCartSide = () => {
|
|
|
275
283
|
text: isToggled ? 'Subtotaal (excl. btw)' : 'Subtotaal (incl. btw)',
|
|
276
284
|
className: 'fw-bold text-end pb-2'
|
|
277
285
|
}, {
|
|
278
|
-
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.
|
|
286
|
+
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
279
287
|
className: 'fw-bold text-end pb-2'
|
|
280
288
|
}]
|
|
281
289
|
}), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
|
|
@@ -283,7 +291,7 @@ const ProductCartSide = () => {
|
|
|
283
291
|
text: 'Producten (excl. btw)',
|
|
284
292
|
className: 'text-end pt-2'
|
|
285
293
|
}, {
|
|
286
|
-
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.
|
|
294
|
+
text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
|
|
287
295
|
className: 'text-end pt-2'
|
|
288
296
|
}], [{}, {
|
|
289
297
|
text: 'btw',
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require("core-js/modules/es.array.includes.js");
|
|
4
4
|
require("core-js/modules/es.array.reduce.js");
|
|
5
5
|
require("core-js/modules/es.json.stringify.js");
|
|
6
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
6
7
|
require("core-js/modules/es.object.from-entries.js");
|
|
7
8
|
require("core-js/modules/es.parse-int.js");
|
|
8
9
|
require("core-js/modules/es.regexp.exec.js");
|
|
@@ -25,6 +26,7 @@ exports.default = void 0;
|
|
|
25
26
|
require("core-js/modules/es.array.includes.js");
|
|
26
27
|
require("core-js/modules/es.array.reduce.js");
|
|
27
28
|
require("core-js/modules/es.json.stringify.js");
|
|
29
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
28
30
|
require("core-js/modules/es.object.from-entries.js");
|
|
29
31
|
require("core-js/modules/es.parse-int.js");
|
|
30
32
|
require("core-js/modules/es.regexp.exec.js");
|
|
@@ -43,6 +45,7 @@ var _logoPrimary = _interopRequireDefault(require("../../../public/assets/images
|
|
|
43
45
|
var _montagePlaceholder = _interopRequireDefault(require("../../../public/assets/images/montage-placeholder.png"));
|
|
44
46
|
var _queries = require("../__api__/queries");
|
|
45
47
|
var _TogglableCard = _interopRequireDefault(require("../__components__/Cards/TogglableCard"));
|
|
48
|
+
var _DecimalInput = _interopRequireDefault(require("../__components__/Form/DecimalInput"));
|
|
46
49
|
var _TextInput = _interopRequireDefault(require("../__components__/Form/TextInput"));
|
|
47
50
|
var _ProductTableEditableRow = _interopRequireDefault(require("../__components__/ProductTable/ProductTableEditableRow"));
|
|
48
51
|
var _ProductTableHead = _interopRequireDefault(require("../__components__/ProductTable/ProductTableHead"));
|
|
@@ -141,6 +144,7 @@ function _toPrimitive(t, r) {
|
|
|
141
144
|
|
|
142
145
|
const ProductCartTable = () => {
|
|
143
146
|
const formula = (0, _FormulaContext.useFormula)();
|
|
147
|
+
const isThc = formula === _constants__.CONFIGURATOR_FORMULAS.THC;
|
|
144
148
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
145
149
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
146
150
|
const [isToggled, setIsToggled] = (0, _react.useState)(false);
|
|
@@ -161,12 +165,15 @@ const ProductCartTable = () => {
|
|
|
161
165
|
discountPercentage,
|
|
162
166
|
selectedBranch,
|
|
163
167
|
vehicleCodingDiscountPercentage,
|
|
164
|
-
consumerDiscounts
|
|
168
|
+
consumerDiscounts,
|
|
169
|
+
montageRate,
|
|
170
|
+
isMontageTariffFixed
|
|
165
171
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
166
172
|
|
|
167
173
|
// Determine display mode
|
|
168
174
|
const displayMode = (0, _cartTable2.getCartTableDisplayMode)(isToggled, isTmg);
|
|
169
|
-
const handleVehicleCodingDiscountChange = value
|
|
175
|
+
const handleVehicleCodingDiscountChange = function handleVehicleCodingDiscountChange(value) {
|
|
176
|
+
let articleNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
170
177
|
const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
|
|
171
178
|
const parsed = sanitized === '' ? 0 : Math.min(100, Math.max(0, parseInt(sanitized, 10)));
|
|
172
179
|
dispatch({
|
|
@@ -175,8 +182,20 @@ const ProductCartTable = () => {
|
|
|
175
182
|
percentage: parsed
|
|
176
183
|
}
|
|
177
184
|
});
|
|
185
|
+
if (articleNumber) {
|
|
186
|
+
dispatch({
|
|
187
|
+
type: _OrderSessionContext.orderSessionActions.SET_CONSUMER_DISCOUNT_PERCENTAGE,
|
|
188
|
+
payload: {
|
|
189
|
+
articleNumber,
|
|
190
|
+
percentage: parsed
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
178
194
|
};
|
|
179
|
-
const handleLineDiscountChange = (articleNumber, value)
|
|
195
|
+
const handleLineDiscountChange = function handleLineDiscountChange(articleNumber, value) {
|
|
196
|
+
let {
|
|
197
|
+
isVehicleCoding = false
|
|
198
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
180
199
|
const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
|
|
181
200
|
const parsed = sanitized === '' ? 0 : Math.min(100, Math.max(0, parseInt(sanitized, 10)));
|
|
182
201
|
dispatch({
|
|
@@ -186,6 +205,47 @@ const ProductCartTable = () => {
|
|
|
186
205
|
percentage: parsed
|
|
187
206
|
}
|
|
188
207
|
});
|
|
208
|
+
if (isVehicleCoding) {
|
|
209
|
+
dispatch({
|
|
210
|
+
type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE,
|
|
211
|
+
payload: {
|
|
212
|
+
percentage: parsed
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const handleMontageRateChange = value => {
|
|
218
|
+
if (value === null || value === undefined) {
|
|
219
|
+
dispatch({
|
|
220
|
+
type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
|
|
221
|
+
payload: {
|
|
222
|
+
montageRate: null
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Permit typing both comma and dot decimals
|
|
229
|
+
const sanitized = value.toString().replace(/[^0-9.,-]/g, '').replace(',', '.');
|
|
230
|
+
|
|
231
|
+
// Allow a lone "0." or "0," while typing
|
|
232
|
+
if (sanitized === '' || sanitized === '0.' || sanitized === '0,') {
|
|
233
|
+
dispatch({
|
|
234
|
+
type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
|
|
235
|
+
payload: {
|
|
236
|
+
montageRate: null
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const parsed = Number.parseFloat(sanitized);
|
|
242
|
+
const clamped = parsed === null || Number.isNaN(parsed) ? null : Math.min(100, Math.max(0, parsed));
|
|
243
|
+
dispatch({
|
|
244
|
+
type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
|
|
245
|
+
payload: {
|
|
246
|
+
montageRate: clamped
|
|
247
|
+
}
|
|
248
|
+
});
|
|
189
249
|
};
|
|
190
250
|
const cartInput = (0, _product.buildCartInput)({
|
|
191
251
|
selectedCableset,
|
|
@@ -213,8 +273,12 @@ const ProductCartTable = () => {
|
|
|
213
273
|
branchId: isToggled ? selectedBranch : null,
|
|
214
274
|
discountAmount,
|
|
215
275
|
discountPercentage,
|
|
216
|
-
formula
|
|
276
|
+
formula,
|
|
277
|
+
montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
|
|
217
278
|
});
|
|
279
|
+
const montageHours = Number(totals === null || totals === void 0 ? void 0 : totals.montageTime) || 0;
|
|
280
|
+
const montageTotalExcl = Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0);
|
|
281
|
+
const montageHourlyExcl = montageHours > 0 ? montageTotalExcl / montageHours : null;
|
|
218
282
|
(0, _react.useEffect)(() => {
|
|
219
283
|
if (!isToggled || !(cart !== null && cart !== void 0 && cart.length)) return;
|
|
220
284
|
cart.forEach(item => {
|
|
@@ -229,6 +293,32 @@ const ProductCartTable = () => {
|
|
|
229
293
|
}
|
|
230
294
|
});
|
|
231
295
|
}, [cart, consumerDiscounts, dispatch, isToggled]);
|
|
296
|
+
(0, _react.useEffect)(() => {
|
|
297
|
+
const rateFromApi = totals === null || totals === void 0 ? void 0 : totals.montageRate;
|
|
298
|
+
if (rateFromApi === undefined || rateFromApi === null) return;
|
|
299
|
+
const numericRate = Number(rateFromApi);
|
|
300
|
+
if (Number.isNaN(numericRate)) return;
|
|
301
|
+
if (montageRate === null || montageRate === undefined) {
|
|
302
|
+
dispatch({
|
|
303
|
+
type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
|
|
304
|
+
payload: {
|
|
305
|
+
montageRate: numericRate
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}, [dispatch, montageRate, totals === null || totals === void 0 ? void 0 : totals.montageRate]);
|
|
310
|
+
(0, _react.useEffect)(() => {
|
|
311
|
+
const isFixedFromApi = totals === null || totals === void 0 ? void 0 : totals.isMontageTariffFixed;
|
|
312
|
+
if (isFixedFromApi === undefined || isFixedFromApi === null) return;
|
|
313
|
+
if (isMontageTariffFixed !== Boolean(isFixedFromApi)) {
|
|
314
|
+
dispatch({
|
|
315
|
+
type: _OrderSessionContext.orderSessionActions.SET_IS_MONTAGE_TARIFF_FIXED,
|
|
316
|
+
payload: {
|
|
317
|
+
isFixed: Boolean(isFixedFromApi)
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}, [dispatch, isMontageTariffFixed, totals === null || totals === void 0 ? void 0 : totals.isMontageTariffFixed]);
|
|
232
322
|
|
|
233
323
|
// ============================================================================
|
|
234
324
|
// DATA PROCESSING
|
|
@@ -443,22 +533,36 @@ const ProductCartTable = () => {
|
|
|
443
533
|
isRequired: false,
|
|
444
534
|
onChange: onChange
|
|
445
535
|
}));
|
|
446
|
-
const renderVehicleCodingInput =
|
|
536
|
+
const renderVehicleCodingInput = articleNumber => /*#__PURE__*/_react.default.createElement("div", {
|
|
447
537
|
className: (0, _helpers__.withStyle)('text-end')
|
|
448
|
-
}, /*#__PURE__*/_react.default.createElement("
|
|
449
|
-
className: (0, _helpers__.withStyle)('small text-muted d-block mb-1')
|
|
450
|
-
}, "Korting voertuigcodering"), /*#__PURE__*/_react.default.createElement("div", {
|
|
538
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
451
539
|
className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-end gap-2')
|
|
452
540
|
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
541
|
+
label: "Korting voertuigcodering (%)",
|
|
453
542
|
className: "mb-0",
|
|
454
543
|
name: "vehicle-coding-discount",
|
|
455
544
|
placeholder: "0-100",
|
|
456
545
|
value: vehicleCodingDiscountPercentage === null || vehicleCodingDiscountPercentage === undefined ? '' : vehicleCodingDiscountPercentage.toString(),
|
|
457
546
|
isRequired: false,
|
|
458
|
-
onChange: handleVehicleCodingDiscountChange
|
|
459
|
-
})
|
|
547
|
+
onChange: v => handleVehicleCodingDiscountChange(v, articleNumber)
|
|
548
|
+
})));
|
|
549
|
+
const renderMontageRateInput = () => isThc ? null : /*#__PURE__*/_react.default.createElement("div", {
|
|
550
|
+
className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end justify-content-end gap-1')
|
|
551
|
+
}, /*#__PURE__*/_react.default.createElement(_DecimalInput.default, {
|
|
552
|
+
label: "Montage tarief",
|
|
553
|
+
className: "mb-0",
|
|
554
|
+
name: "montage-rate",
|
|
555
|
+
placeholder: "0.0 - 100.0",
|
|
556
|
+
value: montageRate === null || montageRate === undefined ? '' : montageRate.toString(),
|
|
557
|
+
min: 0,
|
|
558
|
+
max: 100,
|
|
559
|
+
step: "0.1",
|
|
560
|
+
isRequired: false,
|
|
561
|
+
isDisabled: isMontageTariffFixed,
|
|
562
|
+
onChange: handleMontageRateChange
|
|
563
|
+
}), montageHourlyExcl !== null && /*#__PURE__*/_react.default.createElement("span", {
|
|
460
564
|
className: (0, _helpers__.withStyle)('small text-muted')
|
|
461
|
-
}, "
|
|
565
|
+
}, "Uurprijs: ", (0, _helpers__.formatPrice)(montageHourlyExcl)));
|
|
462
566
|
|
|
463
567
|
// ============================================================================
|
|
464
568
|
// RENDER
|
|
@@ -468,6 +572,17 @@ const ProductCartTable = () => {
|
|
|
468
572
|
return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
|
|
469
573
|
}
|
|
470
574
|
const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode);
|
|
575
|
+
const montageRateInputCell = isThc ? {} : {
|
|
576
|
+
text: renderMontageRateInput(),
|
|
577
|
+
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
578
|
+
};
|
|
579
|
+
const montageRateCellOverrides = APP_CONFIG.internal && !isThc && renderMontageRateInput ? displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
|
|
580
|
+
// Show input in discount column; keep price column as price
|
|
581
|
+
discountCell: montageRateInputCell
|
|
582
|
+
} : displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT ? {
|
|
583
|
+
// In default view, show input in the same column as vehicle coding
|
|
584
|
+
discountCell: montageRateInputCell
|
|
585
|
+
} : {} : {};
|
|
471
586
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
472
587
|
className: (0, _helpers__.withStyle)('content col-lg')
|
|
473
588
|
}, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
|
|
@@ -486,11 +601,13 @@ const ProductCartTable = () => {
|
|
|
486
601
|
const isVehicleCodingProduct = (product === null || product === void 0 ? void 0 : product.subgroupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME || (product === null || product === void 0 ? void 0 : product.groupName) === _constants__.VEHICLE_CODING_SUBGROUP_NAME;
|
|
487
602
|
const lineDiscountValue = (_product$consumerDisc = product === null || product === void 0 ? void 0 : product.consumerDiscountPercentage) !== null && _product$consumerDisc !== void 0 ? _product$consumerDisc : isVehicleCodingProduct ? vehicleCodingDiscountPercentage : 0;
|
|
488
603
|
const discountInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
|
|
489
|
-
text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v
|
|
604
|
+
text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v, {
|
|
605
|
+
isVehicleCoding: isVehicleCodingProduct
|
|
606
|
+
})),
|
|
490
607
|
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
491
608
|
} : {};
|
|
492
609
|
const vehicleCodingInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT && isTowmotive && isVehicleCodingProduct ? {
|
|
493
|
-
text: renderVehicleCodingInput(),
|
|
610
|
+
text: renderVehicleCodingInput(product.articleNumber),
|
|
494
611
|
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
495
612
|
} : {};
|
|
496
613
|
return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
|
|
@@ -511,7 +628,7 @@ const ProductCartTable = () => {
|
|
|
511
628
|
productTitle: "Montage",
|
|
512
629
|
productSubtitle: (0, _helpers__.formatMontageTime)(totals === null || totals === void 0 ? void 0 : totals.montageTime),
|
|
513
630
|
productImage: _montagePlaceholder.default,
|
|
514
|
-
extraCells: (0, _cartTable2.getMontageCells)(displayMode, totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat, totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat)
|
|
631
|
+
extraCells: (0, _cartTable2.getMontageCells)(displayMode, totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat, totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat, montageRateCellOverrides)
|
|
515
632
|
}), isToggled && marketCorrectionValues.hasValue && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
|
|
516
633
|
productTitle: "Marktcorrectie",
|
|
517
634
|
productImage: _montagePlaceholder.default,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
3
4
|
require("core-js/modules/es.promise.js");
|
|
4
5
|
require("core-js/modules/es.regexp.exec.js");
|
|
6
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
5
7
|
require("core-js/modules/es.string.replace.js");
|
|
6
8
|
require("core-js/modules/es.weak-map.js");
|
|
7
9
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
@@ -16,8 +18,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
18
|
value: true
|
|
17
19
|
});
|
|
18
20
|
exports.default = void 0;
|
|
21
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
19
22
|
require("core-js/modules/es.promise.js");
|
|
20
23
|
require("core-js/modules/es.regexp.exec.js");
|
|
24
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
21
25
|
require("core-js/modules/es.string.replace.js");
|
|
22
26
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
23
27
|
require("core-js/modules/esnext.iterator.find.js");
|
|
@@ -209,7 +213,9 @@ const InternalAppointmentForm = _ref => {
|
|
|
209
213
|
selectedExtras,
|
|
210
214
|
invoicePaymentByLeaseCompany,
|
|
211
215
|
webshop,
|
|
212
|
-
vehicleCodingDiscountPercentage
|
|
216
|
+
vehicleCodingDiscountPercentage,
|
|
217
|
+
consumerDiscounts,
|
|
218
|
+
montageRate
|
|
213
219
|
} = order;
|
|
214
220
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
215
221
|
const [_licensePlate, _setLicensePlate] = (0, _react.useState)();
|
|
@@ -364,7 +370,9 @@ const InternalAppointmentForm = _ref => {
|
|
|
364
370
|
isTmg: isTmg
|
|
365
371
|
}
|
|
366
372
|
});
|
|
367
|
-
|
|
373
|
+
const parsedMontageRate = montageRate === null || montageRate === undefined ? undefined : Number.parseFloat(montageRate.toString().replace(',', '.'));
|
|
374
|
+
console.log('parsedMontageRate', parsedMontageRate);
|
|
375
|
+
const payload = (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({
|
|
368
376
|
vehicle,
|
|
369
377
|
customer: (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({}, customer), {}, {
|
|
370
378
|
firstName: (_customer$firstName = customer === null || customer === void 0 ? void 0 : customer.firstName) !== null && _customer$firstName !== void 0 ? _customer$firstName : undefined,
|
|
@@ -416,9 +424,12 @@ const InternalAppointmentForm = _ref => {
|
|
|
416
424
|
selectedExtras,
|
|
417
425
|
selectedDiscountedProducts,
|
|
418
426
|
isTowmotiveFormula: isTowmotive,
|
|
419
|
-
vehicleCodingDiscountPercentage
|
|
427
|
+
vehicleCodingDiscountPercentage,
|
|
428
|
+
consumerDiscounts
|
|
420
429
|
})
|
|
421
|
-
}))
|
|
430
|
+
}));
|
|
431
|
+
payload.montageRate = Number.isNaN(parsedMontageRate) ? undefined : parsedMontageRate;
|
|
432
|
+
await onSubmit(payload);
|
|
422
433
|
} catch (ex) {
|
|
423
434
|
console.error("handleSubmit(): ".concat(ex));
|
|
424
435
|
setErrors(function () {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
3
4
|
require("core-js/modules/es.promise.js");
|
|
4
5
|
require("core-js/modules/es.regexp.exec.js");
|
|
6
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
5
7
|
require("core-js/modules/es.string.replace.js");
|
|
6
8
|
require("core-js/modules/es.weak-map.js");
|
|
7
9
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
@@ -16,8 +18,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
18
|
value: true
|
|
17
19
|
});
|
|
18
20
|
exports.default = void 0;
|
|
21
|
+
require("core-js/modules/es.number.parse-float.js");
|
|
19
22
|
require("core-js/modules/es.promise.js");
|
|
20
23
|
require("core-js/modules/es.regexp.exec.js");
|
|
24
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
21
25
|
require("core-js/modules/es.string.replace.js");
|
|
22
26
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
23
27
|
require("core-js/modules/esnext.iterator.find.js");
|
|
@@ -183,7 +187,9 @@ const InternalQuotationForm = _ref => {
|
|
|
183
187
|
selectedDiscountedProducts = [],
|
|
184
188
|
channel,
|
|
185
189
|
selectedExtras,
|
|
186
|
-
vehicleCodingDiscountPercentage
|
|
190
|
+
vehicleCodingDiscountPercentage,
|
|
191
|
+
consumerDiscounts,
|
|
192
|
+
montageRate
|
|
187
193
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
188
194
|
const [errors, setErrors] = (0, _react.useState)({});
|
|
189
195
|
const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
|
|
@@ -342,7 +348,8 @@ const InternalQuotationForm = _ref => {
|
|
|
342
348
|
isTmg
|
|
343
349
|
}
|
|
344
350
|
});
|
|
345
|
-
|
|
351
|
+
const parsedMontageRate = montageRate === null || montageRate === undefined ? undefined : Number.parseFloat(montageRate.toString().replace(',', '.'));
|
|
352
|
+
const payload = (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({
|
|
346
353
|
vehicle,
|
|
347
354
|
customer: (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({}, customer), {}, {
|
|
348
355
|
firstName: (_customer$firstName = customer === null || customer === void 0 ? void 0 : customer.firstName) !== null && _customer$firstName !== void 0 ? _customer$firstName : undefined,
|
|
@@ -388,9 +395,12 @@ const InternalQuotationForm = _ref => {
|
|
|
388
395
|
selectedExtras,
|
|
389
396
|
selectedDiscountedProducts,
|
|
390
397
|
isTowmotiveFormula: isTowmotive,
|
|
391
|
-
vehicleCodingDiscountPercentage
|
|
398
|
+
vehicleCodingDiscountPercentage,
|
|
399
|
+
consumerDiscounts
|
|
392
400
|
})
|
|
393
|
-
}))
|
|
401
|
+
}));
|
|
402
|
+
payload.montageRate = Number.isNaN(parsedMontageRate) ? undefined : parsedMontageRate;
|
|
403
|
+
await onSubmit(payload);
|
|
394
404
|
} catch (ex) {
|
|
395
405
|
console.error("handleSubmit(): ".concat(ex));
|
|
396
406
|
setErrors(function () {
|
|
@@ -136,6 +136,8 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
136
136
|
customerAgreed: undefined,
|
|
137
137
|
vehicleCodingDiscountPercentage: null,
|
|
138
138
|
consumerDiscounts: {},
|
|
139
|
+
montageRate: null,
|
|
140
|
+
isMontageTariffFixed: false,
|
|
139
141
|
vehicle: {
|
|
140
142
|
ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
|
|
141
143
|
singleOrderOwnershipType: null,
|
|
@@ -247,7 +249,9 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
247
249
|
SET_CUSTOMER_HOUSE_NUMBER_ADDITION: 'SET_CUSTOMER_HOUSE_NUMBER_ADDITION',
|
|
248
250
|
SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY: 'SET_CUSTOMER_INVOICE_PAYMENT_BY_LEASE_COMPANY',
|
|
249
251
|
SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE: 'SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE',
|
|
250
|
-
SET_CONSUMER_DISCOUNT_PERCENTAGE: 'SET_CONSUMER_DISCOUNT_PERCENTAGE'
|
|
252
|
+
SET_CONSUMER_DISCOUNT_PERCENTAGE: 'SET_CONSUMER_DISCOUNT_PERCENTAGE',
|
|
253
|
+
SET_MONTAGE_RATE: 'SET_MONTAGE_RATE',
|
|
254
|
+
SET_IS_MONTAGE_TARIFF_FIXED: 'SET_IS_MONTAGE_TARIFF_FIXED'
|
|
251
255
|
};
|
|
252
256
|
const orderSessionReducer = (state, action) => {
|
|
253
257
|
switch (action.type) {
|
|
@@ -846,6 +850,25 @@ const orderSessionReducer = (state, action) => {
|
|
|
846
850
|
isTouched: true
|
|
847
851
|
});
|
|
848
852
|
}
|
|
853
|
+
case orderSessionActions.SET_MONTAGE_RATE:
|
|
854
|
+
{
|
|
855
|
+
const {
|
|
856
|
+
montageRate
|
|
857
|
+
} = action.payload;
|
|
858
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
859
|
+
montageRate,
|
|
860
|
+
isTouched: true
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
case orderSessionActions.SET_IS_MONTAGE_TARIFF_FIXED:
|
|
864
|
+
{
|
|
865
|
+
const {
|
|
866
|
+
isFixed
|
|
867
|
+
} = action.payload;
|
|
868
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
869
|
+
isMontageTariffFixed: Boolean(isFixed)
|
|
870
|
+
});
|
|
871
|
+
}
|
|
849
872
|
case orderSessionActions.SET_APPOINTMENT_TIME:
|
|
850
873
|
{
|
|
851
874
|
const {
|
|
@@ -178,20 +178,28 @@ const getAccessoryProductCells = _ref2 => {
|
|
|
178
178
|
* @param {string} displayMode - Current display mode
|
|
179
179
|
* @param {number} montagePrice - Montage price excl VAT
|
|
180
180
|
* @param {number} montagePriceInclVat - Montage price incl VAT
|
|
181
|
+
* @param {Object} overrides - Optional overrides for discount/price cells
|
|
182
|
+
* @param {Object} overrides.discountCell - Override cell for discount column (toggled standard)
|
|
183
|
+
* @param {Object} overrides.priceCell - Override cell for price column
|
|
181
184
|
* @returns {Array} Array of cell configuration objects
|
|
182
185
|
*/
|
|
183
186
|
exports.getAccessoryProductCells = getAccessoryProductCells;
|
|
184
|
-
const getMontageCells = (displayMode, montagePrice, montagePriceInclVat)
|
|
187
|
+
const getMontageCells = exports.getMontageCells = function getMontageCells(displayMode, montagePrice, montagePriceInclVat) {
|
|
188
|
+
let overrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
189
|
+
const {
|
|
190
|
+
discountCell: discountOverride,
|
|
191
|
+
priceCell: priceOverride
|
|
192
|
+
} = overrides;
|
|
185
193
|
const baseCells = [{}, {}, {}];
|
|
186
194
|
const nvt = textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS);
|
|
187
195
|
switch (displayMode) {
|
|
188
196
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
189
|
-
return [...baseCells, nvt, nvt, nvt, priceCell(montagePrice)];
|
|
197
|
+
return [...baseCells, nvt, nvt, nvt, priceOverride || priceCell(montagePrice)];
|
|
190
198
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
191
|
-
return [...baseCells, nvt, nvt, nvt, emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(montagePrice)];
|
|
199
|
+
return [...baseCells, nvt, nvt, nvt, discountOverride || emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceOverride || priceCell(montagePrice)];
|
|
192
200
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
193
201
|
default:
|
|
194
|
-
return [
|
|
202
|
+
return [discountOverride || {}, {}, {}, {}, {}, priceOverride || priceCell(montagePriceInclVat)];
|
|
195
203
|
}
|
|
196
204
|
};
|
|
197
205
|
|
|
@@ -204,7 +212,6 @@ const getMontageCells = (displayMode, montagePrice, montagePriceInclVat) => {
|
|
|
204
212
|
* @param {number} values.salesExcl - Sales price excl VAT
|
|
205
213
|
* @returns {Array} Array of cell configuration objects
|
|
206
214
|
*/
|
|
207
|
-
exports.getMontageCells = getMontageCells;
|
|
208
215
|
const getMarketCorrectionCells = (displayMode, _ref3) => {
|
|
209
216
|
let {
|
|
210
217
|
purchaseExcl,
|