contentoh-components-library 21.3.15 → 21.3.16
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.
|
@@ -759,14 +759,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
759
759
|
|
|
760
760
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
761
761
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
762
|
-
var _product$article9, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
762
|
+
var dataClean, _product$article9, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
763
763
|
|
|
764
764
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
765
765
|
while (1) {
|
|
766
766
|
switch (_context5.prev = _context5.next) {
|
|
767
767
|
case 0:
|
|
768
|
-
|
|
769
|
-
|
|
768
|
+
dataClean = updatedDescriptions.filter(function (f) {
|
|
769
|
+
return f.value !== '';
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
if (!(dataClean.length > 0)) {
|
|
773
|
+
_context5.next = 25;
|
|
770
774
|
break;
|
|
771
775
|
}
|
|
772
776
|
|
|
@@ -775,22 +779,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
775
779
|
articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
|
|
776
780
|
dataObject = {
|
|
777
781
|
articleId: articleId,
|
|
778
|
-
articleData:
|
|
782
|
+
articleData: dataClean
|
|
779
783
|
};
|
|
780
784
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
781
|
-
_context5.prev =
|
|
782
|
-
_context5.next =
|
|
785
|
+
_context5.prev = 7;
|
|
786
|
+
_context5.next = 10;
|
|
783
787
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
784
788
|
headers: {
|
|
785
789
|
Authorization: token
|
|
786
790
|
}
|
|
787
791
|
});
|
|
788
792
|
|
|
789
|
-
case
|
|
793
|
+
case 10:
|
|
790
794
|
res = _context5.sent;
|
|
791
795
|
|
|
792
796
|
if (!(res.data.statusCode === 200)) {
|
|
793
|
-
_context5.next =
|
|
797
|
+
_context5.next = 20;
|
|
794
798
|
break;
|
|
795
799
|
}
|
|
796
800
|
|
|
@@ -800,24 +804,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
800
804
|
setProduct(productTemp);
|
|
801
805
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
802
806
|
setMessage("Descripciones guardadas con éxito");
|
|
803
|
-
_context5.next =
|
|
807
|
+
_context5.next = 20;
|
|
804
808
|
return loadData();
|
|
805
809
|
|
|
806
|
-
case
|
|
807
|
-
_context5.next =
|
|
810
|
+
case 20:
|
|
811
|
+
_context5.next = 25;
|
|
808
812
|
break;
|
|
809
813
|
|
|
810
|
-
case
|
|
811
|
-
_context5.prev =
|
|
812
|
-
_context5.t0 = _context5["catch"](
|
|
814
|
+
case 22:
|
|
815
|
+
_context5.prev = 22;
|
|
816
|
+
_context5.t0 = _context5["catch"](7);
|
|
813
817
|
console.log(_context5.t0);
|
|
814
818
|
|
|
815
|
-
case
|
|
819
|
+
case 25:
|
|
816
820
|
case "end":
|
|
817
821
|
return _context5.stop();
|
|
818
822
|
}
|
|
819
823
|
}
|
|
820
|
-
}, _callee5, null, [[
|
|
824
|
+
}, _callee5, null, [[7, 22]]);
|
|
821
825
|
}));
|
|
822
826
|
|
|
823
827
|
return function saveDescriptions() {
|
|
@@ -827,14 +831,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
827
831
|
|
|
828
832
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
829
833
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
830
|
-
var _product$article10, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
834
|
+
var dataClean, _product$article10, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
831
835
|
|
|
832
836
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
833
837
|
while (1) {
|
|
834
838
|
switch (_context6.prev = _context6.next) {
|
|
835
839
|
case 0:
|
|
836
|
-
|
|
837
|
-
|
|
840
|
+
dataClean = updatedDatasheets.filter(function (f) {
|
|
841
|
+
return f.value !== '';
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
if (!(dataClean.length > 0)) {
|
|
845
|
+
_context6.next = 25;
|
|
838
846
|
break;
|
|
839
847
|
}
|
|
840
848
|
|
|
@@ -843,22 +851,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
843
851
|
articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
|
|
844
852
|
dataObject = {
|
|
845
853
|
articleId: articleId,
|
|
846
|
-
articleData:
|
|
854
|
+
articleData: dataClean
|
|
847
855
|
};
|
|
848
856
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
849
|
-
_context6.prev =
|
|
850
|
-
_context6.next =
|
|
857
|
+
_context6.prev = 7;
|
|
858
|
+
_context6.next = 10;
|
|
851
859
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
852
860
|
headers: {
|
|
853
861
|
Authorization: token
|
|
854
862
|
}
|
|
855
863
|
});
|
|
856
864
|
|
|
857
|
-
case
|
|
865
|
+
case 10:
|
|
858
866
|
res = _context6.sent;
|
|
859
867
|
|
|
860
868
|
if (!(res.data.statusCode === 200)) {
|
|
861
|
-
_context6.next =
|
|
869
|
+
_context6.next = 20;
|
|
862
870
|
break;
|
|
863
871
|
}
|
|
864
872
|
|
|
@@ -868,24 +876,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
868
876
|
setProduct(productTemp);
|
|
869
877
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
870
878
|
setMessage("Fichas técnicas guardadas");
|
|
871
|
-
_context6.next =
|
|
879
|
+
_context6.next = 20;
|
|
872
880
|
return loadData();
|
|
873
881
|
|
|
874
|
-
case
|
|
875
|
-
_context6.next =
|
|
882
|
+
case 20:
|
|
883
|
+
_context6.next = 25;
|
|
876
884
|
break;
|
|
877
885
|
|
|
878
|
-
case
|
|
879
|
-
_context6.prev =
|
|
880
|
-
_context6.t0 = _context6["catch"](
|
|
886
|
+
case 22:
|
|
887
|
+
_context6.prev = 22;
|
|
888
|
+
_context6.t0 = _context6["catch"](7);
|
|
881
889
|
console.log(_context6.t0);
|
|
882
890
|
|
|
883
|
-
case
|
|
891
|
+
case 25:
|
|
884
892
|
case "end":
|
|
885
893
|
return _context6.stop();
|
|
886
894
|
}
|
|
887
895
|
}
|
|
888
|
-
}, _callee6, null, [[
|
|
896
|
+
}, _callee6, null, [[7, 22]]);
|
|
889
897
|
}));
|
|
890
898
|
|
|
891
899
|
return function saveDatasheets() {
|
package/package.json
CHANGED
|
@@ -435,13 +435,14 @@ export const RetailerProductEdition = ({
|
|
|
435
435
|
};
|
|
436
436
|
|
|
437
437
|
const saveDescriptions = async () => {
|
|
438
|
-
|
|
438
|
+
const dataClean = updatedDescriptions.filter((f) => f.value !== '');
|
|
439
|
+
if (dataClean.length > 0) {
|
|
439
440
|
setLoading(true);
|
|
440
441
|
const productTemp = product;
|
|
441
442
|
const articleId = product?.article?.id_article;
|
|
442
443
|
const dataObject = {
|
|
443
444
|
articleId,
|
|
444
|
-
articleData:
|
|
445
|
+
articleData: dataClean,
|
|
445
446
|
};
|
|
446
447
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
447
448
|
try {
|
|
@@ -475,13 +476,14 @@ export const RetailerProductEdition = ({
|
|
|
475
476
|
};
|
|
476
477
|
|
|
477
478
|
const saveDatasheets = async () => {
|
|
478
|
-
|
|
479
|
+
const dataClean = updatedDatasheets.filter((f) => f.value !== '');
|
|
480
|
+
if (dataClean.length > 0) {
|
|
479
481
|
setLoading(true);
|
|
480
482
|
const productTemp = product;
|
|
481
483
|
const articleId = product?.article?.id_article;
|
|
482
484
|
const dataObject = {
|
|
483
485
|
articleId,
|
|
484
|
-
articleData:
|
|
486
|
+
articleData: dataClean,
|
|
485
487
|
};
|
|
486
488
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
487
489
|
try {
|