thm-p3-configurator 0.0.236 → 0.0.238
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.
- package/dist/src/shared/__containers__/ProductCartSide.js +3 -2
- package/dist/src/shared/__containers__/ProductsCartOverview.js +16 -11
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +12 -1
- package/dist/src/shared/__containers__/internal/InternalDiscountCodeSelector.js +1 -1
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +12 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +1 -0
- package/dist/src/shared/__helpers__/dossier.js +1 -0
- package/package.json +1 -1
|
@@ -155,11 +155,12 @@ const ProductCartSide = () => {
|
|
|
155
155
|
marginPercentage: 0
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
+
const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
|
|
158
159
|
|
|
159
160
|
// Get prices directly from product objects and calculate excl VAT for location
|
|
160
|
-
const purchasePrice =
|
|
161
|
+
const purchasePrice = hasLocationTotal ? cartItem.locationTotal : 0;
|
|
161
162
|
const salesPrice = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
|
|
162
|
-
const margin = salesPrice - purchasePrice;
|
|
163
|
+
const margin = hasLocationTotal ? salesPrice - purchasePrice : 0;
|
|
163
164
|
const marginPercentage = purchasePrice ? margin / purchasePrice * 100 : 0;
|
|
164
165
|
return {
|
|
165
166
|
purchasePrice,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require("core-js/modules/es.array.includes.js");
|
|
4
4
|
require("core-js/modules/es.array.reduce.js");
|
|
5
5
|
require("core-js/modules/es.json.stringify.js");
|
|
6
|
-
require("core-js/modules/es.parse-float.js");
|
|
7
6
|
require("core-js/modules/es.regexp.to-string.js");
|
|
8
7
|
require("core-js/modules/es.string.includes.js");
|
|
9
8
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -23,7 +22,6 @@ exports.default = void 0;
|
|
|
23
22
|
require("core-js/modules/es.array.includes.js");
|
|
24
23
|
require("core-js/modules/es.array.reduce.js");
|
|
25
24
|
require("core-js/modules/es.json.stringify.js");
|
|
26
|
-
require("core-js/modules/es.parse-float.js");
|
|
27
25
|
require("core-js/modules/es.regexp.to-string.js");
|
|
28
26
|
require("core-js/modules/es.string.includes.js");
|
|
29
27
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
@@ -187,6 +185,12 @@ const ProductCartTable = () => {
|
|
|
187
185
|
// Subtotal calculation variables
|
|
188
186
|
let mainProductsSubtotal = 0;
|
|
189
187
|
let accessoireProductsSubtotal = 0;
|
|
188
|
+
const calculatePurchaseSubtotal = products => {
|
|
189
|
+
return products.reduce((total, product) => {
|
|
190
|
+
var _product$priceInfo;
|
|
191
|
+
return total + Number((product === null || product === void 0 || (_product$priceInfo = product.priceInfo) === null || _product$priceInfo === void 0 ? void 0 : _product$priceInfo.purchasePrice) || 0);
|
|
192
|
+
}, 0);
|
|
193
|
+
};
|
|
190
194
|
|
|
191
195
|
/**
|
|
192
196
|
* Calculate item prices from a cart item
|
|
@@ -233,11 +237,12 @@ const ProductCartTable = () => {
|
|
|
233
237
|
let purchasePrice = 0;
|
|
234
238
|
let salesPrice = 0;
|
|
235
239
|
const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
|
|
240
|
+
const locationTotal = hasLocationTotal ? Number(cartItem.locationTotal) : 0;
|
|
236
241
|
|
|
237
242
|
// Get prices directly from product objects
|
|
238
243
|
if (APP_CONFIG.internal) {
|
|
239
|
-
purchasePrice =
|
|
240
|
-
salesPrice = isToggled ? (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) / 1.21 :
|
|
244
|
+
purchasePrice = locationTotal;
|
|
245
|
+
salesPrice = isToggled ? (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) / 1.21 : hasLocationTotal ? locationTotal : (cartItem === null || cartItem === void 0 ? void 0 : cartItem.consumerTotal) || 0;
|
|
241
246
|
} else {
|
|
242
247
|
purchasePrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
|
|
243
248
|
salesPrice = (product === null || product === void 0 ? void 0 : product.price) || 0;
|
|
@@ -281,14 +286,14 @@ const ProductCartTable = () => {
|
|
|
281
286
|
});
|
|
282
287
|
|
|
283
288
|
// Calculate subtotals based on locationTotal (purchasePrice)
|
|
284
|
-
mainProductsSubtotal = mainProducts
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
mainProductsSubtotal = calculatePurchaseSubtotal(mainProducts);
|
|
290
|
+
accessoireProductsSubtotal = calculatePurchaseSubtotal(accessoireProducts);
|
|
291
|
+
}
|
|
292
|
+
const shouldIncludeMarketCorrection = isToggled && (marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal);
|
|
293
|
+
if (shouldIncludeMarketCorrection) {
|
|
294
|
+
const marketCorrectionPrice = Number(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) || 0;
|
|
295
|
+
mainProductsSubtotal += marketCorrectionPrice;
|
|
290
296
|
}
|
|
291
|
-
mainProductsSubtotal = mainProductsSubtotal + (marketCorrection !== null && marketCorrection !== void 0 && marketCorrection.locationTotal ? parseFloat(marketCorrection === null || marketCorrection === void 0 ? void 0 : marketCorrection.locationTotal) : 0);
|
|
292
297
|
if (isLoadingProducts) {
|
|
293
298
|
return /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null);
|
|
294
299
|
}
|
|
@@ -182,6 +182,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
182
182
|
customerAgreed,
|
|
183
183
|
customer,
|
|
184
184
|
licensePlate,
|
|
185
|
+
licensePlateBrandModel,
|
|
185
186
|
model,
|
|
186
187
|
vehicle,
|
|
187
188
|
chassisNumber,
|
|
@@ -1596,7 +1597,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
1596
1597
|
},
|
|
1597
1598
|
label: "Goedkeuringsnummer onbekend",
|
|
1598
1599
|
isDisabled: !!(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumber)
|
|
1599
|
-
})), !licensePlate && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1600
|
+
})), !licensePlate && !licensePlateBrandModel && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1600
1601
|
key: "licensePlate",
|
|
1601
1602
|
placeholder: "",
|
|
1602
1603
|
value: _licensePlate,
|
|
@@ -1606,6 +1607,16 @@ const InternalAppointmentForm = _ref => {
|
|
|
1606
1607
|
form: "quotation",
|
|
1607
1608
|
label: "Kenteken:",
|
|
1608
1609
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['licensePlate']
|
|
1610
|
+
}), (licensePlate || licensePlateBrandModel) && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1611
|
+
key: "licensePlateReadOnly",
|
|
1612
|
+
placeholder: "",
|
|
1613
|
+
value: licensePlate || licensePlateBrandModel || '',
|
|
1614
|
+
name: "licensePlateReadOnly",
|
|
1615
|
+
onChange: () => {},
|
|
1616
|
+
isRequired: false,
|
|
1617
|
+
form: "quotation",
|
|
1618
|
+
label: "Kenteken:",
|
|
1619
|
+
isDisabled: true
|
|
1609
1620
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
1610
1621
|
key: "chassisNumber",
|
|
1611
1622
|
placeholder: "",
|
|
@@ -55,7 +55,7 @@ const InternalDiscountCodeSelector = () => {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
if (isLoadingDiscounts || !Array.isArray(discounts)) return null;
|
|
58
|
-
const selectedDiscountCode = discounts.find(discount => (discount === null || discount === void 0 ? void 0 : discount.code.toLowerCase()) === discountCode.toLowerCase());
|
|
58
|
+
const selectedDiscountCode = discounts.find(discount => (discount === null || discount === void 0 ? void 0 : discount.code.toLowerCase()) === (discountCode === null || discountCode === void 0 ? void 0 : discountCode.toLowerCase()));
|
|
59
59
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
60
60
|
className: (0, _helpers__.withStyle)('mb-2')
|
|
61
61
|
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, {
|
|
@@ -162,6 +162,7 @@ const InternalQuotationForm = _ref => {
|
|
|
162
162
|
vehicle,
|
|
163
163
|
customer,
|
|
164
164
|
licensePlate,
|
|
165
|
+
licensePlateBrandModel,
|
|
165
166
|
model,
|
|
166
167
|
chassisNumber,
|
|
167
168
|
executionAnswer1,
|
|
@@ -930,7 +931,7 @@ const InternalQuotationForm = _ref => {
|
|
|
930
931
|
},
|
|
931
932
|
label: "Goedkeuringsnummer onbekend",
|
|
932
933
|
isDisabled: !!(vehicle !== null && vehicle !== void 0 && vehicle.leaseNumber)
|
|
933
|
-
})), !licensePlate && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
934
|
+
})), !licensePlate && !licensePlateBrandModel && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
934
935
|
placeholder: "",
|
|
935
936
|
value: _licensePlate,
|
|
936
937
|
name: "licensePlate",
|
|
@@ -939,6 +940,16 @@ const InternalQuotationForm = _ref => {
|
|
|
939
940
|
form: "quotation",
|
|
940
941
|
label: "Kenteken:",
|
|
941
942
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['licensePlate']
|
|
943
|
+
}), (licensePlate || licensePlateBrandModel) && /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
944
|
+
key: "licensePlateReadOnly",
|
|
945
|
+
placeholder: "",
|
|
946
|
+
value: licensePlate || licensePlateBrandModel || '',
|
|
947
|
+
name: "licensePlateReadOnly",
|
|
948
|
+
onChange: () => {},
|
|
949
|
+
isRequired: false,
|
|
950
|
+
form: "quotation",
|
|
951
|
+
label: "Kenteken:",
|
|
952
|
+
isDisabled: true
|
|
942
953
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
943
954
|
placeholder: "",
|
|
944
955
|
value: vehicle === null || vehicle === void 0 ? void 0 : vehicle.chassisNumber,
|
|
@@ -77,6 +77,7 @@ const parseDossierToOrderSession = exports.parseDossierToOrderSession = function
|
|
|
77
77
|
return {
|
|
78
78
|
canAlterQuantity: (dossier === null || dossier === void 0 || (_dossier$statusBeoord = dossier.statusBeoordeling) === null || _dossier$statusBeoord === void 0 ? void 0 : _dossier$statusBeoord.title) === _constants__.STATUS_ASSESSMENT.Open,
|
|
79
79
|
licensePlate: dossier === null || dossier === void 0 ? void 0 : dossier.kenteken,
|
|
80
|
+
licensePlateBrandModel: dossier === null || dossier === void 0 ? void 0 : dossier.kentekenMerkmodel,
|
|
80
81
|
model: dossier !== null && dossier !== void 0 && dossier.kenteken ? null : dossier === null || dossier === void 0 ? void 0 : dossier.model,
|
|
81
82
|
// Note: only fill in when license plate is empty
|
|
82
83
|
channel: {
|