thm-p3-configurator 0.0.115 → 0.0.117

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.
@@ -25,7 +25,7 @@ var _FormulaContext = require("./__context__/FormulaContext");
25
25
  var _OrderSessionContext = require("./__context__/OrderSessionContext");
26
26
  var _cookiebot = require("./__helpers__/cookiebot");
27
27
  var _queryClient = _interopRequireDefault(require("./__helpers__/queryClient"));
28
- var _index = _interopRequireDefault(require("./__pages__/index"));
28
+ var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES"));
29
29
  var _Experiments = _interopRequireDefault(require("./__services__/Experiments"));
30
30
  var _mainExternal = _interopRequireDefault(require("./__style__/main-external.scss"));
31
31
  var _main = _interopRequireDefault(require("./__style__/main.scss"));
@@ -59,7 +59,7 @@ function _interopRequireWildcard(e, r) {
59
59
  }
60
60
  return n.default = e, t && t.set(e, n), n;
61
61
  }
62
- // import TEST_ONLY_INTERNAL_ROUTES from './__pages__/internal/__TEST_ONLY_INTERNAL_ROUTES';
62
+ // import Routes from './__pages__/index';
63
63
 
64
64
  _reactGtmModule.default.initialize({
65
65
  gtmId: APP_CONFIG.googleTagManagerId || 'GTM-TC67SZ4'
@@ -76,6 +76,6 @@ const App = () => {
76
76
  defaultCountry: APP_CONFIG.country
77
77
  }, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
78
78
  client: _queryClient.default
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
+ }, /*#__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))))))))));
80
80
  };
81
81
  var _default = exports.default = App;
@@ -228,6 +228,7 @@ const LocationClusteredTreeMarkers = _ref => {
228
228
  anchor: markers[activeMarkerId],
229
229
  onCloseClick: handleInfoWindowClose
230
230
  }, /*#__PURE__*/_react.default.createElement(_LocationInfo.default, {
231
+ openingHours: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.openingstijden,
231
232
  locationImage: selectedTree === null || selectedTree === void 0 || (_selectedTree$afbeeld = selectedTree.afbeeldingLogo) === null || _selectedTree$afbeeld === void 0 ? void 0 : _selectedTree$afbeeld[0],
232
233
  street: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.street,
233
234
  houseNumber: selectedTree === null || selectedTree === void 0 ? void 0 : selectedTree.street2,
@@ -12,6 +12,7 @@ var _react = _interopRequireDefault(require("react"));
12
12
  var _cardPlaceholder = _interopRequireDefault(require("../../../../public/assets/images/card-placeholder.png"));
13
13
  var _helpers__ = require("../../__helpers__");
14
14
  var _image = require("../../__helpers__/image");
15
+ var _constants__ = require("../../__constants__");
15
16
  function _interopRequireDefault(e) {
16
17
  return e && e.__esModule ? e : {
17
18
  default: e
@@ -29,35 +30,45 @@ const LocationInfo = _ref => {
29
30
  title,
30
31
  email,
31
32
  website,
33
+ openingHours,
32
34
  province
33
35
  } = _ref;
34
36
  const address = [street, postCode, city].join(', ');
35
37
 
36
- /*
37
- TODO: OPENING HOURS NOT IN PROXY BRANCH DATA FEED
38
- */
39
- const openingDays = [{
40
- day: 'Maandag',
41
- hours: 'Gesloten'
42
- }, {
43
- day: 'Dinsdag',
44
- hours: '09:00 - 17:00'
45
- }, {
46
- day: 'Woensdag',
47
- hours: '09:00 - 17:00'
48
- }, {
49
- day: 'Donderdag',
50
- hours: '09:00 - 17:00'
51
- }, {
52
- day: 'Vrijdag',
53
- hours: '09:00 - 17:00'
54
- }, {
55
- day: 'Zaterdag',
56
- hours: '09:00 - 17:00'
57
- }, {
58
- day: 'Zondag',
59
- hours: 'Gesloten'
60
- }];
38
+ // Function to format opening hours display text
39
+ const formatOpeningHours = dayData => {
40
+ if (!dayData) return {
41
+ text: 'Onbekend',
42
+ isUnknown: true
43
+ };
44
+ if (!dayData.isOpen) return {
45
+ text: 'Gesloten',
46
+ isUnknown: false
47
+ };
48
+ if (dayData.opensAt && dayData.closesAt) {
49
+ return {
50
+ text: "".concat(dayData.opensAt, " - ").concat(dayData.closesAt),
51
+ isUnknown: false
52
+ };
53
+ } else if (dayData.opensAt) {
54
+ return {
55
+ text: "".concat(dayData.opensAt),
56
+ isUnknown: false
57
+ };
58
+ } else if (dayData.closesAt) {
59
+ return {
60
+ text: "".concat(dayData.closesAt),
61
+ isUnknown: false
62
+ };
63
+ }
64
+ return {
65
+ text: 'Onbekend',
66
+ isUnknown: true
67
+ };
68
+ };
69
+
70
+ // Order of days to display
71
+ const daysOrder = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
61
72
  return /*#__PURE__*/_react.default.createElement("div", {
62
73
  className: (0, _helpers__.withStyle)('dealer-map__infowindow p-0 shadow-none')
63
74
  }, /*#__PURE__*/_react.default.createElement("h4", {
@@ -89,20 +100,27 @@ const LocationInfo = _ref => {
89
100
  }), /*#__PURE__*/_react.default.createElement("a", {
90
101
  href: website
91
102
  }, /*#__PURE__*/_react.default.createElement("u", null, website)))), /*#__PURE__*/_react.default.createElement("p", {
92
- className: (0, _helpers__.withStyle)('font-weight-bold d-none d-md-block')
103
+ className: (0, _helpers__.withStyle)('font-weight-bold mb-1 d-none d-md-block')
93
104
  }, /*#__PURE__*/_react.default.createElement("i", {
94
105
  className: "fas fa-clock ".concat((0, _helpers__.withStyle)('mx-1'))
95
106
  }), "Openingstijden"), /*#__PURE__*/_react.default.createElement("ul", {
96
- className: (0, _helpers__.withStyle)('ml-3 d-none d-md-block')
97
- }, openingDays.map((_ref2, key) => {
98
- let {
99
- day,
100
- hours
101
- } = _ref2;
107
+ className: (0, _helpers__.withStyle)('ml-3 p-0 d-none d-md-block'),
108
+ style: {
109
+ lineHeight: '1.2'
110
+ }
111
+ }, daysOrder.map(day => {
112
+ const hoursInfo = openingHours && formatOpeningHours(openingHours[day]);
102
113
  return /*#__PURE__*/_react.default.createElement("li", {
103
- key: key,
104
- className: (0, _helpers__.withStyle)('d-flex align-content-center justify-content-between')
105
- }, /*#__PURE__*/_react.default.createElement("p", null, day), /*#__PURE__*/_react.default.createElement("p", null, hours));
114
+ key: day,
115
+ className: (0, _helpers__.withStyle)('d-flex align-content-center justify-content-between mb-0'),
116
+ style: {
117
+ marginBottom: '2px'
118
+ }
119
+ }, /*#__PURE__*/_react.default.createElement("p", {
120
+ className: (0, _helpers__.withStyle)('mb-0')
121
+ }, _constants__.DAY_NAMES[day]), /*#__PURE__*/_react.default.createElement("p", {
122
+ className: "".concat(hoursInfo !== null && hoursInfo !== void 0 && hoursInfo.isUnknown ? (0, _helpers__.withStyle)('text-muted fst-italic') : '', " ").concat((0, _helpers__.withStyle)('mb-0'))
123
+ }, (hoursInfo === null || hoursInfo === void 0 ? void 0 : hoursInfo.text) || 'Onbekend'));
106
124
  }))), /*#__PURE__*/_react.default.createElement("div", {
107
125
  className: (0, _helpers__.withStyle)('col-12 col-md-6 d-flex flex-column justify-content-evenly align-items-center')
108
126
  }, /*#__PURE__*/_react.default.createElement("img", {
@@ -162,6 +162,7 @@ const LocationList = _ref => {
162
162
  className: (0, _helpers__.withStyle)('dealer-list')
163
163
  }, /*#__PURE__*/_react.default.createElement("h5", null, userLocation ? 'Dichtsbijzijnde montagelocaties' : 'Montagelocaties'), isLoading && /*#__PURE__*/_react.default.createElement(LocationsLoading, null), !isLoading && !locationIds.length && /*#__PURE__*/_react.default.createElement(NoLocationFound, null), sortedLocations.map(location => /*#__PURE__*/_react.default.createElement(_LocationListItem.default, {
164
164
  ref: location.entityId === activeMarkerId || location.entityId === selectedBranch ? selectedRef : null,
165
+ openingHours: location.openingstijden,
165
166
  title: location.name,
166
167
  city: location.city,
167
168
  distance: location.distance ? location.distance : null,
@@ -15,6 +15,7 @@ var _ProductTableSection = _interopRequireDefault(require("./ProductTableSection
15
15
  var _ProductTableSectionTotal = _interopRequireDefault(require("./ProductTableSectionTotal"));
16
16
  var _ProductTableStaticRow = _interopRequireDefault(require("./ProductTableStaticRow"));
17
17
  var _ProductTableTotal = _interopRequireDefault(require("./ProductTableTotal"));
18
+ var _OrderSessionContext = require("../../__context__/OrderSessionContext");
18
19
  function _interopRequireDefault(e) {
19
20
  return e && e.__esModule ? e : {
20
21
  default: e
@@ -25,18 +26,21 @@ const ProductTable = _ref => {
25
26
  staticProducts = [],
26
27
  editableProducts = []
27
28
  } = _ref;
29
+ const {
30
+ selectedBranch
31
+ } = (0, _OrderSessionContext.useOrderSession)();
28
32
  return /*#__PURE__*/_react.default.createElement("div", {
29
33
  className: (0, _helpers__.withStyle)("content col-lg")
30
34
  }, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
31
35
  title: 'Overzicht',
32
- untoggleButton: "Verberg inkoopprijzen",
33
- toggleButton: "Toon inkoopprijzen",
36
+ untoggleButton: selectedBranch ? 'Verberg inkoopprijzen' : undefined,
37
+ toggleButton: selectedBranch ? 'Toon inkoopprijzen' : undefined,
34
38
  onToggle: toggled => console.info('Toggled ' + toggled)
35
39
  }, /*#__PURE__*/_react.default.createElement("table", {
36
40
  className: (0, _helpers__.withStyle)('cart__table table table-borderless align-middle')
37
41
  }, /*#__PURE__*/_react.default.createElement(_ProductTableHead.default, {
38
42
  columns: [{}, {}, {}, {}, {
39
- text: 'Verkoop Prijs',
43
+ text: 'Verkoop Prjs',
40
44
  className: 'fw-bold text-end'
41
45
  }]
42
46
  }), /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
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;
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.DAY_NAMES = 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',
@@ -18,6 +18,15 @@ const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
18
18
  licensePlateMin: 'Kenteken moet minimaal 6 characters bevatten',
19
19
  licensePlateMax: 'Kenteken mag maximaal 8 characters bevatten'
20
20
  };
21
+ const DAY_NAMES = exports.DAY_NAMES = {
22
+ monday: 'Maandag',
23
+ tuesday: 'Dinsdag',
24
+ wednesday: 'Woensdag',
25
+ thursday: 'Donderdag',
26
+ friday: 'Vrijdag',
27
+ saturday: 'Zaterdag',
28
+ sunday: 'Zondag'
29
+ };
21
30
  const VESTIGING_TYPE_ID = exports.VESTIGING_TYPE_ID = 'kyDouClQsfmXWWloLdwzG';
22
31
  const NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_INTERNAL = [{
23
32
  to: '/configurator/trekhaakpakket',
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.array.includes.js");
4
- require("core-js/modules/es.array.reduce.js");
5
4
  require("core-js/modules/es.json.stringify.js");
6
5
  require("core-js/modules/es.parse-float.js");
7
6
  require("core-js/modules/es.regexp.to-string.js");
@@ -11,7 +10,6 @@ require("core-js/modules/esnext.iterator.constructor.js");
11
10
  require("core-js/modules/esnext.iterator.filter.js");
12
11
  require("core-js/modules/esnext.iterator.find.js");
13
12
  require("core-js/modules/esnext.iterator.map.js");
14
- require("core-js/modules/esnext.iterator.reduce.js");
15
13
  require("core-js/modules/web.dom-collections.iterator.js");
16
14
  require("core-js/modules/es.weak-map.js");
17
15
  Object.defineProperty(exports, "__esModule", {
@@ -19,7 +17,6 @@ Object.defineProperty(exports, "__esModule", {
19
17
  });
20
18
  exports.default = void 0;
21
19
  require("core-js/modules/es.array.includes.js");
22
- require("core-js/modules/es.array.reduce.js");
23
20
  require("core-js/modules/es.json.stringify.js");
24
21
  require("core-js/modules/es.parse-float.js");
25
22
  require("core-js/modules/es.regexp.to-string.js");
@@ -28,7 +25,6 @@ require("core-js/modules/esnext.iterator.constructor.js");
28
25
  require("core-js/modules/esnext.iterator.filter.js");
29
26
  require("core-js/modules/esnext.iterator.find.js");
30
27
  require("core-js/modules/esnext.iterator.map.js");
31
- require("core-js/modules/esnext.iterator.reduce.js");
32
28
  require("core-js/modules/web.dom-collections.iterator.js");
33
29
  var _react = _interopRequireWildcard(require("react"));
34
30
  var _logoPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-primary.png"));
@@ -91,8 +87,7 @@ const ProductCartSide = () => {
91
87
  selectedCombiset,
92
88
  selectedBoardComputer,
93
89
  selectedExtras,
94
- discountAmount,
95
- discountPercentage
90
+ selectedBranch
96
91
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
97
92
  const cartInput = (0, _product.validateCartInput)([{
98
93
  articleNumber: selectedCableset,
@@ -123,8 +118,10 @@ const ProductCartSide = () => {
123
118
  durationAnswer,
124
119
  selectBoardComputerUpdate: selectedBoardComputer != null,
125
120
  cart: cartInput ? JSON.stringify(cartInput) : undefined,
126
- formula
121
+ formula,
122
+ branchId: isToggled ? selectedBranch : undefined
127
123
  });
124
+ const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === 'MC');
128
125
  let mainProducts = [];
129
126
  let accessoireProducts = [];
130
127
  if (products) {
@@ -147,196 +144,39 @@ const ProductCartSide = () => {
147
144
  * @return {Object} Calculated prices for the item
148
145
  */
149
146
  const getItemPrices = cartItem => {
150
- var _product$locationPric, _product$consumerPric, _product$consumerPric2;
151
147
  if (!cartItem) {
152
148
  return {
153
149
  purchasePrice: 0,
154
150
  salesPrice: 0,
155
- salesPriceInclVat: 0,
156
151
  margin: 0,
157
152
  marginPercentage: 0
158
153
  };
159
154
  }
160
155
 
161
- // Find the corresponding product
162
- const product = [...mainProducts, ...accessoireProducts].find(p => p.articleNumber === cartItem.articleNumber);
163
- if (!product) {
164
- return {
165
- purchasePrice: 0,
166
- salesPrice: 0,
167
- salesPriceInclVat: 0,
168
- margin: 0,
169
- marginPercentage: 0
170
- };
171
- }
172
-
173
- // Get prices directly from product objects
174
- const purchasePrice = (product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.priceExclVat) || 0;
175
- const salesPrice = (product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceExclVat) || 0;
176
- const salesPriceInclVat = (product === null || product === void 0 || (_product$consumerPric2 = product.consumerPrices) === null || _product$consumerPric2 === void 0 ? void 0 : _product$consumerPric2.priceInclVat) || 0;
156
+ // Get prices directly from product objects and calculate excl VAT for location
157
+ const purchasePrice = cartItem !== null && cartItem !== void 0 && cartItem.locationTotal ? cartItem.locationTotal : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
158
+ const salesPrice = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
177
159
  const margin = salesPrice - purchasePrice;
178
160
  const marginPercentage = purchasePrice ? margin / purchasePrice * 100 : 0;
179
161
  return {
180
162
  purchasePrice,
181
163
  salesPrice,
182
- salesPriceInclVat,
183
164
  margin,
184
165
  marginPercentage: Math.round(marginPercentage * 100) / 100
185
166
  };
186
167
  };
187
168
 
188
- // ===== MAIN PRODUCTS PRICING =====
189
- /**
190
- * Calculate sum of main products price (excluding montage) including VAT
191
- */
192
- const mainProductsInclVat = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
193
- if (mainProducts.find(product => product.articleNumber === item.articleNumber)) {
194
- const {
195
- salesPriceInclVat
196
- } = getItemPrices(item);
197
- return acc + salesPriceInclVat;
198
- }
199
- return acc;
200
- }, 0)) || 0;
201
-
202
- /**
203
- * Calculate sum of main products price (excluding montage) excluding VAT
204
- */
205
- const mainProductsExclVat = mainProductsInclVat / 1.21;
206
-
207
- /**
208
- * Calculate sum of main products purchase price (excluding montage)
209
- */
210
- const mainProductsPurchase = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
211
- if (mainProducts.find(product => product.articleNumber === item.articleNumber)) {
212
- const {
213
- purchasePrice
214
- } = getItemPrices(item);
215
- return acc + purchasePrice;
216
- }
217
- return acc;
218
- }, 0)) || 0;
219
-
220
169
  // ===== MONTAGE PRICING =====
221
170
  /**
222
171
  * Montage price including VAT
223
172
  */
224
173
  const montageInclVat = parseFloat(totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat) || 0;
225
-
226
- /**
227
- * Montage price excluding VAT
228
- */
229
- const montageExclVat = parseFloat(totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionExclVat) || 0;
230
-
231
- // ===== ACCESSORIES PRICING =====
232
- /**
233
- * Calculate sum of accessories price including VAT
234
- */
235
- const accessoriesInclVat = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
236
- if (accessoireProducts.find(product => product.articleNumber === item.articleNumber)) {
237
- const {
238
- salesPriceInclVat
239
- } = getItemPrices(item);
240
- const quantity = selectedExtras[item.articleNumber.toString()] || 1;
241
- return acc + salesPriceInclVat * quantity;
242
- }
243
- return acc;
244
- }, 0)) || 0;
245
-
246
- /**
247
- * Calculate sum of accessories price excluding VAT
248
- */
249
- const accessoriesExclVat = accessoriesInclVat / 1.21;
250
-
251
- /**
252
- * Calculate sum of accessories purchase price
253
- */
254
- const accessoriesPurchase = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
255
- if (accessoireProducts.find(product => product.articleNumber === item.articleNumber)) {
256
- const {
257
- purchasePrice
258
- } = getItemPrices(item);
259
- const quantity = selectedExtras[item.articleNumber.toString()] || 1;
260
- return acc + purchasePrice * quantity;
261
- }
262
- return acc;
263
- }, 0)) || 0;
264
-
265
- // ===== SUBTOTALS =====
266
- /**
267
- * Subtotal for main products + montage including VAT
268
- */
269
- const mainSubtotalInclVat = mainProductsInclVat + montageInclVat;
270
-
271
- /**
272
- * Subtotal for main products + montage excluding VAT
273
- */
274
- const mainSubtotalExclVat = mainProductsExclVat + montageExclVat;
275
-
276
- // ===== TOTALS BEFORE DISCOUNT =====
277
- /**
278
- * Total purchase price (without montage)
279
- */
280
- const totalPurchase = mainProductsPurchase + accessoriesPurchase;
281
-
282
- /**
283
- * Total price excluding VAT
284
- */
285
- const totalExclVat = mainSubtotalExclVat + accessoriesExclVat;
286
-
287
- /**
288
- * Total price including VAT
289
- */
290
- const totalInclVat = mainSubtotalInclVat + accessoriesInclVat;
291
-
292
- /**
293
- * VAT amount
294
- */
295
- const totalVat = totalInclVat - totalExclVat;
296
-
297
- // ===== DISCOUNT CALCULATIONS =====
298
- /**
299
- * Calculate discount amount
300
- */
301
- const getDiscountAmount = () => {
302
- if (discountPercentage) {
303
- return totalInclVat * discountPercentage / 100;
304
- }
305
- if (discountAmount) {
306
- return discountAmount;
307
- }
308
- return 0;
309
- };
310
- const discountTotal = getDiscountAmount();
311
- const discountExclVat = discountTotal / 1.21;
312
- const discountVat = discountTotal - discountExclVat;
313
-
314
- // ===== TOTALS AFTER DISCOUNT =====
315
- /**
316
- * Final price excluding VAT (after discount)
317
- */
318
- const finalExclVat = Math.max(0, totalExclVat - discountExclVat);
319
-
320
- /**
321
- * Final VAT amount (after discount)
322
- */
323
- const finalVat = Math.max(0, totalVat - discountVat);
324
-
325
- /**
326
- * Final price including VAT (after discount)
327
- */
328
- const finalInclVat = Math.max(0, totalInclVat - discountTotal);
329
-
330
- /**
331
- * Final purchase price after discount
332
- */
333
- const finalPurchase = Math.max(0, totalPurchase - discountExclVat * totalPurchase / totalExclVat);
334
174
  return /*#__PURE__*/_react.default.createElement("div", {
335
175
  className: (0, _helpers__.withStyle)("col-lg mt-3")
336
176
  }, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
337
177
  title: 'Overzicht',
338
- untoggleButton: "Verberg inkoopprijzen",
339
- toggleButton: "Toon inkoopprijzen",
178
+ untoggleButton: selectedBranch ? 'Verberg inkoopprijzen' : undefined,
179
+ toggleButton: selectedBranch ? 'Toon inkoopprijzen' : undefined,
340
180
  onToggle: toggled => setIsToggled(toggled)
341
181
  }, /*#__PURE__*/_react.default.createElement("table", {
342
182
  className: (0, _helpers__.withStyle)('cart__table table table-borderless align-middle')
@@ -356,7 +196,7 @@ const ProductCartSide = () => {
356
196
  const cartItem = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === product.articleNumber);
357
197
  const {
358
198
  purchasePrice,
359
- salesPriceInclVat
199
+ salesPrice
360
200
  } = getItemPrices(cartItem);
361
201
  return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
362
202
  key: product.articleNumber,
@@ -365,7 +205,7 @@ const ProductCartSide = () => {
365
205
  imageId: (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
366
206
  }) : _logoPrimary.default,
367
207
  extraCells: [{}, {
368
- text: (0, _helpers__.formatPrice)(isToggled ? purchasePrice : salesPriceInclVat),
208
+ text: (0, _helpers__.formatPrice)(isToggled ? purchasePrice : salesPrice),
369
209
  className: 'cart__table-purchase-price text-end'
370
210
  }]
371
211
  });
@@ -373,19 +213,15 @@ const ProductCartSide = () => {
373
213
  productTitle: "Montage",
374
214
  productImage: _montagePlaceholder.default,
375
215
  extraCells: [{}, {
376
- text: isToggled ? montageExclVat > 0 ? (0, _helpers__.formatPrice)(montageExclVat) : 'N.v.t.' : (0, _helpers__.formatPrice)(montageInclVat),
216
+ text: isToggled ? 'N.v.t.' : montageInclVat > 0 ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat) : 'N.v.t.',
377
217
  className: 'cart__table-purchase-price text-end'
378
218
  }]
379
- }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
380
- isEditable: true,
381
- editLabel: 'Wijzig je trekhaakpakket',
382
- editLink: '/configurator/trekhaakpakket',
219
+ }), isToggled && (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
220
+ productTitle: "Marktcorrectie",
221
+ productImage: _montagePlaceholder.default,
383
222
  extraCells: [{}, {
384
- text: isToggled ? 'Subtotaal (excl. btw)' : 'Subtotaal (incl. btw)',
385
- className: 'fw-bold text-end pb-2'
386
- }, {
387
- text: (0, _helpers__.formatPrice)(isToggled ? mainSubtotalExclVat : mainSubtotalInclVat),
388
- className: 'fw-bold text-end pb-2'
223
+ text: (0, _helpers__.formatPrice)(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal),
224
+ className: 'cart__table-purchase-price text-end'
389
225
  }]
390
226
  })), accessoireProducts.length > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
391
227
  heading: 'Toebehoren'
@@ -394,7 +230,7 @@ const ProductCartSide = () => {
394
230
  const cartItem = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === product.articleNumber);
395
231
  const {
396
232
  purchasePrice,
397
- salesPriceInclVat
233
+ salesPrice
398
234
  } = getItemPrices(cartItem);
399
235
  const quantity = selectedExtras[product.articleNumber] || 1;
400
236
  return /*#__PURE__*/_react.default.createElement(_ProductTableEditableRow.default, {
@@ -404,7 +240,7 @@ const ProductCartSide = () => {
404
240
  imageId: (_product$images4 = product.images) === null || _product$images4 === void 0 ? void 0 : _product$images4[0]
405
241
  }) : _logoPrimary.default,
406
242
  extraCells: [{}, {
407
- text: (0, _helpers__.formatPrice)(isToggled ? purchasePrice * quantity : salesPriceInclVat * quantity),
243
+ text: (0, _helpers__.formatPrice)(isToggled ? purchasePrice * quantity : salesPrice * quantity),
408
244
  className: 'cart__table-purchase-price text-end'
409
245
  }],
410
246
  productAmount: selectedExtras[product.articleNumber],
@@ -427,64 +263,41 @@ const ProductCartSide = () => {
427
263
  }),
428
264
  isDisabled: false
429
265
  });
430
- }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
266
+ })), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
431
267
  isEditable: false,
