contentoh-components-library 21.1.46 → 21.1.47

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.
@@ -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
  });
@@ -1307,7 +1334,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1307
1334
  var datasheet_status = product.datasheet_status,
1308
1335
  description_status = product.description_status,
1309
1336
  images_status = product.images_status;
1310
- 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"];
1311
1338
  var dsEvaluated = completionStates.includes(datasheet_status);
1312
1339
  var descsEvaluated = completionStates.includes(description_status);
1313
1340
  var imgsEvaluated = completionStates.includes(images_status);
@@ -1316,107 +1343,135 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1316
1343
  };
1317
1344
 
1318
1345
  var sendEvaluation = /*#__PURE__*/function () {
1319
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1320
- var data, retailerId, _product$id_order2, _product$id_order3, productTemp, concept;
1346
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
1347
+ var _productTemp$id_order;
1321
1348
 
1322
- return _regenerator.default.wrap(function _callee13$(_context13) {
1349
+ var concept, productTemp, articleId, orderId, evalStatus, data, retailerId, res, orderStatus, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status, newProductEdit;
1350
+
1351
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1323
1352
  while (1) {
1324
- switch (_context13.prev = _context13.next) {
1353
+ switch (_context12.prev = _context12.next) {
1325
1354
  case 0:
1326
1355
  setLoading(true);
1327
- data = {};
1356
+ concept = getConcept(activeTab);
1357
+ productTemp = product;
1358
+ articleId = productTemp.id_article;
1359
+ orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
1360
+ evalStatus = product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status);
1361
+ data = {
1362
+ articleId: articleId,
1363
+ orderId: orderId,
1364
+ concept: concept,
1365
+ evalStatus: evalStatus
1366
+ };
1328
1367
  retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
1368
+ _context12.prev = 8;
1329
1369
 
1330
1370
  if (!result) {
1331
- _context13.next = 9;
1371
+ _context12.next = 19;
1332
1372
  break;
1333
1373
  }
1334
1374
 
1335
- data = {
1336
- articleId: product.id_article,
1337
- orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1338
- concept: getConcept(activeTab),
1339
- result: result,
1340
- retailerId: retailerId
1341
- };
1342
- _context13.next = 7;
1375
+ data.result = result;
1376
+ data.retailerId = retailerId;
1377
+ _context12.next = 14;
1343
1378
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1344
1379
  headers: {
1345
1380
  Authorization: token
1346
1381
  }
1347
1382
  });
1348
1383
 
1349
- case 7:
1350
- _context13.next = 19;
1384
+ case 14:
1385
+ res = _context12.sent;
1386
+ orderStatus = JSON.parse(res.data.body).newOrderStatus;
1387
+ showSurvey && showSurvey(orderStatus[orderId] === "AP");
1388
+ _context12.next = 22;
1351
1389
  break;
1352
1390
 
1353
- case 9:
1354
- productTemp = product;
1355
- concept = getConcept(activeTab);
1356
- productTemp["".concat(concept, "_status")] = "Evaluated";
1357
- data = {
1358
- articleId: product.id_article,
1359
- orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
1360
- concept: concept
1361
- };
1362
-
1363
- _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1391
+ case 19:
1392
+ _context12.next = 21;
1393
+ return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1364
1394
  headers: {
1365
1395
  Authorization: token
1366
1396
  }
1367
1397
  });
1368
1398
 
1399
+ case 21:
1400
+ res = _context12.sent;
1401
+
1402
+ case 22:
1403
+ if (!(res.data.statusCode === 200)) {
1404
+ _context12.next = 38;
1405
+ break;
1406
+ }
1407
+
1408
+ _JSON$parse = JSON.parse(res.data.body), newArticleStatus = _JSON$parse.newArticleStatus, newServiceStatus = _JSON$parse.newServiceStatus, newStatus = _JSON$parse.newStatus;
1409
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
1410
+ retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1411
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
1412
+ setRetailerStatus(retailerStatusCopy);
1413
+ productTemp.statusByRetailer = retailerStatusCopy;
1414
+
1415
+ if (newServiceStatus) {
1416
+ status = newServiceStatus[articleId]["".concat(concept, "Status")];
1417
+ productTemp["".concat(concept, "_status")] = status;
1418
+ }
1419
+
1369
1420
  setProduct(productTemp);
1370
1421
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1371
- setProductEdit({
1372
- ArticleId: productTemp.id_article,
1422
+ newProductEdit = {
1423
+ ArticleId: articleId,
1373
1424
  idCategory: productTemp.article.id_category,
1374
1425
  product: productTemp
1375
- });
1376
- sessionStorage.setItem("productEdit", JSON.stringify({
1377
- ArticleId: productTemp.id_article,
1378
- idCategory: productTemp.article.id_category,
1379
- product: productTemp
1380
- }));
1426
+ };
1427
+ setProductEdit(newProductEdit);
1428
+ sessionStorage.setItem("productEdit", JSON.stringify(newProductEdit));
1381
1429
  setOrigin(function (prev) {
1382
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
1430
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, status));
1383
1431
  });
