thm-p3-configurator 0.0.98 → 0.0.100

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.
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports.default = void 0;
11
- var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES"));
12
11
  var _react = _interopRequireWildcard(require("react"));
13
12
  require("react-datepicker/src/stylesheets/datepicker-cssmodules.scss");
14
13
  var _reactGtmModule = _interopRequireDefault(require("react-gtm-module"));
@@ -30,6 +29,11 @@ var _index = _interopRequireDefault(require("./__pages__/index"));
30
29
  var _Experiments = _interopRequireDefault(require("./__services__/Experiments"));
31
30
  var _mainExternal = _interopRequireDefault(require("./__style__/main-external.scss"));
32
31
  var _main = _interopRequireDefault(require("./__style__/main.scss"));
32
+ function _interopRequireDefault(e) {
33
+ return e && e.__esModule ? e : {
34
+ default: e
35
+ };
36
+ }
33
37
  function _getRequireWildcardCache(e) {
34
38
  if ("function" != typeof WeakMap) return null;
35
39
  var r = new WeakMap(),
@@ -55,11 +59,8 @@ function _interopRequireWildcard(e, r) {
55
59
  }
56
60
  return n.default = e, t && t.set(e, n), n;
57
61
  }
58
- function _interopRequireDefault(e) {
59
- return e && e.__esModule ? e : {
60
- default: e
61
- };
62
- }
62
+ // import TEST_ONLY_INTERNAL_ROUTES from './__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES';
63
+
63
64
  _reactGtmModule.default.initialize({
64
65
  gtmId: APP_CONFIG.googleTagManagerId || 'GTM-TC67SZ4'
65
66
  });
@@ -75,6 +76,6 @@ const App = () => {
75
76
  defaultCountry: APP_CONFIG.country
76
77
  }, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
77
78
  client: _queryClient.default
78
- }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), APP_CONFIG.nodeEnv === 'development' && APP_CONFIG.internal === true && /*#__PURE__*/_react.default.createElement(_TEST_ONLY_INTERNAL_ROUTES.default, null))))))))));
79
+ }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), /*#__PURE__*/_react.default.createElement(_index.default, null))))))))));
79
80
  };
80
81
  var _default = exports.default = App;
@@ -101,7 +101,7 @@ const useCreateSingleOrderMutation = () => {
101
101
  customer,
102
102
  formula,
103
103
  branchId,
104
- channel,
104
+ vehicle,
105
105
  preferredDateTime,
106
106
  internalNote
107
107
  } = _ref3;
@@ -112,7 +112,7 @@ const useCreateSingleOrderMutation = () => {
112
112
  customer,
113
113
  formula,
114
114
  branchId,
115
- channel,
115
+ vehicle,
116
116
  preferredDateTime,
117
117
  internalNote
118
118
  });
@@ -11,9 +11,7 @@ require("core-js/modules/esnext.iterator.for-each.js");
11
11
  require("core-js/modules/esnext.iterator.map.js");
12
12
  require("core-js/modules/web.dom-collections.iterator.js");
13
13
  require("core-js/modules/web.url-search-params.js");
14
- require("core-js/modules/esnext.iterator.constructor.js");
15
14
  require("core-js/modules/esnext.iterator.filter.js");
16
- require("core-js/modules/esnext.iterator.for-each.js");
17
15
  Object.defineProperty(exports, "__esModule", {
18
16
  value: true
19
17
  });
@@ -23,6 +21,8 @@ require("core-js/modules/es.json.stringify.js");
23
21
  require("core-js/modules/es.object.from-entries.js");
24
22
  require("core-js/modules/es.promise.js");
25
23
  require("core-js/modules/es.regexp.to-string.js");
24
+ require("core-js/modules/esnext.iterator.constructor.js");
25
+ require("core-js/modules/esnext.iterator.for-each.js");
26
26
  require("core-js/modules/esnext.iterator.map.js");
27
27
  require("core-js/modules/web.dom-collections.iterator.js");
28
28
  require("core-js/modules/web.url-search-params.js");
@@ -279,8 +279,9 @@ const useSingleOrderArticles = exports.useSingleOrderArticles = function useSing
279
279
  totalArticles: 0
280
280
  };
281
281
  }
282
+ const currentArticles = await (0, _singleOrderArticles.enrichArticlesWithBrandsAndPrices)(articles, branchId, formula);
282
283
  return {
283
- articles: await (0, _singleOrderArticles.enrichArticlesWithBrandsAndPrices)(articles, branchId, formula),
284
+ articles: currentArticles,
284
285
  totalArticles: totalCount
285
286
  };
286
287
  }
@@ -300,6 +301,31 @@ const useSingleOrderCart = () => {
300
301
  singleOrderCart,
301
302
  singleOrderFormulaCode
302
303
  }] = (0, _OrderSessionContext.useOrderSession)();
304
+
305
+ // Create lookup map for cart totals
306
+ let totalQuantity = 0;
307
+ let totalBtw = 0;
308
+ let totalExclVat = 0;
309
+ let totalInclVat = 0;
310
+ const cartTotalsLookup = {};
311
+ singleOrderCart.forEach(article => {
312
+ const productBtw = (article.productPriceInclVat - article.productPrice) * article.quantity;
313
+ const productTotalExclVat = article.productPrice * article.quantity;
314
+ const productTotalInclVat = article.productPriceInclVat * article.quantity;
315
+ totalQuantity += article.quantity;
316
+ totalBtw += productBtw;
317
+ totalExclVat += productTotalExclVat;
318
+ totalInclVat += productTotalInclVat;
319
+ cartTotalsLookup[article.articleNumber] = {
320
+ productBtw,
321
+ productTotalExclVat,
322
+ productTotalInclVat,
323
+ quantity: article.quantity,
324
+ productPrice: article.productPrice,
325
+ individualPriceInclVat: article.productPriceInclVat,
326
+ individualPriceExclVat: article.productPrice
327
+ };
328
+ });
303
329
  let formula = (0, _FormulaContext.useFormula)();
