thm-p3-configurator 0.0.271 → 0.0.273

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.
@@ -70,11 +70,11 @@ const App = () => {
70
70
  (0, _Experiments.default)();
71
71
  });
72
72
  return /*#__PURE__*/_react.default.createElement(_SentryWrapper.default, null, /*#__PURE__*/_react.default.createElement(_FormulaContext.FormulaController, {
73
- defaultFormula: _constants__.CONFIGURATOR_FORMULAS.THM
73
+ defaultFormula: _constants__.CONFIGURATOR_FORMULAS.THC
74
74
  }, /*#__PURE__*/_react.default.createElement(_CountryContext.CountryController, {
75
75
  defaultCountry: APP_CONFIG.country
76
76
  }, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
77
77
  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), /*#__PURE__*/_react.default.createElement(_pages__.default, null))))))))));
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
79
  };
80
80
  var _default = exports.default = App;
@@ -241,7 +241,7 @@ const ProductCartTable = () => {
241
241
  return;
242
242
  }
243
243
  const parsed = Number.parseFloat(sanitized);
244
- const clamped = parsed === null || Number.isNaN(parsed) ? null : Math.min(100, Math.max(0, parsed));
244
+ const clamped = parsed === null || Number.isNaN(parsed) ? null : Math.max(0, parsed);
245
245
  dispatch({
246
246
  type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
247
247
  payload: {
@@ -276,7 +276,7 @@ const ProductCartTable = () => {
276
276
  discountAmount,
277
277
  discountPercentage,
278
278
  formula,
279
- montageRate: montageRate !== null && montageRate !== void 0 ? montageRate : undefined
279
+ montageRate: montageRate !== null && montageRate !== undefined ? montageRate / 100 : undefined
280
280
  });
281
281
  const montageHours = Number(totals === null || totals === void 0 ? void 0 : totals.montageTime) || 0;
282
282
  const montageTotalExcl = Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0);
@@ -304,7 +304,7 @@ const ProductCartTable = () => {
304
304
  dispatch({
305
305
  type: _OrderSessionContext.orderSessionActions.SET_MONTAGE_RATE,
306
306
  payload: {
307
- montageRate: numericRate
307
+ montageRate: numericRate * 100
308
308
  }
309
309
  });
310
310
  }
@@ -554,10 +554,9 @@ const ProductCartTable = () => {
554
554
  label: "Montage tarief",
555
555
  className: "mb-0",
556
556
  name: "montage-rate",
557
- placeholder: "0.0 - 100.0",
557
+ placeholder: "0.0",
558
558
  value: montageRate === null || montageRate === undefined ? '' : montageRate.toString(),
559
559
  min: 0,
560
- max: 100,
561
560
  step: "0.1",
562
561
  isRequired: false,
563
562
  isDisabled: isMontageTariffFixed,
@@ -573,7 +572,8 @@ const ProductCartTable = () => {
573
572
  if (isLoadingProducts) {
574
573
  return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
575
574
  }
576
- const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode);
575
+ const showCatalogPrice = !isThc;
576
+ const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode, showCatalogPrice);
577
577
  const montageRateInputCell = isThc ? {} : {
578
578
  text: renderMontageRateInput(),
579
579
  className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
@@ -626,6 +626,7 @@ const ProductCartTable = () => {
626
626
  discountInputCell: discountInputCellMain,
627
627
  vehicleCodingInputCell,
628
628
  isVehicleCodingProduct,
629
+ showCatalogPrice,
629
630
  treatZeroPurchaseAsNvt: Boolean(isBoardComputerProduct)
630
631
  })
631
632
  });