1432
+ _context12.next = 38;
1433
+ return loadData();
1384
1434
 
1385
- case 19:
1386
- loadData();
1387
- showSurvey && showSurvey(confirmStatusComplete());
1435
+ case 38:
1436
+ _context12.next = 43;
1437
+ break;
1388
1438
 
1389
- case 21:
1439
+ case 40:
1440
+ _context12.prev = 40;
1441
+ _context12.t0 = _context12["catch"](8);
1442
+ console.log(_context12.t0);
1443
+
1444
+ case 43:
1390
1445
  case "end":
1391
- return _context13.stop();
1446
+ return _context12.stop();
1392
1447
  }
1393
1448
  }
1394
- }, _callee13);
1449
+ }, _callee12, null, [[8, 40]]);
1395
1450
  }));
1396
1451
 
1397
1452
  return function sendEvaluation(_x7) {
1398
- return _ref14.apply(this, arguments);
1453
+ return _ref13.apply(this, arguments);
1399
1454
  };
1400
1455
  }();
1401
1456
 
1402
1457
  var validateAll = /*#__PURE__*/function () {
1403
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
1404
- var evaluationArray, sendAll, conceptArray, productTemp;
1405
- return _regenerator.default.wrap(function _callee14$(_context14) {
1458
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1459
+ var evaluationArray, sendAll, conceptArray, productTemp, retailerStatusCopy;
1460
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1406
1461
  while (1) {
1407
- switch (_context14.prev = _context14.next) {
1462
+ switch (_context13.prev = _context13.next) {
1408
1463
  case 0:
1409
- _context14.prev = 0;
1464
+ _context13.prev = 0;
1410
1465
  setLoading(true);
1411
1466
  evaluationArray = [];
1412
1467
  sendAll = [];
1413
1468
  conceptArray = ["description", "datasheet", "images"];
1414
1469
  servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1415
- var _product$id_order4;
1470
+ var _product$id_order2;
1416
1471
 
1417
1472
  var data = {
1418
1473
  articleId: product.id_article,
1419
- orderId: (_product$id_order4 = product.id_order) !== null && _product$id_order4 !== void 0 ? _product$id_order4 : product.orderId,
1474
+ orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1420
1475
  concept: ret.service,
1421
1476
  result: result,
1422
1477
  retailerId: ret.id_retailer
@@ -1427,16 +1482,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1427
1482
  }
1428
1483
  }));
1429
1484
  });
1430
- _context14.next = 8;
1485
+ _context13.next = 8;
1431
1486
  return Promise.all(evaluationArray);
1432
1487
 
1433
1488
  case 8:
1434
1489
  conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
1435
- var _product$id_order5;
1490
+ var _product$id_order3;
1436
1491
 
1437
1492
  var data = {
1438
1493
  articleId: product.id_article,
1439
- orderId: (_product$id_order5 = product.id_order) !== null && _product$id_order5 !== void 0 ? _product$id_order5 : product.orderId,
1494
+ orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
1440
1495
  concept: concept
1441
1496
  };
1442
1497
  sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
@@ -1445,15 +1500,25 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1445
1500
  }
1446
1501
  }));
1447
1502
  });
1448
- _context14.next = 11;
1503
+ _context13.next = 11;
1449
1504
  return Promise.all(sendAll);
