contentoh-components-library 21.5.50 → 21.5.51
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.
|
@@ -295,7 +295,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
295
295
|
});
|
|
296
296
|
|
|
297
297
|
var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
298
|
-
var _product$retailers, _location$state, _location$state2, _product$services2, _datasheets$, _datasheets$$data, _product$
|
|
298
|
+
var _product$retailers, _location$state, _location$state2, _product$services2, _datasheets$, _datasheets$$data, _product$article22, _comment$message;
|
|
299
299
|
|
|
300
300
|
var tabsSections = _ref3.tabsSections,
|
|
301
301
|
_ref3$productSelected = _ref3.productSelected,
|
|
@@ -796,7 +796,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
796
796
|
|
|
797
797
|
var loadData = /*#__PURE__*/function () {
|
|
798
798
|
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
799
|
-
var _ref10, _product$statusByReta, _product$statusByReta2, _product$statusByReta3, _ref11, _product$article$cate, _product$
|
|
799
|
+
var _ref10, _product$statusByReta, _product$statusByReta2, _product$statusByReta3, _ref11, _product$article$cate, _product$article5, _product$article5$cat, _product$article6, _product$article6$cat, _categoryRetailer$, _categoryRetailer$2, _product$article7, _product$article8, _activeRetailerId, _product$article9, _services$, _services$$values, _product$article10, ids, uniqueIds, activeRetailerId, _product$article4, _product$article4$cat, firstValid, categoryRetailer, categoryName, categoryId, category_name, category_id, retailer_id, _services, generalServices, data, headers;
|
|
800
800
|
|
|
801
801
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
802
802
|
while (1) {
|
|
@@ -809,53 +809,51 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
809
809
|
return item.id_retailer;
|
|
810
810
|
})) !== null && _ref10 !== void 0 ? _ref10 : [];
|
|
811
811
|
uniqueIds = (0, _toConsumableArray2.default)(new Set(ids));
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
812
|
+
activeRetailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
813
|
+
|
|
814
|
+
if (!activeRetailerId) {
|
|
815
|
+
firstValid = product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : (_product$article4$cat = _product$article4.categoryRetailer) === null || _product$article4$cat === void 0 ? void 0 : _product$article4$cat.find(function (item) {
|
|
816
|
+
return uniqueIds.includes(item.id_retailer || item.retailer_id);
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
if (firstValid) {
|
|
820
|
+
activeRetailerId = firstValid.id_retailer || firstValid.retailer_id;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
categoryRetailer = (_ref11 = (_product$article$cate = product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : (_product$article5$cat = _product$article5.categoryRetailer) === null || _product$article5$cat === void 0 ? void 0 : _product$article5$cat.filter(function (item) {
|
|
825
|
+
return uniqueIds.includes(item.id_retailer) && item.id_retailer === activeRetailerId;
|
|
826
|
+
})) !== null && _product$article$cate !== void 0 ? _product$article$cate : product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : (_product$article6$cat = _product$article6.categoryRetailer) === null || _product$article6$cat === void 0 ? void 0 : _product$article6$cat.filter(function (item) {
|
|
827
|
+
return uniqueIds.includes(item.retailer_id) && item.retailer_id === activeRetailerId;
|
|
816
828
|
})) !== null && _ref11 !== void 0 ? _ref11 : [];
|
|
817
|
-
console.log({
|
|
818
|
-
categoryRetailer: categoryRetailer
|
|
819
|
-
});
|
|
820
829
|
categoryName = (_categoryRetailer$ = categoryRetailer[0]) === null || _categoryRetailer$ === void 0 ? void 0 : _categoryRetailer$.category_name;
|
|
821
830
|
categoryId = (_categoryRetailer$2 = categoryRetailer[0]) === null || _categoryRetailer$2 === void 0 ? void 0 : _categoryRetailer$2.id_category;
|
|
822
|
-
category_name = categoryName !== null && categoryName !== void 0 ? categoryName : (product === null || product === void 0 ? void 0 : (_product$
|
|
823
|
-
category_id = categoryId !== null && categoryId !== void 0 ? categoryId : parseInt((product === null || product === void 0 ? void 0 : (_product$
|
|
824
|
-
retailer_id = (
|
|
825
|
-
_context7.next =
|
|
826
|
-
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$
|
|
831
|
+
category_name = categoryName !== null && categoryName !== void 0 ? categoryName : (product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName);
|
|
832
|
+
category_id = categoryId !== null && categoryId !== void 0 ? categoryId : parseInt((product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_category) || (product === null || product === void 0 ? void 0 : product.id_category));
|
|
833
|
+
retailer_id = (_activeRetailerId = activeRetailerId) !== null && _activeRetailerId !== void 0 ? _activeRetailerId : categoryRetailer === null || categoryRetailer === void 0 ? void 0 : categoryRetailer.id_retailer;
|
|
834
|
+
_context7.next = 13;
|
|
835
|
+
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article), category_name, category_id, version, token, retailer_id);
|
|
827
836
|
|
|
828
|
-
case
|
|
837
|
+
case 13:
|
|
829
838
|
_services = _context7.sent;
|
|
830
839
|
|
|
831
|
-
if (auditableVersion &&
|
|
840
|
+
if (auditableVersion && retailer_id) {
|
|
832
841
|
loadAuditableData();
|
|
833
|
-
}
|
|
834
|
-
|
|
842
|
+
}
|
|
835
843
|
|
|
836
844
|
setServices(_services);
|
|
837
|
-
_context7.next =
|
|
845
|
+
_context7.next = 18;
|
|
838
846
|
return getServices();
|
|
839
847
|
|
|
840
|
-
case
|
|
848
|
+
case 18:
|
|
841
849
|
generalServices = _context7.sent;
|
|
842
850
|
setImages({
|
|
843
851
|
action: "init",
|
|
844
852
|
init: _services[2]
|
|
845
853
|
});
|
|
846
|
-
if (((_services$ = _services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
847
|
-
// {
|
|
848
|
-
// id_article: product.article.id_article,
|
|
849
|
-
// id_category: product.article.id_category,
|
|
850
|
-
// version: product.version,
|
|
851
|
-
// id_retailer_array: (
|
|
852
|
-
// product.retailersAvailable ?? product.retailers
|
|
853
|
-
// ).map(({ id }) => id),
|
|
854
|
-
// },
|
|
855
|
-
// ];
|
|
856
|
-
|
|
854
|
+
if (((_services$ = _services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
857
855
|
data = [{
|
|
858
|
-
id_article: product === null || product === void 0 ? void 0 : (_product$
|
|
856
|
+
id_article: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
|
|
859
857
|
relations: [{
|
|
860
858
|
id_retailer: retailer_id,
|
|
861
859
|
id_category: category_id
|
|
@@ -874,21 +872,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
874
872
|
setPercentages(JSON.parse(res === null || res === void 0 ? void 0 : (_res$ = res[0]) === null || _res$ === void 0 ? void 0 : _res$.body));
|
|
875
873
|
});
|
|
876
874
|
setLoading(false);
|
|
877
|
-
_context7.next =
|
|
875
|
+
_context7.next = 31;
|
|
878
876
|
break;
|
|
879
877
|
|
|
880
|
-
case
|
|
881
|
-
_context7.prev =
|
|
878
|
+
case 27:
|
|
879
|
+
_context7.prev = 27;
|
|
882
880
|
_context7.t0 = _context7["catch"](0);
|
|
883
881
|
setLoading(false);
|
|
884
882
|
console.log(_context7.t0);
|
|
885
883
|
|
|
886
|
-
case
|
|
884
|
+
case 31:
|
|
887
885
|
case "end":
|
|
888
886
|
return _context7.stop();
|
|
889
887
|
}
|
|
890
888
|
}
|
|
891
|
-
}, _callee7, null, [[0,
|
|
889
|
+
}, _callee7, null, [[0, 27]]);
|
|
892
890
|
}));
|
|
893
891
|
|
|
894
892
|
return function loadData() {
|
|
@@ -903,7 +901,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
903
901
|
|
|
904
902
|
var getServices = /*#__PURE__*/function () {
|
|
905
903
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
906
|
-
var _product$
|
|
904
|
+
var _product$article11, _product$article12, _servicesResponse$dat;
|
|
907
905
|
|
|
908
906
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
909
907
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -911,7 +909,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
911
909
|
switch (_context8.prev = _context8.next) {
|
|
912
910
|
case 0:
|
|
913
911
|
_context8.next = 2;
|
|
914
|
-
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$
|
|
912
|
+
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_order) || product.orderId, "&end=true"));
|
|
915
913
|
|
|
916
914
|
case 2:
|
|
917
915
|
servicesResponse = _context8.sent;
|
|
@@ -950,7 +948,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
950
948
|
|
|
951
949
|
var getComments = /*#__PURE__*/function () {
|
|
952
950
|
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
953
|
-
var _product$
|
|
951
|
+
var _product$article13, _product$article14, _product$article15;
|
|
954
952
|
|
|
955
953
|
var tab,
|
|
956
954
|
commentsResponse,
|
|
@@ -962,7 +960,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
962
960
|
case 0:
|
|
963
961
|
tab = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : "Descripción";
|
|
964
962
|
_context9.next = 3;
|
|
965
|
-
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$
|
|
963
|
+
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article14 = product.article) === null || _product$article14 === void 0 ? void 0 : _product$article14.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article15 = product.article) === null || _product$article15 === void 0 ? void 0 : _product$article15.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
|
|
966
964
|
|
|
967
965
|
case 3:
|
|
968
966
|
commentsResponse = _context9.sent;
|
|
@@ -1160,7 +1158,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1160
1158
|
|
|
1161
1159
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
1162
1160
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1163
|
-
var dataClean, _product$
|
|
1161
|
+
var dataClean, _product$article16, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
1164
1162
|
|
|
1165
1163
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1166
1164
|
while (1) {
|
|
@@ -1177,7 +1175,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1177
1175
|
|
|
1178
1176
|
setLoading(true);
|
|
1179
1177
|
productTemp = product;
|
|
1180
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$
|
|
1178
|
+
articleId = product === null || product === void 0 ? void 0 : (_product$article16 = product.article) === null || _product$article16 === void 0 ? void 0 : _product$article16.id_article;
|
|
1181
1179
|
dataObject = {
|
|
1182
1180
|
articleId: articleId,
|
|
1183
1181
|
articleData: dataClean
|
|
@@ -1238,7 +1236,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1238
1236
|
|
|
1239
1237
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1240
1238
|
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1241
|
-
var dataClean, _product$
|
|
1239
|
+
var dataClean, _product$article17, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
1242
1240
|
|
|
1243
1241
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1244
1242
|
while (1) {
|
|
@@ -1255,7 +1253,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1255
1253
|
|
|
1256
1254
|
setLoading(true);
|
|
1257
1255
|
productTemp = product;
|
|
1258
|
-
articleId = product === null || product === void 0 ? void 0 : (_product$
|
|
1256
|
+
articleId = product === null || product === void 0 ? void 0 : (_product$article17 = product.article) === null || _product$article17 === void 0 ? void 0 : _product$article17.id_article;
|
|
1259
1257
|
dataObject = {
|
|
1260
1258
|
articleId: articleId,
|
|
1261
1259
|
articleData: dataClean
|
|
@@ -1332,7 +1330,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1332
1330
|
setSocketType(imageInputs);
|
|
1333
1331
|
}, [images]);
|
|
1334
1332
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1335
|
-
var _images$values3, _images$attrForImgs, _product$
|
|
1333
|
+
var _images$values3, _images$attrForImgs, _product$article18, _data$articleData, _data$articleData2, _data$updateImages;
|
|
1336
1334
|
|
|
1337
1335
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
1338
1336
|
|
|
@@ -1350,7 +1348,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1350
1348
|
});
|
|
1351
1349
|
attrForImgs = Object.values((_images$attrForImgs = images === null || images === void 0 ? void 0 : images.attrForImgs) !== null && _images$attrForImgs !== void 0 ? _images$attrForImgs : {}).pop();
|
|
1352
1350
|
data = {
|
|
1353
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1351
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article18 = product.article) === null || _product$article18 === void 0 ? void 0 : _product$article18.id_article,
|
|
1354
1352
|
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
1355
1353
|
var _e$value;
|
|
1356
1354
|
|
|
@@ -1465,7 +1463,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1465
1463
|
}, _callee13, null, [[10, 25, 28, 31]]);
|
|
1466
1464
|
})), [images, imagesUploaded]);
|
|
1467
1465
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1468
|
-
var res, _product$
|
|
1466
|
+
var res, _product$article19, productTemp, _JSON$parse4, newStatus, newArticleStatus;
|
|
1469
1467
|
|
|
1470
1468
|
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1471
1469
|
while (1) {
|
|
@@ -1498,7 +1496,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1498
1496
|
if (res.data.statusCode === 200) {
|
|
1499
1497
|
productTemp = product;
|
|
1500
1498
|
_JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
|
|
1501
|
-
if (newArticleStatus) productTemp.status = newArticleStatus[product === null || product === void 0 ? void 0 : (_product$
|
|
1499
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[product === null || product === void 0 ? void 0 : (_product$article19 = product.article) === null || _product$article19 === void 0 ? void 0 : _product$article19.id_article];
|
|
1502
1500
|
if (newStatus) productTemp.images_status = newStatus;
|
|
1503
1501
|
setProduct(productTemp);
|
|
1504
1502
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
@@ -1798,7 +1796,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1798
1796
|
|
|
1799
1797
|
var createComment = /*#__PURE__*/function () {
|
|
1800
1798
|
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(e, body, tab) {
|
|
1801
|
-
var _product$
|
|
1799
|
+
var _product$article20;
|
|
1802
1800
|
|
|
1803
1801
|
var concept, data;
|
|
1804
1802
|
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
@@ -1824,7 +1822,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1824
1822
|
|
|
1825
1823
|
case 10:
|
|
1826
1824
|
data = {
|
|
1827
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1825
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article20 = product.article) === null || _product$article20 === void 0 ? void 0 : _product$article20.id_article,
|
|
1828
1826
|
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1829
1827
|
message: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, ""),
|
|
1830
1828
|
concept: concept,
|
|
@@ -1970,7 +1968,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1970
1968
|
|
|
1971
1969
|
var setAssignation = /*#__PURE__*/function () {
|
|
1972
1970
|
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(assignationType, assignationId) {
|
|
1973
|
-
var _product$
|
|
1971
|
+
var _product$article21;
|
|
1974
1972
|
|
|
1975
1973
|
var concept, productTemp, data;
|
|
1976
1974
|
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
@@ -2000,7 +1998,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2000
1998
|
data = {
|
|
2001
1999
|
articleList: [{
|
|
2002
2000
|
orderId: product.orderId,
|
|
2003
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
2001
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article21 = product.article) === null || _product$article21 === void 0 ? void 0 : _product$article21.id_article
|
|
2004
2002
|
}],
|
|
2005
2003
|
concept: concept,
|
|
2006
2004
|
userId: assignationId
|
|
@@ -2439,7 +2437,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2439
2437
|
auditInputGroup: auditDescriptions[0],
|
|
2440
2438
|
updatedDescriptions: updatedDescriptions,
|
|
2441
2439
|
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
2442
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
2440
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article22 = product.article) === null || _product$article22 === void 0 ? void 0 : _product$article22.id_article,
|
|
2443
2441
|
version: version,
|
|
2444
2442
|
dinamicHeight: true,
|
|
2445
2443
|
compare: compare
|
package/package.json
CHANGED
|
@@ -361,7 +361,6 @@ export const RetailerProductEdition = ({
|
|
|
361
361
|
).innerHTML;
|
|
362
362
|
createComment(e, commentText, activeTab);
|
|
363
363
|
};
|
|
364
|
-
|
|
365
364
|
|
|
366
365
|
useEffect(async () => {
|
|
367
366
|
const { id_article } = product?.article || {};
|
|
@@ -407,17 +406,29 @@ export const RetailerProductEdition = ({
|
|
|
407
406
|
[];
|
|
408
407
|
const uniqueIds = [...new Set(ids)];
|
|
409
408
|
|
|
409
|
+
let activeRetailerId = activeRetailer?.id;
|
|
410
|
+
if (!activeRetailerId) {
|
|
411
|
+
const firstValid = product?.article?.categoryRetailer?.find((item) =>
|
|
412
|
+
uniqueIds.includes(item.id_retailer || item.retailer_id)
|
|
413
|
+
);
|
|
414
|
+
if (firstValid) {
|
|
415
|
+
activeRetailerId = firstValid.id_retailer || firstValid.retailer_id;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
410
419
|
const categoryRetailer =
|
|
411
|
-
product?.article?.categoryRetailer?.filter(
|
|
412
|
-
|
|
420
|
+
product?.article?.categoryRetailer?.filter(
|
|
421
|
+
(item) =>
|
|
422
|
+
uniqueIds.includes(item.id_retailer) &&
|
|
423
|
+
item.id_retailer === activeRetailerId
|
|
413
424
|
) ??
|
|
414
|
-
product?.article?.categoryRetailer?.filter(
|
|
415
|
-
|
|
425
|
+
product?.article?.categoryRetailer?.filter(
|
|
426
|
+
(item) =>
|
|
427
|
+
uniqueIds.includes(item.retailer_id) &&
|
|
428
|
+
item.retailer_id === activeRetailerId
|
|
416
429
|
) ??
|
|
417
430
|
[];
|
|
418
431
|
|
|
419
|
-
console.log({ categoryRetailer });
|
|
420
|
-
|
|
421
432
|
const categoryName = categoryRetailer[0]?.category_name;
|
|
422
433
|
const categoryId = categoryRetailer[0]?.id_category;
|
|
423
434
|
|
|
@@ -428,7 +439,7 @@ export const RetailerProductEdition = ({
|
|
|
428
439
|
categoryId ??
|
|
429
440
|
parseInt(product?.article?.id_category || product?.id_category);
|
|
430
441
|
|
|
431
|
-
const retailer_id =
|
|
442
|
+
const retailer_id = activeRetailerId ?? categoryRetailer?.id_retailer;
|
|
432
443
|
|
|
433
444
|
const services = await getRetailerServices(
|
|
434
445
|
product?.id_article || product?.article?.id_article,
|
|
@@ -439,29 +450,16 @@ export const RetailerProductEdition = ({
|
|
|
439
450
|
retailer_id
|
|
440
451
|
);
|
|
441
452
|
|
|
442
|
-
if (auditableVersion &&
|
|
453
|
+
if (auditableVersion && retailer_id) {
|
|
443
454
|
loadAuditableData();
|
|
444
455
|
}
|
|
445
456
|
|
|
446
|
-
//Converts the data inside the datasheets object to array
|
|
447
457
|
setServices(services);
|
|
448
458
|
const generalServices = await getServices();
|
|
449
459
|
|
|
450
460
|
setImages({ action: "init", init: services[2] });
|
|
451
|
-
|
|
452
461
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
453
462
|
|
|
454
|
-
// const data = [
|
|
455
|
-
// {
|
|
456
|
-
// id_article: product.article.id_article,
|
|
457
|
-
// id_category: product.article.id_category,
|
|
458
|
-
// version: product.version,
|
|
459
|
-
// id_retailer_array: (
|
|
460
|
-
// product.retailersAvailable ?? product.retailers
|
|
461
|
-
// ).map(({ id }) => id),
|
|
462
|
-
// },
|
|
463
|
-
// ];
|
|
464
|
-
|
|
465
463
|
const data = [
|
|
466
464
|
{
|
|
467
465
|
id_article: product?.article?.id_article,
|
|
@@ -488,7 +486,6 @@ export const RetailerProductEdition = ({
|
|
|
488
486
|
};
|
|
489
487
|
|
|
490
488
|
useEffect(() => {
|
|
491
|
-
|
|
492
489
|
setLoading(true);
|
|
493
490
|
loadData();
|
|
494
491
|
}, [activeRetailer]);
|
|
@@ -968,7 +965,6 @@ export const RetailerProductEdition = ({
|
|
|
968
965
|
default:
|
|
969
966
|
break;
|
|
970
967
|
}
|
|
971
|
-
|
|
972
968
|
};
|
|
973
969
|
|
|
974
970
|
const getConcept = (tab) => {
|
|
@@ -1244,9 +1240,7 @@ export const RetailerProductEdition = ({
|
|
|
1244
1240
|
) {
|
|
1245
1241
|
desInputsRequired++;
|
|
1246
1242
|
}
|
|
1247
|
-
|
|
1248
1243
|
});
|
|
1249
|
-
|
|
1250
1244
|
}
|
|
1251
1245
|
});
|
|
1252
1246
|
|