contentoh-components-library 21.3.41 → 21.3.43

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.
@@ -53,12 +53,6 @@ var _uuid = require("uuid");
53
53
 
54
54
  var _awsSdk = _interopRequireDefault(require("aws-sdk"));
55
55
 
56
- var _attributesSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/attributesSent.svg"));
57
-
58
- var _descriptionSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/descriptionSent.svg"));
59
-
60
- var _uploadingImages = _interopRequireDefault(require("../../../assets/images/modalsSVGs/uploadingImages.svg"));
61
-
62
56
  var _index = require("../../molecules/TagAndInput/index");
63
57
 
64
58
  var _GeneralButton = require("../../atoms/GeneralButton");
@@ -227,7 +221,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
227
221
  revision = _ref$revision === void 0 ? false : _ref$revision,
228
222
  setShowContentohRequestModal = _ref.setShowContentohRequestModal,
229
223
  showSurvey = _ref.showSurvey,
230
- company = _ref.company;
224
+ company = _ref.company,
225
+ addToCart = _ref.addToCart;
231
226
 
232
227
  var _useState = (0, _react.useState)("Descripción"),
233
228
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -472,9 +467,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
472
467
  detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
473
468
  button1: {
474
469
  name: "Cerrar",
475
- action: function action() {
476
- return setGlobalModal();
477
- }
470
+ action: closeGlobalModal
478
471
  },
