thm-p3-configurator 0.0.98 → 0.0.99

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.
@@ -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;
@@ -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
@@ -512,12 +512,16 @@ const orderSessionReducer = (state, action) => {
512
512
  {
513
513
  const {
514
514
  articleNumber,
515
- quantity
515
+ quantity,
516
+ productPrice,
517
+ productPriceInclVat
516
518
  } = action.payload;
517
519
  return _objectSpread(_objectSpread({}, state), {}, {
518
520
  singleOrderCart: [...state.singleOrderCart.filter(p => p.articleNumber !== articleNumber), {
519
521
  articleNumber,
520
- quantity
522
+ quantity,
523
+ productPrice,
524
+ productPriceInclVat
521
525
  }],
522
526
  isTouched: true
523
527
  });
@@ -195,13 +195,15 @@ const InternalSingleOrderPage = () => {
195
195
  type: _OrderSessionContext.orderSessionActions.RESET_LICENSEPLATE_FILTERS
196
196
  });
197
197
  }, [dispatch]);
198
- const handleQuantityChange = (articleNumber, quantity) => {
198
+ const handleQuantityChange = (articleNumber, quantity, productPrice, productPriceInclVat) => {
199
199
  if (quantity > 0) {
200
200
  dispatch({
201
201
  type: _OrderSessionContext.orderSessionActions.ADD_SINGLE_ORDER_PRODUCT,
202
202
  payload: {
203
203
  articleNumber,
204
- quantity
204
+ quantity,
205
+ productPrice,
206
+ productPriceInclVat
205
207
  }
206
208
  });
207
209
  } else {
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.99",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",