contentoh-components-library 21.1.55 → 21.1.56

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