thm-p3-configurator 0.0.282 → 0.0.283

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.
@@ -461,14 +461,15 @@ const ProductCartTable = () => {
461
461
  const montageInclVat = !isToggled && APP_CONFIG.internal ? Number((totals === null || totals === void 0 ? void 0 : totals.montagePricePlusMarketCorrectionInclVat) || 0) : 0;
462
462
 
463
463
  // Main products excl VAT (for toggled standard mode)
464
- const mainExclVat = isToggled && !isTmg ? mainProducts.reduce((total, product) => {
464
+ // Use !useTmgDisplayMode to match the display mode logic (isTmg && !isTowFormula)
465
+ const mainExclVat = isToggled && !useTmgDisplayMode ? mainProducts.reduce((total, product) => {
465
466
  const {
466
467
  salesPrice
467
468
  } = product.priceInfo || {};
468
469
  return salesPrice > 0 ? total + Number(salesPrice) : total;
469
470
  }, 0) : 0;
470
- const montageExclVat = isToggled && !isTmg ? Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) : 0;
471
- const marketCorrectionExclVat = isToggled && !isTmg && marketCorrectionValues.hasValue ? marketCorrectionValues.salesExcl : 0;
471
+ const montageExclVat = isToggled && !useTmgDisplayMode ? Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) : 0;
472
+ const marketCorrectionExclVat = isToggled && !useTmgDisplayMode && marketCorrectionValues.hasValue ? marketCorrectionValues.salesExcl : 0;
472
473
 
473
474
  // TMG subtotals
474
475
  const tmgCatalog = isTmg ? mainProducts.reduce((t, p) => {
@@ -519,7 +520,7 @@ const ProductCartTable = () => {
519
520
  }
520
521
  }
521
522
  };
522
- }, [mainProducts, accessoireProducts, marketCorrectionValues, isToggled, isTmg, totals]);
523
+ }, [mainProducts, accessoireProducts, marketCorrectionValues, isToggled, isTmg, useTmgDisplayMode, totals]);
523
524
 
524
525
  // ============================================================================
525
526
  // RENDER HELPERS
@@ -78,9 +78,9 @@ const getCartTableHeaderColumns = exports.getCartTableHeaderColumns = function g
78
78
  const baseColumns = [{}, {}, {}, {}];
79
79
  switch (displayMode) {
80
80
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
81
+ // THC: Inkoopprijs - Marge - Verkoopprijs ex BTW (no catalog price)
82
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs ex BTW
83
+ return [...baseColumns, textCell('Inkoopprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Marge (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS), ...(showCatalogPrice ? [textCell('Catalogprijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
84
84
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
85
85
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs ex BTW
86
86
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs ex BTW
@@ -131,7 +131,7 @@ const getMainProductCells = _ref => {
131
131
  const baseCells = [vehicleCodingInputCell, {}, {}];
132
132
  switch (displayMode) {
133
133
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
134
+ 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)] : []), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
135
135
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
136
136
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
137
137
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
@@ -177,7 +177,7 @@ const getAccessoryProductCells = _ref2 => {
177
177
  const baseCells = [{}, {}, {}];
178
178
  switch (displayMode) {
179
179
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
180
+ 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)] : []), textCell(salesPrice > 0 ? (0, _index.formatPrice)(salesPrice) : 'N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)];
181
181
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
182
182
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
183
183
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
@@ -214,9 +214,9 @@ const getMontageCells = exports.getMontageCells = function getMontageCells(displ
214
214
  const nvt = textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS);
215
215
  switch (displayMode) {
216
216
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
217
- // THC: Marge - Inkoopprijs - Verkoopprijs (no catalog price)
218
- // Towmotive: Catalogprijs - Marge - Inkoopprijs - Verkoopprijs
219
- return [...baseCells, ...(showCatalogPrice ? [nvt] : []), nvt, nvt, priceOverride || priceCell(montagePrice)];
217
+ // THC: Inkoopprijs - Marge - Verkoopprijs (no catalog price)
218
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
219
+ return [...baseCells, nvt, nvt, ...(showCatalogPrice ? [nvt] : []), priceOverride || priceCell(montagePrice)];
220
220
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
221
221
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
222
222
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
@@ -247,9 +247,9 @@ const getMarketCorrectionCells = exports.getMarketCorrectionCells = function get
247
247
  const baseCells = [{}, {}, {}];
248
248
  switch (displayMode) {
249
249
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
250
+ // THC: Inkoopprijs - Marge - Verkoopprijs (no catalog price)
251
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
252
+ return [...baseCells, priceCell(purchaseExcl), priceCell(margin), ...(showCatalogPrice ? [textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)] : []), priceCell(salesExcl)];
253
253
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
254
254
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
255
255
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
@@ -279,13 +279,21 @@ const getSectionTotalCells = exports.getSectionTotalCells = function getSectionT
279
279
  const baseCells = [{}, {}];
280
280
  switch (displayMode) {
281
281
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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')];
282
+ // THC: Inkoopprijs - Marge - Verkoopprijs (no catalog price)
283
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
284
+ return [...baseCells, {}, {}, priceCell(tmgSubtotals.purchase, _cartTable.CART_TABLE_BOLD_END_CLASS), priceCell(tmgSubtotals.margin, _cartTable.CART_TABLE_BOLD_END_CLASS), ...(showCatalogPrice ? [priceCell(tmgSubtotals.catalog, _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), textCell((0, _index.formatPrice)(tmgSubtotals.sales), 'fw-bold text-end pb-2')];
285
285
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
286
286
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
287
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')];
288
+ return [...baseCells, emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS), textCell('Subtotaal inkoopprijs', _cartTable.CART_TABLE_BOLD_END_CLASS), textCell((0, _index.formatPrice)(standardSubtotals.purchase), 'fw-bold text-end pb-2'),
289
+ // Marge column (no subtotal value)
290
+ emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS),
291
+ // Catalogusprijs column (only present for Towmotive)
292
+ ...(showCatalogPrice ? [emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS)] : []),
293
+ // Korting column: show subtotal label for sales
294
+ textCell('Subtotaal (excl. btw)', 'fw-bold text-end pb-2'),
295
+ // Verkoopprijs column: show subtotal sales value
296
+ textCell((0, _index.formatPrice)(standardSubtotals.sales), 'fw-bold text-end pb-2')];
289
297
  case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
290
298
  default:
291
299
  return [...baseCells, {}, {}, {}, textCell('Subtotaal (incl. btw)', 'fw-bold text-end pb-2'), textCell((0, _index.formatPrice)(defaultSubtotal), 'fw-bold text-end pb-2')];
@@ -314,9 +322,9 @@ const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(di
314
322
  const baseCells = [{}, {}, {}];
315
323
  switch (displayMode) {
316
324
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
325
+ // THC: Inkoopprijs - Marge - Verkoopprijs (no catalog price)
326
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
327
+ return [...baseCells, {}, textCell(label, className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
320
328
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
321
329
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
322
330
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
@@ -347,9 +355,9 @@ const getDiscountRowCells = exports.getDiscountRowCells = function getDiscountRo
347
355
  const baseCells = [{}, {}, {}];
348
356
  switch (displayMode) {
349
357
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
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)];
358
+ // THC: Inkoopprijs - Marge - Verkoopprijs (no catalog price)
359
+ // Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
360
+ return [...baseCells, {}, emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell(label, className), textCell(value, className)];
353
361
  case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
354
362
  // THC: Inkoopprijs - Marge - Korting% - Verkoopprijs
355
363
  // Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.282",
3
+ "version": "0.0.283",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",