thm-p3-configurator 0.0.290 → 0.0.291
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.
|
@@ -148,7 +148,8 @@ const ProductCartSide = () => {
|
|
|
148
148
|
* @param {Object} cartItem - Cart item object
|
|
149
149
|
* @return {Object} Calculated prices for the item
|
|
150
150
|
*/
|
|
151
|
-
const getItemPrices = cartItem => {
|
|
151
|
+
const getItemPrices = (cartItem, product) => {
|
|
152
|
+
var _ref, _consumerPrices$price, _product$price;
|
|
152
153
|
if (!cartItem) {
|
|
153
154
|
return {
|
|
154
155
|
purchasePrice: 0,
|
|
@@ -158,10 +159,14 @@ const ProductCartSide = () => {
|
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
|
|
162
|
+
const consumerPrices = (product === null || product === void 0 ? void 0 : product.consumerPrices) || null;
|
|
163
|
+
const consumerPriceIncl = (_ref = (_consumerPrices$price = consumerPrices === null || consumerPrices === void 0 ? void 0 : consumerPrices.priceInclVat) !== null && _consumerPrices$price !== void 0 ? _consumerPrices$price : cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) !== null && _ref !== void 0 ? _ref : null;
|
|
164
|
+
const fallbackSalesPrice = (_product$price = product === null || product === void 0 ? void 0 : product.price) !== null && _product$price !== void 0 ? _product$price : 0;
|
|
165
|
+
const resolvedSalesPrice = consumerPriceIncl !== null && consumerPriceIncl !== undefined ? Number(consumerPriceIncl) : Number(fallbackSalesPrice) || 0;
|
|
161
166
|
|
|
162
167
|
// Get prices directly from product objects and calculate excl VAT for location
|
|
163
168
|
const purchasePrice = hasLocationTotal ? cartItem.locationTotal : 0;
|
|
164
|
-
const salesPrice =
|
|
169
|
+
const salesPrice = resolvedSalesPrice;
|
|
165
170
|
const margin = hasLocationTotal ? salesPrice - purchasePrice : 0;
|
|
166
171
|
const marginPercentage = purchasePrice ? margin / purchasePrice * 100 : 0;
|
|
167
172
|
return {
|
|
@@ -209,7 +214,7 @@ const ProductCartSide = () => {
|
|
|
209
214
|
const {
|
|
210
215
|
purchasePrice,
|
|
211
216
|
salesPrice
|
|
212
|
-
} = getItemPrices(cartItem);
|
|
217
|
+
} = getItemPrices(cartItem, product);
|
|
213
218
|
const isBoardComputerProduct = selectedBoardComputer && String(product.articleNumber) === String(selectedBoardComputer);
|
|
214
219
|
const mainRowPriceText = isToggled ? isBoardComputerProduct && Number(purchasePrice) <= 0 ? 'N.v.t.' : (0, _helpers__.formatPrice)(purchasePrice) : (0, _helpers__.formatPrice)(salesPrice);
|
|
215
220
|
return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
|
|
@@ -245,7 +250,7 @@ const ProductCartSide = () => {
|
|
|
245
250
|
const {
|
|
246
251
|
purchasePrice,
|
|
247
252
|
salesPrice
|
|
248
|
-
} = getItemPrices(cartItem);
|
|
253
|
+
} = getItemPrices(cartItem, product);
|
|
249
254
|
const quantity = selectedExtras[product.articleNumber] || 1;
|
|
250
255
|
const price = isToggled ? purchasePrice : salesPrice;
|
|
251
256
|
const accessoryPriceText = isToggled && Number(purchasePrice) <= 0 ? 'N.v.t.' : (0, _helpers__.formatPrice)(price);
|
|
@@ -640,9 +640,6 @@ const ProductCartTable = () => {
|
|
|
640
640
|
const montageRateCellOverrides = APP_CONFIG.internal && !isThc && renderMontageRateInput ? displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD ? {
|
|
641
641
|
// Show input in discount column; keep price column as price
|
|
642
642
|
discountCell: montageRateInputCell
|
|
643
|
-
} : displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.DEFAULT ? {
|
|
644
|
-
// In default view, show input in the same column as vehicle coding
|
|
645
|
-
discountCell: montageRateInputCell
|
|
646
643
|
} : {} : {};
|
|
647
644
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
648
645
|
className: (0, _helpers__.withStyle)('content col-lg')
|
|
@@ -675,7 +672,7 @@ const ProductCartTable = () => {
|
|
|
675
672
|
})),
|
|
676
673
|
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
677
674
|
} : {};
|
|
678
|
-
const vehicleCodingInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.
|
|
675
|
+
const vehicleCodingInputCell = displayMode === _cartTable.CART_TABLE_DISPLAY_MODES.TOGGLED_STANDARD && isTowmotive && isVehicleCodingProduct ? {
|
|
679
676
|
text: renderVehicleCodingInput(product.articleNumber),
|
|
680
677
|
className: _cartTable.CART_TABLE_PRICE_CELL_CLASS
|
|
681
678
|
} : {};
|
|
@@ -806,6 +803,6 @@ const ProductCartTable = () => {
|
|
|
806
803
|
value: (0, _helpers__.formatPrice)(totals === null || totals === void 0 ? void 0 : totals.totalAfterDiscountInclVat),
|
|
807
804
|
className: 'fw-bold text-end'
|
|
808
805
|
}, showCatalogPrice)]
|
|
809
|
-
})))), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
806
|
+
})))), APP_CONFIG.internal && isToggled && /*#__PURE__*/_react.default.createElement(_InternalDiscountForm.default, null)));
|
|
810
807
|
};
|
|
811
808
|
var _default = exports.default = ProductCartTable;
|
|
@@ -319,7 +319,7 @@ const ProductsOverview = () => {
|
|
|
319
319
|
product: a,
|
|
320
320
|
category: productCategory
|
|
321
321
|
}) ? -1 : 0).map(product => {
|
|
322
|
-
var _product$images, _product$images2, _product$locationPric;
|
|
322
|
+
var _product$images, _product$images2, _product$locationPric, _product$consumerPric2, _product$consumerPric3;
|
|
323
323
|
const isRecommended = (0, _product.checkIfTowbarIsRecommended)({
|
|
324
324
|
product,
|
|
325
325
|
category: productCategory
|
|
@@ -392,7 +392,7 @@ const ProductsOverview = () => {
|
|
|
392
392
|
},
|
|
393
393
|
productSpecifications: (0, _product.extractProductSpecsArray)(product),
|
|
394
394
|
showPrice: APP_CONFIG.internal ? true : false,
|
|
395
|
-
productPrice: product.price
|
|
395
|
+
productPrice: (_product$consumerPric2 = product === null || product === void 0 || (_product$consumerPric3 = product.consumerPrices) === null || _product$consumerPric3 === void 0 ? void 0 : _product$consumerPric3.priceInclVat) !== null && _product$consumerPric2 !== void 0 ? _product$consumerPric2 : product.price
|
|
396
396
|
});
|
|
397
397
|
}));
|
|
398
398
|
}));
|