304
330
  if (singleOrderFormulaCode) {
305
331
  formula = singleOrderFormulaCode;
@@ -329,14 +355,28 @@ const useSingleOrderCart = () => {
329
355
  const cartLookup = Object.fromEntries(cart.map(item => [item.articleNumber, item]));
330
356
  const articlesWithPrice = articles === null || articles === void 0 || (_articles$articles = articles.articles) === null || _articles$articles === void 0 ? void 0 : _articles$articles.map(article => {
331
357
  const cartItem = cartLookup[article.articleNumber];
358
+ const totals = cartTotalsLookup[article.articleNumber];
332
359
  return _objectSpread(_objectSpread({}, article), {}, {
333
360
  price: cartItem !== null && cartItem !== void 0 && cartItem.consumerTotal ? Math.round(Number(cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) * 100) / 100 : 0,
334
- quantity: Number(cartItem === null || cartItem === void 0 ? void 0 : cartItem.quantity)
361
+ quantity: Number(cartItem === null || cartItem === void 0 ? void 0 : cartItem.quantity),
362
+ // Add the calculated totals
363
+ productBtw: totals === null || totals === void 0 ? void 0 : totals.productBtw,
364
+ productTotalExclVat: totals === null || totals === void 0 ? void 0 : totals.productTotalExclVat,
365
+ productTotalInclVat: totals === null || totals === void 0 ? void 0 : totals.productTotalInclVat,
366
+ productPrice: totals === null || totals === void 0 ? void 0 : totals.productPrice,
367
+ productPriceInclVat: totals === null || totals === void 0 ? void 0 : totals.productPriceInclVat,
368
+ individualPriceInclVat: totals === null || totals === void 0 ? void 0 : totals.individualPriceInclVat,
369
+ individualPriceExclVat: totals === null || totals === void 0 ? void 0 : totals.individualPriceExclVat
335
370
  });
336
371
  });
337
372
  return {
338
373
  articles: articlesWithPrice,
339
- totals: orderResults.data.totals
374
+ totals: {
375
+ totalQuantity: Math.round(totalQuantity * 100) / 100,
376
+ totalBtw: Math.round(totalBtw * 100) / 100,
377
+ totalExclVat: Math.round(totalExclVat * 100) / 100,
378
+ totalInclVat: Math.round(totalInclVat * 100) / 100
379
+ }
340
380
  };
341
381
  }
342
382
  });
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.number.to-fixed.js");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ require("core-js/modules/es.number.to-fixed.js");
7
9
  var _react = _interopRequireDefault(require("react"));
8
10
  var _helpers__ = require("../__helpers__");
9
11
  var _LinkButton = _interopRequireDefault(require("./Buttons/LinkButton"));
@@ -36,6 +38,8 @@ const SingleOrderCartCard = _ref2 => {
36
38
  productImage,
37
39
  productTitle,
38
40
  productPrice,
41
+ productPriceInclVat,
42
+ productPriceExclVat,
39
43
  quantity = 0,
40
44
  handleQuantityChange,
41
45
  removeFromCart
@@ -57,14 +61,14 @@ const SingleOrderCartCard = _ref2 => {
57
61
  className: (0, _helpers__.withStyle)('mb-0')
58
62
  }, productTitle), /*#__PURE__*/_react.default.createElement("p", {
59
63
  className: (0, _helpers__.withStyle)('ms-2 fw-bold')
60
- }, "\u20AC", productPrice)), /*#__PURE__*/_react.default.createElement("div", {
64
+ }, "\u20AC", Number(productPrice).toFixed(2))), /*#__PURE__*/_react.default.createElement("div", {
61
65
  className: (0, _helpers__.withStyle)('d-flex mt-1 justify-content-between align-items-center')
62
66
  }, /*#__PURE__*/_react.default.createElement(_NumericInput.default, {
63
67
  className: (0, _helpers__.withStyle)('me-2 rounded'),
64
68
  width: "100px",
65
69
  height: "40px",
66
70
  defaultValue: quantity,
67
- onChange: value => handleQuantityChange(productId, value),
71
+ onChange: value => handleQuantityChange(productId, value, productPriceExclVat, productPriceInclVat),
68
72
  buttonTransformY: 40
69
73
  }), /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
70
74
  label: "Verwijder",
@@ -1,22 +1,16 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.description.js");
4
- require("core-js/modules/es.weak-map.js");
5
3
  require("core-js/modules/esnext.iterator.constructor.js");
6
4
  require("core-js/modules/esnext.iterator.filter.js");
7
5
  require("core-js/modules/esnext.iterator.map.js");
8
- require("core-js/modules/web.dom-collections.iterator.js");
9
- require("core-js/modules/es.weak-map.js");
10
- require("core-js/modules/web.dom-collections.iterator.js");
11
6
  Object.defineProperty(exports, "__esModule", {
12
7
  value: true
13
8
  });
14
9
  exports.default = void 0;
15
- require("core-js/modules/es.symbol.description.js");
16
10
  require("core-js/modules/esnext.iterator.constructor.js");
17
11
  require("core-js/modules/esnext.iterator.filter.js");
18
12
  require("core-js/modules/esnext.iterator.map.js");
19
- var _react = _interopRequireWildcard(require("react"));
13
+ var _react = _interopRequireDefault(require("react"));
20
14
  var _queries = require("../__api__/queries");
21
15
  var _NumericInput = _interopRequireDefault(require("../__components__/Form/NumericInput"));
22
16
  var _helpers__ = require("../__helpers__");
@@ -29,31 +23,6 @@ function _interopRequireDefault(e) {
29
23
  default: e
30
24
  };
31
25
  }