432
268
  extraCells: [{}, {
433
269
  text: isToggled ? 'Subtotaal (excl. btw)' : 'Subtotaal (incl. btw)',
434
270
  className: 'fw-bold text-end pb-2'
435
271
  }, {
436
- text: (0, _helpers__.formatPrice)(isToggled ? accessoriesExclVat : accessoriesInclVat),
272
+ 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),
437
273
  className: 'fw-bold text-end pb-2'
438
274
  }]
439
- })), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
275
+ }), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
440
276
  rows: [[{}, {
441
277
  text: 'Producten (excl. btw)',
442
278
  className: 'text-end pt-2'
443
279
  }, {
444
- text: (0, _helpers__.formatPrice)(totalExclVat),
280
+ 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),
445
281
  className: 'text-end pt-2'
446
- }], ...(isToggled ? [[{}, {
447
- text: 'btw',
448
- className: 'text-end'
449
- }, {
450
- text: (0, _helpers__.formatPrice)(totalVat),
451
- className: 'text-end'
452
- }]] : []), [{}, {
453
- text: 'Totaal (incl. btw)',
454
- className: 'fw-bold text-end'
455
- }, {
456
- text: (0, _helpers__.formatPrice)(totalInclVat),
457
- className: 'fw-bold text-end'
458
- }]]
459
- }), (discountAmount || discountPercentage) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
460
- colSpan: "3",
461
- className: (0, _helpers__.withStyle)('pt-4 pb-2')
462
- }, /*#__PURE__*/_react.default.createElement("hr", null))), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
463
- rows: [[{}, {
464
- text: discountPercentage ? "Correctie (".concat(discountPercentage, "%)") : 'Correctie',
465
- className: 'text-end text-success'
466
- }, {
467
- text: "-".concat((0, _helpers__.formatPrice)(discountTotal)),
468
- className: 'text-end text-success'
469
282
  }], [{}, {
470
- text: 'Totaal na correctie (excl. btw)',
471
- className: 'text-end'
472
- }, {
473
- text: (0, _helpers__.formatPrice)(finalExclVat),
474
- className: 'text-end'
475
- }], ...(isToggled ? [[{}, {
476
283
  text: 'btw',
477
- className: 'text-end'
284
+ className: 'text-end pt-2'
285
+ }, {
286
+ text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalVatAfterDiscount),
287
+ className: 'text-end pt-2'
288
+ }], ...(totals !== null && totals !== void 0 && totals.discountInclVat && (totals === null || totals === void 0 ? void 0 : totals.discountExclVat) != 0 ? [[{}, {
289
+ text: 'Korting (incl. btw)',
290
+ className: 'text-end pt-2'
478
291
  }, {
479
- text: (0, _helpers__.formatPrice)(finalVat),
480
- className: 'text-end'
292
+ text: (0, _helpers__.formatPrice)(totals.discountInclVat),
293
+ className: 'text-end pt-2'
481
294
  }]] : []), [{}, {
482
- text: 'Totaal na correctie (incl. btw)',
483
- className: 'fw-bold text-end'
295
+ text: 'Totaal (incl. btw)',
296
+ className: 'text-end pt-2'
484
297
  }, {
485
- text: (0, _helpers__.formatPrice)(finalInclVat),
486
- className: 'fw-bold text-end'
298
+ text: isToggled ? (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceInclVat) : (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
299
+ className: 'text-end pt-2'
487
300
  }]]
488
- }))))));
301
+ })))));
489
302
  };
