thm-p3-configurator 0.0.262 → 0.0.263

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.
@@ -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.totalBeforeDiscountInclVat),
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.subtotalMontageExclVat),
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"));
@@ -161,12 +164,15 @@ const ProductCartTable = () => {
161
164
  discountPercentage,
162
165
  selectedBranch,
163
166
  vehicleCodingDiscountPercentage,
164
- consumerDiscounts
167
+ consumerDiscounts,
168
+ montageRate,
169
+ isMontageTariffFixed
165
170
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
166
171
 
167
172
  // Determine display mode
168
173
  const displayMode = (0, _cartTable2.getCartTableDisplayMode)(isToggled, isTmg);
169
- const handleVehicleCodingDiscountChange = value => {
174
+ const handleVehicleCodingDiscountChange = function handleVehicleCodingDiscountChange(value) {
175
+ let articleNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
170
176
  const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
171
177
  const parsed = sanitized === '' ? 0 : Math.min(100, Math.max(0, parseInt(sanitized, 10)));
172
178
  dispatch({
@@ -175,8 +181,20 @@ const ProductCartTable = () => {
175
181
  percentage: parsed
176
182
  }
177
183
  });
184
+ if (articleNumber) {
185
+ dispatch({
186
+ type: _OrderSessionContext.orderSessionActions.SET_CONSUMER_DISCOUNT_PERCENTAGE,
187
+ payload: {
188
+ articleNumber,
189
+ percentage: parsed
190
+ }
191
+ });
192
+ }
178
193
  };
179
- const handleLineDiscountChange = (articleNumber, value) => {
194
+ const handleLineDiscountChange = function handleLineDiscountChange(articleNumber, value) {
195
+ let {
196
+ isVehicleCoding = false
197
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
180
198
  const sanitized = value === null || value === void 0 ? void 0 : value.toString().replace(/[^0-9]/g, '');
181
199
  const parsed = sanitized === '' ? 0 : Math.min(100, Math.max(0, parseInt(sanitized, 10)));
182
200
  dispatch({
@@ -186,6 +204,47 @@ const ProductCartTable = () => {
186
204
  percentage: parsed
187
205
  }
188
206
  });
207
+ if (isVehicleCoding) {
208
+ dispatch({
209
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_CODING_DISCOUNT_PERCENTAGE,
210
+ payload: {
211
+ percentage: parsed
212
+ }
213
+ });
214
+ }
215
+ };
216
+ const handleMontageRateChange = value => {
217
+ if (value === null || value === undefined) {
218
+ dispatch({
219
+ type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
220
+ payload: {
221
+ montageRate: null
222
+ }
223
+ });
224
+ return;
225
+ }
226
+
227
+ // Permit typing both comma and dot decimals
228
+ const sanitized = value.toString().replace(/[^0-9.,-]/g, '').replace(',', '.');
229
+
230
+ // Allow a lone "0." or "0," while typing
231
+ if (sanitized === '' || sanitized === '0.' || sanitized === '0,') {
232
+ dispatch({
233
+ type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
234
+ payload: {
235
+ montageRate: null
236
+ }
237
+ });
238
+ return;
239
+ }
240
+ const parsed = Number.parseFloat(sanitized);
241
+ const clamped = parsed === null || Number.isNaN(parsed) ? null : Math.min(100, Math.max(0, parsed));
242
+ dispatch({
243
+ type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
244
+ payload: {
245
+ montageRate: clamped
246
+ }
247
+ });
189
248
  };
190
249
  const cartInput = (0, _product.buildCartInput)({
191
250
  selectedCableset,
@@ -213,8 +272,12 @@ const ProductCartTable = () => {
213
272
  branchId: isToggled ? selectedBranch : null,
214
273
  discountAmount,
215
274
  discountPercentage,
216
- formula
275
+ formula,
276
+ montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
217
277
  });
278
+ const montageHours = Number(totals === null || totals === void 0 ? void 0 : totals.montageTime) || 0;
279
+ const montageTotalExcl = Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0);
280
+ const montageHourlyExcl = montageHours > 0 ? montageTotalExcl / montageHours : null;
218
281
  (0, _react.useEffect)(() => {
219
282
  if (!isToggled || !(cart !== null && cart !== void 0 && cart.length)) return;
220
283
  cart.forEach(item => {
@@ -229,6 +292,32 @@ const ProductCartTable = () => {
229
292
  }
230
293
  });
231
294
  }, [cart, consumerDiscounts, dispatch, isToggled]);
295
+ (0, _react.useEffect)(() => {
296
+ const rateFromApi = totals === null || totals === void 0 ? void 0 : totals.montageRate;
297
+ if (rateFromApi === undefined || rateFromApi === null) return;
298
+ const numericRate = Number(rateFromApi);
299
+ if (Number.isNaN(numericRate)) return;
300
+ if (montageRate === null || montageRate === undefined) {
301
+ dispatch({
302
+ type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
303
+ payload: {
304
+ montageRate: numericRate
305
+ }
306
+ });
307
+ }
308
+ }, [dispatch, montageRate, totals === null || totals === void 0 ? void 0 : totals.montageRate]);
309
+ (0, _react.useEffect)(() => {
310
+ const isFixedFromApi = totals === null || totals === void 0 ? void 0 : totals.isMontageTariffFixed;
311
+ if (isFixedFromApi === undefined || isFixedFromApi === null) return;
312
+ if (isMontageTariffFixed !== Boolean(isFixedFromApi)) {
313
+ dispatch({
314
+ type: _OrderSessionContext.orderSessionActions.SET_IS_MONTAGE_TARIFF_FIXED,
315
+ payload: {
316
+ isFixed: Boolean(isFixedFromApi)
317
+ }
318
+ });
319
+ }
320
+ }, [dispatch, isMontageTariffFixed, totals === null || totals === void 0 ? void 0 : totals.isMontageTariffFixed]);
232
321
 
233
322
  // ============================================================================
234
323
  // DATA PROCESSING
@@ -443,22 +532,36 @@ const ProductCartTable = () => {
443
532
  isRequired: false,
444
533
  onChange: onChange
445
534
  }));
446
- const renderVehicleCodingInput = () => /*#__PURE__*/_react.default.createElement("div", {
535
+ const renderVehicleCodingInput = articleNumber => /*#__PURE__*/_react.default.createElement("div", {
447
536
  className: (0, _helpers__.withStyle)('text-end')
448
- }, /*#__PURE__*/_react.default.createElement("span", {
449
- className: (0, _helpers__.withStyle)('small text-muted d-block mb-1')
450
- }, "Korting voertuigcodering"), /*#__PURE__*/_react.default.createElement("div", {
537
+ }, /*#__PURE__*/_react.default.createElement("div", {
451
538
  className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-end gap-2')
452
539
  }, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
540
+ label: "Korting voertuigcodering (%)",
453
541
  className: "mb-0",
454
542
  name: "vehicle-coding-discount",
455
543
  placeholder: "0-100",
456
544
  value: vehicleCodingDiscountPercentage === null || vehicleCodingDiscountPercentage === undefined ? '' : vehicleCodingDiscountPercentage.toString(),
457
545
  isRequired: false,
458
- onChange: handleVehicleCodingDiscountChange
459
- }), /*#__PURE__*/_react.default.createElement("span", {
546
+ onChange: v => handleVehicleCodingDiscountChange(v, articleNumber)
547
+ })));
548
+ const renderMontageRateInput = () => /*#__PURE__*/_react.default.createElement("div", {
549
+ className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end justify-content-end gap-1')
550
+ }, /*#__PURE__*/_react.default.createElement(_DecimalInput.default, {
551
+ label: "Montage tarief",
552
+ className: "mb-0",
553
+ name: "montage-rate",
554
+ placeholder: "0.0 - 100.0",
555
+ value: montageRate === null || montageRate === undefined ? '' : montageRate.toString(),
556
+ min: 0,
557
+ max: 100,
558
+ step: "0.1",
559
+ isRequired: false,
560
+ isDisabled: isMontageTariffFixed,
561
+ onChange: handleMontageRateChange
562
+ }), montageHourlyExcl !== null && /*#__PURE__*/_react.default.createElement("span", {
460
563
  className: (0, _helpers__.withStyle)('small text-muted')
461
- }, "%")));
564
+ }, "Uurprijs: ", (0, _helpers__.formatPrice)(montageHourlyExcl)));
462
565
 