32
- function _getRequireWildcardCache(e) {
33
- if ("function" != typeof WeakMap) return null;
34
- var r = new WeakMap(),
35
- t = new WeakMap();
36
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
37
- return e ? t : r;
38
- })(e);
39
- }
40
- function _interopRequireWildcard(e, r) {
41
- if (!r && e && e.__esModule) return e;
42
- if (null === e || "object" != typeof e && "function" != typeof e) return {
43
- default: e
44
- };
45
- var t = _getRequireWildcardCache(r);
46
- if (t && t.has(e)) return t.get(e);
47
- var n = {
48
- __proto__: null
49
- },
50
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
52
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
53
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
54
- }
55
- return n.default = e, t && t.set(e, n), n;
56
- }
57
26
  const ProductImage = _ref => {
58
27
  let {
59
28
  productImage
@@ -66,42 +35,19 @@ const ProductImage = _ref => {
66
35
  alt: ""
67
36
  }));
68
37
  };
69
- const ProductDescription = _ref2 => {
70
- let {
71
- description
72
- } = _ref2;
73
- return description && /*#__PURE__*/_react.default.createElement("div", {
74
- className: (0, _helpers__.withStyle)('card-text mb-3')
75
- }, /*#__PURE__*/_react.default.createElement("strong", null, "Omschrijving: "), (description !== null && description !== void 0 ? description : 'Niet beschikbaar').split('\n').map((line, index) => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
76
- key: index
77
- }, line, /*#__PURE__*/_react.default.createElement("br", null))));
78
- };
79
- const ProductSpecifications = _ref3 => {
80
- let {
81
- specifications
82
- } = _ref3;
83
- return specifications && /*#__PURE__*/_react.default.createElement("div", {
84
- className: (0, _helpers__.withStyle)('card-text mb-3')
85
- }, /*#__PURE__*/_react.default.createElement("strong", null, "Specificaties: "), /*#__PURE__*/_react.default.createElement("br", null), specifications.map((_ref4, index) => {
86
- let {
87
- key,
88
- value
89
- } = _ref4;
90
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
91
- key: index
92
- }, key, ": ", value, /*#__PURE__*/_react.default.createElement("br", null));
93
- }));
94
- };
95
- const ProductActions = _ref5 => {
38
+ const ProductActions = _ref2 => {
96
39
  let {
40
+ isTmg,
97
41
  isOutOfStock,
98
42
  stock,
99
43
  quantity,
100
44
  productId,
101
45
  handleQuantityChange,
102
46
  handleSelected,
103
- removeFromCart
104
- } = _ref5;
47
+ removeFromCart,
48
+ productPrice,
49
+ productPriceInclVat
50
+ } = _ref2;
105
51
  return /*#__PURE__*/_react.default.createElement("div", {
106
52
  className: (0, _helpers__.withStyle)('d-flex justify-content-end')
107
53
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -110,30 +56,30 @@ const ProductActions = _ref5 => {
110
56
  className: (0, _helpers__.withStyle)('text-danger mb-1')
111
57
  }, "Niet op voorraad") : /*#__PURE__*/_react.default.createElement("div", {
112
58
  className: (0, _helpers__.withStyle)('text-success mb-1')
113
- }, stock, " op voorraad"), /*#__PURE__*/_react.default.createElement("div", {
59
+ }, isTmg ? "".concat(stock, " op voorraad") : 'Op voorraad'), /*#__PURE__*/_react.default.createElement("div", {
114
60
  className: (0, _helpers__.withStyle)('d-flex align-items-center')
115
61
  }, /*#__PURE__*/_react.default.createElement(_NumericInput.default, {
116
62
  className: (0, _helpers__.withStyle)('me-2 rounded'),
117
63
  width: "100px",
118
64
  height: "55px",
119
65
  defaultValue: quantity,
120
- onChange: value => handleQuantityChange(productId, value),
66
+ onChange: value => handleQuantityChange(productId, value, productPrice, productPriceInclVat),
121
67
  buttonTransformY: 40
122
68
  }), quantity === 0 ? /*#__PURE__*/_react.default.createElement(_PrimaryButton.default, {
123
- onClick: () => handleSelected(productId, quantity + 1),
69
+ onClick: () => handleSelected(productId, quantity + 1, productPrice, productPriceInclVat),
124
70
  label: "Toevoegen"
125
71
  }) : /*#__PURE__*/_react.default.createElement(_OutlinedButton.default, {
126
72
  onClick: () => removeFromCart(productId),
127
73
  label: "Verwijder"
128
74
  }))));
129
75
  };
130
- const ProductCategories = _ref6 => {
76
+ const ProductCategories = _ref3 => {
131
77
  let {
132
78
  productType = null,
133
79
  productGroup = null,
134
80
  productSubgroup = null,
135
81
  articleNumber = null
136
- } = _ref6;
82
+ } = _ref3;
137
83
  return /*#__PURE__*/_react.default.createElement("div", null, articleNumber && /*#__PURE__*/_react.default.createElement("p", {
138
84
  className: (0, _helpers__.withStyle)('fst-italic mb-0')
139
85
  }, /*#__PURE__*/_react.default.createElement("strong", null, "Artikelnummer:"), " ", articleNumber), productType && /*#__PURE__*/_react.default.createElement("p", {
@@ -144,7 +90,7 @@ const ProductCategories = _ref6 => {
144
90
  className: (0, _helpers__.withStyle)('fst-italic mb-0')
145
91
  }, /*#__PURE__*/_react.default.createElement("strong", null, "Subgroep:"), " ", productSubgroup));
146
92
  };
147
- const SingleOrderProductCard = _ref7 => {
93
+ const SingleOrderProductCard = _ref4 => {
148
94
  let {
149
95
  productId,
150
96
  isSelected,
@@ -159,25 +105,27 @@ const SingleOrderProductCard = _ref7 => {
159
105
  productUsps,
160
106
  productTitle,
161
107
  productPrice,
108
+ productPriceInclVat,
162
109
  productSpecifications,
163
110
  quantity = 0,
164
111
  handleQuantityChange,
165
112
  removeFromCart,
166
- isModelArticle = false
167
- } = _ref7;
113
+ isModelArticle = false,
114
+ isTmg = false
115
+ } = _ref4;
168
116
  const {
169
117
  productFieldLabels
170
118
  } = (0, _queries.useProductFieldLabels)();
171
- const filteredProductSpecifications = productSpecifications.filter(_ref8 => {
119
+ const filteredProductSpecifications = productSpecifications.filter(_ref5 => {
172
120
  let {
173
121
  key
174
- } = _ref8;
122
+ } = _ref5;
175
123
  return productFieldLabels === null || productFieldLabels === void 0 ? void 0 : productFieldLabels[key];
176
- }).map(_ref9 => {
124
+ }).map(_ref6 => {
177
125
  let {
178
126
  key,
179
127
  value
180
- } = _ref9;
128
+ } = _ref6;
181
129
  return {
182
130
  key: productFieldLabels[key],
183
131
  value
@@ -214,11 +162,14 @@ const SingleOrderProductCard = _ref7 => {
214
162
  }))), /*#__PURE__*/_react.default.createElement(ProductActions, {
215
163
  isOutOfStock: isOutOfStock,
216
164
  stock: stock,
165
+ isTmg: isTmg,
217
166
  quantity: quantity,
218
167
  productId: productId,
219
168
  handleQuantityChange: handleQuantityChange,
220
169
  handleSelected: handleSelected,
221
- removeFromCart: removeFromCart
170
+ removeFromCart: removeFromCart,
171
+ productPrice: productPrice,
172
+ productPriceInclVat: productPriceInclVat
222
173
  })))));