490
303
  var _default = exports.default = ProductCartSide;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.array.includes.js");
4
- require("core-js/modules/es.array.reduce.js");
5
4
  require("core-js/modules/es.json.stringify.js");
6
- require("core-js/modules/es.parse-float.js");
7
5
  require("core-js/modules/es.regexp.to-string.js");
8
6
  require("core-js/modules/es.string.includes.js");
9
7
  require("core-js/modules/es.weak-map.js");
@@ -11,7 +9,6 @@ require("core-js/modules/esnext.iterator.constructor.js");
11
9
  require("core-js/modules/esnext.iterator.filter.js");
12
10
  require("core-js/modules/esnext.iterator.find.js");
13
11
  require("core-js/modules/esnext.iterator.map.js");
14
- require("core-js/modules/esnext.iterator.reduce.js");
15
12
  require("core-js/modules/web.dom-collections.iterator.js");
16
13
  require("core-js/modules/es.weak-map.js");
17
14
  Object.defineProperty(exports, "__esModule", {
@@ -19,16 +16,13 @@ Object.defineProperty(exports, "__esModule", {
19
16
  });
20
17
  exports.default = void 0;
21
18
  require("core-js/modules/es.array.includes.js");
22
- require("core-js/modules/es.array.reduce.js");
23
19
  require("core-js/modules/es.json.stringify.js");
24
- require("core-js/modules/es.parse-float.js");
25
20
  require("core-js/modules/es.regexp.to-string.js");
26
21
  require("core-js/modules/es.string.includes.js");
27
22
  require("core-js/modules/esnext.iterator.constructor.js");
28
23
  require("core-js/modules/esnext.iterator.filter.js");
29
24
  require("core-js/modules/esnext.iterator.find.js");
30
25
  require("core-js/modules/esnext.iterator.map.js");
31
- require("core-js/modules/esnext.iterator.reduce.js");
32
26
  require("core-js/modules/web.dom-collections.iterator.js");
33
27
  var _react = _interopRequireWildcard(require("react"));
34
28
  var _logoPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-primary.png"));
@@ -84,7 +78,6 @@ const ProductCartTable = () => {
84
78
  const [{
85
79
  licensePlate,
86
80
  model,
87
- answers,
88
81
  durationAnswer,
89
82
  selectedTowbar,
90
83
  selectedCableset,
@@ -94,7 +87,8 @@ const ProductCartTable = () => {
94
87
  executionAnswer1,
95
88
  executionAnswer2,
96
89
  discountAmount,
97
- discountPercentage
90
+ discountPercentage,
91
+ selectedBranch
98
92
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
99
93
  const cartInput = (0, _product.validateCartInput)([{
100
94
  articleNumber: selectedCableset,
@@ -125,8 +119,13 @@ const ProductCartTable = () => {
125
119
  durationAnswer,
126
120
  selectBoardComputerUpdate: selectedBoardComputer != null,
127
121
  cart: JSON.stringify(cartInput || []),
122
+ branchId: isToggled ? selectedBranch : null,
123
+ discountAmount,
124
+ discountPercentage,
128
125
  formula
129
126
  });
127
+ console.log(totals);
128
+ const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === 'MC');
130
129
  let mainProducts = [];
131
130
  let accessoireProducts = [];
132
131
  if (products) {
@@ -165,191 +164,36 @@ const ProductCartTable = () => {
165
164
  return {
166
165
  purchasePrice: 0,
167
166
  salesPrice: 0,
168
- salesPriceInclVat: 0,
169
167
  margin: 0,
170
168
  marginPercentage: 0
171
169
  };
172
170
  }
173
171
  let purchasePrice = 0;
174
172
  let salesPrice = 0;
175
- let salesPriceInclVat = 0;
176
173
 
177
174
  // Get prices directly from product objects
178
175
  if (APP_CONFIG.internal) {
179
- var _product$locationPric, _product$consumerPric, _product$consumerPric2;
180
- purchasePrice = (product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.priceExclVat) || 0;
181
- salesPrice = (product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceExclVat) || 0;
182
- salesPriceInclVat = (product === null || product === void 0 || (_product$consumerPric2 = product.consumerPrices) === null || _product$consumerPric2 === void 0 ? void 0 : _product$consumerPric2.priceInclVat) || 0;
176
+ purchasePrice = cartItem !== null && cartItem !== void 0 && cartItem.locationTotal ? cartItem.locationTotal : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
177
+ salesPrice = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) / 1.21 || 0;
183
178
  } else {
184
179
  purchasePrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
185
180
  salesPrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
186
- salesPriceInclVat = (product === null || product === void 0 ? void 0 : product.price) || 0;
187
181
  }
188
182
  const margin = salesPrice - purchasePrice;
189
183
  const marginPercentage = purchasePrice ? margin / purchasePrice * 100 : 0;
190
184
  return {
191
185
  purchasePrice,
192
186
  salesPrice,
193
- salesPriceInclVat,
194
187
  margin,
195
188
  marginPercentage: Math.round(marginPercentage * 100) / 100
196
189
  };
197
190
  };
198
-
199
- // ===== MAIN PRODUCTS PRICING =====
200
- /**
201
- * Calculate sum of main products price (excluding montage) including VAT
202
- */
203
- const mainProductsInclVat = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
204
- if (mainProducts.find(product => product.articleNumber === item.articleNumber)) {
205
- const {
206
- salesPriceInclVat
207
- } = getItemPrices(item);
208
- return acc + salesPriceInclVat;
209
- }
210
- return acc;
211
- }, 0)) || 0;
212
-
213
- /**
214
- * Calculate sum of main products price (excluding montage) excluding VAT
215
- */
216
- const mainProductsExclVat = mainProductsInclVat / 1.21;
217
-
218
- /**
219
- * Calculate sum of main products purchase price (excluding montage)
220
- */
221
- const mainProductsPurchase = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
222
- if (mainProducts.find(product => product.articleNumber === item.articleNumber)) {
223
- const {
224
- purchasePrice
225
- } = getItemPrices(item);
226
- return acc + purchasePrice;
227
- }
228
- return acc;
229
- }, 0)) || 0;
230
-
231
- // ===== MONTAGE PRICING =====
232
- /**
233
- * Montage price including VAT
234
- */
235
- const montageInclVat = parseFloat(totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat) || 0;
236
-
237
- /**
238
- * Montage price excluding VAT
239
- */
240
- const montageExclVat = parseFloat(totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionExclVat) || 0;
241
-
242
- // ===== ACCESSORIES PRICING =====
243
- /**
244
- * Calculate sum of accessories price including VAT
245
- */
246
- const accessoriesInclVat = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
247
- if (accessoireProducts.find(product => product.articleNumber === item.articleNumber)) {
248
- const {
249
- salesPriceInclVat
250
- } = getItemPrices(item);
251
- const quantity = selectedExtras[item.articleNumber.toString()] || 1;
252
- return acc + salesPriceInclVat * quantity;
253
- }
254
- return acc;
255
- }, 0)) || 0;
256
-
257
- /**
258
- * Calculate sum of accessories price excluding VAT
259
- */
260
- const accessoriesExclVat = accessoriesInclVat / 1.21;
261
-
262
- /**
263
- * Calculate sum of accessories purchase price
264
- */
265
- const accessoriesPurchase = (cart === null || cart === void 0 ? void 0 : cart.reduce((acc, item) => {
266
- if (accessoireProducts.find(product => product.articleNumber === item.articleNumber)) {
267
- const {
268
- purchasePrice
269
- } = getItemPrices(item);
270
- const quantity = selectedExtras[item.articleNumber.toString()] || 1;
271
- return acc + purchasePrice * quantity;
272
- }
273
- return acc;
274
- }, 0)) || 0;
275
-
276
- // ===== SUBTOTALS =====
277
- /**
278
- * Subtotal for main products + montage including VAT
279
- */
280
- const mainSubtotalInclVat = APP_CONFIG.internal ? mainProductsInclVat + montageInclVat : totals.totalAfterDiscountInclVat;
281
-
282
- /**
283
- * Subtotal for main products + montage excluding VAT
284
- */
285
- const mainSubtotalExclVat = APP_CONFIG.internal ? mainProductsExclVat + montageExclVat : totals.totalAfterDiscountExclVat;
286
-
287
- // ===== TOTALS BEFORE DISCOUNT =====
288
- /**
289
- * Total purchase price (without montage)
290
- */
291
- const totalPurchase = mainProductsPurchase + accessoriesPurchase;
292
-
293
- /**
294
- * Total price excluding VAT
295
- */
296
-
297
- const totalExclVat = parseFloat(mainSubtotalExclVat) + accessoriesExclVat;
298
-
299
- /**
300
- * Total price including VAT
301
- */
302
-
303
- const totalInclVat = parseFloat(mainSubtotalInclVat) + accessoriesInclVat;
304
-
305
- /**
306
- * VAT amount
307
- */
308
- const totalVat = parseFloat(totalInclVat) - totalExclVat;
309
-
310
- // ===== DISCOUNT CALCULATIONS =====
311
- /**
312
- * Calculate discount amount
313
- */
314
- const getDiscountAmount = () => {
315
- if (discountPercentage) {
316
- return totalInclVat * discountPercentage / 100;
317
- }
318
- if (discountAmount) {
319
- return discountAmount;
320
- }
321
- return 0;
322
- };
323
- const discountTotal = getDiscountAmount();
324
- const discountExclVat = discountTotal / 1.21;
325
- const discountVat = discountTotal - discountExclVat;
326
-
327
- // ===== TOTALS AFTER DISCOUNT =====
328
- /**
329
- * Final price excluding VAT (after discount)
330
- */
331
- const finalExclVat = Math.max(0, totalExclVat - discountExclVat);
332
-
333
- /**
334
- * Final VAT amount (after discount)
335
- */
336
- const finalVat = Math.max(0, totalVat - discountVat);
337
-
338
- /**
339
- * Final price including VAT (after discount)
340
- */
341
- const finalInclVat = Math.max(0, totalInclVat - discountTotal);
342
-
343
- /**
344
- * Final purchase price after discount
345
- */
346
- const finalPurchase = Math.max(0, totalPurchase - discountExclVat * totalPurchase / totalExclVat);
347
191
  return /*#__PURE__*/_react.default.createElement("div", {
348
192
  className: (0, _helpers__.withStyle)("content col-lg")
349
193
  }, /*#__PURE__*/_react.default.createElement(_TogglableCard.default, {
350
194
  title: 'Overzicht',
351
- untoggleButton: "Verberg inkoopprijzen",
352
- toggleButton: "Toon inkoopprijzen",
195
+ untoggleButton: selectedBranch ? 'Verberg inkoopprijzen' : undefined,
196
+ toggleButton: selectedBranch ? 'Toon inkoopprijzen' : undefined,
353
197
  onToggle: toggled => setIsToggled(toggled)
354
198
  }, /*#__PURE__*/_react.default.createElement("table", {
355
199
  className: (0, _helpers__.withStyle)('cart__table table table-borderless align-middle')
@@ -375,7 +219,6 @@ const ProductCartTable = () => {
375
219
  const {
376
220
  purchasePrice,
377
221
  salesPrice,
378
- salesPriceInclVat,
379
222
  margin,
380
223
  marginPercentage
381
224
  } = getItemPrices(cartItem);
@@ -395,12 +238,12 @@ const ProductCartTable = () => {
395
238
  text: (0, _helpers__.formatPrice)(salesPrice),
396
239
  className: 'cart__table-price text-end'
397
240
  }] : [{}, {}, {
398
- text: salesPriceInclVat > 0 ? (0, _helpers__.formatPrice)(salesPriceInclVat) : '',
241
+ text: salesPrice > 0 ? (0, _helpers__.formatPrice)(salesPrice) : '',
399
242
  className: 'cart__table-price text-end'
400
243
  }])]
401
244
  });
