thm-p3-configurator 0.0.196 → 0.0.198
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.
|
@@ -271,7 +271,7 @@ const useSingleOrderArticles = exports.useSingleOrderArticles = function useSing
|
|
|
271
271
|
({
|
|
272
272
|
articles,
|
|
273
273
|
totalCount
|
|
274
|
-
} = await (0, _singleOrderArticles.fetchArticlesByArticleNumbers)([articleNumber]));
|
|
274
|
+
} = await (0, _singleOrderArticles.fetchArticlesByArticleNumbers)([articleNumber], articleNumber));
|
|
275
275
|
}
|
|
276
276
|
if (totalCount === 0 || !articles.length) {
|
|
277
277
|
return {
|
|
@@ -228,7 +228,7 @@ const InternalSingleOrderFilters = /*#__PURE__*/(0, _react.forwardRef)((_ref, re
|
|
|
228
228
|
}, /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
229
229
|
isRequired: false,
|
|
230
230
|
value: selectedArticleNumber,
|
|
231
|
-
label: "
|
|
231
|
+
label: "Zoeken",
|
|
232
232
|
placeholder: "Zoeken",
|
|
233
233
|
onChange: value => {
|
|
234
234
|
resetLicensePlateFilters();
|
|
@@ -155,10 +155,13 @@ const fetchArticlesByLicensePlateAndModel = async (filters, formula, branchId) =
|
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
157
|
exports.fetchArticlesByLicensePlateAndModel = fetchArticlesByLicensePlateAndModel;
|
|
158
|
-
const fetchArticlesByArticleNumbers = async articleNumbers
|
|
159
|
-
|
|
158
|
+
const fetchArticlesByArticleNumbers = exports.fetchArticlesByArticleNumbers = async function fetchArticlesByArticleNumbers(articleNumbers) {
|
|
159
|
+
let term = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
160
|
+
const articleParamsString = new URLSearchParams(_objectSpread({
|
|
160
161
|
articleNumbers: JSON.stringify(articleNumbers)
|
|
161
|
-
}
|
|
162
|
+
}, term ? {
|
|
163
|
+
term
|
|
164
|
+
} : {})).toString();
|
|
162
165
|
const response = await _authenticatedProxyApi.authenticatedProxyApi.getArticles(articleParamsString);
|
|
163
166
|
if (!(response !== null && response !== void 0 && response.data)) {
|
|
164
167
|
throw new Error('No articles found');
|
|
@@ -175,7 +178,6 @@ const fetchArticlesByArticleNumbers = async articleNumbers => {
|
|
|
175
178
|
* @description fetch the stock levels of the parts
|
|
176
179
|
* @param {Object} parts - The parts
|
|
177
180
|
*/
|
|
178
|
-
exports.fetchArticlesByArticleNumbers = fetchArticlesByArticleNumbers;
|
|
179
181
|
const fetchPartStockLevels = exports.fetchPartStockLevels = async function fetchPartStockLevels(part, branchId) {
|
|
180
182
|
var _response$data$data;
|
|
181
183
|
let formula = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -210,9 +212,11 @@ const enrichArticlesWithBrandsAndPrices = exports.enrichArticlesWithBrandsAndPri
|
|
|
210
212
|
throw new Error('Failed to fetch the brands of the articles');
|
|
211
213
|
}
|
|
212
214
|
const articlesWithBrands = articles.map(article => {
|
|
213
|
-
var _brandResponse$data$f, _brandResponse$data$f2;
|
|
214
215
|
return _objectSpread(_objectSpread({}, article), {}, {
|
|
215
|
-
brand: (
|
|
216
|
+
brand: ((_ref3, _brandData$preferredP) => {
|
|
217
|
+
const brandData = brandResponse.data.find(brand => brand.articleNumber === article.articleNumber);
|
|
218
|
+
return (_ref3 = (_brandData$preferredP = brandData === null || brandData === void 0 ? void 0 : brandData.preferredPartBrandNumber) !== null && _brandData$preferredP !== void 0 ? _brandData$preferredP : brandData === null || brandData === void 0 ? void 0 : brandData.brandNumber) !== null && _ref3 !== void 0 ? _ref3 : _index2.DEFAULT_ARTICLE_BRAND;
|
|
219
|
+
})()
|
|
216
220
|
});
|
|
217
221
|
}).filter(article => article.brand);
|
|
218
222
|
const parts = articlesWithBrands.map(article => {
|
|
@@ -238,16 +242,17 @@ const enrichArticlesWithBrandsAndPrices = exports.enrichArticlesWithBrandsAndPri
|
|
|
238
242
|
consumer: Object.fromEntries(consumerPrices.map(price => [price.partNumber, price])),
|
|
239
243
|
location: Object.fromEntries(locationPrices.map(price => [price.partNumber, price]))
|
|
240
244
|
};
|
|
241
|
-
|
|
245
|
+
let currentArticles = articlesWithBrands.map(article => _objectSpread(_objectSpread({}, article), {}, {
|
|
242
246
|
consumerPrices: pricesMap.consumer[article.articleNumber],
|
|
243
247
|
locationPrices: pricesMap.location[article.articleNumber]
|
|
244
248
|
}));
|
|
249
|
+
return currentArticles;
|
|
245
250
|
};
|
|
246
251
|
const formatModelArticle = article => {
|
|
247
|
-
var
|
|
252
|
+
var _ref4, _article$name, _ref5, _article$description$, _article$description, _article$boldDescript, _article$boldDescript2, _article$specificatio, _article$images, _article$images2, _article$articleNumbe;
|
|
248
253
|
return _objectSpread(_objectSpread({}, article), {}, {
|
|
249
|
-
name: (
|
|
250
|
-
description: (
|
|
254
|
+
name: (_ref4 = (_article$name = article.name) !== null && _article$name !== void 0 ? _article$name : article === null || article === void 0 ? void 0 : article.title) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
255
|
+
description: (_ref5 = (_article$description$ = article === null || article === void 0 || (_article$description = article.description) === null || _article$description === void 0 || (_article$description = _article$description.ops) === null || _article$description === void 0 || (_article$description = _article$description[0]) === null || _article$description === void 0 ? void 0 : _article$description.insert) !== null && _article$description$ !== void 0 ? _article$description$ : article === null || article === void 0 ? void 0 : article.remark) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
251
256
|
subTitle: (_article$boldDescript = article === null || article === void 0 || (_article$boldDescript2 = article.boldDescription) === null || _article$boldDescript2 === void 0 || (_article$boldDescript2 = _article$boldDescript2.ops) === null || _article$boldDescript2 === void 0 || (_article$boldDescript2 = _article$boldDescript2[0]) === null || _article$boldDescript2 === void 0 ? void 0 : _article$boldDescript2.insert) !== null && _article$boldDescript !== void 0 ? _article$boldDescript : null,
|
|
252
257
|
specifications: Array.isArray(article === null || article === void 0 ? void 0 : article.specifications) ? article === null || article === void 0 ? void 0 : article.specifications.join(' \n ') : (_article$specificatio = article === null || article === void 0 ? void 0 : article.specifications) !== null && _article$specificatio !== void 0 ? _article$specificatio : null,
|
|
253
258
|
image: article !== null && article !== void 0 && (_article$images = article.images) !== null && _article$images !== void 0 && _article$images[0] ? (0, _image.getImageFromHyper)({
|
|
@@ -262,11 +267,11 @@ const formatModelArticle = article => {
|
|
|
262
267
|
const formatGenericArticle = article => {
|
|
263
268
|
var _article$images3, _article$images4, _article$articleNumbe2, _article$type, _article$group, _article$subgroup;
|
|
264
269
|
const specificationPairs = [['C2 module', article === null || article === void 0 ? void 0 : article.c2Module], ['Check control', article === null || article === void 0 ? void 0 : article.checkControl], ['Direct current', article === null || article === void 0 ? void 0 : article.directCurrent], ['Draw weight', article === null || article === void 0 ? void 0 : article.drawWeight], ['D value', article === null || article === void 0 ? void 0 : article.dValue], ['Foglight shutdown', article === null || article === void 0 ? void 0 : article.foglightShutdown], ['PDC shutdown', article === null || article === void 0 ? void 0 : article.pdcShutdown], ['Switched PSU', article === null || article === void 0 ? void 0 : article.switchedPsu], ['LED', article === null || article === void 0 ? void 0 : article.led]];
|
|
265
|
-
const specification = specificationPairs.filter(
|
|
266
|
-
let [_, value] =
|
|
270
|
+
const specification = specificationPairs.filter(_ref6 => {
|
|
271
|
+
let [_, value] = _ref6;
|
|
267
272
|
return value;
|
|
268
|
-
}).map(
|
|
269
|
-
let [label, value] =
|
|
273
|
+
}).map(_ref7 => {
|
|
274
|
+
let [label, value] = _ref7;
|
|
270
275
|
return "".concat(label, ": ").concat(value);
|
|
271
276
|
}).join(' \n ');
|
|
272
277
|
return _objectSpread(_objectSpread({}, article), {}, {
|