223
174
  };
224
175
  var _default = exports.default = SingleOrderProductCard;
@@ -4,11 +4,10 @@ require("core-js/modules/es.promise.js");
4
4
  require("core-js/modules/es.weak-map.js");
5
5
  require("core-js/modules/esnext.iterator.constructor.js");
6
6
  require("core-js/modules/esnext.iterator.filter.js");
7
- require("core-js/modules/esnext.iterator.find.js");
8
7
  require("core-js/modules/esnext.iterator.for-each.js");
9
- require("core-js/modules/esnext.iterator.map.js");
10
8
  require("core-js/modules/web.dom-collections.iterator.js");
11
9
  require("core-js/modules/es.weak-map.js");
10
+ require("core-js/modules/esnext.iterator.constructor.js");
12
11
  require("core-js/modules/esnext.iterator.filter.js");
13
12
  require("core-js/modules/esnext.iterator.for-each.js");
14
13
  Object.defineProperty(exports, "__esModule", {
@@ -16,9 +15,6 @@ Object.defineProperty(exports, "__esModule", {
16
15
  });
17
16
  exports.default = void 0;
18
17
  require("core-js/modules/es.promise.js");
19
- require("core-js/modules/esnext.iterator.constructor.js");
20
- require("core-js/modules/esnext.iterator.find.js");
21
- require("core-js/modules/esnext.iterator.map.js");
22
18
  require("core-js/modules/web.dom-collections.iterator.js");
23
19
  var _react = _interopRequireWildcard(require("react"));
24
20
  var _yup = require("yup");
@@ -30,7 +26,7 @@ var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
30
26
  var _LinkButton = _interopRequireDefault(require("../Buttons/LinkButton"));
31
27
  var _CardWide = _interopRequireDefault(require("../Cards/CardWide"));
32
28
  var _DatePickerInput = _interopRequireDefault(require("../Form/DatePickerInput"));
33
- var _DropdownInput = _interopRequireDefault(require("../Form/DropdownInput"));
29
+ var _RadioButtons = _interopRequireDefault(require("../Form/RadioButtons"));
34
30
  var _TextAreaInput = _interopRequireDefault(require("../Form/TextAreaInput"));
35
31
  var _TextInput = _interopRequireDefault(require("../Form/TextInput"));
36
32
  var _TimePickerInput = _interopRequireDefault(require("../Form/TimePickerInput"));
@@ -108,19 +104,22 @@ function _toPrimitive(t, r) {
108
104
  return ("string" === r ? String : Number)(t);
109
105
  }
110
106
  const customerDetailsFormSchema = (0, _yup.object)({
107
+ singleOrderOwnershipType: (0, _yup.string)().nullable(),
111
108
  firstName: (0, _yup.string)().nullable(),
112
- channelType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
113
- channelId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
114
109
  infix: (0, _yup.string)().nullable(),
115
- lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
116
- email: (0, _yup.string)().email(_constants__.FORM_ERROR_MESSAGES.email).required(_constants__.FORM_ERROR_MESSAGES.required),
117
- phoneNumber: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
110
+ lastName: (0, _yup.string)().nullable(),
111
+ email: (0, _yup.string)().nullable(),
112
+ phoneNumber: (0, _yup.string)().nullable(),
113
+ zipCode: (0, _yup.string)().nullable(),
114
+ houseNumber: (0, _yup.string)().nullable(),
115
+ streetName: (0, _yup.string)().nullable(),
116
+ city: (0, _yup.string)().nullable(),
118
117
  date: (0, _yup.string)().nullable(),
119
118
  time: (0, _yup.string)().nullable(),
120
119
  internalNote: (0, _yup.string)().nullable()
121
120
  });
122
121
  const InternalCustomerDetailsForm = (_ref, ref) => {
123
- var _branchTypes$byId$aut, _authSession$branch, _marketingChannels$fi;
122
+ var _branchTypes$byId$aut, _authSession$branch;
124
123
  let {
125
124
  errors = {},
126
125
  onValidationError,
@@ -131,7 +130,8 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
131
130
  channel,
132
131
  selectedBranch,
133
132
  appointment,
134
- internalNote
133
+ internalNote,
134
+ vehicle
135
135
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
136
136
  const {
137
137
  branchById
@@ -199,39 +199,21 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
199
199
  label: 'Vestiginggegevens invullen?',
200
200
  onClick: handleAutofillButtonClicked,
201
201
  isDisabled: !branchById
202
- })), /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
203
- className: 'col-12 col-md-6',
204
- options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
205
- label: channel === null || channel === void 0 ? void 0 : channel.title,
206
- value: channel
207
- })),
208
- name: "channel",
209
- label: "Kanaal:",
210
- isRequired: true,
211
- isLoading: isLoadingMarketingChannels,
212
- noOptionsMessage: "Geen opties beschikbaar",
213
- placeholder: "Maak een keuze",
214
- errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
215
- initialValue: channel !== null && channel !== void 0 && channel.channelId ? {
216
- label: marketingChannels === null || marketingChannels === void 0 || (_marketingChannels$fi = marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))) === null || _marketingChannels$fi === void 0 ? void 0 : _marketingChannels$fi.title,
217
- value: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId))
218
- } : null,
219
- onChange: _ref2 => {
220
- var _value$kanaalType;
221
- let {
222
- label,
223
- value
224
- } = _ref2;
225
- return dispatch({
226
- type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
202
+ })), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
203
+ name: "singleOrderOwnershipType",
204
+ label: "Type:",
205
+ initialValue: vehicle === null || vehicle === void 0 ? void 0 : vehicle.singleOrderOwnershipType,
206
+ onChange: val => {
207
+ dispatch({
208
+ type: _OrderSessionContext.orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE,
227
209
  payload: {
228
- channel: {
229
- channelType: value === null || value === void 0 || (_value$kanaalType = value.kanaalType) === null || _value$kanaalType === void 0 || (_value$kanaalType = _value$kanaalType[0]) === null || _value$kanaalType === void 0 ? void 0 : _value$kanaalType.entityId,
230
- channelId: value === null || value === void 0 ? void 0 : value.entityId
231
- }
210
+ singleOrderOwnershipType: val
232
211
  }
233
212
  });
234
- }
213
+ },
214
+ options: Object.values(_constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE),
215
+ isRequired: false,
216
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['singleOrderOwnershipType']
235
217
  }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
