thm-p3-configurator 0.0.305 → 0.0.307

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.
@@ -66,6 +66,7 @@ var _product = require("../__helpers__/product");
66
66
  var _useIsTmg = require("../__hooks__/useIsTmg");
67
67
  var _useIsTowmotive = require("../__hooks__/useIsTowmotive");
68
68
  var _InternalDiscountForm = _interopRequireDefault(require("./internal/InternalDiscountForm"));
69
+ var _InternalExtraPriceForm = _interopRequireDefault(require("./internal/InternalExtraPriceForm"));
69
70
  function _interopRequireDefault(e) {
70
71
  return e && e.__esModule ? e : {
71
72
  default: e
@@ -170,7 +171,8 @@ const ProductCartTable = () => {
170
171
  consumerDiscounts,
171
172
  touchedConsumerDiscounts,
172
173
  montageRate,
173
- isMontageTariffFixed
174
+ isMontageTariffFixed,
175
+ extraPriceAmount
174
176
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
175
177
 
176
178
  // Determine display mode
@@ -281,7 +283,8 @@ const ProductCartTable = () => {
281
283
  discountAmount,
282
284
  discountPercentage,
283
285
  formula,
284
- montageRate: (0, _montageRate.toApiMontageRate)(montageRate)
286
+ montageRate: (0, _montageRate.toApiMontageRate)(montageRate),
287
+ extraPriceAmount
285
288
  });
286
289
  const montageHours = Number(totals === null || totals === void 0 ? void 0 : totals.montageTime) || 0;
287
290
  const montageTotalExcl = Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0);
@@ -357,6 +360,18 @@ const ProductCartTable = () => {
357
360
 
358
361
  const cartLookup = (0, _react.useMemo)(() => cart ? Object.fromEntries(cart.map(item => [item.articleNumber, item])) : {}, [cart]);
359
362
  const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === _cartTable.MARKET_CORRECTION_ARTICLE_NUMBER);
363
+ const extraPriceItem = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === _cartTable.EXTRA_PRICE_ARTICLE_NUMBER);
364
+ const extraPriceValues = (0, _react.useMemo)(() => {
365
+ const consumerTotal = Number(extraPriceItem === null || extraPriceItem === void 0 ? void 0 : extraPriceItem.consumerTotal) || 0;
366
+ const hasValue = consumerTotal !== 0;
367
+ const salesIncl = consumerTotal;
368
+ const salesExcl = consumerTotal / _cartTable.VAT_RATE;
369
+ return {
370
+ salesIncl,
371
+ salesExcl,
372
+ hasValue
373
+ };
374
+ }, [extraPriceItem]);
360
375
  const marketCorrectionValues = (0, _react.useMemo)(() => {
361
376
  const purchaseExcl = Number(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) || 0;
362
377
  const salesIncl = (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.consumerTotal) != null ? Number(marketCorrection.consumerTotal) : Number(totals === null || totals === void 0 ? void 0 : totals.totalMarketCorrectionInclVat) || 0;
@@ -760,6 +775,30 @@ const ProductCartTable = () => {
760
775
  },
761
776
  defaultSubtotal: subtotals.accessories.inclVat
762
777
  }, showCatalogPrice)
778
+ })), extraPriceValues.hasValue && (isTowmotive || isTmg) && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
779
+ heading: "Meerprijs"
780
+ }, /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
781
+ productTitle: "Meerprijs",
782
+ productImage: _montagePlaceholder.default,
783
+ extraCells: (0, _cartTable2.getExtraPriceCells)(displayMode, {
784
+ salesIncl: extraPriceValues.salesIncl,
785
+ salesExcl: extraPriceValues.salesExcl
786
+ }, showCatalogPrice)
787
+ }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
788
+ isEditable: false,
789
+ extraCells: (0, _cartTable2.getSectionTotalCells)(displayMode, {
790
+ tmgSubtotals: {
791
+ catalog: 0,
792
+ margin: extraPriceValues.salesExcl,
793
+ purchase: 0,
794
+ sales: extraPriceValues.salesExcl
795
+ },
796
+ standardSubtotals: {
797
+ purchase: 0,
798
+ sales: extraPriceValues.salesExcl
799
+ },
800
+ defaultSubtotal: extraPriceValues.salesIncl
801
+ }, showCatalogPrice)
763
802
  })), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
764
803
  rows: [(0, _cartTable2.getTotalRowCells)(displayMode, {
765
804
  label: 'Producten (excl. btw)',
@@ -794,6 +833,6 @@ const ProductCartTable = () => {
794
833
  value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
795
834
  className: 'fw-bold text-end'
796
835
  }, showCatalogPrice)]
797
- })))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
836
+ })))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null), APP_CONFIG.internal && (isTowmotive || isTmg) && /*#__PURE__*/_react.default.createElement(_InternalExtraPriceForm.default, null)));
798
837
  };
799
838
  var _default = exports.default = ProductCartTable;