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