479
472
  button2: {
480
473
  name: "Continuar",
@@ -513,6 +506,170 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
513
506
  globalModal = _useState74[0],
514
507
  setGlobalModal = _useState74[1];
515
508
 
509
+ var updateAuditStatus = /*#__PURE__*/function () {
510
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(status) {
511
+ var productTemp, retailerStatusCopy, conceptArray;
512
+ return _regenerator.default.wrap(function _callee2$(_context2) {
513
+ while (1) {
514
+ switch (_context2.prev = _context2.next) {
515
+ case 0:
516
+ productTemp = product;
517
+ productTemp.article_status = status;
518
+ productTemp.datasheet_status = status;
519
+ productTemp.description_status = status;
520
+ productTemp.images_status = status;
521
+ retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
522
+ conceptArray = ["description", "datasheet", "images"];
523
+ Object.keys(retailerStatusCopy).forEach(function (key) {
524
+ conceptArray.forEach(function (concept) {
525
+ if (retailerStatusCopy[key][concept]) {
526
+ retailerStatusCopy[key][concept] = status;
527
+ }
528
+ });
529
+ });
530
+ setRetailerStatus(retailerStatusCopy);
531
+ productTemp.statusByRetailer = retailerStatusCopy;
532
+ setProduct(productTemp);
533
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
534
+ setProductEdit({
535
+ ArticleId: productTemp.id_article,
536
+ idCategory: productTemp.article.id_category,
537
+ product: productTemp
538
+ });
539
+ sessionStorage.setItem("productEdit", JSON.stringify({
540
+ ArticleId: productTemp.id_article,
541
+ idCategory: productTemp.article.id_category,
542
+ product: productTemp
543
+ }));
544
+ _context2.next = 16;
545
+ return loadData();
546
+
547
+ case 16:
548
+ case "end":
549
+ return _context2.stop();
550
+ }
551
+ }
552
+ }, _callee2);
553
+ }));
554
+
555
+ return function updateAuditStatus(_x2) {
556
+ return _ref3.apply(this, arguments);
557
+ };
558
+ }();
559
+
560
+ var addCart = /*#__PURE__*/function () {
561
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(retailers) {
562
+ var article, version, articleToOrder, modatlType, resCart;
563
+ return _regenerator.default.wrap(function _callee3$(_context3) {
564
+ while (1) {
565
+ switch (_context3.prev = _context3.next) {
566
+ case 0:
567
+ article = product.article, version = product.version;
568
+ articleToOrder = [{
569
+ articleId: article.id_article,
570
+ version: version,
571
+ userId: user.id_user,
572
+ discount: 0,
573
+ subtotal: 0,
574
+ companyId: user.id_company,
575
+ datasheet: retailers,
576
+ description: retailers,
577
+ image: retailers,
578
+ attributeTranslations: false,
579
+ descriptionTranslations: false,
580
+ build: "[]",
581
+ manual: "[]",
582
+ userCreated: user.id_user
583
+ }];
584
+ modatlType = "addedToCartError";
585
+
586
+ if (!addToCart) {
587
+ _context3.next = 8;
588
+ break;
589
+ }
590
+
591
+ _context3.next = 6;
592
+ return addToCart({
593
+ data: articleToOrder
594
+ });
595
+
596
+ case 6:
597
+ resCart = _context3.sent;
598
+
599
+ if (resCart.data.statusCode === 200) {
600
+ modatlType = "addedToCart";
601
+ }
602
+
603
+ case 8:
604
+ showGlobalModal(modatlType);
605
+
606
+ case 9:
607
+ case "end":
608
+ return _context3.stop();
609
+ }
610
+ }
611
+ }, _callee3);
612
+ }));
613
+
614
+ return function addCart(_x3) {
615
+ return _ref4.apply(this, arguments);
616
+ };
617
+ }();
618
+
619
+ var closeGlobalModal = function closeGlobalModal() {
620
+ return setGlobalModal();
621
+ };
622
+
623
+ var seenByProvider = /*#__PURE__*/function () {
624
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
625
+ var _productTemp$id_order;
626
+
627
+ var productTemp, articleId, orderId, promises, conceptArray;
628
+ return _regenerator.default.wrap(function _callee4$(_context4) {
629
+ while (1) {
630
+ switch (_context4.prev = _context4.next) {
631
+ case 0:
632
+ productTemp = product;
633
+ articleId = productTemp.id_article;
634
+ orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
635
+ promises = [];
636
+ conceptArray = ["description", "datasheet", "images"];
637
+ conceptArray.forEach(function (concept) {
638
+ var sectionStatusKey = "".concat(concept, "_status");
639
+ var evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
640
+ var data = {
641
+ articleId: articleId,
642
+ orderId: orderId,
643
+ concept: concept,
644
+ evalStatus: evalStatus
645
+ };
646
+ promises.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
647
+ headers: {
648
+ Authorization: token
649
+ }
650
+ }));
651
+ });
652
+ _context4.next = 8;
653
+ return Promise.all(promises);
654
+
655
+ case 8:
656
+ closeGlobalModal();
657
+ _context4.next = 11;
658
+ return updateAuditStatus("FAP");
659
+
660
+ case 11:
661
+ case "end":
662
+ return _context4.stop();
663
+ }
664
+ }
665
+ }, _callee4);
666
+ }));
667
+
668
+ return function seenByProvider() {
669
+ return _ref5.apply(this, arguments);
670
+ };
671
+ }();
672
+
516
673
  var showGlobalModal = (0, _react.useCallback)(function (type) {
517
674
  var formatter = new Intl.ListFormat("es", {
518
675
  type: "conjunction"
@@ -553,9 +710,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
553
710
  detail: "Trabajaremos en conjunto para resolverlo.",
554
711
  button1: {
555
712
  name: "Cerrar",
556
- action: function action() {
557
- return setGlobalModal();
558
- }
713
+ action: closeGlobalModal
559
714
  },
560
715
  img: _defaultProfileImage.default,
561
716
  textArea: false
@@ -565,9 +720,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
565
720
  case "RAC":
566
721
  var servicesRejected = [];
567
722
  var translateServices = {
568
- datasheet: '"ficha técnica"',
569
- description: '"descripción"',
570
- images: '"imágenes"'
723
+ datasheet: "ficha técnica",
724
+ description: "descripción",
725
+ images: "imágenes"
571
726
  };
572
727
  Object.keys(translateServices).forEach(function (service) {
573
728
  if (product["".concat(service, "_status")] === "RAC") {
@@ -580,6 +735,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
580
735
  var formatted = formatter.format(servicesRejected);
581
736
  var text1 = "".concat(grammar[0], " de ").concat(formatted, " no ").concat(grammar[1], " con lo que la cadena necesita.");
582
737
  var text2 = "\xA1Solicita el servicio de Content-oh! para completarlo!";
738
+ var retailers = product.retailersWithService.map(function (retailer) {
739
+ return Number(retailer);
740
+ });
583
741
  setGlobalModal({
584
742
  message: "Tu producto no cumple con los requerimientos de la cadena",
585
743
  customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
@@ -590,17 +748,64 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
590
748
  }),
591
749
  button1: {
592
750
  name: "Continuar",
593
- action: function action() {
594
- return setGlobalModal();
595
- }
751
+ action: function () {
752
+ var _action = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
753
+ return _regenerator.default.wrap(function _callee5$(_context5) {
754
+ while (1) {
755
+ switch (_context5.prev = _context5.next) {
756
+ case 0:
757
+ _context5.next = 2;
758
+ return seenByProvider();
759
+
760
+ case 2:
761
+ return _context5.abrupt("return", _context5.sent);
762
+
763
+ case 3:
764
+ case "end":
765
+ return _context5.stop();
766
+ }
767
+ }
768
+ }, _callee5);
769
+ }));
770
+
771
+ function action() {
772
+ return _action.apply(this, arguments);
773
+ }
774
+
775
+ return action;
776
+ }()
596
777
  },
597
778
  button2: {
598
779
  name: "Solicitar a Content-oh!",
599
- action: function action() {
600
- return setGlobalModal();
601
- }
780
+ action: function () {
781
+ var _action2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
782
+ return _regenerator.default.wrap(function _callee6$(_context6) {
783
+ while (1) {
784
+ switch (_context6.prev = _context6.next) {
785
+ case 0:
786
+ _context6.next = 2;
787
+ return addCart(retailers);
788
+
789
+ case 2:
790
+ _context6.next = 4;
791
+ return seenByProvider();
792
+
793
+ case 4:
794
+ case "end":
795
+ return _context6.stop();
796
+ }
797
+ }
798
+ }, _callee6);
799
+ }));
800
+
801
+ function action() {
802
+ return _action2.apply(this, arguments);
803
+ }
804
+
805
+ return action;
806
+ }()
602
807
  },
603
- img: _defaultProfileImage.default
808
+ img: _errorModal.default
604
809
  });
605
810
  break;
606
811
 
@@ -610,19 +815,64 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
610
815
  detail: "Tu producto cumple con los requerimientos de la cadena.",
611
816
  button1: {
612
817
  name: "Continuar",
613
- action: function action() {
614
- return setGlobalModal();
615
- }
818
+ action: function () {
819
+ var _action3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
820
+ return _regenerator.default.wrap(function _callee7$(_context7) {
821
+ while (1) {
822
+ switch (_context7.prev = _context7.next) {
823
+ case 0:
824
+ _context7.next = 2;
825
+ return seenByProvider();
826
+
827
+ case 2:
828
+ return _context7.abrupt("return", _context7.sent);
829
+
830
+ case 3:
831
+ case "end":
832
+ return _context7.stop();
833
+ }
834
+ }
835
+ }, _callee7);
836
+ }));
837
+
838
+ function action() {
839
+ return _action3.apply(this, arguments);
840
+ }
841
+
842
+ return action;
843
+ }()
844
+ },
845
+ img: _defaultProfileImage.default
846
+ });
847
+ break;
848
+
849
+ case "addedToCartError":
850
+ setGlobalModal({
851
+ detail: "Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
852
+ button1: {
853
+ name: "Continuar",
854
+ action: closeGlobalModal
855
+ }
856
+ });
857
+ break;
858
+
859
+ case "addedToCart":
860
+ setGlobalModal({
861
+ message: "Producto añadido",
862
+ detail: "Tu producto se añadió al carrito de compras.",
863
+ button1: {
864
+ name: "Continuar",
865
+ action: closeGlobalModal
616
866
  },
617
867
  img: _defaultProfileImage.default
618
868
  });