463
566
  // ============================================================================
464
567
  // RENDER
@@ -468,6 +571,17 @@ const ProductCartTable = () => {
468
571
  return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
469
572
  }
470
573
  const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode);
574
+ const montageRateInputCell = {
575
+ text: renderMontageRateInput(),
576
+ className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
577
+ };
578
+ const montageRateCellOverrides = APP_CONFIG.internal && renderMontageRateInput ? displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
579
+ // Show input in discount column; keep price column as price
580
+ discountCell: montageRateInputCell
581
+ } : displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT ? {
582
+ // In default view, show input in the same column as vehicle coding
583
+ discountCell: montageRateInputCell
584
+ } : {} : {};
471
585
  return /*#__PURE__*/_react.default.createElement("div", {
472
586
  className: (0, _helpers__.withStyle)('content col-lg')
473
587
  }, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
@@ -486,11 +600,13 @@ const ProductCartTable = () => {
486
600
  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
601
  const lineDiscountValue = (_product$consumerDisc = product === null || product === void 0 ? void 0 : product.consumerDiscountPercentage) !== null && _product$consumerDisc !== void 0 ? _product$consumerDisc : isVehicleCodingProduct ? vehicleCodingDiscountPercentage : 0;
488
602
  const discountInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
489
- text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v)),
603
+ text: renderDiscountInput(product.articleNumber, lineDiscountValue, v => handleLineDiscountChange(product.articleNumber, v, {
604
+ isVehicleCoding: isVehicleCodingProduct
605
+ })),
490
606
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
491
607
  } : {};
492
608
  const vehicleCodingInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT && isTowmotive && isVehicleCodingProduct ? {
493
- text: renderVehicleCodingInput(),
609
+ text: renderVehicleCodingInput(product.articleNumber),
494
610
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
495
611
  } : {};
496
612
  return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
@@ -511,7 +627,7 @@ const ProductCartTable = () => {
511
627
  productTitle: "Montage",
512
628
  productSubtitle: (0, _helpers__.formatMontageTime)(totals === null || totals === void 0 ? void 0 : totals.montageTime),
513
629
  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)
630
+ 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
631
  }), isToggled && marketCorrectionValues.hasValue && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
516
632
  productTitle: "Marktcorrectie",
517
633
  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
- await onSubmit((0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({
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
- await onSubmit((0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({
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 [...baseCells, {}, {}, priceCell(montagePriceInclVat)];
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.262",
3
+ "version": "0.0.263",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",