402
245
  }), mainProducts && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
403
- productTitle: isToggled ? 'Montage + Marktcorrectie' : 'Montage',
246
+ productTitle: 'Montage',
404
247
  productImage: _montagePlaceholder.default,
405
248
  extraCells: [{}, {}, {}, ...(isToggled ? [{
406
249
  text: 'N.v.t.',
@@ -409,10 +252,26 @@ const ProductCartTable = () => {
409
252
  text: 'N.v.t.',
410
253
  className: 'cart__table-price text-end'
411
254
  }, {
412
- text: (0, _helpers__.formatPrice)(montageExclVat),
255
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat),
256
+ className: 'cart__table-price text-end'
257
+ }] : [{}, {}, {
258
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.montagePriceInclVat),
259
+ className: 'cart__table-price text-end'
260
+ }])]
261
+ }), isToggled && marketCorrection && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
262
+ productTitle: 'Marktcorrectie',
263
+ productImage: _montagePlaceholder.default,
264
+ extraCells: [{}, {}, {}, ...(isToggled ? [{
265
+ text: (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) > 0 ? "".concat((0, _helpers__.formatPrice)(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal), " (").concat(Math.round(((marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) - (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal)) / (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) * 100 * 100) / 100, "%)") : 'N.v.t.',
266
+ className: 'cart__table-price text-end'
267
+ }, {
268
+ text: (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) > 0 ? (0, _helpers__.formatPrice)(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) : 'N.v.t.',
269
+ className: 'cart__table-price text-end'
270
+ }, {
271
+ text: (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) > 0 ? (0, _helpers__.formatPrice)((marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) / 1.21) : 'N.v.t.',
413
272
  className: 'cart__table-price text-end'
414
273
  }] : [{}, {}, {
415
- text: (0, _helpers__.formatPrice)(montageInclVat),
274
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.montagePriceInclVat),
416
275
  className: 'cart__table-price text-end'
417
276
  }])]