619
869
  break;
620
870
 
621
871
  default:
622
- setGlobalModal();
872
+ closeGlobalModal();
623
873
  break;
624
874
  }
625
- }, [activeTab, dataGenericModal]);
875
+ }, [activeTab, dataGenericModal, product]);
626
876
  (0, _react.useEffect)(function () {
627
877
  checkAll && setSelectedImages(images.values);
628
878
  }, [checkAll]);
@@ -633,22 +883,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
633
883
  }, [showModal]);
634
884
 
635
885
  var loadData = /*#__PURE__*/function () {
636
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
886
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
637
887
  var _product$article, _product$article2, _product$article3, _services$, _services$$values;
638
888
 
639
889
  var services;
640
- return _regenerator.default.wrap(function _callee2$(_context2) {
890
+ return _regenerator.default.wrap(function _callee8$(_context8) {
641
891
  while (1) {
642
- switch (_context2.prev = _context2.next) {
892
+ switch (_context8.prev = _context8.next) {
643
893
  case 0:
644
- _context2.next = 2;
894
+ _context8.next = 2;
645
895
  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)), version);
646
896
 
647
897
  case 2:
648
- services = _context2.sent;
898
+ services = _context8.sent;
649
899
  //Converts the data inside the datasheets object to array
650
900
  setServices(services);
651
- _context2.next = 6;
901
+ _context8.next = 6;
652
902
  return getServices();
653
903
 
654
904
  case 6:
@@ -666,26 +916,26 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
666
916
 
667
917
  case 10:
668
918
  case "end":
669
- return _context2.stop();
919
+ return _context8.stop();
670
920
  }
671
921
  }
672
- }, _callee2);
922
+ }, _callee8);
673
923
  }));
674
924
 
675
925
  return function loadData() {
676
- return _ref3.apply(this, arguments);
926
+ return _ref6.apply(this, arguments);
677
927
  };
678
928
  }();
679
929
 
680
930
  var getServices = /*#__PURE__*/function () {
681
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
931
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
682
932
  var _product$article4;
683
933
 
684
934
  var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
685
935
 
686
- return _regenerator.default.wrap(function _callee3$(_context3) {
936
+ return _regenerator.default.wrap(function _callee9$(_context9) {
687
937
  while (1) {
688
- switch (_context3.prev = _context3.next) {
938
+ switch (_context9.prev = _context9.next) {
689
939
  case 0:
690
940
  productInOrder = product.id_order || product.orderId;
691
941
  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);
@@ -693,15 +943,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
693
943
  active = null;
694
944
 
695
945
  if (!(isRevision() || productInOrder)) {
696
- _context3.next = 12;
946
+ _context9.next = 12;
697
947
  break;
698
948
  }
699
949
 
700
- _context3.next = 7;
950
+ _context9.next = 7;
701
951
  return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(idArticle, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
702
952
 
703
953
  case 7:
704
- servicesResponse = _context3.sent;
954
+ servicesResponse = _context9.sent;
705
955
  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;
706
956
  retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
707
957
  return srv.id_retailer;
@@ -716,14 +966,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
716
966
 
717
967
  case 13:
718
968
  case "end":
719
- return _context3.stop();
969
+ return _context9.stop();
720
970
  }
721
971
  }
722
- }, _callee3);
972
+ }, _callee9);
723
973
  }));
724
974
 
725
975
  return function getServices() {
726
- return _ref4.apply(this, arguments);
976
+ return _ref7.apply(this, arguments);
727
977
  };
728
978
  }();
729
979
 
@@ -753,13 +1003,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
753
1003
  };
754
1004
 
755
1005
  var getCart = /*#__PURE__*/function () {
756
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
1006
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
757
1007
  var res, arr;
758
- return _regenerator.default.wrap(function _callee4$(_context4) {
1008
+ return _regenerator.default.wrap(function _callee10$(_context10) {
759
1009
  while (1) {
760
- switch (_context4.prev = _context4.next) {
1010
+ switch (_context10.prev = _context10.next) {
761
1011
  case 0:
762
- _context4.next = 2;
1012
+ _context10.next = 2;
763
1013
  return _axios.default.get(process.env.REACT_APP_CART, {
764
1014
  headers: {
765
1015
  Authorization: token
@@ -767,7 +1017,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
767
1017
  });
768
1018
 
769
1019
  case 2:
770
- res = _context4.sent;
1020
+ res = _context10.sent;
771
1021
  arr = JSON.parse(res.data.body).data.map(function (e) {
772
1022
  return e.article_id;
773
1023
  });
@@ -777,14 +1027,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
777
1027
 
778
1028
  case 5:
779
1029
  case "end":
780
- return _context4.stop();
1030
+ return _context10.stop();
781
1031
  }
782
1032
  }
783
- }, _callee4);
1033
+ }, _callee10);
784
1034
  }));
785
1035
 