@@ -633,11 +634,11 @@ const ProductCartTable = () => {
633
634
  productTitle: "Montage",
634
635
  productSubtitle: (0, _helpers__.formatMontageTime)(totals === null || totals === void 0 ? void 0 : totals.montageTime),
635
636
  productImage: _montagePlaceholder.default,
636
- extraCells: (0, _cartTable2.getMontageCells)(displayMode, totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat, totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat, montageRateCellOverrides)
637
+ extraCells: (0, _cartTable2.getMontageCells)(displayMode, totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat, totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat, montageRateCellOverrides, showCatalogPrice)
637
638
  }), isToggled && marketCorrectionValues.hasValue && /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
638
639
  productTitle: "Marktcorrectie",
639
640
  productImage: _montagePlaceholder.default,
640
- extraCells: (0, _cartTable2.getMarketCorrectionCells)(displayMode, marketCorrectionValues)
641
+ extraCells: (0, _cartTable2.getMarketCorrectionCells)(displayMode, marketCorrectionValues, showCatalogPrice)
641
642
  }), /*#__PURE__*/_react.default.createElement(_ProductTableSectionTotal.default, {
642
643
  isEditable: true,
643
644
  editLabel: "Wijzig je trekhaakpakket",
@@ -649,7 +650,7 @@ const ProductCartTable = () => {
649
650
  sales: subtotals.main.exclVat
650
651
  },
651
652
  defaultSubtotal: subtotals.main.inclVat
652
- })
653
+ }, showCatalogPrice)
653
654
  })), accessoireProducts.length > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
654
655
  heading: "Toebehoren"
655
656
  }, accessoireProducts.map(product => {
@@ -674,7 +675,8 @@ const ProductCartTable = () => {
674
675
  extraCells: (0, _cartTable2.getAccessoryProductCells)({
675
676
  displayMode,
676
677
  priceInfo: product.priceInfo,
677
- discountInputCell: discountInputCellAccessory
678
+ discountInputCell: discountInputCellAccessory,
679
+ showCatalogPrice
678
680
  }),
679
681
  productAmount: selectedExtras[product.articleNumber],
680
682
  onEdit: value => {
@@ -704,24 +706,24 @@ const ProductCartTable = () => {
704
706
  sales: totals === null || totals === void 0 ? void 0 : totals.totalExtrasExclVat
705
707
  },
706
708
  defaultSubtotal: APP_CONFIG.internal ? totals === null || totals === void 0 ? void 0 : totals.totalExtrasInclVat : (totals === null || totals === void 0 ? void 0 : totals.totalExtrasExclVat) * _cartTable.VAT_RATE
707
- })
709
+ }, showCatalogPrice)
708
710
  })), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
709
711
  rows: [(0, _cartTable2.getTotalRowCells)(displayMode, {
710
712
  label: 'Producten (excl. btw)',
711
713
  locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat,
712
714
  consumerValue: isToggled ? totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat : totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat,
713
715
  className: 'text-end pt-2'
714
- }), (0, _cartTable2.getTotalRowCells)(displayMode, {
716
+ }, showCatalogPrice), (0, _cartTable2.getTotalRowCells)(displayMode, {
715
717
  label: 'btw',
716
718
  locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationVat,
717
719
  consumerValue: isToggled ? totals === null || totals === void 0 ? void 0 : totals.totalVatBeforeDiscount : totals === null || totals === void 0 ? void 0 : totals.totalVatAfterDiscount,
718
720
  className: 'text-end'
719
- }), (0, _cartTable2.getTotalRowCells)(displayMode, {
721
+ }, showCatalogPrice), (0, _cartTable2.getTotalRowCells)(displayMode, {
720
722
  label: 'Totaal (incl. btw)',
721
723
  locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceInclVat,
722
724
  consumerValue: isToggled ? totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountInclVat : APP_CONFIG.internal ? totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountInclVat : totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat,
723
725
  className: 'fw-bold text-end'
724
- })]
726
+ }, showCatalogPrice)]
725
727
  }), (discountAmount || discountPercentage) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
726
728
  colSpan: "10",
727
729
  className: (0, _helpers__.withStyle)('pt-4 pb-2')