418
277
  }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
@@ -432,13 +291,13 @@ const ProductCartTable = () => {
432
291
  text: 'Subtotaal (incl. btw)',
433
292
  className: 'fw-bold text-end pb-2'
434
293
  }]), ...(isToggled ? [{
435
- text: (0, _helpers__.formatPrice)(mainProductsPurchase),
294
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat),
436
295
  className: 'fw-bold text-end pb-2'
437
296
  }, {
438
- text: (0, _helpers__.formatPrice)(mainSubtotalExclVat),
297
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
439
298
  className: 'fw-bold text-end pb-2'
440
299
  }] : [{
441
- text: (0, _helpers__.formatPrice)(mainSubtotalInclVat),
300
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
442
301
  className: 'fw-bold text-end pb-2'
443
302
  }])]
444
303
  })), accessoireProducts.length > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
@@ -506,13 +365,13 @@ const ProductCartTable = () => {
506
365
  text: 'Subtotaal (incl. btw)',
507
366
  className: 'fw-bold text-end pb-2'
508
367
  }]), ...(isToggled ? [{
509
- text: (0, _helpers__.formatPrice)(accessoriesPurchase),
368
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
510
369
  className: 'fw-bold text-end pb-2'
511
370
  }, {
512
- text: (0, _helpers__.formatPrice)(accessoriesExclVat),
371
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
513
372
  className: 'fw-bold text-end pb-2'
514
373
  }] : [{
515
- text: (0, _helpers__.formatPrice)(accessoriesInclVat),
374
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountInclVat),
516
375
  className: 'fw-bold text-end pb-2'
517
376
  }])]