786
1036
  return function getCart() {
787
- return _ref5.apply(this, arguments);
1037
+ return _ref8.apply(this, arguments);
788
1038
  };
789
1039
  }();
790
1040
 
@@ -910,11 +1160,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
910
1160
  }, [images]);
911
1161
 
912
1162
  var saveDescriptions = /*#__PURE__*/function () {
913
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1163
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
914
1164
  var dataObject, res;
915
- return _regenerator.default.wrap(function _callee5$(_context5) {
1165
+ return _regenerator.default.wrap(function _callee11$(_context11) {
916
1166
  while (1) {
917
- switch (_context5.prev = _context5.next) {
1167
+ switch (_context11.prev = _context11.next) {
918
1168
  case 0:
919
1169
  setLoading(true);
920
1170
  dataObject = {
@@ -922,8 +1172,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
922
1172
  articleData: updatedDescriptions
923
1173
  };
924
1174
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
925
- _context5.prev = 3;
926
- _context5.next = 6;
1175
+ _context11.prev = 3;
1176
+ _context11.next = 6;
927
1177
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
928
1178
  headers: {
929
1179
  Authorization: token
@@ -931,45 +1181,45 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
931
1181
  });
932
1182
 
933
1183
  case 6:
934
- res = _context5.sent;
1184
+ res = _context11.sent;
935
1185
 
936
1186
  if (!(res.data.statusCode === 200)) {
937
- _context5.next = 11;
1187
+ _context11.next = 11;
938
1188
  break;
939
1189
  }
940
1190
 
941
1191
  setMessage("Descripciones guardadas con éxito");
942
- _context5.next = 11;
1192
+ _context11.next = 11;
943
1193
  return loadData();
944
1194
 
945
1195
  case 11:
946
- _context5.next = 16;
1196
+ _context11.next = 16;
947
1197
  break;
948
1198
 
949
1199
  case 13:
950
- _context5.prev = 13;
951
- _context5.t0 = _context5["catch"](3);
952
- console.log(_context5.t0);
1200
+ _context11.prev = 13;
1201
+ _context11.t0 = _context11["catch"](3);
1202
+ console.log(_context11.t0);
953
1203
 
954
1204
  case 16:
955
1205
  case "end":
956
- return _context5.stop();
1206
+ return _context11.stop();
957
1207
  }
958
1208
  }
959
- }, _callee5, null, [[3, 13]]);
1209
+ }, _callee11, null, [[3, 13]]);
960
1210
  }));
961
1211
 
962
1212
  return function saveDescriptions() {
963
- return _ref6.apply(this, arguments);
1213
+ return _ref9.apply(this, arguments);
964
1214
  };
965
1215
  }();
966
1216
 
967
1217
  var saveDatasheets = /*#__PURE__*/function () {
968
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1218
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
969
1219
  var dataObject, res;
970
- return _regenerator.default.wrap(function _callee6$(_context6) {
1220
+ return _regenerator.default.wrap(function _callee12$(_context12) {
971
1221
  while (1) {
972
- switch (_context6.prev = _context6.next) {
1222
+ switch (_context12.prev = _context12.next) {
973
1223
  case 0:
974
1224
  setLoading(true);
975
1225
  dataObject = {
@@ -977,8 +1227,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
977
1227
  articleData: updatedDatasheets
978
1228
  };
979
1229
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
980
- _context6.prev = 3;
981
- _context6.next = 6;
1230
+ _context12.prev = 3;
1231
+ _context12.next = 6;
982
1232
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
983
1233
  headers: {
984
1234
  Authorization: token
@@ -986,47 +1236,47 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
986
1236
  });
987
1237
 
988
1238
  case 6:
989
- res = _context6.sent;
1239
+ res = _context12.sent;
990
1240
 
991
1241
  if (!(res.data.statusCode === 200)) {
992
- _context6.next = 11;
1242
+ _context12.next = 11;
993
1243
  break;
994
1244
  }
995
1245
 
996
1246
  setMessage("Fichas técnicas guardadas");
997
- _context6.next = 11;
1247
+ _context12.next = 11;
998
1248
  return loadData();
999
1249
 
1000
1250
  case 11:
1001
- _context6.next = 16;
1251
+ _context12.next = 16;
1002
1252
  break;
1003
1253
 
1004
1254
  case 13:
1005
- _context6.prev = 13;
1006
- _context6.t0 = _context6["catch"](3);
1007
- console.log(_context6.t0);
1255
+ _context12.prev = 13;
1256
+ _context12.t0 = _context12["catch"](3);
1257
+ console.log(_context12.t0);
1008
1258
 
1009
1259
  case 16:
1010
1260
  case "end":
1011
- return _context6.stop();
1261
+ return _context12.stop();
1012
1262
  }
1013
1263
  }
1014
- }, _callee6, null, [[3, 13]]);
1264
+ }, _callee12, null, [[3, 13]]);
1015
1265
  }));
1016
1266
 
1017
1267
  return function saveDatasheets() {
1018
- return _ref7.apply(this, arguments);
1268
+ return _ref10.apply(this, arguments);
1019
1269
  };
1020
1270
  }();
1021
1271
 
1022
- var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1272
+ var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1023
1273
  var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
1024
1274
 
1025
1275
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
1026
1276
 