@@ -730,15 +732,15 @@ const ProductCartTable = () => {
730
732
  label: discountPercentage ? "Correctie (".concat(discountPercentage, "%)") : 'Correctie',
731
733
  value: "-".concat((0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.discountInclVat)),
732
734
  className: 'text-end text-success'
733
- }), (0, _cartTable2.getDiscountRowCells)(displayMode, {
735
+ }, showCatalogPrice), (0, _cartTable2.getDiscountRowCells)(displayMode, {
734
736
  label: 'Totaal na correctie (excl. btw)',
735
737
  value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
736
738
  className: 'text-end'
737
- }), (0, _cartTable2.getDiscountRowCells)(displayMode, {
739
+ }, showCatalogPrice), (0, _cartTable2.getDiscountRowCells)(displayMode, {
738
740
  label: 'Totaal na correctie (incl. btw)',
739
741
  value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
740
742
  className: 'fw-bold text-end'
741
- })]
743
+ }, showCatalogPrice)]
742
744
  })))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
743
745
  };
744
746
  var _default = exports.default = ProductCartTable;
@@ -70,15 +70,21 @@ const emptyCells = exports.emptyCells = function emptyCells(count) {
70
70
  /**
71
71
  * Get table header columns based on display mode
72
72
  * @param {string} displayMode - The current display mode
73
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
73
74
  * @returns {Array} Array of column configuration objects
74
75
  */
75
- const getCartTableHeaderColumns = displayMode => {
76
+ const getCartTableHeaderColumns = exports.getCartTableHeaderColumns = function getCartTableHeaderColumns(displayMode) {
77
+ let showCatalogPrice = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
76
78
  const baseColumns = [{}, {}, {}, {}];
77
79
  switch (displayMode) {
78
80
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
79
- return [...baseColumns, textCell('Catalogprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Marge (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Inkoopprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
81
+ // THC: Marge - Inkoopprijs - Verkoopprijs ex BTW (no catalog price)
82
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs ex BTW
83
+ return [...baseColumns, ...(showCatalogPrice ? [textCell('Catalogprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), textCell('Marge (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Inkoopprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
80
84
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
81
- return [...baseColumns, textCell('Inkoopprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Marge (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Catalogusprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Korting (%)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
85
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs ex BTW
86
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs ex BTW
87
+ return [...baseColumns, textCell('Inkoopprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Marge (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), ...(showCatalogPrice ? [textCell('Catalogusprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), textCell('Korting (%)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
82
88
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
83
89
  default:
84
90
  return [...baseColumns, {}, {}, textCell('Verkoop Prijs (incl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
@@ -97,9 +103,9 @@ const getCartTableHeaderColumns = displayMode => {
97
103
  * @param {Object} params.discountInputCell - Discount input cell (or empty)
98
104
  * @param {Object} params.vehicleCodingInputCell - Vehicle coding input cell (or empty)
99
105
  * @param {boolean} params.isVehicleCodingProduct - Whether this is a vehicle coding product
106
+ * @param {boolean} params.showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
100
107
  * @returns {Array} Array of cell configuration objects
101
108
  */
102
- exports.getCartTableHeaderColumns = getCartTableHeaderColumns;
103
109
  const getMainProductCells = _ref => {
104
110
  let {
105
111
  displayMode,
@@ -107,6 +113,7 @@ const getMainProductCells = _ref => {
107
113
  discountInputCell,
108
114
  vehicleCodingInputCell,
109
115
  isVehicleCodingProduct,
116
+ showCatalogPrice = false,
110
117
  treatZeroPurchaseAsNvt = false
111
118
  } = _ref;
112
119
  const {
@@ -124,9 +131,11 @@ const getMainProductCells = _ref => {
124
131
  const baseCells = [vehicleCodingInputCell, {}, {}];
125
132
  switch (displayMode) {
126
133
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
127
- return [...baseCells, priceCell(catalogPriceExcl), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
134
+ return [...baseCells, ...(showCatalogPrice ? [priceCell(catalogPriceExcl)] : []), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
128
135
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
129
- return [...baseCells, textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(catalogPriceExcl), discountInputCell, priceCell(salesPrice)];
136
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
137
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
138
+ return [...baseCells, textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), ...(showCatalogPrice ? [priceCell(catalogPriceExcl)] : []), discountInputCell, priceCell(salesPrice)];
130
139
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
131
140
  default:
132
141
  {
@@ -142,6 +151,7 @@ const getMainProductCells = _ref => {
142
151
  * @param {string} params.displayMode - Current display mode
143
152
  * @param {Object} params.priceInfo - Price information for the product
144
153
  * @param {Object} params.discountInputCell - Discount input cell (or empty)
154
+ * @param {boolean} params.showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
145
155
  * @returns {Array} Array of cell configuration objects
146
156
  */
147
157
  exports.getMainProductCells = getMainProductCells;
@@ -149,7 +159,8 @@ const getAccessoryProductCells = _ref2 => {
149
159
  let {
150
160
  displayMode,
151
161
  priceInfo,
152
- discountInputCell
162
+ discountInputCell,
163
+ showCatalogPrice = false
153
164
  } = _ref2;
154
165
  const {
155
166
  purchasePrice,
@@ -166,9 +177,11 @@ const getAccessoryProductCells = _ref2 => {
166
177
  const baseCells = [{}, {}, {}];
167
178
  switch (displayMode) {
168
179
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
169
- return [...baseCells, priceCell(catalogPriceExcl), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
180
+ return [...baseCells, ...(showCatalogPrice ? [priceCell(catalogPriceExcl)] : []), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
170
181
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
171
- return [...baseCells, textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(catalogPriceExcl), discountInputCell, priceCell(salesPrice)];
182
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
183
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
184
+ return [...baseCells, textCell(shouldShowPurchasePrice ? (0, _index.formatPrice)(purchasePrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), textCell(hasLocationTotal ? (0, _index.formatPrice)(margin) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), ...(showCatalogPrice ? [priceCell(catalogPriceExcl)] : []), discountInputCell, priceCell(salesPrice)];
172
185
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
173
186
  default:
174
187
  {
@@ -186,11 +199,13 @@ const getAccessoryProductCells = _ref2 => {
186
199
  * @param {Object} overrides - Optional overrides for discount/price cells
187
200
  * @param {Object} overrides.discountCell - Override cell for discount column (toggled standard)
188
201
  * @param {Object} overrides.priceCell - Override cell for price column
202
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
189
203
  * @returns {Array} Array of cell configuration objects
190
204
  */
191
205
  exports.getAccessoryProductCells = getAccessoryProductCells;
192
206
  const getMontageCells = exports.getMontageCells = function getMontageCells(displayMode, montagePrice, montagePriceInclVat) {
193
207
  let overrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
208
+ let showCatalogPrice = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
194
209
  const {
195
210
  discountCell: discountOverride,
196
211
  priceCell: priceOverride
@@ -199,9 +214,13 @@ const getMontageCells = exports.getMontageCells = function getMontageCells(displ
199
214
  const nvt = textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS);
200
215
  switch (displayMode) {
201
216
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
202
- return [...baseCells, nvt, nvt, nvt, priceOverride || priceCell(montagePrice)];
217
+ // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
218
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
219
+ return [...baseCells, ...(showCatalogPrice ? [nvt] : []), nvt, nvt, priceOverride || priceCell(montagePrice)];
203
220
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
204
- return [...baseCells, nvt, nvt, nvt, discountOverride || emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceOverride || priceCell(montagePrice)];
221
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
222
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
223
+ return [...baseCells, nvt, nvt, ...(showCatalogPrice ? [nvt] : []), discountOverride || emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceOverride || priceCell(montagePrice)];
205
224
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
206
225
  default:
207
226
  return [discountOverride || {}, {}, {}, {}, {}, priceOverride || priceCell(montagePriceInclVat)];
@@ -215,20 +234,26 @@ const getMontageCells = exports.getMontageCells = function getMontageCells(displ
215
234
  * @param {number} values.purchaseExcl - Purchase price excl VAT
216
235
  * @param {number} values.margin - Margin
217
236
  * @param {number} values.salesExcl - Sales price excl VAT
237
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
218
238
  * @returns {Array} Array of cell configuration objects
219
239
  */
220
- const getMarketCorrectionCells = (displayMode, _ref3) => {
240
+ const getMarketCorrectionCells = exports.getMarketCorrectionCells = function getMarketCorrectionCells(displayMode, _ref3) {
221
241
  let {
222
242
  purchaseExcl,
223
243
  margin,
224
244
  salesExcl
225
245
  } = _ref3;
246
+ let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
226
247
  const baseCells = [{}, {}, {}];
227
248
  switch (displayMode) {
228
249
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
229
- return [...baseCells, textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(margin), priceCell(purchaseExcl), priceCell(salesExcl)];
250
+ // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
251
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
252
+ return [...baseCells, ...(showCatalogPrice ? [textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)] : []), priceCell(margin), priceCell(purchaseExcl), priceCell(salesExcl)];
230
253
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
231
- return [...baseCells, priceCell(purchaseExcl), priceCell(margin), textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS), emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(salesExcl)];
254
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
255
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
256
+ return [...baseCells, priceCell(purchaseExcl), priceCell(margin), ...(showCatalogPrice ? [textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)] : []), emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceCell(salesExcl)];
232
257
  default:
233
258
  return baseCells;
234
259
  }
@@ -241,21 +266,26 @@ const getMarketCorrectionCells = (displayMode, _ref3) => {
241
266
  * @param {Object} params.tmgSubtotals - TMG subtotals
242
267
  * @param {Object} params.standardSubtotals - Standard subtotals
243
268
  * @param {number} params.defaultSubtotal - Default subtotal
269
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
244
270
  * @returns {Array} Array of cell configuration objects
245
271
  */
246
- exports.getMarketCorrectionCells = getMarketCorrectionCells;
247
- const getSectionTotalCells = (displayMode, _ref4) => {
272
+ const getSectionTotalCells = exports.getSectionTotalCells = function getSectionTotalCells(displayMode, _ref4) {
248
273
  let {
249
274
  tmgSubtotals,
250
275
  standardSubtotals,
251
276
  defaultSubtotal
252
277
  } = _ref4;
278
+ let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
253
279
  const baseCells = [{}, {}];
254
280
  switch (displayMode) {
255
281
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
256
- return [...baseCells, {}, {}, priceCell(tmgSubtotals.catalog, _cartTable.CART_TABLE_BOLD_END_CLASS), priceCell(tmgSubtotals.margin, _cartTable.CART_TABLE_BOLD_END_CLASS), priceCell(tmgSubtotals.purchase, _cartTable.CART_TABLE_BOLD_END_CLASS), textCell((0, _index.formatPrice)(tmgSubtotals.sales), 'fw-bold text-end pb-2')];
282
+ // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
283
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
284
+ return [...baseCells, {}, {}, ...(showCatalogPrice ? [priceCell(tmgSubtotals.catalog, _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), priceCell(tmgSubtotals.margin, _cartTable.CART_TABLE_BOLD_END_CLASS), priceCell(tmgSubtotals.purchase, _cartTable.CART_TABLE_BOLD_END_CLASS), textCell((0, _index.formatPrice)(tmgSubtotals.sales), 'fw-bold text-end pb-2')];
257
285
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
258
- return [...baseCells, emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Subtotaal inkoopprijs', _cartTable.CART_TABLE_BOLD_END_CLASS), emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Subtotaal (excl. btw)', 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(standardSubtotals.purchase), 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(standardSubtotals.sales), 'fw-bold text-end pb-2')];
286
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
287
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
288
+ return [...baseCells, emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Subtotaal inkoopprijs', _cartTable.CART_TABLE_BOLD_END_CLASS), ...(showCatalogPrice ? [emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS)] : []), emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Subtotaal (excl. btw)', 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(standardSubtotals.purchase), 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(standardSubtotals.sales), 'fw-bold text-end pb-2')];
259
289
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
260
290
  default:
261
291
  return [...baseCells, {}, {}, {}, textCell('Subtotaal (incl. btw)', 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(defaultSubtotal), 'fw-bold text-end pb-2')];
@@ -270,22 +300,27 @@ const getSectionTotalCells = (displayMode, _ref4) => {
270
300
  * @param {number} params.locationValue - Location price value
271
301
  * @param {number} params.consumerValue - Consumer price value
272
302
  * @param {string} params.className - CSS class for cells
303
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
273
304
  * @returns {Array} Array of cell configuration objects
274
305
  */
275
- exports.getSectionTotalCells = getSectionTotalCells;
276
- const getTotalRowCells = (displayMode, _ref5) => {
306
+ const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(displayMode, _ref5) {
277
307
  let {
278
308
  label,
279
309
  locationValue,
280
310
  consumerValue,
281
311
  className = 'text-end'
282
312
  } = _ref5;
313
+ let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
283
314
  const baseCells = [{}, {}, {}];
284
315
  switch (displayMode) {
285
316
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
286
- return [...baseCells, {}, emptyCell(className), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
317
+ // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
318
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
319
+ return [...baseCells, {}, ...(showCatalogPrice ? [emptyCell(className)] : []), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
287
320
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
288
- return [...baseCells, emptyCell(className), emptyCell(className), emptyCell(className), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
321
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
322
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
323
+ return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
289
324
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
290
325
  default:
291
326
  return [...baseCells, {}, {}, textCell(label, className), textCell((0, _index.formatPrice)(consumerValue), className)];
@@ -299,24 +334,28 @@ const getTotalRowCells = (displayMode, _ref5) => {
299
334
  * @param {string} params.label - Row label
300
335
  * @param {string} params.value - Formatted value string
301
336
  * @param {string} params.className - CSS class for cells
337
+ * @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
302
338
  * @returns {Array} Array of cell configuration objects
303
339
  */
304
- exports.getTotalRowCells = getTotalRowCells;
305
- const getDiscountRowCells = (displayMode, _ref6) => {
340
+ const getDiscountRowCells = exports.getDiscountRowCells = function getDiscountRowCells(displayMode, _ref6) {
306
341
  let {
307
342
  label,
308
343
  value,
309
344
  className = 'text-end'
310
345
  } = _ref6;
346
+ let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
311
347
  const baseCells = [{}, {}, {}];
312
348
  switch (displayMode) {
313
349
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
314
- return [...baseCells, {}, emptyCell(className), emptyCell(className), textCell(label, className), textCell(value, className)];
350
+ // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
351
+ // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
352
+ return [...baseCells, {}, ...(showCatalogPrice ? [emptyCell(className)] : []), emptyCell(className), textCell(label, className), textCell(value, className)];
315
353
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
316
- return [...baseCells, emptyCell(className), emptyCell(className), emptyCell(className), emptyCell(className), textCell(label, className), textCell(value, className)];
354
+ // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
355
+ // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
356
+ return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), emptyCell(className), textCell(label, className), textCell(value, className)];
317
357
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
318
358
  default:
319
359
  return [...baseCells, {}, {}, textCell(label, className), textCell(value, className)];
320
360
  }
321
- };
322
- exports.getDiscountRowCells = getDiscountRowCells;
361
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.271",
3
+ "version": "0.0.273",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",