1450
1505
 
1451
1506
  case 11:
1452
1507
  productTemp = product;
1453
- productTemp.article_status = "".concat(result, "C");
1454
- productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "C");
1455
- productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "C");
1456
- productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "C");
1508
+ productTemp.article_status = "".concat(result, "CA");
1509
+ productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "CA");
1510
+ productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "CA");
1511
+ productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "CA");
1512
+ retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1513
+ Object.keys(retailerStatusCopy).forEach(function (key) {
1514
+ conceptArray.forEach(function (concept) {
1515
+ if (retailerStatusCopy[key][concept]) {
1516
+ retailerStatusCopy[key][concept] = "".concat(result, "CA");
1517
+ }
1518
+ });
1519
+ });
1520
+ setRetailerStatus(retailerStatusCopy);
1521
+ productTemp.statusByRetailer = retailerStatusCopy;
1457
1522
  setProduct(productTemp);
1458
1523
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1459
1524
  setProductEdit({
@@ -1466,34 +1531,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1466
1531
  idCategory: productTemp.article.id_category,
1467
1532
  product: productTemp
1468
1533
  }));
1469
- loadData();
1470
- _context14.next = 26;
1534
+ _context13.next = 26;
1535
+ return loadData();
1536
+
1537
+ case 26:
1538
+ _context13.next = 31;
1471
1539
  break;
1472
1540
 
1473
- case 23:
1474
- _context14.prev = 23;
1475
- _context14.t0 = _context14["catch"](0);
1476
- console.log(_context14.t0);
1541
+ case 28:
1542
+ _context13.prev = 28;
1543
+ _context13.t0 = _context13["catch"](0);
1544
+ console.log(_context13.t0);
1477
1545
 
1478
- case 26:
1546
+ case 31:
1479
1547
  case "end":
1480
- return _context14.stop();
1548
+ return _context13.stop();
1481
1549
  }
1482
1550
  }
1483
- }, _callee14, null, [[0, 23]]);
1551
+ }, _callee13, null, [[0, 28]]);
1484
1552
  }));
1485
1553
 
1486
1554
  return function validateAll(_x8) {
1487
- return _ref15.apply(this, arguments);
1555
+ return _ref14.apply(this, arguments);
1488
1556
  };
1489
1557
  }();
1490
1558
 
1491
1559
  var evaluationToRetailer = /*#__PURE__*/function () {
1492
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1560
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
1493
1561
  var data, prod, statusComplete;
1494
- return _regenerator.default.wrap(function _callee15$(_context15) {
1562
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1495
1563
  while (1) {
1496
- switch (_context15.prev = _context15.next) {
1564
+ switch (_context14.prev = _context14.next) {
1497
1565
  case 0:
1498
1566
  data = {
1499
1567
  articleId: product.id_article,
@@ -1501,7 +1569,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1501
1569
  versionId: product.version,
1502
1570
  status: result
1503
1571
  };
1504
- _context15.next = 3;
1572
+ _context14.next = 3;
1505
1573
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1506
1574
  headers: {
1507
1575
  Authorization: token
@@ -1510,7 +1578,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1510
1578
 
1511
1579
  case 3:
1512
1580
  prod = productEdit;
1513
- statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
1581
+ statusComplete = user.is_retailer ? "".concat(result, "CA") : "".concat(result, "P");
1514
1582
  prod.product.datasheet_status = statusComplete;
1515
1583
  prod.product.description_status = statusComplete;
1516
1584
  prod.product.images_status = statusComplete;
@@ -1519,33 +1587,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1519
1587
  sessionStorage.setItem("productEdit", JSON.stringify(prod));
1520
1588
  setProduct(prod);
1521
1589
  setShowGenericModal && setShowGenericModal(false);
1522
- loadData();
1590
+ _context14.next = 15;
1591
+ return loadData();
1523
1592
 
1524
- case 14:
1593
+ case 15:
1525
1594
  case "end":
1526
- return _context15.stop();
1595
+ return _context14.stop();
1527
1596
  }
1528
1597
  }
1529
- }, _callee15);
1598
+ }, _callee14);
1530
1599
  }));
1531
1600
 