1027
- return _regenerator.default.wrap(function _callee7$(_context7) {
1277
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1028
1278
  while (1) {
1029
- switch (_context7.prev = _context7.next) {
1279
+ switch (_context13.prev = _context13.next) {
1030
1280
  case 0:
1031
1281
  imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
1032
1282
  imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
@@ -1075,19 +1325,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1075
1325
  }
1076
1326
 
1077
1327
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
1078
- _context7.next = 31;
1328
+ _context13.next = 31;
1079
1329
  break;
1080
1330
  }
1081
1331
 
1082
1332
  setLoading(true);
1083
- _context7.prev = 11;
1333
+ _context13.prev = 11;
1084
1334
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
1085
1335
  e.uuid = (0, _uuid.v4)();
1086
1336
  });
1087
1337
  setDataImages(data);
1088
1338
 
1089
1339
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
1090
- _context7.next = 23;
1340
+ _context13.next = 23;
1091
1341
  break;
1092
1342
  }
1093
1343
 
@@ -1103,28 +1353,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1103
1353
  };
1104
1354
  promiseArray.push(myBucket.putObject(params).promise());
1105
1355
  });
1106
- _context7.next = 20;
1356
+ _context13.next = 20;
1107
1357
  return Promise.all(promiseArray);
1108
1358
 
1109
1359
  case 20:
1110
1360
  setImagesUploaded(true);
1111
- _context7.next = 24;
1361
+ _context13.next = 24;
1112
1362
  break;
1113
1363
 
1114
1364
  case 23:
1115
1365
  setImagesUploaded(true);
1116
1366
 
1117
1367
  case 24:
1118
- _context7.next = 29;
1368
+ _context13.next = 29;
1119
1369
  break;
1120
1370
 
1121
1371
  case 26:
1122
- _context7.prev = 26;
1123
- _context7.t0 = _context7["catch"](11);
1124
- console.log(_context7.t0); // setMainLoading(false);
1372
+ _context13.prev = 26;
1373
+ _context13.t0 = _context13["catch"](11);
1374
+ console.log(_context13.t0); // setMainLoading(false);
1125
1375
 
1126
1376
  case 29:
1127
- _context7.next = 32;
1377
+ _context13.next = 32;
1128
1378
  break;
1129
1379
 
1130
1380
  case 31:
@@ -1133,19 +1383,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1133
1383
 
1134
1384
  case 32:
1135
1385
  case "end":
1136
- return _context7.stop();
1386
+ return _context13.stop();
1137
1387
  }
1138
1388
  }
1139
- }, _callee7, null, [[11, 26]]);
1389
+ }, _callee13, null, [[11, 26]]);
1140
1390
  })), [images, imagesUploaded]);
1141
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1391
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1142
1392
  var res;
1143
- return _regenerator.default.wrap(function _callee8$(_context8) {
1393
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1144
1394
  while (1) {
1145
- switch (_context8.prev = _context8.next) {
1395
+ switch (_context14.prev = _context14.next) {
1146
1396
  case 0:
1147
1397
  if (!imagesUploaded) {
1148
- _context8.next = 16;
1398
+ _context14.next = 16;
1149
1399
  break;
1150
1400
  }
1151
1401
 
@@ -1157,8 +1407,8 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1157
1407
  if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
1158
1408
  return e;
1159
1409
  });
1160
- _context8.prev = 2;
1161
- _context8.next = 5;
1410
+ _context14.prev = 2;
1411
+ _context14.next = 5;
1162
1412
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
1163
1413
  headers: {
1164
1414
  Authorization: token
@@ -1166,33 +1416,33 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1166
1416
  });
1167
1417
 
1168
1418
  case 5:
1169
- res = _context8.sent;
1419
+ res = _context14.sent;
1170
1420
 
1171
1421
  if (!(res.data.statusCode === 200)) {
1172
- _context8.next = 11;
1422
+ _context14.next = 11;
1173
1423
  break;
1174
1424
  }
1175
1425
 
1176
1426
  setMessage("Imágenes guardadas con éxito");
1177
1427
  sessionStorage.removeItem("imagesList");
1178
- _context8.next = 11;
1428
+ _context14.next = 11;
1179
1429
  return loadData();
1180
1430
 
1181
1431
  case 11:
1182
- _context8.next = 16;
1432
+ _context14.next = 16;
1183
1433
  break;
1184
1434
 
1185
1435
  case 13:
1186
- _context8.prev = 13;
1187
- _context8.t0 = _context8["catch"](2);
1188
- console.log(_context8.t0);
1436
+ _context14.prev = 13;
1437
+ _context14.t0 = _context14["catch"](2);
1438
+ console.log(_context14.t0);
1189
1439
 
1190
1440
  case 16:
1191
1441
  case "end":
1192
- return _context8.stop();
1442
+ return _context14.stop();
1193
1443
  }
1194
1444
  }
1195
- }, _callee8, null, [[2, 13]]);
1445
+ }, _callee14, null, [[2, 13]]);
1196
1446
  })), [dataImages, imagesUploaded]);
1197
1447
 
1198
1448
  var getConcept = function getConcept(tab) {
@@ -1209,28 +1459,28 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1209
1459
  };
1210
1460
 
