contentoh-components-library 21.1.36 → 21.1.39
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/components/atoms/Percent/Percent.stories.js +39 -0
- package/dist/components/atoms/Percent/index.js +39 -0
- package/dist/components/atoms/Percent/styles.js +20 -0
- package/dist/components/atoms/StatusTag/index.js +17 -2
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/molecules/TextAndGradient/TextAndGradient.stories.js +31 -0
- package/dist/components/molecules/TextAndGradient/index.js +36 -0
- package/dist/components/molecules/TextAndGradient/styles.js +18 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +105 -103
- package/dist/components/pages/ProviderProductEdition/index.js +323 -349
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -83
- package/dist/components/pages/RetailerProductEdition/index.js +197 -208
- package/dist/global-files/data.js +9 -10
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/atoms/StatusTag/index.js +12 -2
- package/src/components/atoms/StatusTag/styles.js +11 -11
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +117 -103
- package/src/components/pages/ProviderProductEdition/index.js +171 -165
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +33 -82
- package/src/components/pages/RetailerProductEdition/index.js +167 -139
- package/src/global-files/data.js +9 -10
- package/src/index.js +1 -0
|
@@ -39,7 +39,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
|
|
|
39
39
|
|
|
40
40
|
var _fileSaver = require("file-saver");
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var _data2 = require("../../../global-files/data");
|
|
43
43
|
|
|
44
44
|
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
45
45
|
|
|
@@ -487,7 +487,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
487
487
|
switch (_context2.prev = _context2.next) {
|
|
488
488
|
case 0:
|
|
489
489
|
_context2.next = 2;
|
|
490
|
-
return (0,
|
|
490
|
+
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), (product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName), parseInt((product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), product === null || product === void 0 ? void 0 : product.version);
|
|
491
491
|
|
|
492
492
|
case 2:
|
|
493
493
|
services = _context2.sent;
|
|
@@ -497,7 +497,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
497
497
|
|
|
498
498
|
if (!originProp) {
|
|
499
499
|
setActiveRetailer(product !== null && product !== void 0 && product.retailers ? product === null || product === void 0 ? void 0 : product.retailers[0] : product === null || product === void 0 ? void 0 : product.retailersAvailable[0]);
|
|
500
|
-
} //
|
|
500
|
+
} //setActiveRetailer(product?.retailers[0]);
|
|
501
501
|
|
|
502
502
|
|
|
503
503
|
setImages({
|
|
@@ -505,7 +505,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
505
505
|
init: services[2]
|
|
506
506
|
});
|
|
507
507
|
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);
|
|
508
|
-
(0,
|
|
508
|
+
(0, _data2.getPercentage)({
|
|
509
509
|
data: [product]
|
|
510
510
|
}).then(function (res) {
|
|
511
511
|
return setPercentages(res);
|
|
@@ -529,7 +529,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
529
529
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
530
530
|
var _product$article4;
|
|
531
531
|
|
|
532
|
-
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse,
|
|
532
|
+
var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailers, active;
|
|
533
533
|
|
|
534
534
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
535
535
|
while (1) {
|
|
@@ -539,7 +539,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
539
539
|
idArticle = (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article);
|
|
540
540
|
|
|
541
541
|
if (!(isRevision() || productInOrder)) {
|
|
542
|
-
_context3.next =
|
|
542
|
+
_context3.next = 11;
|
|
543
543
|
break;
|
|
544
544
|
}
|
|
545
545
|
|
|
@@ -549,17 +549,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
549
549
|
case 5:
|
|
550
550
|
servicesResponse = _context3.sent;
|
|
551
551
|
parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
|
|
552
|
-
retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
553
|
-
return srv.id_retailer;
|
|
554
|
-
});
|
|
555
552
|
retailers = product.retailers || product.retailersAvailable;
|
|
556
|
-
active = retailers === null || retailers === void 0 ? void 0 : retailers.
|
|
557
|
-
return
|
|
558
|
-
|
|
553
|
+
active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
|
|
554
|
+
return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
|
|
555
|
+
return srv.id_retailer;
|
|
556
|
+
}).includes(retailer.id);
|
|
557
|
+
})[0];
|
|
559
558
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
560
559
|
setServicesData(parsedResponse);
|
|
561
560
|
|
|
562
|
-
case
|
|
561
|
+
case 11:
|
|
563
562
|
case "end":
|
|
564
563
|
return _context3.stop();
|
|
565
564
|
}
|
|
@@ -587,10 +586,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
587
586
|
if (_revision && currentService === "AP") return true;
|
|
588
587
|
} else {
|
|
589
588
|
var _product = productEdit.product;
|
|
590
|
-
|
|
591
|
-
var isRequestWithContentoh = orgn === "RequestWithContentoh" && currentService === "AA";
|
|
592
|
-
var isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
593
|
-
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh) return true;
|
|
589
|
+
if (orgn === "Contentoh" || ["RECEIVED", "IN_PROGRESS"].includes(currentService) && orgn === "RequestWithoutContentoh" || currentService === "AA" && orgn === "RequestWithContentoh" || currentService === "RC" && orgn === "RequestWithoutContentoh" && (!_product.id_order || !_product.orderId)) return true;
|
|
594
590
|
}
|
|
595
591
|
}
|
|
596
592
|
|
|
@@ -633,36 +629,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
633
629
|
};
|
|
634
630
|
}();
|
|
635
631
|
|
|
636
|
-
(0, _react.useEffect)(function () {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
632
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
633
|
+
var arr;
|
|
634
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
635
|
+
while (1) {
|
|
636
|
+
switch (_context5.prev = _context5.next) {
|
|
637
|
+
case 0:
|
|
638
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
639
|
+
loadData();
|
|
640
|
+
getCart();
|
|
641
|
+
_context5.t0 = setUserGroups;
|
|
642
|
+
_context5.next = 6;
|
|
643
|
+
return (0, _data2.fetchUsers)(token);
|
|
644
|
+
|
|
645
|
+
case 6:
|
|
646
|
+
_context5.t1 = _context5.sent;
|
|
647
|
+
(0, _context5.t0)(_context5.t1);
|
|
648
|
+
arr = [];
|
|
649
|
+
_context5.t2 = user.id_role;
|
|
650
|
+
_context5.next = _context5.t2 === 7 ? 12 : _context5.t2 === 8 ? 12 : _context5.t2 === 4 ? 14 : _context5.t2 === 5 ? 14 : _context5.t2 === 6 ? 16 : 18;
|
|
651
|
+
break;
|
|
644
652
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
arr = ["CA", "RC", "RA"];
|
|
649
|
-
break;
|
|
653
|
+
case 12:
|
|
654
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
655
|
+
return _context5.abrupt("break", 20);
|
|
650
656
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
break;
|
|
657
|
+
case 14:
|
|
658
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
659
|
+
return _context5.abrupt("break", 20);
|
|
655
660
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
661
|
+
case 16:
|
|
662
|
+
arr = ["RP", "RC", "AF"];
|
|
663
|
+
return _context5.abrupt("break", 20);
|
|
659
664
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
665
|
+
case 18:
|
|
666
|
+
arr = [];
|
|
667
|
+
return _context5.abrupt("break", 20);
|
|
663
668
|
|
|
664
|
-
|
|
665
|
-
|
|
669
|
+
case 20:
|
|
670
|
+
setStatusArray(arr);
|
|
671
|
+
|
|
672
|
+
case 21:
|
|
673
|
+
case "end":
|
|
674
|
+
return _context5.stop();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}, _callee5);
|
|
678
|
+
})), [product]);
|
|
666
679
|
|
|
667
680
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
668
681
|
setAssig(product === null || product === void 0 ? void 0 : product.asignations);
|
|
@@ -677,11 +690,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
677
690
|
var productTemp = product;
|
|
678
691
|
var retailers = (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailersAvailable) || (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailers);
|
|
679
692
|
retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer) {
|
|
680
|
-
var _percentages$
|
|
693
|
+
var _percentages$filter$;
|
|
681
694
|
|
|
682
|
-
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$
|
|
695
|
+
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
683
696
|
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
684
|
-
})) === null || _percentages$
|
|
697
|
+
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
685
698
|
});
|
|
686
699
|
setProduct(productTemp);
|
|
687
700
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
@@ -760,12 +773,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
760
773
|
}, [images]);
|
|
761
774
|
|
|
762
775
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
763
|
-
var
|
|
764
|
-
var dataObject
|
|
765
|
-
|
|
766
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
776
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
777
|
+
var dataObject;
|
|
778
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
767
779
|
while (1) {
|
|
768
|
-
switch (
|
|
780
|
+
switch (_context6.prev = _context6.next) {
|
|
769
781
|
case 0:
|
|
770
782
|
setLoading(true);
|
|
771
783
|
dataObject = {
|
|
@@ -773,8 +785,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
773
785
|
articleData: updatedDescriptions
|
|
774
786
|
};
|
|
775
787
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
776
|
-
|
|
777
|
-
|
|
788
|
+
_context6.prev = 3;
|
|
789
|
+
_context6.next = 6;
|
|
778
790
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
779
791
|
headers: {
|
|
780
792
|
Authorization: token
|
|
@@ -782,45 +794,35 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
782
794
|
});
|
|
783
795
|
|
|
784
796
|
case 6:
|
|
785
|
-
_res = _context5.sent;
|
|
786
|
-
|
|
787
|
-
if (!(_res.data.statusCode === 200)) {
|
|
788
|
-
_context5.next = 11;
|
|
789
|
-
break;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
797
|
setMessage("Descripciones guardadas con éxito");
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
case 11:
|
|
797
|
-
_context5.next = 16;
|
|
798
|
+
loadData();
|
|
799
|
+
_context6.next = 13;
|
|
798
800
|
break;
|
|
799
801
|
|
|
800
|
-
case
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
console.log(
|
|
802
|
+
case 10:
|
|
803
|
+
_context6.prev = 10;
|
|
804
|
+
_context6.t0 = _context6["catch"](3);
|
|
805
|
+
console.log(_context6.t0);
|
|
804
806
|
|
|
805
|
-
case
|
|
807
|
+
case 13:
|
|
806
808
|
case "end":
|
|
807
|
-
return
|
|
809
|
+
return _context6.stop();
|
|
808
810
|
}
|
|
809
811
|
}
|
|
810
|
-
},
|
|
812
|
+
}, _callee6, null, [[3, 10]]);
|
|
811
813
|
}));
|
|
812
814
|
|
|
813
815
|
return function saveDescriptions() {
|
|
814
|
-
return
|
|
816
|
+
return _ref7.apply(this, arguments);
|
|
815
817
|
};
|
|
816
818
|
}();
|
|
817
819
|
|
|
818
820
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
819
|
-
var
|
|
821
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
820
822
|
var dataObject;
|
|
821
|
-
return _regenerator.default.wrap(function
|
|
823
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
822
824
|
while (1) {
|
|
823
|
-
switch (
|
|
825
|
+
switch (_context7.prev = _context7.next) {
|
|
824
826
|
case 0:
|
|
825
827
|
setLoading(true);
|
|
826
828
|
dataObject = {
|
|
@@ -828,8 +830,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
828
830
|
articleData: updatedDatasheets
|
|
829
831
|
};
|
|
830
832
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
+
_context7.prev = 3;
|
|
834
|
+
_context7.next = 6;
|
|
833
835
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
834
836
|
headers: {
|
|
835
837
|
Authorization: token
|
|
@@ -837,45 +839,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
837
839
|
});
|
|
838
840
|
|
|
839
841
|
case 6:
|
|
840
|
-
if (!(res.data.statusCode === 200)) {
|
|
841
|
-
_context6.next = 10;
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
842
|
setMessage("Fichas técnicas guardadas");
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
case 10:
|
|
850
|
-
_context6.next = 15;
|
|
843
|
+
loadData();
|
|
844
|
+
_context7.next = 13;
|
|
851
845
|
break;
|
|
852
846
|
|
|
853
|
-
case
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
console.log(
|
|
847
|
+
case 10:
|
|
848
|
+
_context7.prev = 10;
|
|
849
|
+
_context7.t0 = _context7["catch"](3);
|
|
850
|
+
console.log(_context7.t0);
|
|
857
851
|
|
|
858
|
-
case
|
|
852
|
+
case 13:
|
|
859
853
|
case "end":
|
|
860
|
-
return
|
|
854
|
+
return _context7.stop();
|
|
861
855
|
}
|
|
862
856
|
}
|
|
863
|
-
},
|
|
857
|
+
}, _callee7, null, [[3, 10]]);
|
|
864
858
|
}));
|
|
865
859
|
|
|
866
860
|
return function saveDatasheets() {
|
|
867
|
-
return
|
|
861
|
+
return _ref8.apply(this, arguments);
|
|
868
862
|
};
|
|
869
863
|
}();
|
|
870
864
|
|
|
871
|
-
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
865
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
872
866
|
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
873
867
|
|
|
874
868
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
875
869
|
|
|
876
|
-
return _regenerator.default.wrap(function
|
|
870
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
877
871
|
while (1) {
|
|
878
|
-
switch (
|
|
872
|
+
switch (_context8.prev = _context8.next) {
|
|
879
873
|
case 0:
|
|
880
874
|
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
881
875
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
@@ -924,19 +918,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
924
918
|
}
|
|
925
919
|
|
|
926
920
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
927
|
-
|
|
921
|
+
_context8.next = 31;
|
|
928
922
|
break;
|
|
929
923
|
}
|
|
930
924
|
|
|
931
925
|
setLoading(true);
|
|
932
|
-
|
|
926
|
+
_context8.prev = 11;
|
|
933
927
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
934
928
|
e.uuid = (0, _uuid.v4)();
|
|
935
929
|
});
|
|
936
930
|
setDataImages(data);
|
|
937
931
|
|
|
938
932
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
939
|
-
|
|
933
|
+
_context8.next = 23;
|
|
940
934
|
break;
|
|
941
935
|
}
|
|
942
936
|
|
|
@@ -952,28 +946,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
952
946
|
};
|
|
953
947
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
954
948
|
});
|
|
955
|
-
|
|
949
|
+
_context8.next = 20;
|
|
956
950
|
return Promise.all(promiseArray);
|
|
957
951
|
|
|
958
952
|
case 20:
|
|
959
953
|
setImagesUploaded(true);
|
|
960
|
-
|
|
954
|
+
_context8.next = 24;
|
|
961
955
|
break;
|
|
962
956
|
|
|
963
957
|
case 23:
|
|
964
958
|
setImagesUploaded(true);
|
|
965
959
|
|
|
966
960
|
case 24:
|
|
967
|
-
|
|
961
|
+
_context8.next = 29;
|
|
968
962
|
break;
|
|
969
963
|
|
|
970
964
|
case 26:
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
console.log(
|
|
965
|
+
_context8.prev = 26;
|
|
966
|
+
_context8.t0 = _context8["catch"](11);
|
|
967
|
+
console.log(_context8.t0); // setMainLoading(false);
|
|
974
968
|
|
|
975
969
|
case 29:
|
|
976
|
-
|
|
970
|
+
_context8.next = 32;
|
|
977
971
|
break;
|
|
978
972
|
|
|
979
973
|
case 31:
|
|
@@ -982,20 +976,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
982
976
|
|
|
983
977
|
case 32:
|
|
984
978
|
case "end":
|
|
985
|
-
return
|
|
979
|
+
return _context8.stop();
|
|
986
980
|
}
|
|
987
981
|
}
|
|
988
|
-
},
|
|
982
|
+
}, _callee8, null, [[11, 26]]);
|
|
989
983
|
})), [images, imagesUploaded]);
|
|
990
|
-
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
984
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
985
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
994
986
|
while (1) {
|
|
995
|
-
switch (
|
|
987
|
+
switch (_context9.prev = _context9.next) {
|
|
996
988
|
case 0:
|
|
997
989
|
if (!imagesUploaded) {
|
|
998
|
-
|
|
990
|
+
_context9.next = 13;
|
|
999
991
|
break;
|
|
1000
992
|
}
|
|
1001
993
|
|
|
@@ -1007,8 +999,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1007
999
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
1008
1000
|
return e;
|
|
1009
1001
|
});
|
|
1010
|
-
|
|
1011
|
-
|
|
1002
|
+
_context9.prev = 2;
|
|
1003
|
+
_context9.next = 5;
|
|
1012
1004
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
1013
1005
|
headers: {
|
|
1014
1006
|
Authorization: token
|
|
@@ -1016,33 +1008,23 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1016
1008
|
});
|
|
1017
1009
|
|
|
1018
1010
|
case 5:
|
|
1019
|
-
_res2 = _context8.sent;
|
|
1020
|
-
|
|
1021
|
-
if (!(_res2.data.statusCode === 200)) {
|
|
1022
|
-
_context8.next = 11;
|
|
1023
|
-
break;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
1011
|
setMessage("Imágenes guardadas con éxito");
|
|
1027
1012
|
sessionStorage.removeItem("imagesList");
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
case 11:
|
|
1032
|
-
_context8.next = 16;
|
|
1013
|
+
loadData();
|
|
1014
|
+
_context9.next = 13;
|
|
1033
1015
|
break;
|
|
1034
1016
|
|
|
1035
|
-
case
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
console.log(
|
|
1017
|
+
case 10:
|
|
1018
|
+
_context9.prev = 10;
|
|
1019
|
+
_context9.t0 = _context9["catch"](2);
|
|
1020
|
+
console.log(_context9.t0);
|
|
1039
1021
|
|
|
1040
|
-
case
|
|
1022
|
+
case 13:
|
|
1041
1023
|
case "end":
|
|
1042
|
-
return
|
|
1024
|
+
return _context9.stop();
|
|
1043
1025
|
}
|
|
1044
1026
|
}
|
|
1045
|
-
},
|
|
1027
|
+
}, _callee9, null, [[2, 10]]);
|
|
1046
1028
|
})), [dataImages, imagesUploaded]);
|
|
1047
1029
|
|
|
1048
1030
|
var getConcept = function getConcept(tab) {
|
|
@@ -1078,28 +1060,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1078
1060
|
};
|
|
1079
1061
|
|
|
1080
1062
|
var createComment = /*#__PURE__*/function () {
|
|
1081
|
-
var
|
|
1063
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
|
|
1082
1064
|
var concept, data;
|
|
1083
|
-
return _regenerator.default.wrap(function
|
|
1065
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1084
1066
|
while (1) {
|
|
1085
|
-
switch (
|
|
1067
|
+
switch (_context10.prev = _context10.next) {
|
|
1086
1068
|
case 0:
|
|
1087
1069
|
concept = "";
|
|
1088
|
-
|
|
1089
|
-
|
|
1070
|
+
_context10.t0 = activeTab;
|
|
1071
|
+
_context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
|
|
1090
1072
|
break;
|
|
1091
1073
|
|
|
1092
1074
|
case 4:
|
|
1093
1075
|
concept = "datasheet";
|
|
1094
|
-
return
|
|
1076
|
+
return _context10.abrupt("break", 10);
|
|
1095
1077
|
|
|
1096
1078
|
case 6:
|
|
1097
1079
|
concept = "images";
|
|
1098
|
-
return
|
|
1080
|
+
return _context10.abrupt("break", 10);
|
|
1099
1081
|
|
|
1100
1082
|
case 8:
|
|
1101
1083
|
concept = "description";
|
|
1102
|
-
return
|
|
1084
|
+
return _context10.abrupt("break", 10);
|
|
1103
1085
|
|
|
1104
1086
|
case 10:
|
|
1105
1087
|
data = {
|
|
@@ -1109,7 +1091,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1109
1091
|
concept: concept,
|
|
1110
1092
|
version: version
|
|
1111
1093
|
};
|
|
1112
|
-
|
|
1094
|
+
_context10.next = 13;
|
|
1113
1095
|
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1114
1096
|
headers: {
|
|
1115
1097
|
Authorization: token
|
|
@@ -1118,14 +1100,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1118
1100
|
|
|
1119
1101
|
case 13:
|
|
1120
1102
|
case "end":
|
|
1121
|
-
return
|
|
1103
|
+
return _context10.stop();
|
|
1122
1104
|
}
|
|
1123
1105
|
}
|
|
1124
|
-
},
|
|
1106
|
+
}, _callee10);
|
|
1125
1107
|
}));
|
|
1126
1108
|
|
|
1127
1109
|
return function createComment(_x2, _x3, _x4) {
|
|
1128
|
-
return
|
|
1110
|
+
return _ref11.apply(this, arguments);
|
|
1129
1111
|
};
|
|
1130
1112
|
}();
|
|
1131
1113
|
|
|
@@ -1134,16 +1116,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1134
1116
|
}, [activeTab]);
|
|
1135
1117
|
|
|
1136
1118
|
var commentRevised = /*#__PURE__*/function () {
|
|
1137
|
-
var
|
|
1119
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1138
1120
|
var data;
|
|
1139
|
-
return _regenerator.default.wrap(function
|
|
1121
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1140
1122
|
while (1) {
|
|
1141
|
-
switch (
|
|
1123
|
+
switch (_context11.prev = _context11.next) {
|
|
1142
1124
|
case 0:
|
|
1143
1125
|
data = {
|
|
1144
1126
|
commentId: comment.id
|
|
1145
1127
|
};
|
|
1146
|
-
|
|
1128
|
+
_context11.next = 3;
|
|
1147
1129
|
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1148
1130
|
headers: {
|
|
1149
1131
|
Authorization: token
|
|
@@ -1155,54 +1137,52 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1155
1137
|
|
|
1156
1138
|
case 4:
|
|
1157
1139
|
case "end":
|
|
1158
|
-
return
|
|
1140
|
+
return _context11.stop();
|
|
1159
1141
|
}
|
|
1160
1142
|
}
|
|
1161
|
-
},
|
|
1143
|
+
}, _callee11);
|
|
1162
1144
|
}));
|
|
1163
1145
|
|
|
1164
1146
|
return function commentRevised() {
|
|
1165
|
-
return
|
|
1147
|
+
return _ref12.apply(this, arguments);
|
|
1166
1148
|
};
|
|
1167
1149
|
}();
|
|
1168
1150
|
|
|
1169
1151
|
var setAssignation = /*#__PURE__*/function () {
|
|
1170
|
-
var
|
|
1152
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
|
|
1171
1153
|
var concept, productTemp, data;
|
|
1172
|
-
return _regenerator.default.wrap(function
|
|
1154
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1173
1155
|
while (1) {
|
|
1174
|
-
switch (
|
|
1156
|
+
switch (_context12.prev = _context12.next) {
|
|
1175
1157
|
case 0:
|
|
1176
1158
|
concept = "";
|
|
1177
|
-
|
|
1178
|
-
|
|
1159
|
+
_context12.t0 = activeTab;
|
|
1160
|
+
_context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
|
|
1179
1161
|
break;
|
|
1180
1162
|
|
|
1181
1163
|
case 4:
|
|
1182
1164
|
concept = "datasheet";
|
|
1183
|
-
return
|
|
1165
|
+
return _context12.abrupt("break", 10);
|
|
1184
1166
|
|
|
1185
1167
|
case 6:
|
|
1186
1168
|
concept = "images";
|
|
1187
|
-
return
|
|
1169
|
+
return _context12.abrupt("break", 10);
|
|
1188
1170
|
|
|
1189
1171
|
case 8:
|
|
1190
1172
|
concept = "description";
|
|
1191
|
-
return
|
|
1173
|
+
return _context12.abrupt("break", 10);
|
|
1192
1174
|
|
|
1193
1175
|
case 10:
|
|
1194
1176
|
productTemp = product;
|
|
1195
1177
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1196
|
-
data = {
|
|
1178
|
+
data = (0, _defineProperty2.default)({
|
|
1197
1179
|
articleList: [{
|
|
1198
1180
|
orderId: product.orderId,
|
|
1199
1181
|
articleId: product === null || product === void 0 ? void 0 : product.id_article
|
|
1200
1182
|
}],
|
|
1201
|
-
concept: concept
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
_context11.next = 15;
|
|
1205
|
-
return (0, _axios.default)({
|
|
1183
|
+
concept: concept
|
|
1184
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1185
|
+
(0, _axios.default)({
|
|
1206
1186
|
method: "post",
|
|
1207
1187
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1208
1188
|
data: data,
|
|
@@ -1210,21 +1190,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1210
1190
|
Authorization: token
|
|
1211
1191
|
}
|
|
1212
1192
|
});
|
|
1213
|
-
|
|
1214
|
-
case 15:
|
|
1215
1193
|
loadAssignations(productTemp);
|
|
1216
1194
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1217
1195
|
|
|
1218
|
-
case
|
|
1196
|
+
case 16:
|
|
1219
1197
|
case "end":
|
|
1220
|
-
return
|
|
1198
|
+
return _context12.stop();
|
|
1221
1199
|
}
|
|
1222
1200
|
}
|
|
1223
|
-
},
|
|
1201
|
+
}, _callee12);
|
|
1224
1202
|
}));
|
|
1225
1203
|
|
|
1226
1204
|
return function setAssignation(_x5, _x6) {
|
|
1227
|
-
return
|
|
1205
|
+
return _ref13.apply(this, arguments);
|
|
1228
1206
|
};
|
|
1229
1207
|
}();
|
|
1230
1208
|
|
|
@@ -1240,7 +1218,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1240
1218
|
});
|
|
1241
1219
|
}
|
|
1242
1220
|
|
|
1243
|
-
var statusArray = user.is_retailer === 1 ? ["
|
|
1221
|
+
var statusArray = user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
|
|
1244
1222
|
return serv.length > 0 && serv.every(function (item) {
|
|
1245
1223
|
return statusArray.includes(item.status);
|
|
1246
1224
|
});
|
|
@@ -1329,7 +1307,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1329
1307
|
var datasheet_status = product.datasheet_status,
|
|
1330
1308
|
description_status = product.description_status,
|
|
1331
1309
|
images_status = product.images_status;
|
|
1332
|
-
var completionStates = user.is_retailer === 1 ? ["
|
|
1310
|
+
var completionStates = user.is_retailer === 1 ? ["AC", "Evaluated", "NS"] : ["AP", "Evaluated", "NS"];
|
|
1333
1311
|
var dsEvaluated = completionStates.includes(datasheet_status);
|
|
1334
1312
|
var descsEvaluated = completionStates.includes(description_status);
|
|
1335
1313
|
var imgsEvaluated = completionStates.includes(images_status);
|
|
@@ -1338,124 +1316,107 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1338
1316
|
};
|
|
1339
1317
|
|
|
1340
1318
|
var sendEvaluation = /*#__PURE__*/function () {
|
|
1341
|
-
var
|
|
1342
|
-
var
|
|
1319
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1320
|
+
var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
|
|
1343
1321
|
|
|
1344
|
-
|
|
1345
|
-
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1322
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1346
1323
|
while (1) {
|
|
1347
|
-
switch (
|
|
1324
|
+
switch (_context13.prev = _context13.next) {
|
|
1348
1325
|
case 0:
|
|
1349
1326
|
setLoading(true);
|
|
1350
|
-
|
|
1351
|
-
productTemp = product;
|
|
1352
|
-
articleId = productTemp.id_article;
|
|
1353
|
-
orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
|
|
1354
|
-
evalStatus = product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status);
|
|
1355
|
-
data = {
|
|
1356
|
-
articleId: articleId,
|
|
1357
|
-
orderId: orderId,
|
|
1358
|
-
concept: concept,
|
|
1359
|
-
evalStatus: evalStatus
|
|
1360
|
-
};
|
|
1327
|
+
data = {};
|
|
1361
1328
|
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1362
|
-
_context12.prev = 8;
|
|
1363
1329
|
|
|
1364
1330
|
if (!result) {
|
|
1365
|
-
|
|
1331
|
+
_context13.next = 9;
|
|
1366
1332
|
break;
|
|
1367
1333
|
}
|
|
1368
1334
|
|
|
1369
|
-
data
|
|
1370
|
-
|
|
1371
|
-
|
|
1335
|
+
data = {
|
|
1336
|
+
articleId: product.id_article,
|
|
1337
|
+
orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
|
|
1338
|
+
concept: getConcept(activeTab),
|
|
1339
|
+
result: result,
|
|
1340
|
+
retailerId: retailerId
|
|
1341
|
+
};
|
|
1342
|
+
_context13.next = 7;
|
|
1372
1343
|
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1373
1344
|
headers: {
|
|
1374
1345
|
Authorization: token
|
|
1375
1346
|
}
|
|
1376
1347
|
});
|
|
1377
1348
|
|
|
1378
|
-
case
|
|
1379
|
-
|
|
1380
|
-
_context12.next = 20;
|
|
1349
|
+
case 7:
|
|
1350
|
+
_context13.next = 19;
|
|
1381
1351
|
break;
|
|
1382
1352
|
|
|
1383
|
-
case
|
|
1384
|
-
|
|
1385
|
-
|
|
1353
|
+
case 9:
|
|
1354
|
+
productTemp = product;
|
|
1355
|
+
concept = getConcept(activeTab);
|
|
1356
|
+
productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1357
|
+
data = {
|
|
1358
|
+
articleId: product.id_article,
|
|
1359
|
+
orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
|
|
1360
|
+
concept: concept
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1363
|
+
_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1386
1364
|
headers: {
|
|
1387
1365
|
Authorization: token
|
|
1388
1366
|
}
|
|
1389
1367
|
});
|
|
1390
1368
|
|
|
1391
|
-
case 19:
|
|
1392
|
-
res = _context12.sent;
|
|
1393
|
-
|
|
1394
|
-
case 20:
|
|
1395
|
-
if (!(res.data.statusCode === 200)) {
|
|
1396
|
-
_context12.next = 31;
|
|
1397
|
-
break;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1401
1369
|
setProduct(productTemp);
|
|
1402
1370
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1403
|
-
|
|
1404
|
-
ArticleId:
|
|
1371
|
+
setProductEdit({
|
|
1372
|
+
ArticleId: productTemp.id_article,
|
|
1405
1373
|
idCategory: productTemp.article.id_category,
|
|
1406
1374
|
product: productTemp
|
|
1407
|
-
};
|
|
1408
|
-
|
|
1409
|
-
|
|
1375
|
+
});
|
|
1376
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1377
|
+
ArticleId: productTemp.id_article,
|
|
1378
|
+
idCategory: productTemp.article.id_category,
|
|
1379
|
+
product: productTemp
|
|
1380
|
+
}));
|
|
1410
1381
|
setOrigin(function (prev) {
|
|
1411
1382
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
|
|
1412
1383
|
});
|
|
1413
|
-
_context12.next = 30;
|
|
1414
|
-
return loadData();
|
|
1415
1384
|
|
|
1416
|
-
case
|
|
1385
|
+
case 19:
|
|
1386
|
+
loadData();
|
|
1417
1387
|
showSurvey && showSurvey(confirmStatusComplete());
|
|
1418
1388
|
|
|
1419
|
-
case
|
|
1420
|
-
_context12.next = 36;
|
|
1421
|
-
break;
|
|
1422
|
-
|
|
1423
|
-
case 33:
|
|
1424
|
-
_context12.prev = 33;
|
|
1425
|
-
_context12.t0 = _context12["catch"](8);
|
|
1426
|
-
console.log(_context12.t0);
|
|
1427
|
-
|
|
1428
|
-
case 36:
|
|
1389
|
+
case 21:
|
|
1429
1390
|
case "end":
|
|
1430
|
-
return
|
|
1391
|
+
return _context13.stop();
|
|
1431
1392
|
}
|
|
1432
1393
|
}
|
|
1433
|
-
},
|
|
1394
|
+
}, _callee13);
|
|
1434
1395
|
}));
|
|
1435
1396
|
|
|
1436
1397
|
return function sendEvaluation(_x7) {
|
|
1437
|
-
return
|
|
1398
|
+
return _ref14.apply(this, arguments);
|
|
1438
1399
|
};
|
|
1439
1400
|
}();
|
|
1440
1401
|
|
|
1441
1402
|
var validateAll = /*#__PURE__*/function () {
|
|
1442
|
-
var
|
|
1403
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1443
1404
|
var evaluationArray, sendAll, conceptArray, productTemp;
|
|
1444
|
-
return _regenerator.default.wrap(function
|
|
1405
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1445
1406
|
while (1) {
|
|
1446
|
-
switch (
|
|
1407
|
+
switch (_context14.prev = _context14.next) {
|
|
1447
1408
|
case 0:
|
|
1448
|
-
|
|
1409
|
+
_context14.prev = 0;
|
|
1449
1410
|
setLoading(true);
|
|
1450
1411
|
evaluationArray = [];
|
|
1451
1412
|
sendAll = [];
|
|
1452
1413
|
conceptArray = ["description", "datasheet", "images"];
|
|
1453
1414
|
servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
|
|
1454
|
-
var _product$
|
|
1415
|
+
var _product$id_order4;
|
|
1455
1416
|
|
|
1456
1417
|
var data = {
|
|
1457
1418
|
articleId: product.id_article,
|
|
1458
|
-
orderId: (_product$
|
|
1419
|
+
orderId: (_product$id_order4 = product.id_order) !== null && _product$id_order4 !== void 0 ? _product$id_order4 : product.orderId,
|
|
1459
1420
|
concept: ret.service,
|
|
1460
1421
|
result: result,
|
|
1461
1422
|
retailerId: ret.id_retailer
|
|
@@ -1466,16 +1427,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1466
1427
|
}
|
|
1467
1428
|
}));
|
|
1468
1429
|
});
|
|
1469
|
-
|
|
1430
|
+
_context14.next = 8;
|
|
1470
1431
|
return Promise.all(evaluationArray);
|
|
1471
1432
|
|
|
1472
1433
|
case 8:
|
|
1473
1434
|
conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
|
|
1474
|
-
var _product$
|
|
1435
|
+
var _product$id_order5;
|
|
1475
1436
|
|
|
1476
1437
|
var data = {
|
|
1477
1438
|
articleId: product.id_article,
|
|
1478
|
-
orderId: (_product$
|
|
1439
|
+
orderId: (_product$id_order5 = product.id_order) !== null && _product$id_order5 !== void 0 ? _product$id_order5 : product.orderId,
|
|
1479
1440
|
concept: concept
|
|
1480
1441
|
};
|
|
1481
1442
|
sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
@@ -1484,15 +1445,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1484
1445
|
}
|
|
1485
1446
|
}));
|
|
1486
1447
|
});
|
|
1487
|
-
|
|
1448
|
+
_context14.next = 11;
|
|
1488
1449
|
return Promise.all(sendAll);
|
|
1489
1450
|
|
|
1490
1451
|
case 11:
|
|
1491
1452
|
productTemp = product;
|
|
1492
|
-
productTemp.article_status = "".concat(result, "
|
|
1493
|
-
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "
|
|
1494
|
-
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "
|
|
1495
|
-
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "
|
|
1453
|
+
productTemp.article_status = "".concat(result, "C");
|
|
1454
|
+
productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1455
|
+
productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1456
|
+
productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "C");
|
|
1496
1457
|
setProduct(productTemp);
|
|
1497
1458
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1498
1459
|
setProductEdit({
|
|
@@ -1505,37 +1466,34 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1505
1466
|
idCategory: productTemp.article.id_category,
|
|
1506
1467
|
product: productTemp
|
|
1507
1468
|
}));
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
case 22:
|
|
1512
|
-
_context13.next = 27;
|
|
1469
|
+
loadData();
|
|
1470
|
+
_context14.next = 26;
|
|
1513
1471
|
break;
|
|
1514
1472
|
|
|
1515
|
-
case
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
console.log(
|
|
1473
|
+
case 23:
|
|
1474
|
+
_context14.prev = 23;
|
|
1475
|
+
_context14.t0 = _context14["catch"](0);
|
|
1476
|
+
console.log(_context14.t0);
|
|
1519
1477
|
|
|
1520
|
-
case
|
|
1478
|
+
case 26:
|
|
1521
1479
|
case "end":
|
|
1522
|
-
return
|
|
1480
|
+
return _context14.stop();
|
|
1523
1481
|
}
|
|
1524
1482
|
}
|
|
1525
|
-
},
|
|
1483
|
+
}, _callee14, null, [[0, 23]]);
|
|
1526
1484
|
}));
|
|
1527
1485
|
|
|
1528
1486
|
return function validateAll(_x8) {
|
|
1529
|
-
return
|
|
1487
|
+
return _ref15.apply(this, arguments);
|
|
1530
1488
|
};
|
|
1531
1489
|
}();
|
|
1532
1490
|
|
|
1533
1491
|
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1534
|
-
var
|
|
1492
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1535
1493
|
var data, prod, statusComplete;
|
|
1536
|
-
return _regenerator.default.wrap(function
|
|
1494
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1537
1495
|
while (1) {
|
|
1538
|
-
switch (
|
|
1496
|
+
switch (_context15.prev = _context15.next) {
|
|
1539
1497
|
case 0:
|
|
1540
1498
|
data = {
|
|
1541
1499
|
articleId: product.id_article,
|
|
@@ -1543,7 +1501,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1543
1501
|
versionId: product.version,
|
|
1544
1502
|
status: result
|
|
1545
1503
|
};
|
|
1546
|
-
|
|
1504
|
+
_context15.next = 3;
|
|
1547
1505
|
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1548
1506
|
headers: {
|
|
1549
1507
|
Authorization: token
|
|
@@ -1552,7 +1510,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1552
1510
|
|
|
1553
1511
|
case 3:
|
|
1554
1512
|
prod = productEdit;
|
|
1555
|
-
statusComplete = user.is_retailer ? "".concat(result, "
|
|
1513
|
+
statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
|
|
1556
1514
|
prod.product.datasheet_status = statusComplete;
|
|
1557
1515
|
prod.product.description_status = statusComplete;
|
|
1558
1516
|
prod.product.images_status = statusComplete;
|
|
@@ -1561,33 +1519,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1561
1519
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1562
1520
|
setProduct(prod);
|
|
1563
1521
|
setShowGenericModal && setShowGenericModal(false);
|
|
1564
|
-
|
|
1565
|
-
return loadData();
|
|
1522
|
+
loadData();
|
|
1566
1523
|
|
|
1567
|
-
case
|
|
1524
|
+
case 14:
|
|
1568
1525
|
case "end":
|
|
1569
|
-
return
|
|
1526
|
+
return _context15.stop();
|
|
1570
1527
|
}
|
|
1571
1528
|
}
|
|
1572
|
-
},
|
|
1529
|
+
}, _callee15);
|
|
1573
1530
|
}));
|
|
1574
1531
|
|
|
1575
1532
|
return function evaluationToRetailer(_x9) {
|
|
1576
|
-
return
|
|
1533
|
+
return _ref16.apply(this, arguments);
|
|
1577
1534
|
};
|
|
1578
1535
|
}();
|
|
1579
1536
|
|
|
1580
1537
|
var getSectionStatus = function getSectionStatus() {
|
|
1581
1538
|
var concept = getConcept(activeTab);
|
|
1582
|
-
return ["AA", "AP", "
|
|
1539
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1583
1540
|
};
|
|
1584
1541
|
|
|
1585
1542
|
var enableActions = function enableActions(versionStatus) {
|
|
1586
1543
|
try {
|
|
1587
|
-
|
|
1544
|
+
var userIsRetailer = user.is_retailer;
|
|
1545
|
+
if (userIsRetailer) return false;
|
|
1588
1546
|
|
|
1589
1547
|
if (versionStatus) {
|
|
1590
|
-
return ["AP", "
|
|
1548
|
+
return ["AP", "AC", "RC", null].includes(versionStatus);
|
|
1591
1549
|
}
|
|
1592
1550
|
|
|
1593
1551
|
return true;
|
|
@@ -1668,49 +1626,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1668
1626
|
});
|
|
1669
1627
|
});
|
|
1670
1628
|
setShowGenericModal(true);
|
|
1671
|
-
} else
|
|
1672
|
-
if (
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1629
|
+
} else {
|
|
1630
|
+
if (user.is_retailer) {
|
|
1631
|
+
if (product.id_order || product.orderId) {
|
|
1632
|
+
validateAll("A");
|
|
1633
|
+
} else {
|
|
1634
|
+
setDataGenericModal(function (prev) {
|
|
1635
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1636
|
+
button2: {
|
|
1637
|
+
name: "Continuar",
|
|
1638
|
+
action: function action() {
|
|
1639
|
+
return evaluationToRetailer("A");
|
|
1640
|
+
}
|
|
1681
1641
|
}
|
|
1682
|
-
}
|
|
1642
|
+
});
|
|
1683
1643
|
});
|
|
1684
|
-
|
|
1685
|
-
|
|
1644
|
+
setShowGenericModal(true);
|
|
1645
|
+
}
|
|
1646
|
+
} else {
|
|
1647
|
+
validateAll("A");
|
|
1686
1648
|
}
|
|
1687
|
-
} else {
|
|
1688
|
-
validateAll("A");
|
|
1689
1649
|
}
|
|
1690
1650
|
},
|
|
1691
1651
|
rejectAll: function rejectAll() {
|
|
1692
1652
|
if (originProp === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1693
1653
|
return;
|
|
1694
|
-
} else
|
|
1695
|
-
if (
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1654
|
+
} else {
|
|
1655
|
+
if (user.is_retailer) {
|
|
1656
|
+
if (product.id_order || product.orderId) {
|
|
1657
|
+
validateAll("R");
|
|
1658
|
+
setModalViewError(true);
|
|
1659
|
+
} else {
|
|
1660
|
+
setDataGenericModal(function (prev) {
|
|
1661
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1662
|
+
button2: {
|
|
1663
|
+
name: "Continuar",
|
|
1664
|
+
action: function action() {
|
|
1665
|
+
return evaluationToRetailer("R");
|
|
1666
|
+
}
|
|
1705
1667
|
}
|
|
1706
|
-
}
|
|
1668
|
+
});
|
|
1707
1669
|
});
|
|
1708
|
-
|
|
1709
|
-
|
|
1670
|
+
setShowGenericModal(true);
|
|
1671
|
+
}
|
|
1672
|
+
} else {
|
|
1673
|
+
validateAll("R");
|
|
1674
|
+
setModalViewError(true);
|
|
1710
1675
|
}
|
|
1711
|
-
} else {
|
|
1712
|
-
validateAll("R");
|
|
1713
|
-
setModalViewError(true);
|
|
1714
1676
|
}
|
|
1715
1677
|
},
|
|
1716
1678
|
approve: function approve() {
|
|
@@ -1726,49 +1688,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1726
1688
|
});
|
|
1727
1689
|
});
|
|
1728
1690
|
setShowGenericModal(true);
|
|
1729
|
-
} else
|
|
1730
|
-
if (
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1691
|
+
} else {
|
|
1692
|
+
if (user.is_retailer) {
|
|
1693
|
+
if (product.id_order || product.orderId) {
|
|
1694
|
+
sendEvaluation("A");
|
|
1695
|
+
} else {
|
|
1696
|
+
setDataGenericModal(function (prev) {
|
|
1697
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1698
|
+
button2: {
|
|
1699
|
+
name: "Continuar",
|
|
1700
|
+
action: function action() {
|
|
1701
|
+
return evaluationToRetailer("A");
|
|
1702
|
+
}
|
|
1739
1703
|
}
|
|
1740
|
-
}
|
|
1704
|
+
});
|
|
1741
1705
|
});
|
|
1742
|
-
|
|
1743
|
-
|
|
1706
|
+
setShowGenericModal(true);
|
|
1707
|
+
}
|
|
1708
|
+
} else {
|
|
1709
|
+
sendEvaluation("A");
|
|
1744
1710
|
}
|
|
1745
|
-
} else {
|
|
1746
|
-
sendEvaluation("A");
|
|
1747
1711
|
}
|
|
1748
1712
|
},
|
|
1749
1713
|
reject: function reject() {
|
|
1750
1714
|
if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1751
1715
|
return;
|
|
1752
|
-
} else
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1716
|
+
} else {
|
|
1717
|
+
if (user.is_retailer) {
|
|
1718
|
+
if (product.id_order || product.orderId) {
|
|
1719
|
+
sendEvaluation("R");
|
|
1720
|
+
setModalViewError(true);
|
|
1721
|
+
} else {
|
|
1722
|
+
setDataGenericModal(function (prev) {
|
|
1723
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1724
|
+
button2: {
|
|
1725
|
+
name: "Continuar",
|
|
1726
|
+
action: function action() {
|
|
1727
|
+
return evaluationToRetailer("R");
|
|
1728
|
+
}
|
|
1763
1729
|
}
|
|
1764
|
-
}
|
|
1730
|
+
});
|
|
1765
1731
|
});
|
|
1766
|
-
|
|
1767
|
-
|
|
1732
|
+
setShowGenericModal(true);
|
|
1733
|
+
}
|
|
1734
|
+
} else {
|
|
1735
|
+
sendEvaluation("R");
|
|
1736
|
+
setModalViewError(true);
|
|
1768
1737
|
}
|
|
1769
|
-
} else {
|
|
1770
|
-
sendEvaluation("R");
|
|
1771
|
-
setModalViewError(true);
|
|
1772
1738
|
}
|
|
1773
1739
|
}
|
|
1774
1740
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
@@ -1847,9 +1813,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1847
1813
|
headerType: "input-name-header"
|
|
1848
1814
|
}))]
|
|
1849
1815
|
})
|
|
1850
|
-
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.
|
|
1816
|
+
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1851
1817
|
className: "commentary-box",
|
|
1852
|
-
children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1818
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1853
1819
|
className: "commentary",
|
|
1854
1820
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1855
1821
|
label: "Caja de Comentario",
|
|
@@ -1875,23 +1841,31 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1875
1841
|
reviewed: crossComment
|
|
1876
1842
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1877
1843
|
buttonType: "circular-button accept-button",
|
|
1878
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1879
|
-
return _regenerator.default.wrap(function
|
|
1844
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1845
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1880
1846
|
while (1) {
|
|
1881
|
-
switch (
|
|
1847
|
+
switch (_context16.prev = _context16.next) {
|
|
1882
1848
|
case 0:
|
|
1883
1849
|
setCrossComment(true);
|
|
1884
1850
|
commentRevised();
|
|
1885
1851
|
|
|
1886
1852
|
case 2:
|
|
1887
1853
|
case "end":
|
|
1888
|
-
return
|
|
1854
|
+
return _context16.stop();
|
|
1889
1855
|
}
|
|
1890
1856
|
}
|
|
1891
|
-
},
|
|
1857
|
+
}, _callee16);
|
|
1892
1858
|
}))
|
|
1893
1859
|
})]
|
|
1894
|
-
})
|
|
1860
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1861
|
+
buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
|
|
1862
|
+
label: "Enviar evaluación",
|
|
1863
|
+
onClick: function onClick() {
|
|
1864
|
+
//setModalSent(true);
|
|
1865
|
+
sendEvaluation();
|
|
1866
|
+
setMessage("\xA1Evaluaci\xF3n de ".concat(activeTab, " completada!"));
|
|
1867
|
+
}
|
|
1868
|
+
})]
|
|
1895
1869
|
}) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1896
1870
|
className: "required-inputs-message",
|
|
1897
1871
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|