518
377
  })), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
@@ -526,13 +385,13 @@ const ProductCartTable = () => {
526
385
  text: 'Producten (excl. btw)',
527
386
  className: 'text-end pt-2'
528
387
  }]), ...(isToggled ? [{
529
- text: (0, _helpers__.formatPrice)(totalPurchase),
388
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat),
530
389
  className: 'text-end pt-2'
531
390
  }, {
532
- text: (0, _helpers__.formatPrice)(totalExclVat),
391
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
533
392
  className: 'text-end pt-2'
534
393
  }] : [{
535
- text: (0, _helpers__.formatPrice)(totalExclVat),
394
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat),
536
395
  className: 'text-end pt-2'
537
396
  }])], [{}, {}, {}, ...(isToggled ? [{
538
397
  text: '',
@@ -544,13 +403,13 @@ const ProductCartTable = () => {
544
403
  text: 'btw',
545
404
  className: 'text-end'
546
405
  }]), ...(isToggled ? [{
547
- text: (0, _helpers__.formatPrice)(totalVat / 1.21),
406
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationVat),
548
407
  className: 'text-end'
549
408
  }, {
550
- text: (0, _helpers__.formatPrice)(totalVat),
409
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalVatBeforeDiscount),
551
410
  className: 'text-end'
552
411
  }] : [{
553
- text: (0, _helpers__.formatPrice)(totalVat),
412
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalVatBeforeDiscount),
554
413
  className: 'text-end'
555
414
  }])], [{}, {}, {}, ...(isToggled ? [{
556
415
  text: '',
@@ -562,13 +421,13 @@ const ProductCartTable = () => {
562
421
  text: 'Totaal (incl. btw)',
563
422
  className: 'fw-bold text-end'
564
423
  }]), ...(isToggled ? [{
565
- text: (0, _helpers__.formatPrice)(totalPurchase + totalVat / 1.21),
424
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceInclVat),
566
425
  className: 'fw-bold text-end'
567
426
  }, {
568
- text: (0, _helpers__.formatPrice)(totalInclVat),
427
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountInclVat),
569
428
  className: 'fw-bold text-end'
570
429
  }] : [{
571
- text: (0, _helpers__.formatPrice)(totalInclVat),
430
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountInclVat),
572
431
  className: 'fw-bold text-end'
573
432
  }])]].filter(Boolean)