1211
1461
  var createComment = /*#__PURE__*/function () {
1212
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(e, body, tab) {
1462
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(e, body, tab) {
1213
1463
  var concept, data;
1214
- return _regenerator.default.wrap(function _callee9$(_context9) {
1464
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1215
1465
  while (1) {
1216
- switch (_context9.prev = _context9.next) {
1466
+ switch (_context15.prev = _context15.next) {
1217
1467
  case 0:
1218
1468
  concept = "";
1219
- _context9.t0 = activeTab;
1220
- _context9.next = _context9.t0 === "Ficha técnica" ? 4 : _context9.t0 === "Imágenes" ? 6 : 8;
1469
+ _context15.t0 = activeTab;
1470
+ _context15.next = _context15.t0 === "Ficha técnica" ? 4 : _context15.t0 === "Imágenes" ? 6 : 8;
1221
1471
  break;
1222
1472
 
1223
1473
  case 4:
1224
1474
  concept = "datasheet";
1225
- return _context9.abrupt("break", 10);
1475
+ return _context15.abrupt("break", 10);
1226
1476
 
1227
1477
  case 6:
1228
1478
  concept = "images";
1229
- return _context9.abrupt("break", 10);
1479
+ return _context15.abrupt("break", 10);
1230
1480
 
1231
1481
  case 8:
1232
1482
  concept = "description";
1233
- return _context9.abrupt("break", 10);
1483
+ return _context15.abrupt("break", 10);
1234
1484
 
1235
1485
  case 10:
1236
1486
  data = {
@@ -1240,7 +1490,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1240
1490
  concept: concept,
1241
1491
  version: version
1242
1492
  };
1243
- _context9.next = 13;
1493
+ _context15.next = 13;
1244
1494
  return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1245
1495
  headers: {
1246
1496
  Authorization: token
@@ -1249,14 +1499,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1249
1499
 
1250
1500
  case 13:
1251
1501
  case "end":
1252
- return _context9.stop();
1502
+ return _context15.stop();
1253
1503
  }
1254
1504
  }
1255
- }, _callee9);
1505
+ }, _callee15);
1256
1506
  }));
1257
1507
 
1258
- return function createComment(_x2, _x3, _x4) {
1259
- return _ref10.apply(this, arguments);
1508
+ return function createComment(_x4, _x5, _x6) {
1509
+ return _ref13.apply(this, arguments);
1260
1510
  };
1261
1511
  }();
1262
1512
 
@@ -1265,16 +1515,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1265
1515
  }, [activeTab]);
1266
1516
 
1267
1517
  var commentRevised = /*#__PURE__*/function () {
1268
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1518
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1269
1519
  var data;
1270
- return _regenerator.default.wrap(function _callee10$(_context10) {
1520
+ return _regenerator.default.wrap(function _callee16$(_context16) {
1271
1521
  while (1) {
1272
- switch (_context10.prev = _context10.next) {
1522
+ switch (_context16.prev = _context16.next) {
1273
1523
  case 0:
1274
1524
  data = {
1275
1525
  commentId: comment.id
1276
1526
  };
1277
- _context10.next = 3;
1527
+ _context16.next = 3;
1278
1528
  return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1279
1529
  headers: {
1280
1530
  Authorization: token
@@ -1286,40 +1536,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1286
1536
 
1287
1537
  case 4:
1288
1538
  case "end":
1289
- return _context10.stop();
1539
+ return _context16.stop();
1290
1540
  }
1291
1541
  }
1292
- }, _callee10);
1542
+ }, _callee16);
1293
1543
  }));
1294
1544
 
1295
1545
  return function commentRevised() {
1296
- return _ref11.apply(this, arguments);
1546
+ return _ref14.apply(this, arguments);
1297
1547
  };
1298
1548
  }();
1299
1549
 
