contentoh-components-library 21.1.55 → 21.1.59

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