574
433
  }), (discountAmount || discountPercentage) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
@@ -588,7 +447,7 @@ const ProductCartTable = () => {
588
447
  text: discountPercentage ? "Correctie (".concat(discountPercentage, "%)") : 'Correctie',
589
448
  className: 'text-end text-success'
590
449
  }]), {
591
- text: "-".concat((0, _helpers__.formatPrice)(discountTotal)),
450
+ text: "-".concat((0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.discountInclVat)),
592
451
  className: 'text-end text-success'
593
452
  }], [{}, {}, {}, ...(isToggled ? [{
594
453
  text: '',
@@ -603,7 +462,7 @@ const ProductCartTable = () => {
603
462
  text: 'Totaal na correctie (excl. btw)',
604
463
  className: 'text-end'
605
464
  }]), {
606
- text: (0, _helpers__.formatPrice)(finalExclVat),
465
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
607
466
  className: 'text-end'
608
467
  }], [{}, {}, {}, ...(isToggled ? [{
609
468
  text: '',
@@ -618,7 +477,7 @@ const ProductCartTable = () => {
618
477
  text: 'Totaal na correctie (incl. btw)',
619
478
  className: 'fw-bold text-end'
620
479
  }]), {
621
- text: (0, _helpers__.formatPrice)(finalInclVat),
480
+ text: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
622
481
  className: 'fw-bold text-end'
623
482
  }]]
624
483
  })))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
@@ -813,6 +813,20 @@ const InternalAppointmentForm = _ref => {
813
813
  isRequired: true,
814
814
  label: "Huisnummer:",
815
815
  errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
816
+ }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
817
+ placeholder: "",
818
+ initialValue: customer.houseNumberAddition,
819
+ name: "houseNumberAddition",
820
+ onChange: value => dispatch({
821
+ type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_HOUSE_NUMBER_ADDITION,
822
+ payload: {
823
+ houseNumberAddition: value
824
+ }
825
+ }),
826
+ key: "houseNumberAddition",
827
+ isRequired: false,
828
+ label: "Huisnummer toevoeging:",
829
+ errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumberAddition']
816
830
  }), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
817
831
  placeholder: "",
818
832
  initialValue: customer.streetName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.115",
3
+ "version": "0.0.117",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",