1300
1550
  var setAssignation = /*#__PURE__*/function () {
1301
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(assignationType, assignationId) {
1551
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(assignationType, assignationId) {
1302
1552
  var concept, productTemp, data;
1303
- return _regenerator.default.wrap(function _callee11$(_context11) {
1553
+ return _regenerator.default.wrap(function _callee17$(_context17) {
1304
1554
  while (1) {
1305
- switch (_context11.prev = _context11.next) {
1555
+ switch (_context17.prev = _context17.next) {
1306
1556
  case 0:
1307
1557
  concept = "";
1308
- _context11.t0 = activeTab;
1309
- _context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
1558
+ _context17.t0 = activeTab;
1559
+ _context17.next = _context17.t0 === "Ficha técnica" ? 4 : _context17.t0 === "Imágenes" ? 6 : 8;
1310
1560
  break;
1311
1561
 
1312
1562
  case 4:
1313
1563
  concept = "datasheet";
1314
- return _context11.abrupt("break", 10);
1564
+ return _context17.abrupt("break", 10);
1315
1565
 
1316
1566
  case 6:
1317
1567
  concept = "images";
1318
- return _context11.abrupt("break", 10);
1568
+ return _context17.abrupt("break", 10);
1319
1569
 
1320
1570
  case 8:
1321
1571
  concept = "description";
1322
- return _context11.abrupt("break", 10);
1572
+ return _context17.abrupt("break", 10);
1323
1573
 
1324
1574
  case 10:
1325
1575
  productTemp = product;
@@ -1332,7 +1582,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1332
1582
  concept: concept,
1333
1583
  userId: assignationId
1334
1584
  };
1335
- _context11.next = 15;
1585
+ _context17.next = 15;
1336
1586
  return (0, _axios.default)({
1337
1587
  method: "post",
1338
1588
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -1348,14 +1598,14 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1348
1598
 
1349
1599
  case 17:
1350
1600
  case "end":
1351
- return _context11.stop();
1601
+ return _context17.stop();
1352
1602
  }
1353
1603
  }
1354
- }, _callee11);
1604
+ }, _callee17);
1355
1605
  }));
1356
1606
 
1357
- return function setAssignation(_x5, _x6) {
1358
- return _ref12.apply(this, arguments);
1607
+ return function setAssignation(_x7, _x8) {
1608
+ return _ref15.apply(this, arguments);
1359
1609
  };
1360
1610
  }();
1361
1611
 
@@ -1439,20 +1689,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1439
1689
  };
1440
1690
 
1441
1691
  var sendEvaluation = /*#__PURE__*/function () {
1442
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(result) {
1443
- var _productTemp$id_order;
1692
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(result) {
1693
+ var _productTemp$id_order2;
1444
1694
 
1445
1695
  var concept, productTemp, articleId, orderId, sectionStatusKey, evalStatus, data, retailerId, res, newStatuses, orderStatus, serviceStatus, newProductEdit, showSurveyByProvider, showSurveyByRetailer, _JSON$parse, newArticleStatus, newServiceStatus, newStatus, retailerStatusCopy, status;
1446
1696
 
1447
- return _regenerator.default.wrap(function _callee12$(_context12) {
1697
+ return _regenerator.default.wrap(function _callee18$(_context18) {
1448
1698
  while (1) {
1449
- switch (_context12.prev = _context12.next) {
1699
+ switch (_context18.prev = _context18.next) {
1450
1700
  case 0:
1451
1701
  setLoading(true);
1452
1702
  concept = getConcept(activeTab);
1453
1703
  productTemp = product;
1454
1704
  articleId = productTemp.id_article;
1455
- orderId = (_productTemp$id_order = productTemp.id_order) !== null && _productTemp$id_order !== void 0 ? _productTemp$id_order : productTemp.orderId;
1705
+ orderId = (_productTemp$id_order2 = productTemp.id_order) !== null && _productTemp$id_order2 !== void 0 ? _productTemp$id_order2 : productTemp.orderId;
1456
1706
  sectionStatusKey = "".concat(getConcept(activeTab), "_status");
1457
1707
  evalStatus = product[sectionStatusKey] || (product === null || product === void 0 ? void 0 : product.version_status);
1458
1708
  data = {
@@ -1462,16 +1712,16 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1462
1712
  evalStatus: evalStatus
1463
1713
  };
1464
1714
  retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
1465
- _context12.prev = 9;
1715
+ _context18.prev = 9;
1466
1716
 
1467
1717
  if (!result) {
1468
- _context12.next = 27;
1718
+ _context18.next = 27;
1469
1719
  break;
1470
1720
  }
1471
1721
 
1472
1722
  data.result = result;
1473
1723
  data.retailerId = retailerId;
1474
- _context12.next = 15;
1724
+ _context18.next = 15;
1475
1725
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1476
1726
  headers: {
1477
1727
  Authorization: token
@@ -1479,7 +1729,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1479
1729
  });
1480
1730
 
1481
1731
  case 15:
1482
- res = _context12.sent;
1732
+ res = _context18.sent;
1483
1733
  newStatuses = JSON.parse(res.data.body);
1484
1734
  orderStatus = newStatuses.newOrderStatus;
1485
1735
  serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(getConcept(activeTab), "Status")];
@@ -1489,11 +1739,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1489
1739
  showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
1490
1740
  showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
1491
1741
  showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
1492
- _context12.next = 30;
1742
+ _context18.next = 30;
1493
1743
  break;
1494
1744
 
1495
1745
  case 27:
1496
- _context12.next = 29;
1746
+ _context18.next = 29;
1497
1747
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1498
1748
  headers: {
1499
1749
  Authorization: token
@@ -1501,7 +1751,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1501
1751
  });
1502
1752
 
1503
1753
  case 29:
1504
- res = _context12.sent;
1754
+ res = _context18.sent;
1505
1755
 
1506
1756
  case 30:
1507
1757
  if (res.data.statusCode === 200) {
@@ -1524,39 +1774,39 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1524
1774
  });
1525
1775
  }
1526
1776
 
1527
- _context12.next = 36;
1777
+ _context18.next = 36;
1528
1778
  break;
1529
1779
 
1530
1780
  case 33:
1531
- _context12.prev = 33;
1532
- _context12.t0 = _context12["catch"](9);
1533
- console.log(_context12.t0);
1781
+ _context18.prev = 33;
1782
+ _context18.t0 = _context18["catch"](9);
1783
+ console.log(_context18.t0);
1534
1784
 
1535
1785
  case 36:
1536
1786
  loadData();
1537
1787
 
1538
1788
  case 37:
1539
1789
  case "end":
1540
- return _context12.stop();
1790
+ return _context18.stop();
1541
1791
  }
1542
1792
  }
1543
- }, _callee12, null, [[9, 33]]);
1793
+ }, _callee18, null, [[9, 33]]);
1544
1794
  }));
1545
1795
 
1546
- return function sendEvaluation(_x7) {
1547
- return _ref13.apply(this, arguments);
1796
+ return function sendEvaluation(_x9) {
1797
+ return _ref16.apply(this, arguments);
1548
1798
  };
1549
1799
  }();
1550
1800
 
1551
1801
  var validateAll = /*#__PURE__*/function () {
1552
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1553
- var _product$id_order2, evaluationArray, conceptArray, dataGeneral, evalResponse, userType, productTemp, retailerStatusCopy;
1802
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(result) {
1803
+ var _product$id_order2, evaluationArray, conceptArray, dataGeneral, userType, productTemp, status, retailerStatusCopy;
1554
1804
 
1555
- return _regenerator.default.wrap(function _callee13$(_context13) {
1805
+ return _regenerator.default.wrap(function _callee19$(_context19) {
1556
1806
  while (1) {
1557
- switch (_context13.prev = _context13.next) {
1807
+ switch (_context19.prev = _context19.next) {
1558
1808
  case 0:
1559
- _context13.prev = 0;
1809
+ _context19.prev = 0;
1560
1810
  setLoading(true);
1561
1811
  evaluationArray = [];
1562
1812
  conceptArray = ["description", "datasheet", "images"];
@@ -1581,22 +1831,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1581
1831
  }
1582
1832
  }));
1583
1833
  });
1584
- _context13.next = 8;
1834
+ _context19.next = 8;
1585
1835
  return Promise.all(evaluationArray);
1586
1836
 
1587
1837
  case 8:
1588
- evalResponse = _context13.sent;
1589
1838
  userType = user.is_retailer === 1 ? "CA" : "P";
1590
1839
  productTemp = product;
1591
- productTemp.article_status = "".concat(result).concat(userType);
1592
- productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result).concat(userType);
1593
- productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result).concat(userType);
1594
- productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result).concat(userType);
1840
+ status = "".concat(result).concat(userType);
1841
+ productTemp.article_status = status;
1842
+ productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : status;
1843
+ productTemp.description_status = productTemp.description_status === "NA" ? "NA" : status;
1844
+ productTemp.images_status = productTemp.images_status === "NA" ? "NA" : status;
1595
1845
  retailerStatusCopy = (0, _objectSpread3.default)({}, retailerStatus);