236
218
  className: 'col-12 col-md-6',
237
219
  placeholder: "",
@@ -273,7 +255,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
273
255
  lastName: value
274
256
  }
275
257
  }),
276
- isRequired: true,
258
+ isRequired: false,
277
259
  form: form,
278
260
  label: "Achternaam:",
279
261
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['lastName']
@@ -288,7 +270,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
288
270
  email: value
289
271
  }
290
272
  }),
291
- isRequired: true,
273
+ isRequired: false,
292
274
  form: form,
293
275
  label: "E-mailadres:",
294
276
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['email']
@@ -304,9 +286,69 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
304
286
  }
305
287
  }),
306
288
  form: form,
307
- isRequired: true,
289
+ isRequired: false,
308
290
  label: "Telefoonnummer:",
309
291
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['phoneNumber']
292
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
293
+ className: 'col-12 col-md-6',
294
+ placeholder: "",
295
+ initialValue: customer.zipCode,
296
+ name: "zipCode",
297
+ onChange: value => dispatch({
298
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_ZIP_CODE,
299
+ payload: {
300
+ zipCode: value
301
+ }
302
+ }),
303
+ isRequired: false,
304
+ form: form,
305
+ label: "Postcode:",
306
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['zipCode']
307
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
308
+ className: 'col-12 col-md-6',
309
+ placeholder: "",
310
+ initialValue: customer.houseNumber,
311
+ name: "houseNumber",
312
+ onChange: value => dispatch({
313
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER,
314
+ payload: {
315
+ houseNumber: value
316
+ }
317
+ }),
318
+ isRequired: false,
319
+ form: form,
320
+ label: "Huisnummer:",
321
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
322
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
323
+ className: 'col-12 col-md-6',
324
+ placeholder: "",
325
+ initialValue: customer.streetName,
326
+ name: "streetName",
327
+ onChange: value => dispatch({
328
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_STREET_NAME,
329
+ payload: {
330
+ streetName: value
331
+ }
332
+ }),
333
+ isRequired: false,
334
+ form: form,
335
+ label: "Straat:",
336
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['streetName']
337
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
338
+ className: 'col-12 col-md-6',
339
+ placeholder: "",
340
+ initialValue: customer.city,
341
+ name: "city",
342
+ onChange: value => dispatch({
343
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_CITY,
344
+ payload: {
345
+ city: value
346
+ }
347
+ }),
348
+ isRequired: false,
349
+ form: form,
350
+ label: "Stad:",
351
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
310
352
  })))), /*#__PURE__*/_react.default.createElement("div", {
311
353
  className: (0, _helpers__.withStyle)('col-12')
312
354
  }, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("div", {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VESTIGING_TYPE_ID = exports.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.ORDER_SESSION_KEY = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
6
+ exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.USER_GEOLOCATION_KEY = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.ORDER_SESSION_KEY = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.FORM_ERROR_MESSAGES = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.CONFIGURATOR_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
7
7
  const DOSSIER_TYPES = exports.DOSSIER_TYPES = {
8
8
  Quotation: 'quotation',
9
9
  AppointmentRequest: 'appointment-request',
@@ -154,6 +154,10 @@ const VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = {
154
154
  Zakelijk: 'Zakelijk',
155
155
  Leasemaatschappij: 'Leasemaatschappij'
156
156
  };
157
+ const VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = {
158
+ Particulier: 'Particulier',
159
+ Zakelijk: 'Zakelijk'
160
+ };
157
161
  const DISCOUNT_TYPES = exports.DISCOUNT_TYPES = {
158
162
  Percentage: '%',
159
163
  Amount: '€'
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.number.to-fixed.js");
3
4
  require("core-js/modules/esnext.iterator.map.js");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+ require("core-js/modules/es.number.to-fixed.js");
8
10
  require("core-js/modules/esnext.iterator.map.js");
9
11
  var _react = _interopRequireDefault(require("react"));
10
12
  var _queries = require("../../__api__/queries");
@@ -27,7 +29,7 @@ const EmptyState = _ref => {
27
29
  }, message));
28
30
  };
29
31
  const InternalSingleOrderCart = _ref2 => {
30
- var _cart$articles, _cart$totals$totalBef, _cart$totals, _cart$totals$discount, _cart$totals2, _cart$totals$totalAft, _cart$totals3, _cart$totals$totalVat, _cart$totals4;
32
+ var _cart$articles, _cart$totals$totalExc, _cart$totals, _cart$totals$totalBtw, _cart$totals2, _cart$totals$totalInc, _cart$totals3;
31
33
  let {
32
34
  handleQuantityChange,
33
35
  removeFromCart: _removeFromCart,
@@ -55,16 +57,20 @@ const InternalSingleOrderCart = _ref2 => {
55
57
  className: (0, _helpers__.withStyle)('w-full')
56
58
  }, /*#__PURE__*/_react.default.createElement("strong", null, "Toebehoren"), isLoadingCart ? /*#__PURE__*/_react.default.createElement(EmptyState, {
57
59
  message: "We zijn het overzicht aan het laden..."
58
- }) : (cart === null || cart === void 0 || (_cart$articles = cart.articles) === null || _cart$articles === void 0 ? void 0 : _cart$articles.length) > 0 ? cart.articles.map(article => /*#__PURE__*/_react.default.createElement(_SingleOrderCartCard.default, {
59
- key: article.articleNumber,
60
- productId: article.articleNumber,
61
- productImage: article.image,
62
- productTitle: article.name,
63
- productPrice: article.price,
64
- removeFromCart: () => _removeFromCart(article.articleNumber),
65
- quantity: article.quantity,
66
- handleQuantityChange: handleQuantityChange
67
- })) : /*#__PURE__*/_react.default.createElement(EmptyState, {
60
+ }) : (cart === null || cart === void 0 || (_cart$articles = cart.articles) === null || _cart$articles === void 0 ? void 0 : _cart$articles.length) > 0 ? cart.articles.map(article => {
61
+ return /*#__PURE__*/_react.default.createElement(_SingleOrderCartCard.default, {
62
+ key: article.articleNumber,
63
+ productId: article.articleNumber,
64
+ productImage: article.image,
65
+ productTitle: article.name,
66
+ productPrice: article.productTotalExclVat,
67
+ productPriceInclVat: article.individualPriceInclVat,
68
+ productPriceExclVat: article.individualPriceExclVat,
69
+ removeFromCart: () => _removeFromCart(article.articleNumber),
70
+ quantity: article.quantity,
71
+ handleQuantityChange: handleQuantityChange
72
+ });
73
+ }) : /*#__PURE__*/_react.default.createElement(EmptyState, {
68
74
  message: "Er zitten nog geen producten in je winkelwagen."
69
75
  }), /*#__PURE__*/_react.default.createElement("hr", null), /*#__PURE__*/_react.default.createElement("div", {
70
76
  className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end w-100')
@@ -72,13 +78,11 @@ const InternalSingleOrderCart = _ref2 => {
72
78
  className: (0, _helpers__.withStyle)('d-flex flex-column mt-1 w-100')
73
79
  }, /*#__PURE__*/_react.default.createElement("p", {
74
80
  className: (0, _helpers__.withStyle)('d-flex justify-content-between m-0')
75
- }, /*#__PURE__*/_react.default.createElement("strong", null, "Subtotaal:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", (_cart$totals$totalBef = cart === null || cart === void 0 || (_cart$totals = cart.totals) === null || _cart$totals === void 0 ? void 0 : _cart$totals.totalBeforeDiscountInclVat) !== null && _cart$totals$totalBef !== void 0 ? _cart$totals$totalBef : 0)), /*#__PURE__*/_react.default.createElement("p", {
81
+ }, /*#__PURE__*/_react.default.createElement("strong", null, "Totaal excl BTW:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", ((_cart$totals$totalExc = cart === null || cart === void 0 || (_cart$totals = cart.totals) === null || _cart$totals === void 0 ? void 0 : _cart$totals.totalExclVat) !== null && _cart$totals$totalExc !== void 0 ? _cart$totals$totalExc : 0).toFixed(2))), /*#__PURE__*/_react.default.createElement("p", {
76
82
  className: (0, _helpers__.withStyle)('d-flex justify-content-between m-0')
77
- }, /*#__PURE__*/_react.default.createElement("strong", null, "Kortingen:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", (_cart$totals$discount = cart === null || cart === void 0 || (_cart$totals2 = cart.totals) === null || _cart$totals2 === void 0 ? void 0 : _cart$totals2.discountInclVat) !== null && _cart$totals$discount !== void 0 ? _cart$totals$discount : 0)), /*#__PURE__*/_react.default.createElement("p", {
83
+ }, /*#__PURE__*/_react.default.createElement("strong", null, "BTW:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", ((_cart$totals$totalBtw = cart === null || cart === void 0 || (_cart$totals2 = cart.totals) === null || _cart$totals2 === void 0 ? void 0 : _cart$totals2.totalBtw) !== null && _cart$totals$totalBtw !== void 0 ? _cart$totals$totalBtw : 0).toFixed(2))), /*#__PURE__*/_react.default.createElement("hr", null), /*#__PURE__*/_react.default.createElement("p", {
78
84
  className: (0, _helpers__.withStyle)('d-flex justify-content-between m-0')
79
- }, /*#__PURE__*/_react.default.createElement("strong", null, "Totaal:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", (_cart$totals$totalAft = cart === null || cart === void 0 || (_cart$totals3 = cart.totals) === null || _cart$totals3 === void 0 ? void 0 : _cart$totals3.totalAfterDiscountInclVat) !== null && _cart$totals$totalAft !== void 0 ? _cart$totals$totalAft : 0)), /*#__PURE__*/_react.default.createElement("hr", null), /*#__PURE__*/_react.default.createElement("p", {
80
- className: (0, _helpers__.withStyle)('d-flex justify-content-between m-0')
81
- }, /*#__PURE__*/_react.default.createElement("strong", null, "BTW:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", (_cart$totals$totalVat = cart === null || cart === void 0 || (_cart$totals4 = cart.totals) === null || _cart$totals4 === void 0 ? void 0 : _cart$totals4.totalVatAfterDiscount) !== null && _cart$totals$totalVat !== void 0 ? _cart$totals$totalVat : 0)))))
85
+ }, /*#__PURE__*/_react.default.createElement("strong", null, "Totaal:"), /*#__PURE__*/_react.default.createElement("span", null, " \u20AC", ((_cart$totals$totalInc = cart === null || cart === void 0 || (_cart$totals3 = cart.totals) === null || _cart$totals3 === void 0 ? void 0 : _cart$totals3.totalInclVat) !== null && _cart$totals$totalInc !== void 0 ? _cart$totals$totalInc : 0).toFixed(2))))))
82
86
  }), /*#__PURE__*/_react.default.createElement("div", {
83
87
  className: (0, _helpers__.withStyle)('d-flex mt-2 justify-content-between')
84
88
  }, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
@@ -31,6 +31,7 @@ var _FormulaContext = require("../../__context__/FormulaContext");
31
31
  var _OrderSessionContext = require("../../__context__/OrderSessionContext");
32
32
  var _helpers__ = require("../../__helpers__");
33
33
  var _product = require("../../__helpers__/product");
34
+ var _useIsTmg = require("../../__hooks__/useIsTmg");
34
35
  function _interopRequireDefault(e) {
35
36
  return e && e.__esModule ? e : {
36
37
  default: e
@@ -101,6 +102,7 @@ const InternalSingleOrderProductOverview = _ref => {
101
102
  if (singleOrderFormulaCode) {
102
103
  formula = singleOrderFormulaCode;
103
104
  }
105
+ const isTmg = (0, _useIsTmg.useIsTmg)();
104
106
  const mergedFilters = _objectSpread(_objectSpread({}, filters), {}, {
105
107
  licensePlate,
106
108
  model,
@@ -125,8 +127,9 @@ const InternalSingleOrderProductOverview = _ref => {
125
127
  message: "Geen producten gevonden.",
126
128
  subMessage: "Probeer een ander filter toe te passen."
127
129
  }), articles && hasActiveFilters && (articles === null || articles === void 0 || (_articles$articles2 = articles.articles) === null || _articles$articles2 === void 0 ? void 0 : _articles$articles2.length) > 0 && (articles === null || articles === void 0 || (_articles$articles3 = articles.articles) === null || _articles$articles3 === void 0 ? void 0 : _articles$articles3.map(article => {
128
- var _cart$find$quantity, _cart$find, _article$locationPric, _article$locationPric2, _article$locationPric3, _article$consumerPric;
130
+ var _cart$find$quantity, _cart$find, _article$locationPric, _article$locationPric2, _article$locationPric3, _article$locationPric6, _article$locationPric7;
129
131
  return /*#__PURE__*/_react.default.createElement(_SingleOrderProductCard.default, {
132
+ isTmg: isTmg,
130
133
  key: article.articleNumber,
131
134
  isModelArticle: Boolean(model || licensePlate),
132
135
  removeFromCart: () => _removeFromCart(article.articleNumber),
@@ -135,7 +138,10 @@ const InternalSingleOrderProductOverview = _ref => {
135
138
  isSelected: false,
136
139
  stock: (_article$locationPric = article === null || article === void 0 || (_article$locationPric2 = article.locationPrices) === null || _article$locationPric2 === void 0 || (_article$locationPric2 = _article$locationPric2.stock) === null || _article$locationPric2 === void 0 ? void 0 : _article$locationPric2.quantity) !== null && _article$locationPric !== void 0 ? _article$locationPric : 0,
137
140
  isOutOfStock: (article === null || article === void 0 || (_article$locationPric3 = article.locationPrices) === null || _article$locationPric3 === void 0 || (_article$locationPric3 = _article$locationPric3.stock) === null || _article$locationPric3 === void 0 ? void 0 : _article$locationPric3.status) == _constants__.StockStatus.OutOfStock,
138
- handleSelected: () => handleQuantityChange(article.articleNumber, 1),
141
+ handleSelected: () => {
142
+ var _article$locationPric4, _article$locationPric5;
143
+ return handleQuantityChange(article.articleNumber, 1, article === null || article === void 0 || (_article$locationPric4 = article.locationPrices) === null || _article$locationPric4 === void 0 ? void 0 : _article$locationPric4.priceExclVat, article === null || article === void 0 || (_article$locationPric5 = article.locationPrices) === null || _article$locationPric5 === void 0 ? void 0 : _article$locationPric5.priceInclVat);
144
+ },
139
145
  productUsps: [{
140
146
  type: 'excl',
141
147
  text: article === null || article === void 0 ? void 0 : article.excl
@@ -152,7 +158,8 @@ const InternalSingleOrderProductOverview = _ref => {
152
158
  productImage: article.image,
153
159
  productSpecifications: (0, _product.extractProductSpecsArray)(article),
154
160
  productTitle: article.name,
155
- productPrice: Number(article === null || article === void 0 || (_article$consumerPric = article.consumerPrices) === null || _article$consumerPric === void 0 ? void 0 : _article$consumerPric.priceInclVat).toFixed(2),
161
+ productPrice: Number(article === null || article === void 0 || (_article$locationPric6 = article.locationPrices) === null || _article$locationPric6 === void 0 ? void 0 : _article$locationPric6.priceExclVat).toFixed(2),
162
+ productPriceInclVat: Number(article === null || article === void 0 || (_article$locationPric7 = article.locationPrices) === null || _article$locationPric7 === void 0 ? void 0 : _article$locationPric7.priceInclVat).toFixed(2),
156
163
  productType: article === null || article === void 0 ? void 0 : article.type,
157
164
  productGroup: article === null || article === void 0 ? void 0 : article.group,
158
165
  productSubgroup: article === null || article === void 0 ? void 0 : article.subgroup
@@ -135,6 +135,7 @@ const INITIAL_ORDER_SESSION_STATE = {
135
135
  customerAgreed: undefined,
136
136
  vehicle: {
137
137
  ownershipType: _constants__.VEHICLE_OWNERSHIP_TYPE.Particulier,
138
+ singleOrderOwnershipType: null,
138
139
  leaseNumber: '',
139
140
  leaseNumberUnknown: true
140
141
  },
@@ -209,6 +210,7 @@ const orderSessionActions = exports.orderSessionActions = {
209
210
  SET_VEHICLE_LEASE_NUMBER: 'SET_VEHICLE_LEASE_NUMBER',
210
211
  SET_VEHICLE_LEASE_NUMBER_UNKNOWN: 'SET_VEHICLE_LEASE_NUMBER_UNKNOWN',
211
212
  SET_VEHICLE_OWNERSHIP_TYPE: 'SET_VEHICLE_OWNERSHIP_TYPE',
213
+ SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE: 'SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE',
212
214
  SET_MARKETING_CHANNEL: 'SET_MARKETING_CHANNEL',
213
215
  SET_CUSTOMER_ZIP_CODE: 'SET_CUSTOMER_ZIP_CODE',
214
216
  SET_CUSTOMER_CITY: 'SET_CUSTOMER_CITY',
@@ -512,12 +514,16 @@ const orderSessionReducer = (state, action) => {
512
514
  {
513
515
  const {
514
516
  articleNumber,
515
- quantity
517
+ quantity,
518
+ productPrice,
519
+ productPriceInclVat
516
520
  } = action.payload;
517
521
  return _objectSpread(_objectSpread({}, state), {}, {
518
522
  singleOrderCart: [...state.singleOrderCart.filter(p => p.articleNumber !== articleNumber), {
519
523
  articleNumber,
520
- quantity
524
+ quantity,
525
+ productPrice,
526
+ productPriceInclVat
521
527
  }],
522
528
  isTouched: true
523
529
  });
@@ -834,6 +840,17 @@ const orderSessionReducer = (state, action) => {
834
840
  })
835
841
  });
836
842
  }
843
+ case orderSessionActions.SET_VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE:
844
+ {
845
+ const {
846
+ singleOrderOwnershipType
847
+ } = action.payload;
848
+ return _objectSpread(_objectSpread({}, state), {}, {
849
+ vehicle: _objectSpread(_objectSpread({}, state === null || state === void 0 ? void 0 : state.vehicle), {}, {
850
+ singleOrderOwnershipType
851
+ })
852
+ });
853
+ }
837
854
  case orderSessionActions.REMOVE_DISCOUNTED_PRODUCT:
838
855
  {
839
856
  var _state$selectedDiscou;
@@ -143,6 +143,7 @@ const InternalSingleOrderPage = () => {
143
143
  channel,
144
144
  customer,
145
145
  selectedBranch,
146
+ vehicle,
146
147
  appointment,
147
148
  internalNote,
148
149
  singleOrderFormulaCode,
@@ -195,13 +196,15 @@ const InternalSingleOrderPage = () => {
195
196
  type: _OrderSessionContext.orderSessionActions.RESET_LICENSEPLATE_FILTERS
196
197
  });
197
198
  }, [dispatch]);
198
- const handleQuantityChange = (articleNumber, quantity) => {
199
+ const handleQuantityChange = (articleNumber, quantity, productPrice, productPriceInclVat) => {
199
200
  if (quantity > 0) {
200
201
  dispatch({
201
202
  type: _OrderSessionContext.orderSessionActions.ADD_SINGLE_ORDER_PRODUCT,
202
203
  payload: {
203
204
  articleNumber,
204
- quantity
205
+ quantity,
206
+ productPrice,
207
+ productPriceInclVat
205
208
  }
206
209
  });
207
210
  } else {
@@ -213,7 +216,6 @@ const InternalSingleOrderPage = () => {
213
216
  });
214
217
  }
215
218
  };
216
- const [filtersResetTrigger, setFiltersResetTrigger] = (0, _react.useState)(false);
217
219
  const filterModelOrLicenseplate = filter => {
218
220
  var _filtersRef$current;
219
221
  (_filtersRef$current = filtersRef.current) === null || _filtersRef$current === void 0 || _filtersRef$current.resetFilters(true);
@@ -256,10 +258,34 @@ const InternalSingleOrderPage = () => {
256
258
  const isValid = await ((_customerFormRef$curr = customerFormRef.current) === null || _customerFormRef$curr === void 0 ? void 0 : _customerFormRef$curr.validateForm());
257
259
  if (isValid) {
258
260
  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;
261
+ console.log({
262
+ licensePlate: filters.licensePlate,
263
+ model: filters.model,
264
+ cart: singleOrderCart,
265
+ customer,
266
+ vehicle,
267
+ formula,
268
+ branchId: selectedBranch,
269
+ preferredDateTime,
270
+ internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
271
+ });
272
+ vehicle.ownershipType = vehicle.singleOrderOwnershipType;
273
+ delete vehicle.singleOrderOwnershipType;
274
+ // Check and set default values for empty or null fields
275
+ if (!customer.email || customer.email === '') {
276
+ customer.email = branchById === null || branchById === void 0 ? void 0 : branchById.email;
277
+ }
278
+ if (!customer.phoneNumber || customer.phoneNumber === '') {
279
+ customer.phoneNumber = branchById === null || branchById === void 0 ? void 0 : branchById.phone;
280
+ }
281
+ if (!customer.lastName || customer.lastName === '') {
282
+ customer.lastName = branchById === null || branchById === void 0 ? void 0 : branchById.name;
283
+ }
259
284
  createSingleOrder({
260
285
  licensePlate: filters.licensePlate,
261
286
  model: filters.model,
262
287
  cart: singleOrderCart,
288
+ vehicle,
263
289
  customer,
264
290
  formula,
265
291
  branchId: selectedBranch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",