thm-p3-configurator 0.0.285 → 0.0.287
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.
|
@@ -173,7 +173,9 @@ const ProductCartTable = () => {
|
|
|
173
173
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
174
174
|
|
|
175
175
|
// Determine display mode
|
|
176
|
-
|
|
176
|
+
// THC users who cannot edit discounts should use TMG display mode (no Korting column)
|
|
177
|
+
const canEditDiscounts = isTowmotive || isTowFormula;
|
|
178
|
+
const useTmgDisplayMode = isTmg && !isTowFormula || isThc && !canEditDiscounts;
|
|
177
179
|
const displayMode = (0, _cartTable2.getCartTableDisplayMode)(isToggled, useTmgDisplayMode);
|
|
178
180
|
const handleVehicleCodingDiscountChange = function handleVehicleCodingDiscountChange(value) {
|
|
179
181
|
let articleNumber = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -366,8 +368,9 @@ const ProductCartTable = () => {
|
|
|
366
368
|
};
|
|
367
369
|
}
|
|
368
370
|
|
|
369
|
-
// TMG case
|
|
370
|
-
|
|
371
|
+
// TMG-style case (used for TOGGLED_TMG display mode)
|
|
372
|
+
// This provides more robust price calculations with proper fallbacks
|
|
373
|
+
if (useTmgDisplayMode && isToggled && product !== null && product !== void 0 && product.consumerPrices) {
|
|
371
374
|
var _product$locationPric, _ref, _ref2, _cartItem$consumerTot, _product$consumerPric;
|
|
372
375
|
const purchasePrice = locationTotal || Number((product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.priceExclVat) || 0);
|
|
373
376
|
const salesPriceRaw = (_ref = (_ref2 = (_cartItem$consumerTot = cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) !== null && _cartItem$consumerTot !== void 0 ? _cartItem$consumerTot : product === null || product === void 0 || (_product$consumerPric = product.consumerPrices) === null || _product$consumerPric === void 0 ? void 0 : _product$consumerPric.priceInclVat) !== null && _ref2 !== void 0 ? _ref2 : product === null || product === void 0 ? void 0 : product.price) !== null && _ref !== void 0 ? _ref : 0;
|
|
@@ -433,7 +436,7 @@ const ProductCartTable = () => {
|
|
|
433
436
|
mainProducts: rawMainProducts.map(enhanceProduct),
|
|
434
437
|
accessoireProducts: rawAccessoireProducts.map(enhanceProduct)
|
|
435
438
|
};
|
|
436
|
-
}, [products, selectedTowbar, selectedCombiset, selectedCableset, selectedBoardComputer, selectedExtras, cartLookup, consumerDiscounts,
|
|
439
|
+
}, [products, selectedTowbar, selectedCombiset, selectedCableset, selectedBoardComputer, selectedExtras, cartLookup, consumerDiscounts, useTmgDisplayMode, isToggled]);
|
|
437
440
|
|
|
438
441
|
// Calculate subtotals
|
|
439
442
|
const subtotals = (0, _react.useMemo)(() => {
|
|
@@ -471,30 +474,31 @@ const ProductCartTable = () => {
|
|
|
471
474
|
const montageExclVat = isToggled && !useTmgDisplayMode ? Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) : 0;
|
|
472
475
|
const marketCorrectionExclVat = isToggled && !useTmgDisplayMode && marketCorrectionValues.hasValue ? marketCorrectionValues.salesExcl : 0;
|
|
473
476
|
|
|
474
|
-
// TMG subtotals
|
|
475
|
-
|
|
477
|
+
// TMG-style subtotals (used for TOGGLED_TMG display mode)
|
|
478
|
+
// Calculate whenever useTmgDisplayMode is true (TMG users OR THC users without discount capability)
|
|
479
|
+
const tmgCatalog = useTmgDisplayMode ? mainProducts.reduce((t, p) => {
|
|
476
480
|
var _p$priceInfo2;
|
|
477
481
|
return t + Number((p === null || p === void 0 || (_p$priceInfo2 = p.priceInfo) === null || _p$priceInfo2 === void 0 ? void 0 : _p$priceInfo2.catalogPriceExcl) || 0);
|
|
478
482
|
}, 0) : 0;
|
|
479
|
-
const tmgMargin =
|
|
483
|
+
const tmgMargin = useTmgDisplayMode ? mainProducts.reduce((t, p) => {
|
|
480
484
|
var _p$priceInfo3;
|
|
481
485
|
return t + Number((p === null || p === void 0 || (_p$priceInfo3 = p.priceInfo) === null || _p$priceInfo3 === void 0 ? void 0 : _p$priceInfo3.margin) || 0);
|
|
482
486
|
}, 0) + (isToggled && marketCorrectionValues.hasValue ? marketCorrectionValues.margin : 0) : 0;
|
|
483
|
-
const tmgSales =
|
|
487
|
+
const tmgSales = useTmgDisplayMode ? mainProducts.reduce((t, p) => {
|
|
484
488
|
var _p$priceInfo4;
|
|
485
489
|
return t + Number((p === null || p === void 0 || (_p$priceInfo4 = p.priceInfo) === null || _p$priceInfo4 === void 0 ? void 0 : _p$priceInfo4.salesPrice) || 0);
|
|
486
490
|
}, 0) + Number((totals === null || totals === void 0 ? void 0 : totals.totalMontageExclVat) || 0) + (isToggled && marketCorrectionValues.hasValue ? marketCorrectionValues.salesExcl : 0) : 0;
|
|
487
491
|
|
|
488
|
-
// Accessories TMG subtotals
|
|
489
|
-
const accessoryTmgCatalog =
|
|
492
|
+
// Accessories TMG-style subtotals
|
|
493
|
+
const accessoryTmgCatalog = useTmgDisplayMode ? accessoireProducts.reduce((t, p) => {
|
|
490
494
|
var _p$priceInfo5;
|
|
491
495
|
return t + Number((p === null || p === void 0 || (_p$priceInfo5 = p.priceInfo) === null || _p$priceInfo5 === void 0 ? void 0 : _p$priceInfo5.catalogPriceExcl) || 0);
|
|
492
496
|
}, 0) : 0;
|
|
493
|
-
const accessoryTmgMargin =
|
|
497
|
+
const accessoryTmgMargin = useTmgDisplayMode ? accessoireProducts.reduce((t, p) => {
|
|
494
498
|
var _p$priceInfo6;
|
|
495
499
|
return t + Number((p === null || p === void 0 || (_p$priceInfo6 = p.priceInfo) === null || _p$priceInfo6 === void 0 ? void 0 : _p$priceInfo6.margin) || 0);
|
|
496
500
|
}, 0) : 0;
|
|
497
|
-
const accessoryTmgSales =
|
|
501
|
+
const accessoryTmgSales = useTmgDisplayMode ? accessoireProducts.reduce((t, p) => {
|
|
498
502
|
var _p$priceInfo7;
|
|
499
503
|
return t + Number((p === null || p === void 0 || (_p$priceInfo7 = p.priceInfo) === null || _p$priceInfo7 === void 0 ? void 0 : _p$priceInfo7.salesPrice) || 0);
|
|
500
504
|
}, 0) : 0;
|
|
@@ -520,7 +524,7 @@ const ProductCartTable = () => {
|
|
|
520
524
|
}
|
|
521
525
|
}
|
|
522
526
|
};
|
|
523
|
-
}, [mainProducts, accessoireProducts, marketCorrectionValues, isToggled,
|
|
527
|
+
}, [mainProducts, accessoireProducts, marketCorrectionValues, isToggled, useTmgDisplayMode, totals]);
|
|
524
528
|
|
|
525
529
|
// ============================================================================
|
|
526
530
|
// RENDER HELPERS
|
|
@@ -571,8 +575,7 @@ const ProductCartTable = () => {
|
|
|
571
575
|
// ============================================================================
|
|
572
576
|
|
|
573
577
|
const showCatalogPrice = !isThc;
|
|
574
|
-
const
|
|
575
|
-
const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode, showCatalogPrice, showDiscountColumn);
|
|
578
|
+
const headerColumns = (0, _cartTable2.getCartTableHeaderColumns)(displayMode, showCatalogPrice);
|
|
576
579
|
const montageRateInputCell = isThc ? {} : {
|
|
577
580
|
text: renderMontageRateInput(),
|
|
578
581
|
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
@@ -655,7 +658,7 @@ const ProductCartTable = () => {
|
|
|
655
658
|
sales: subtotals.main.exclVat
|
|
656
659
|
},
|
|
657
660
|
defaultSubtotal: subtotals.main.inclVat
|
|
658
|
-
}, showCatalogPrice
|
|
661
|
+
}, showCatalogPrice)
|
|
659
662
|
})), accessoireProducts.length > 0 && /*#__PURE__*/_react.default.createElement(_ProductTableSection.default, {
|
|
660
663
|
heading: "Toebehoren"
|
|
661
664
|
}, accessoireProducts.map(product => {
|
|
@@ -711,24 +714,24 @@ const ProductCartTable = () => {
|
|
|
711
714
|
sales: totals === null || totals === void 0 ? void 0 : totals.totalExtrasExclVat
|
|
712
715
|
},
|
|
713
716
|
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
|
|
714
|
-
}, showCatalogPrice
|
|
717
|
+
}, showCatalogPrice)
|
|
715
718
|
})), /*#__PURE__*/_react.default.createElement(_ProductTableTotal.default, {
|
|
716
719
|
rows: [(0, _cartTable2.getTotalRowCells)(displayMode, {
|
|
717
720
|
label: 'Producten (excl. btw)',
|
|
718
721
|
locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceExclVat,
|
|
719
722
|
consumerValue: isToggled ? totals === null || totals === void 0 ? void 0 : totals.totalBeforeDiscountExclVat : totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat,
|
|
720
723
|
className: 'text-end pt-2'
|
|
721
|
-
}, showCatalogPrice
|
|
724
|
+
}, showCatalogPrice), (0, _cartTable2.getTotalRowCells)(displayMode, {
|
|
722
725
|
label: 'btw',
|
|
723
726
|
locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationVat,
|
|
724
727
|
consumerValue: isToggled ? totals === null || totals === void 0 ? void 0 : totals.totalVatBeforeDiscount : totals === null || totals === void 0 ? void 0 : totals.totalVatAfterDiscount,
|
|
725
728
|
className: 'text-end'
|
|
726
|
-
}, showCatalogPrice
|
|
729
|
+
}, showCatalogPrice), (0, _cartTable2.getTotalRowCells)(displayMode, {
|
|
727
730
|
label: 'Totaal (incl. btw)',
|
|
728
731
|
locationValue: totals === null || totals === void 0 ? void 0 : totals.totalLocationPriceInclVat,
|
|
729
732
|
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,
|
|
730
733
|
className: 'fw-bold text-end'
|
|
731
|
-
}, showCatalogPrice
|
|
734
|
+
}, showCatalogPrice)]
|
|
732
735
|
}), (discountAmount || discountPercentage) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
|
|
733
736
|
colSpan: "10",
|
|
734
737
|
className: (0, _helpers__.withStyle)('pt-4 pb-2')
|
|
@@ -737,15 +740,15 @@ const ProductCartTable = () => {
|
|
|
737
740
|
label: discountPercentage ? "Correctie (".concat(discountPercentage, "%)") : 'Correctie',
|
|
738
741
|
value: "-".concat((0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.discountInclVat)),
|
|
739
742
|
className: 'text-end text-success'
|
|
740
|
-
}, showCatalogPrice
|
|
743
|
+
}, showCatalogPrice), (0, _cartTable2.getDiscountRowCells)(displayMode, {
|
|
741
744
|
label: 'Totaal na correctie (excl. btw)',
|
|
742
745
|
value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountExclVat),
|
|
743
746
|
className: 'text-end'
|
|
744
|
-
}, showCatalogPrice
|
|
747
|
+
}, showCatalogPrice), (0, _cartTable2.getDiscountRowCells)(displayMode, {
|
|
745
748
|
label: 'Totaal na correctie (incl. btw)',
|
|
746
749
|
value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
747
750
|
className: 'fw-bold text-end'
|
|
748
|
-
}, showCatalogPrice
|
|
751
|
+
}, showCatalogPrice)]
|
|
749
752
|
})))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
750
753
|
};
|
|
751
754
|
var _default = exports.default = ProductCartTable;
|
|
@@ -71,12 +71,10 @@ const emptyCells = exports.emptyCells = function emptyCells(count) {
|
|
|
71
71
|
* Get table header columns based on display mode
|
|
72
72
|
* @param {string} displayMode - The current display mode
|
|
73
73
|
* @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
|
|
74
|
-
* @param {boolean} showDiscountColumn - Whether to show the discount column (true for Towmotive/TOW/TM, false otherwise)
|
|
75
74
|
* @returns {Array} Array of column configuration objects
|
|
76
75
|
*/
|
|
77
76
|
const getCartTableHeaderColumns = exports.getCartTableHeaderColumns = function getCartTableHeaderColumns(displayMode) {
|
|
78
77
|
let showCatalogPrice = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
79
|
-
let showDiscountColumn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
80
78
|
const baseColumns = [{}, {}, {}, {}];
|
|
81
79
|
switch (displayMode) {
|
|
82
80
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
@@ -84,10 +82,9 @@ const getCartTableHeaderColumns = exports.getCartTableHeaderColumns = function g
|
|
|
84
82
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs ex BTW
|
|
85
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)];
|
|
86
84
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
87
|
-
//
|
|
88
|
-
// THC
|
|
89
|
-
|
|
90
|
-
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)] : []), ...(showDiscountColumn ? [textCell('Korting (%)', _cartTable.CART_TABLE_BOLD_END_CLASS)] : []), textCell('Verkoop Prijs (excl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
|
|
85
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs ex BTW
|
|
86
|
+
// (THC without discount capability uses TOGGLED_TMG mode instead)
|
|
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)];
|
|
91
88
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
92
89
|
default:
|
|
93
90
|
return [...baseColumns, {}, {}, textCell('Verkoop Prijs (incl. btw)', _cartTable.CART_TABLE_BOLD_END_CLASS)];
|
|
@@ -136,8 +133,7 @@ const getMainProductCells = _ref => {
|
|
|
136
133
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
137
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)];
|
|
138
135
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
139
|
-
//
|
|
140
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
136
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
141
137
|
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)];
|
|
142
138
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
143
139
|
default:
|
|
@@ -182,8 +178,7 @@ const getAccessoryProductCells = _ref2 => {
|
|
|
182
178
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
183
179
|
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)];
|
|
184
180
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
185
|
-
//
|
|
186
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
181
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
187
182
|
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)];
|
|
188
183
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
189
184
|
default:
|
|
@@ -221,8 +216,7 @@ const getMontageCells = exports.getMontageCells = function getMontageCells(displ
|
|
|
221
216
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
|
|
222
217
|
return [...baseCells, nvt, nvt, ...(showCatalogPrice ? [nvt] : []), priceOverride || priceCell(montagePrice)];
|
|
223
218
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
224
|
-
//
|
|
225
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
219
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
226
220
|
return [...baseCells, nvt, nvt, ...(showCatalogPrice ? [nvt] : []), discountOverride || emptyCell(_cartTable.CART_TABLE_PRICE_CELL_CLASS), priceOverride || priceCell(montagePrice)];
|
|
227
221
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
228
222
|
default:
|
|
@@ -254,8 +248,7 @@ const getMarketCorrectionCells = exports.getMarketCorrectionCells = function get
|
|
|
254
248
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
|
|
255
249
|
return [...baseCells, priceCell(purchaseExcl), priceCell(margin), ...(showCatalogPrice ? [textCell('N.v.t.', _cartTable.CART_TABLE_PRICE_CELL_CLASS)] : []), priceCell(salesExcl)];
|
|
256
250
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
257
|
-
//
|
|
258
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
251
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
259
252
|
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)];
|
|
260
253
|
default:
|
|
261
254
|
return baseCells;
|
|
@@ -270,7 +263,6 @@ const getMarketCorrectionCells = exports.getMarketCorrectionCells = function get
|
|
|
270
263
|
* @param {Object} params.standardSubtotals - Standard subtotals
|
|
271
264
|
* @param {number} params.defaultSubtotal - Default subtotal
|
|
272
265
|
* @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
|
|
273
|
-
* @param {boolean} showDiscountColumn - Whether to show the discount column (true for Towmotive/TOW/TM, false otherwise)
|
|
274
266
|
* @returns {Array} Array of cell configuration objects
|
|
275
267
|
*/
|
|
276
268
|
const getSectionTotalCells = exports.getSectionTotalCells = function getSectionTotalCells(displayMode, _ref4) {
|
|
@@ -280,7 +272,6 @@ const getSectionTotalCells = exports.getSectionTotalCells = function getSectionT
|
|
|
280
272
|
defaultSubtotal
|
|
281
273
|
} = _ref4;
|
|
282
274
|
let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
283
|
-
let showDiscountColumn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
284
275
|
const baseCells = [{}, {}];
|
|
285
276
|
switch (displayMode) {
|
|
286
277
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
@@ -288,16 +279,14 @@ const getSectionTotalCells = exports.getSectionTotalCells = function getSectionT
|
|
|
288
279
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
|
|
289
280
|
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')];
|
|
290
281
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
291
|
-
//
|
|
292
|
-
// THC (with discount): Inkoopprijs - Marge - Korting% - Verkoopprijs
|
|
293
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
282
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
294
283
|
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'),
|
|
295
284
|
// Marge column (no subtotal value)
|
|
296
285
|
emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS),
|
|
297
286
|
// Catalogusprijs column (only present for Towmotive)
|
|
298
287
|
...(showCatalogPrice ? [emptyCell(_cartTable.CART_TABLE_BOLD_END_CLASS)] : []),
|
|
299
|
-
// Korting column: show label
|
|
300
|
-
|
|
288
|
+
// Korting column: show subtotal label for sales
|
|
289
|
+
textCell('Subtotaal (excl. btw)', 'fw-bold text-end pb-2'),
|
|
301
290
|
// Verkoopprijs column: show subtotal sales value
|
|
302
291
|
textCell((0, _index.formatPrice)(standardSubtotals.sales), 'fw-bold text-end pb-2')];
|
|
303
292
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
@@ -315,7 +304,6 @@ const getSectionTotalCells = exports.getSectionTotalCells = function getSectionT
|
|
|
315
304
|
* @param {number} params.consumerValue - Consumer price value
|
|
316
305
|
* @param {string} params.className - CSS class for cells
|
|
317
306
|
* @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
|
|
318
|
-
* @param {boolean} showDiscountColumn - Whether to show the discount column (true for Towmotive/TOW/TM, false otherwise)
|
|
319
307
|
* @returns {Array} Array of cell configuration objects
|
|
320
308
|
*/
|
|
321
309
|
const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(displayMode, _ref5) {
|
|
@@ -326,7 +314,6 @@ const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(di
|
|
|
326
314
|
className = 'text-end'
|
|
327
315
|
} = _ref5;
|
|
328
316
|
let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
329
|
-
let showDiscountColumn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
330
317
|
const baseCells = [{}, {}, {}];
|
|
331
318
|
switch (displayMode) {
|
|
332
319
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
@@ -334,10 +321,8 @@ const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(di
|
|
|
334
321
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
|
|
335
322
|
return [...baseCells, {}, textCell(label, className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
|
|
336
323
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
337
|
-
//
|
|
338
|
-
|
|
339
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
340
|
-
return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), ...(showDiscountColumn ? [emptyCell(className)] : []), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
|
|
324
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
325
|
+
return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell(label, className), textCell((0, _index.formatPrice)(locationValue), className), textCell((0, _index.formatPrice)(consumerValue), className)];
|
|
341
326
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
342
327
|
default:
|
|
343
328
|
return [...baseCells, {}, {}, textCell(label, className), textCell((0, _index.formatPrice)(consumerValue), className)];
|
|
@@ -352,7 +337,6 @@ const getTotalRowCells = exports.getTotalRowCells = function getTotalRowCells(di
|
|
|
352
337
|
* @param {string} params.value - Formatted value string
|
|
353
338
|
* @param {string} params.className - CSS class for cells
|
|
354
339
|
* @param {boolean} showCatalogPrice - Whether to show the catalog price column (false for THC, true otherwise)
|
|
355
|
-
* @param {boolean} showDiscountColumn - Whether to show the discount column (true for Towmotive/TOW/TM, false otherwise)
|
|
356
340
|
* @returns {Array} Array of cell configuration objects
|
|
357
341
|
*/
|
|
358
342
|
const getDiscountRowCells = exports.getDiscountRowCells = function getDiscountRowCells(displayMode, _ref6) {
|
|
@@ -362,7 +346,6 @@ const getDiscountRowCells = exports.getDiscountRowCells = function getDiscountRo
|
|
|
362
346
|
className = 'text-end'
|
|
363
347
|
} = _ref6;
|
|
364
348
|
let showCatalogPrice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
365
|
-
let showDiscountColumn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
366
349
|
const baseCells = [{}, {}, {}];
|
|
367
350
|
switch (displayMode) {
|
|
368
351
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_TMG:
|
|
@@ -370,10 +353,8 @@ const getDiscountRowCells = exports.getDiscountRowCells = function getDiscountRo
|
|
|
370
353
|
// Towmotive: Inkoopprijs - Marge - Catalogprijs - Verkoopprijs
|
|
371
354
|
return [...baseCells, {}, emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), textCell(label, className), textCell(value, className)];
|
|
372
355
|
case _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD:
|
|
373
|
-
//
|
|
374
|
-
|
|
375
|
-
// Towmotive: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
376
|
-
return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), ...(showDiscountColumn ? [emptyCell(className)] : []), textCell(label, className), textCell(value, className)];
|
|
356
|
+
// Towmotive/TowFormula: Inkoopprijs - Marge - Catalogusprijs - Korting% - Verkoopprijs
|
|
357
|
+
return [...baseCells, emptyCell(className), emptyCell(className), ...(showCatalogPrice ? [emptyCell(className)] : []), emptyCell(className), textCell(label, className), textCell(value, className)];
|
|
377
358
|
case _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT:
|
|
378
359
|
default:
|
|
379
360
|
return [...baseCells, {}, {}, textCell(label, className), textCell(value, className)];
|