1596
1846
  Object.keys(retailerStatusCopy).forEach(function (key) {
1597
1847
  conceptArray.forEach(function (concept) {
1598
1848
  if (retailerStatusCopy[key][concept]) {
1599
- retailerStatusCopy[key][concept] = "".concat(result).concat(userType);
1849
+ retailerStatusCopy[key][concept] = status;
1600
1850
  }
1601
1851
  });
1602
1852
  });
@@ -1614,37 +1864,37 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1614
1864
  idCategory: productTemp.article.id_category,
1615
1865
  product: productTemp
1616
1866
  }));
1617
- _context13.next = 25;
1867
+ _context19.next = 25;
1618
1868
  return loadData();
1619
1869
 
1620
1870
  case 25:
1621
- _context13.next = 30;
1871
+ _context19.next = 30;
1622
1872
  break;
1623
1873
 
1624
1874
  case 27:
1625
- _context13.prev = 27;
1626
- _context13.t0 = _context13["catch"](0);
1627
- console.log(_context13.t0);
1875
+ _context19.prev = 27;
1876
+ _context19.t0 = _context19["catch"](0);
1877
+ console.log(_context19.t0);
1628
1878
 
1629
1879
  case 30:
1630
1880
  case "end":
1631
- return _context13.stop();
1881
+ return _context19.stop();
1632
1882
  }
1633
1883
  }
1634
- }, _callee13, null, [[0, 27]]);
1884
+ }, _callee19, null, [[0, 27]]);
1635
1885
  }));
1636
1886
 
1637
- return function validateAll(_x8) {
1638
- return _ref14.apply(this, arguments);
1887
+ return function validateAll(_x10) {
1888
+ return _ref17.apply(this, arguments);
1639
1889
  };
1640
1890
  }();
1641
1891
 
1642
1892
  var evaluationToRetailer = /*#__PURE__*/function () {
1643
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
1893
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
1644
1894
  var data, prod, statusComplete;
1645
- return _regenerator.default.wrap(function _callee14$(_context14) {
1895
+ return _regenerator.default.wrap(function _callee20$(_context20) {
1646
1896
  while (1) {
1647
- switch (_context14.prev = _context14.next) {
1897
+ switch (_context20.prev = _context20.next) {
1648
1898
  case 0:
1649
1899
  data = {
1650
1900
  articleId: product.id_article,
@@ -1652,7 +1902,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1652
1902
  versionId: product.version,
1653
1903
  status: result
1654
1904
  };
1655
- _context14.next = 3;
1905
+ _context20.next = 3;
1656
1906
  return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
1657
1907
  headers: {
1658
1908
  Authorization: token
@@ -1670,19 +1920,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1670
1920
  sessionStorage.setItem("productEdit", JSON.stringify(prod));
1671
1921
  setProduct(prod);
1672
1922
  showGlobalModal("generic");
1673
- _context14.next = 15;
1923
+ _context20.next = 15;
1674
1924
  return loadData();
1675
1925
 
1676
1926
  case 15:
1677
1927
  case "end":
1678
- return _context14.stop();
1928
+ return _context20.stop();
1679
1929
  }
1680
1930
  }
1681
- }, _callee14);
1931
+ }, _callee20);
1682
1932
  }));
1683
1933
 
1684
- return function evaluationToRetailer(_x9) {
1685
- return _ref15.apply(this, arguments);
1934
+ return function evaluationToRetailer(_x11) {
1935
+ return _ref18.apply(this, arguments);
1686
1936
  };
1687
1937
  }();
1688
1938
 
@@ -2001,20 +2251,20 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
2001
2251
  reviewed: crossComment
2002
2252
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
2003
2253
  buttonType: "circular-button accept-button",
2004
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
2005
- return _regenerator.default.wrap(function _callee15$(_context15) {
2254
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
2255
+ return _regenerator.default.wrap(function _callee21$(_context21) {
2006
2256
  while (1) {
2007
- switch (_context15.prev = _context15.next) {
2257
+ switch (_context21.prev = _context21.next) {
2008
2258
  case 0:
2009
2259
  setCrossComment(true);
2010
2260
  commentRevised();
2011
2261
 
2012
2262
  case 2:
2013
2263
  case "end":
2014
- return _context15.stop();
2264
+ return _context21.stop();
2015
2265
  }
2016
2266
  }
2017
- }, _callee15);
2267
+ }, _callee21);
2018
2268
  }))
2019
2269
  })]
2020
2270
  })
@@ -2069,9 +2319,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
2069
2319
  return setMessage("");
2070
2320
  }
2071
2321
  }), globalModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, (0, _objectSpread3.default)({
2072
- close: function close() {
2073
- return setGlobalModal();
2074
- }
2322
+ close: closeGlobalModal
2075
2323
  }, globalModal)), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
2076
2324
  modalId: "version-selector",
2077
2325
  articleId: product.id_article,