1532
1601
  return function evaluationToRetailer(_x9) {
1533
- return _ref16.apply(this, arguments);
1602
+ return _ref15.apply(this, arguments);
1534
1603
  };
1535
1604
  }();
1536
1605
 
1537
1606
  var getSectionStatus = function getSectionStatus() {
1538
1607
  var concept = getConcept(activeTab);
1539
- return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
1608
+ return ["AA", "AP", "R", "CA", "RCA"].includes(productEdit.product["".concat(concept, "_status")]);
1540
1609
  };
1541
1610
 
1542
1611
  var enableActions = function enableActions(versionStatus) {
1543
1612
  try {
1544
- var userIsRetailer = user.is_retailer;
1545
- if (userIsRetailer) return false;
1613
+ if (user.is_retailer) return false;
1546
1614
 
1547
1615
  if (versionStatus) {
1548
- return ["AP", "AC", "RC", null].includes(versionStatus);
1616
+ return ["AP", "ACA", "RCA", null].includes(versionStatus);
1549
1617
  }
1550
1618
 
1551
1619
  return true;
@@ -1626,53 +1694,49 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1626
1694
  });
1627
1695
  });
1628
1696
  setShowGenericModal(true);
1629
- } else {
1630
- if (user.is_retailer) {
1631
- if (product.id_order || product.orderId) {
1632
- validateAll("A");
1633
- } else {
1634
- setDataGenericModal(function (prev) {
1635
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1636
- button2: {
1637
- name: "Continuar",
1638
- action: function action() {
1639
- return evaluationToRetailer("A");
1640
- }
1697
+ } else if (user.is_retailer) {
1698
+ if (product.id_order || product.orderId) {
1699
+ validateAll("A");
1700
+ } else {
1701
+ setDataGenericModal(function (prev) {
1702
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1703
+ button2: {
1704
+ name: "Continuar",
1705
+ action: function action() {
1706
+ return evaluationToRetailer("A");
1641
1707
  }
1642
- });
1708
+ }
1643
1709
  });
1644
- setShowGenericModal(true);
1645
- }
1646
- } else {
1647
- validateAll("A");
1710
+ });
1711
+ setShowGenericModal(true);
1648
1712
  }
1713
+ } else {
1714
+ validateAll("A");
1649
1715
  }
1650
1716
  },
1651
1717
  rejectAll: function rejectAll() {
1652
1718
  if (originProp === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
1653
1719
  return;
1654
- } else {
1655
- if (user.is_retailer) {
1656
- if (product.id_order || product.orderId) {
1657
- validateAll("R");
1658
- setModalViewError(true);
1659
- } else {
1660
- setDataGenericModal(function (prev) {
1661
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1662
- button2: {
1663
- name: "Continuar",
1664
- action: function action() {
1665
- return evaluationToRetailer("R");
1666
- }
1667
- }
1668
- });
1669
- });
1670
- setShowGenericModal(true);
1671
- }
1672
- } else {
1720
+ } else if (user.is_retailer) {
1721
+ if (product.id_order || product.orderId) {
1673
1722
  validateAll("R");
1674
1723
  setModalViewError(true);
1724
+ } else {
1725
+ setDataGenericModal(function (prev) {
1726
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1727
+ button2: {
1728
+ name: "Continuar",
1729
+ action: function action() {
1730
+ return evaluationToRetailer("R");
1731
+ }
1732
+ }
1733
+ });
1734
+ });
1735
+ setShowGenericModal(true);
1675
1736
  }
1737
+ } else {
1738
+ validateAll("R");
1739
+ setModalViewError(true);
1676
1740
  }
1677
1741
  },
1678
1742
  approve: function approve() {
@@ -1688,58 +1752,54 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1688
1752
  });
1689
1753
  });
1690
1754
  setShowGenericModal(true);
1691
- } else {
1692
- if (user.is_retailer) {
1693
- if (product.id_order || product.orderId) {
1694
- sendEvaluation("A");
1695
- } else {
1696
- setDataGenericModal(function (prev) {
1697
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1698
- button2: {
1699
- name: "Continuar",
1700
- action: function action() {
1701
- return evaluationToRetailer("A");
1702
- }
1755
+ } else if (user.is_retailer) {
1756
+ if (product.id_order || product.orderId) {
1757
+ sendEvaluation("A");
1758
+ } else {
1759
+ setDataGenericModal(function (prev) {
1760
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1761
+ button2: {
1762
+ name: "Continuar",
1763
+ action: function action() {
1764
+ return evaluationToRetailer("A");
1703
1765
  }
1704
- });
1766
+ }
1705
1767
  });
1706
- setShowGenericModal(true);
1707
- }
1708
- } else {
1709
- sendEvaluation("A");
1768
+ });
1769
+ setShowGenericModal(true);
1710
1770
  }
1771
+ } else {
1772
+ sendEvaluation("A");
1711
1773
  }
1712
1774
  },
1713
1775
  reject: function reject() {
1714
1776
  if (origin[activeTab] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
1715
1777
  return;
1716
- } else {
1717
- if (user.is_retailer) {
1718
- if (product.id_order || product.orderId) {
1719
- sendEvaluation("R");
1720
- setModalViewError(true);
1721
- } else {
1722
- setDataGenericModal(function (prev) {
1723
- return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1724
- button2: {
1725
- name: "Continuar",
1726
- action: function action() {
1727
- return evaluationToRetailer("R");
1728
- }
1729
- }
1730
- });
1731
- });
1732
- setShowGenericModal(true);
1733
- }
1734
- } else {
1778
+ } else if (user.is_retailer) {
1779
+ if (product.id_order || product.orderId) {
1735
1780
  sendEvaluation("R");
1736
1781
  setModalViewError(true);
1782
+ } else {
1783
+ setDataGenericModal(function (prev) {
1784
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
1785
+ button2: {
1786
+ name: "Continuar",
1787
+ action: function action() {
1788
+ return evaluationToRetailer("R");
1789
+ }
1790
+ }
1791
+ });
1792
+ });
1793
+ setShowGenericModal(true);
1737
1794
  }
1795
+ } else {
1796
+ sendEvaluation("R");
1797
+ setModalViewError(true);
1738
1798
  }
1739
1799
  }
1740
1800
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1741
1801
  tabsSections: tabsSections,
1742
- status: product["".concat(getConcept(activeTab), "_status")] || (product === null || product === void 0 ? void 0 : product.version_status),
1802
+ status: activeRetailer.id ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
1743
1803
  activeTab: activeTab,
1744
1804
  setActiveTab: setActiveTab,
1745
1805
  setImageLayout: setImageLayout,
@@ -1813,9 +1873,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1813
1873
  headerType: "input-name-header"
1814
1874
  }))]
1815
1875
  })
1816
- }), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1876
+ }), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1817
1877
  className: "commentary-box",
1818
- children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1878
+ children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1819
1879
  className: "commentary",
1820
1880
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1821
1881
  label: "Caja de Comentario",
@@ -1841,32 +1901,24 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1841
1901
  reviewed: crossComment
1842
1902
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1843
1903
  buttonType: "circular-button accept-button",
1844
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1845
- return _regenerator.default.wrap(function _callee16$(_context16) {
1904
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1905
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1846
1906
  while (1) {
1847
- switch (_context16.prev = _context16.next) {
1907
+ switch (_context15.prev = _context15.next) {
1848
1908
  case 0:
1849
1909
  setCrossComment(true);
1850
1910
  commentRevised();
1851
1911
 
1852
1912
  case 2:
1853
1913
  case "end":
1854
- return _context16.stop();
1914
+ return _context15.stop();
1855
1915
  }
1856
1916
  }
1857
- }, _callee16);
1917
+ }, _callee15);
1858
1918
  }))
1859
1919
  })]
1860
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1861
- buttonType: evaluationComplete(activeTab) && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
1862
- label: "Enviar evaluación",
1863
- onClick: function onClick() {
1864
- //setModalSent(true);
1865
- sendEvaluation();
1866
- setMessage("\xA1Evaluaci\xF3n de ".concat(activeTab, " completada!"));
1867
- }
1868
- })]
1869
- }) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1920
+ })
1921
+ }) : !revision && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1870
1922
  className: "required-inputs-message",
1871
1923
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1872
1924
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {