contentoh-components-library 21.1.29 → 21.1.32

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 (158) hide show
  1. package/dist/components/atoms/Commentary/styles.js +1 -1
  2. package/dist/components/atoms/GeneralInput/styles.js +3 -3
  3. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  4. package/dist/components/atoms/SliderToolTip/index.js +14 -9
  5. package/dist/components/atoms/SliderToolTip/styles.js +1 -1
  6. package/dist/components/atoms/StatusTag/index.js +2 -17
  7. package/dist/components/atoms/StatusTag/styles.js +1 -1
  8. package/dist/components/atoms/ValidationPanel/index.js +4 -3
  9. package/dist/components/molecules/AvatarAndValidation/index.js +4 -0
  10. package/dist/components/organisms/FullProductNameHeader/index.js +6 -2
  11. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +62 -74
  12. package/dist/components/pages/ProviderProductEdition/index.js +433 -323
  13. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +107 -71
  14. package/dist/components/pages/RetailerProductEdition/index.js +314 -194
  15. package/dist/global-files/data.js +10 -9
  16. package/package.json +1 -1
  17. package/src/components/atoms/Commentary/styles.js +2 -2
  18. package/src/components/atoms/GeneralInput/styles.js +5 -5
  19. package/src/components/atoms/InputFormatter/styles.js +3 -3
  20. package/src/components/atoms/SliderToolTip/index.js +20 -13
  21. package/src/components/atoms/SliderToolTip/styles.js +21 -25
  22. package/src/components/atoms/StatusTag/index.js +2 -12
  23. package/src/components/atoms/StatusTag/styles.js +11 -11
  24. package/src/components/atoms/ValidationPanel/index.js +5 -4
  25. package/src/components/molecules/AvatarAndValidation/index.js +5 -1
  26. package/src/components/organisms/FullProductNameHeader/index.js +6 -2
  27. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +63 -79
  28. package/src/components/pages/ProviderProductEdition/index.js +236 -168
  29. package/src/components/pages/ProviderProductEdition/styles.js +1 -1
  30. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -70
  31. package/src/components/pages/RetailerProductEdition/index.js +238 -166
  32. package/src/global-files/data.js +10 -9
  33. package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Bold.otf +0 -0
  34. package/dist/assets/fonts/avenirnext/AvenirNextLTPro-It.otf +0 -0
  35. package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Regular.otf +0 -0
  36. package/dist/assets/fonts/lato/Lato-Bold.ttf +0 -0
  37. package/dist/assets/fonts/lato/Lato-Italic.ttf +0 -0
  38. package/dist/assets/fonts/lato/Lato-Light.ttf +0 -0
  39. package/dist/assets/fonts/lato/Lato-Regular.ttf +0 -0
  40. package/dist/assets/fonts/lato/Lato-Thin.ttf +0 -0
  41. package/dist/assets/fonts/lato/OFL.txt +0 -93
  42. package/dist/assets/fonts/raleway/Raleway-Black.ttf +0 -0
  43. package/dist/assets/fonts/raleway/Raleway-Bold.ttf +0 -0
  44. package/dist/assets/fonts/raleway/Raleway-ExtraBold.ttf +0 -0
  45. package/dist/assets/fonts/raleway/Raleway-Italic.ttf +0 -0
  46. package/dist/assets/fonts/raleway/Raleway-Medium.ttf +0 -0
  47. package/dist/assets/fonts/raleway/Raleway-Regular.ttf +0 -0
  48. package/dist/assets/fonts/raleway/Raleway-SemiBold.ttf +0 -0
  49. package/dist/assets/images/activedFilter/removeFilter.svg +0 -3
  50. package/dist/assets/images/arrow/arrowIcon.svg +0 -3
  51. package/dist/assets/images/arrow/polygon.svg +0 -3
  52. package/dist/assets/images/asignationOptions/availableIcon.svg +0 -3
  53. package/dist/assets/images/asignationOptions/removeAsigned.svg +0 -4
  54. package/dist/assets/images/asignationOptions/requestToProvider.svg +0 -3
  55. package/dist/assets/images/asignationOptions/requestToTeam.svg +0 -3
  56. package/dist/assets/images/card/masterCardIcon.svg +0 -5
  57. package/dist/assets/images/carouselImagesLogin/login2.svg +0 -117
  58. package/dist/assets/images/carouselImagesLogin/login3.svg +0 -147
  59. package/dist/assets/images/carouselImagesLogin/loginImage.svg +0 -301
  60. package/dist/assets/images/checkBox/checked.svg +0 -3
  61. package/dist/assets/images/checkBox/unchecked.svg +0 -3
  62. package/dist/assets/images/componentAssigned/assignedImage1.svg +0 -9
  63. package/dist/assets/images/componentAssigned/assignedImage2.svg +0 -9
  64. package/dist/assets/images/componentAssigned/clock.svg +0 -4
  65. package/dist/assets/images/componentAssigned/flag.svg +0 -3
  66. package/dist/assets/images/defaultImages/defaultProductImage.png +0 -0
  67. package/dist/assets/images/defaultImages/defaultProfileImage.svg +0 -13
  68. package/dist/assets/images/defaultImages/defaultUpdate.png +0 -0
  69. package/dist/assets/images/dropDownButton/dropDownArrowButton.svg +0 -3
  70. package/dist/assets/images/editField/editField.svg +0 -3
  71. package/dist/assets/images/editField/showPassword.png +0 -0
  72. package/dist/assets/images/flags/highPriority.svg +0 -3
  73. package/dist/assets/images/flags/lowPriority.svg +0 -3
  74. package/dist/assets/images/flags/mediumPriority.svg +0 -3
  75. package/dist/assets/images/flags/noPriority.svg +0 -3
  76. package/dist/assets/images/generalButton/acceptIcon.svg +0 -3
  77. package/dist/assets/images/generalButton/closeIcon.svg +0 -4
  78. package/dist/assets/images/generalButton/deleteIcon.svg +0 -13
  79. package/dist/assets/images/generalButton/deleteIconHover.svg +0 -13
  80. package/dist/assets/images/generalButton/downloadIcon.svg +0 -3
  81. package/dist/assets/images/generalButton/gridLayout.svg +0 -3
  82. package/dist/assets/images/generalButton/nullIcon.svg +0 -3
  83. package/dist/assets/images/generalButton/openModal.svg +0 -3
  84. package/dist/assets/images/generalButton/rejectIcon.svg +0 -3
  85. package/dist/assets/images/generalButton/rowLayout.svg +0 -3
  86. package/dist/assets/images/generalButton/saveIcon.svg +0 -3
  87. package/dist/assets/images/generalButton/saveIconHover.svg +0 -3
  88. package/dist/assets/images/generalImage/assigned.svg +0 -14
  89. package/dist/assets/images/generalImage/bags.svg +0 -25
  90. package/dist/assets/images/generalImage/clock.svg +0 -4
  91. package/dist/assets/images/generalImage/flag.svg +0 -3
  92. package/dist/assets/images/genericModal/closeWhite.svg +0 -3
  93. package/dist/assets/images/genericModal/errorModal.svg +0 -3
  94. package/dist/assets/images/genericModal/genericModalCheck.svg +0 -3
  95. package/dist/assets/images/genericModal/genericModalClose.svg +0 -3
  96. package/dist/assets/images/genericModal/genericModalDown.svg +0 -3
  97. package/dist/assets/images/genericModal/genericModalUp.svg +0 -3
  98. package/dist/assets/images/genericModal/genericModalWarning.svg +0 -12
  99. package/dist/assets/images/genericModal/yellowAlert.svg +0 -12
  100. package/dist/assets/images/logo/logoLogin.svg +0 -15
  101. package/dist/assets/images/menuNotification/menuNotificationComment.svg +0 -3
  102. package/dist/assets/images/menuNotification/menuNotificationProduct.svg +0 -3
  103. package/dist/assets/images/menuProfile/logOut.svg +0 -3
  104. package/dist/assets/images/menuProfile/myAccount.svg +0 -3
  105. package/dist/assets/images/menuProfile/settings.svg +0 -3
  106. package/dist/assets/images/modalsSVGs/attributesSent.svg +0 -208
  107. package/dist/assets/images/modalsSVGs/descriptionSent.svg +0 -237
  108. package/dist/assets/images/modalsSVGs/providerSent.svg +0 -445
  109. package/dist/assets/images/modalsSVGs/uploadingImages.svg +0 -148
  110. package/dist/assets/images/productImage/openModal.svg +0 -3
  111. package/dist/assets/images/productNotification/productNotification.svg +0 -3
  112. package/dist/assets/images/profileHeader/profilePicture.svg +0 -9
  113. package/dist/assets/images/providerAndCadena/Cadena.svg +0 -188
  114. package/dist/assets/images/providerAndCadena/LoginContentoh.svg +0 -15
  115. package/dist/assets/images/providerAndCadena/Proveedor.svg +0 -231
  116. package/dist/assets/images/sideMenuButton/contenoh.svg +0 -5
  117. package/dist/assets/images/sideMenuButton/dashboard.svg +0 -5
  118. package/dist/assets/images/sideMenuButton/products.svg +0 -10
  119. package/dist/assets/images/sideMenuButton/providers.svg +0 -10
  120. package/dist/assets/images/sideMenuButton/tasks.svg +0 -3
  121. package/dist/assets/images/sliderToolTip/infoIcon.svg +0 -4
  122. package/dist/assets/images/sliderToolTip/slide1.svg +0 -5
  123. package/dist/assets/images/sliderToolTip/slide2.svg +0 -9
  124. package/dist/assets/images/sliderToolTip/slide21.svg +0 -9
  125. package/dist/assets/images/sliderToolTip/slide22.svg +0 -9
  126. package/dist/assets/images/sliderToolTip/slide23.svg +0 -9
  127. package/dist/assets/images/sliderToolTip/slide3.svg +0 -9
  128. package/dist/assets/images/sliderToolTip/slide4.svg +0 -9
  129. package/dist/assets/images/sliderToolTip/slide5.svg +0 -40
  130. package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +0 -4
  131. package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +0 -12
  132. package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +0 -3
  133. package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +0 -12
  134. package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +0 -15
  135. package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +0 -3
  136. package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +0 -12
  137. package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +0 -10
  138. package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +0 -4
  139. package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
  140. package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
  141. package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
  142. package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
  143. package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
  144. package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
  145. package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
  146. package/dist/components/atoms/MenuProductImage/index.js +0 -88
  147. package/dist/components/atoms/MenuProductImage/styles.js +0 -20
  148. package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
  149. package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
  150. package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
  151. package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
  152. package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
  153. package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
  154. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
  155. package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
  156. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
  157. package/dist/global-files/fonts.css +0 -45
  158. package/dist/global-files/global-styles.css +0 -40
@@ -9,8 +9,6 @@ exports.RetailerProductEdition = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
13
-
14
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
15
13
 
16
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
@@ -39,7 +37,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
39
37
 
40
38
  var _fileSaver = require("file-saver");
41
39
 
42
- var _data2 = require("../../../global-files/data");
40
+ var _data = require("../../../global-files/data");
43
41
 
44
42
  var _GalleryHeader = require("../../molecules/GalleryHeader");
45
43
 
@@ -142,8 +140,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
142
140
  productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
143
141
  _ref$user = _ref.user,
144
142
  user = _ref$user === void 0 ? {} : _ref$user,
145
- _ref$location = _ref.location,
146
- location = _ref$location === void 0 ? {} : _ref$location,
147
143
  token = _ref.token;
148
144
 
149
145
  var _useState = (0, _react.useState)("Descripción"),
@@ -378,6 +374,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
378
374
  saving = _useState70[0],
379
375
  setSaving = _useState70[1];
380
376
 
377
+ var isAuditor = user.id_role === 6;
381
378
  (0, _react.useEffect)(function () {
382
379
  checkAll && setSelectedImages(images.values);
383
380
  }, [checkAll]);
@@ -392,20 +389,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
392
389
  case 0:
393
390
  _context.prev = 0;
394
391
  _context.next = 3;
395
- return (0, _data2.getRetailerServices)(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.category, 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.version);
392
+ return (0, _data.getRetailerServices)(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.category, 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.version);
396
393
 
397
394
  case 3:
398
395
  _services = _context.sent;
399
396
  //Converts the data inside the datasheets object to array
400
397
  setServices(_services);
401
- getServices(); //setActiveRetailer(product?.retailers[0]);
398
+ getServices(); // setActiveRetailer(product?.retailers[0]);
402
399
 
403
400
  setImages({
404
401
  action: "init",
405
402
  init: _services[2]
406
403
  });
407
404
  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);
408
- (0, _data2.getPercentage)({
405
+ (0, _data.getPercentage)({
409
406
  data: [product]
410
407
  }).then(function (res) {
411
408
  return setPercentages(res);
@@ -436,7 +433,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
436
433
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
437
434
  var _product$article4, _product$article5, _servicesResponse$dat;
438
435
 
439
- var servicesResponse, parsedResponse, retailers, active;
436
+ var servicesResponse, parsedResponse, retailers, retailerResponse, active;
440
437
  return _regenerator.default.wrap(function _callee2$(_context2) {
441
438
  while (1) {
442
439
  switch (_context2.prev = _context2.next) {
@@ -448,15 +445,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
448
445
  servicesResponse = _context2.sent;
449
446
  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;
450
447
  retailers = product.retailers || product.retailersAvailable;
451
- active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
452
- return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
453
- return srv.id_retailer;
454
- }).includes(retailer.id);
455
- })[0];
448
+ retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
449
+ return srv.id_retailer;
450
+ });
451
+ active = retailers === null || retailers === void 0 ? void 0 : retailers.find(function (retailer) {
452
+ return retailerResponse.includes(retailer.id);
453
+ });
456
454
  !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
457
455
  setServicesData(parsedResponse);
458
456
 
459
- case 8:
457
+ case 9:
460
458
  case "end":
461
459
  return _context2.stop();
462
460
  }
@@ -470,17 +468,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
470
468
  }();
471
469
 
472
470
  var translateConcept = function translateConcept(concept) {
473
- var translation = "";
474
-
475
- if (concept === "datasheet") {
476
- translation = "Ficha técnica";
477
- } else if (concept === "description") {
478
- translation = "Descripción";
479
- } else if (concept === "images") {
480
- translation = "Imágenes";
481
- }
482
-
483
- return translation;
471
+ var translation = {
472
+ datasheet: "Ficha técnica",
473
+ description: "Descripción",
474
+ images: "Imágenes"
475
+ };
476
+ return translation[concept];
484
477
  };
485
478
 
486
479
  var getComments = /*#__PURE__*/function () {
@@ -533,7 +526,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
533
526
  getComments();
534
527
  _context4.t0 = setUserGroups;
535
528
  _context4.next = 5;
536
- return (0, _data2.fetchUsers)(token);
529
+ return (0, _data.fetchUsers)(token);
537
530
 
538
531
  case 5:
539
532
  _context4.t1 = _context4.sent;
@@ -544,15 +537,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
544
537
  break;
545
538
 
546
539
  case 11:
547
- arr = ["IN_PROGRESS", "RF", "RA"];
540
+ arr = ["CA", "RC", "RA"];
548
541
  return _context4.abrupt("break", 19);
549
542
 
550
543
  case 13:
551
- arr = ["RF", "AF", "AA", "AP", "AC"];
544
+ arr = ["RC", "AC", "AA", "AP", "ACA"];
552
545
  return _context4.abrupt("break", 19);
553
546
 
554
547
  case 15:
555
- arr = ["RP", "RC", "AF", "RA"];
548
+ arr = ["RP", "RCA", "AC", "RA"];
556
549
  return _context4.abrupt("break", 19);
557
550
 
558
551
  case 17:
@@ -688,49 +681,60 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
688
681
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
689
682
  var _product$article9;
690
683
 
691
- var productTemp, dataObject;
684
+ var productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
685
+
692
686
  return _regenerator.default.wrap(function _callee5$(_context5) {
693
687
  while (1) {
694
688
  switch (_context5.prev = _context5.next) {
695
689
  case 0:
696
690
  setLoading(true);
697
691
  productTemp = product;
692
+ articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
698
693
  dataObject = {
699
- articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
694
+ articleId: articleId,
700
695
  articleData: updatedDescriptions
701
696
  };
702
697
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
703
- _context5.prev = 4;
704
- _context5.next = 7;
698
+ _context5.prev = 5;
699
+ _context5.next = 8;
705
700
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
706
701
  headers: {
707
702
  Authorization: token
708
703
  }
709
704
  });
710
705
 
711
- case 7:
712
- if (productTemp.status === "ASSIGNED") {
713
- productTemp.status = "IN_PROGRESS";
714
- setProduct(productTemp);
715
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
706
+ case 8:
707
+ res = _context5.sent;
708
+
709
+ if (!(res.data.statusCode === 200)) {
710
+ _context5.next = 18;
711
+ break;
716
712
  }
717
713
 
714
+ _JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
715
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
716
+ if (newStatus) productTemp.description_status = newStatus;
717
+ setProduct(productTemp);
718
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
718
719
  setMessage("Descripciones guardadas con éxito");
719
- loadData();
720
- _context5.next = 15;
720
+ _context5.next = 18;
721
+ return loadData();
722
+
723
+ case 18:
724
+ _context5.next = 23;
721
725
  break;
722
726
 
723
- case 12:
724
- _context5.prev = 12;
725
- _context5.t0 = _context5["catch"](4);
727
+ case 20:
728
+ _context5.prev = 20;
729
+ _context5.t0 = _context5["catch"](5);
726
730
  console.log(_context5.t0);
727
731
 
728
- case 15:
732
+ case 23:
729
733
  case "end":
730
734
  return _context5.stop();
731
735
  }
732
736
  }
733
- }, _callee5, null, [[4, 12]]);
737
+ }, _callee5, null, [[5, 20]]);
734
738
  }));
735
739
 
736
740
  return function saveDescriptions() {
@@ -742,18 +746,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
742
746
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
743
747
  var _product$article10;
744
748
 
745
- var productTemp, dataObject;
749
+ var productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
750
+
746
751
  return _regenerator.default.wrap(function _callee6$(_context6) {
747
752
  while (1) {
748
753
  switch (_context6.prev = _context6.next) {
749
754
  case 0:
750
755
  setLoading(true);
751
756
  productTemp = product;
757
+ articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
752
758
  dataObject = {
753
- articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
759
+ articleId: articleId,
754
760
  articleData: updatedDatasheets
755
761
  };
756
- console.log(updatedDatasheets, "updatedDatasheets");
757
762
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
758
763
  _context6.prev = 5;
759
764
  _context6.next = 8;
@@ -764,29 +769,37 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
764
769
  });
765
770
 
766
771
  case 8:
767
- setMessage("Fichas técnicas guardadas");
772
+ res = _context6.sent;
768
773
 
769
- if (productTemp.status === "ASSIGNED") {
770
- productTemp.status = "IN_PROGRESS";
771
- setProduct(productTemp);
772
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
774
+ if (!(res.data.statusCode === 200)) {
775
+ _context6.next = 18;
776
+ break;
773
777
  }
774
778
 
775
- loadData();
776
- _context6.next = 16;
779
+ _JSON$parse3 = JSON.parse(res.data.body), newStatus = _JSON$parse3.newStatus, newArticleStatus = _JSON$parse3.newArticleStatus;
780
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
781
+ if (newStatus) productTemp.datasheet_status = newStatus;
782
+ setProduct(productTemp);
783
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
784
+ setMessage("Fichas técnicas guardadas");
785
+ _context6.next = 18;
786
+ return loadData();
787
+
788
+ case 18:
789
+ _context6.next = 23;
777
790
  break;
778
791
 
779
- case 13:
780
- _context6.prev = 13;
792
+ case 20:
793
+ _context6.prev = 20;
781
794
  _context6.t0 = _context6["catch"](5);
782
795
  console.log(_context6.t0);
783
796
 
784
- case 16:
797
+ case 23:
785
798
  case "end":
786
799
  return _context6.stop();
787
800
  }
788
801
  }
789
- }, _callee6, null, [[5, 13]]);
802
+ }, _callee6, null, [[5, 20]]);
790
803
  }));
791
804
 
792
805
  return function saveDatasheets() {
@@ -812,7 +825,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
812
825
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
813
826
  var _images$values2, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
814
827
 
815
- var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray, productTemp;
828
+ var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
816
829
 
817
830
  return _regenerator.default.wrap(function _callee7$(_context7) {
818
831
  while (1) {
@@ -865,7 +878,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
865
878
  }
866
879
 
867
880
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
868
- _context7.next = 33;
881
+ _context7.next = 31;
869
882
  break;
870
883
  }
871
884
 
@@ -905,44 +918,38 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
905
918
  setImagesUploaded(true);
906
919
 
907
920
  case 24:
908
- productTemp = product;
909
-
910
- if (productTemp.status === "ASSIGNED") {
911
- productTemp.status = "IN_PROGRESS";
912
- setProduct(productTemp);
913
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
914
- }
915
-
916
- _context7.next = 31;
921
+ _context7.next = 29;
917
922
  break;
918
923
 
919
- case 28:
920
- _context7.prev = 28;
924
+ case 26:
925
+ _context7.prev = 26;
921
926
  _context7.t0 = _context7["catch"](11);
922
927
  console.log(_context7.t0); // setMainLoading(false);
923
928
 
924
- case 31:
925
- _context7.next = 34;
929
+ case 29:
930
+ _context7.next = 32;
926
931
  break;
927
932
 
928
- case 33:
933
+ case 31:
929
934
  // setMainLoading(false);
930
935
  setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
931
936
 
932
- case 34:
937
+ case 32:
933
938
  case "end":
934
939
  return _context7.stop();
935
940
  }
936
941
  }
937
- }, _callee7, null, [[11, 28]]);
942
+ }, _callee7, null, [[11, 26]]);
938
943
  })), [images, imagesUploaded]);
939
944
  (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
945
+ var res, productTemp, _JSON$parse4, newStatus, newArticleStatus;
946
+
940
947
  return _regenerator.default.wrap(function _callee8$(_context8) {
941
948
  while (1) {
942
949
  switch (_context8.prev = _context8.next) {
943
950
  case 0:
944
951
  if (!imagesUploaded) {
945
- _context8.next = 13;
952
+ _context8.next = 22;
946
953
  break;
947
954
  }
948
955
 
@@ -963,58 +970,72 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
963
970
  });
964
971
 
965
972
  case 5:
973
+ res = _context8.sent;
974
+
975
+ if (!(res.data.statusCode === 200)) {
976
+ _context8.next = 17;
977
+ break;
978
+ }
979
+
980
+ productTemp = product;
981
+ _JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
982
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
983
+ if (newStatus) productTemp.images_status = newStatus;
984
+ setProduct(productTemp);
985
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
966
986
  setMessage("Imágenes guardadas con éxito");
967
987
  sessionStorage.removeItem("imagesList");
968
- loadData();
969
- _context8.next = 13;
988
+ _context8.next = 17;
989
+ return loadData();
990
+
991
+ case 17:
992
+ _context8.next = 22;
970
993
  break;
971
994
 
972
- case 10:
973
- _context8.prev = 10;
995
+ case 19:
996
+ _context8.prev = 19;
974
997
  _context8.t0 = _context8["catch"](2);
975
998
  console.log(_context8.t0);
976
999
 
977
- case 13:
1000
+ case 22:
978
1001
  case "end":
979
1002
  return _context8.stop();
980
1003
  }
981
1004
  }
982
- }, _callee8, null, [[2, 10]]);
1005
+ }, _callee8, null, [[2, 19]]);
983
1006
  })), [dataImages, imagesUploaded]);
984
1007
 
985
1008
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
1009
+ var _srv$find, _srv$find$status;
1010
+
986
1011
  var srv = servicesData.filter(function (serv) {
987
1012
  return serv.service === getConcept(tab);
988
1013
  });
989
-
990
- var _srv$filter = srv.filter(function (serv) {
1014
+ var srvActive = (_srv$find = srv.find(function (serv) {
991
1015
  return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
992
- }),
993
- _srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
994
- srvActive = _srv$filter2[0];
995
-
996
- var unvalidated = product["".concat(getConcept(tab), "_status")] === "QF" || product["".concat(getConcept(tab), "_status")] === "IN_PROGRESS";
997
- var auditorUnvalidated = !["RA", "AA", "AC", "AP"].includes(product["".concat(getConcept(tab), "_status")]);
1016
+ })) === null || _srv$find === void 0 ? void 0 : (_srv$find$status = _srv$find.status) === null || _srv$find$status === void 0 ? void 0 : _srv$find$status.replace(/.*\//, "");
1017
+ var currStatus = product["".concat(getConcept(tab), "_status")].replace(/.*\//, "");
1018
+ var unvalidated = ["IE", "CA"].includes(currStatus);
1019
+ var auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currStatus);
998
1020
 
999
1021
  switch (userId) {
1000
1022
  case 7:
1001
1023
  case 8:
1002
- return ["RA", "RF"].includes(product === null || product === void 0 ? void 0 : product.status) && //"IN_PROGRESS", "RF", "RA"
1003
- statusArray.includes(srvActive === null || srvActive === void 0 ? void 0 : srvActive.status) || statusArray.includes(product.status) && srv.filter(function (serv) {
1024
+ return statusArray.includes(srvActive) && (["RA", "RC"].includes(product === null || product === void 0 ? void 0 : product.status) || srv.filter(function (serv) {
1004
1025
  return statusArray.includes(serv.status);
1005
- }).length === srv.length;
1026
+ }).length === srv.length);
1006
1027
 
1007
1028
  case 4:
1008
1029
  case 5:
1009
- return unvalidated && ["IN_PROGRESS", "QF"].includes(product.status) && //"RF", "AF", "AA", "AP", "AC
1030
+ return unvalidated && ["CA", "IE"].includes(product.status) && // "RC", "AC", "AA", "AP", "ACA"
1010
1031
  srv.filter(function (serv) {
1011
1032
  return statusArray.includes(serv.status);
1012
1033
  }).length === srv.length;
1013
1034
 
1014
1035
  case 6:
1015
- return statusArray.includes(product.status) && //RP, RC, AF, RA true
1036
+ return statusArray.includes(product.status) && // RP, RCA, AC, RA true
1016
1037
  srv.every(function (serv) {
1017
- return ["RA", "AA", "AP", "AC"].includes(serv.status);
1038
+ return ["RA", "AA", "AP", "ACA"].includes(serv.status);
1018
1039
  }) && auditorUnvalidated;
1019
1040
 
1020
1041
  default:
@@ -1036,16 +1057,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1036
1057
  };
1037
1058
 
1038
1059
  var approveRejectButtons = function approveRejectButtons(action) {
1039
- var concept = getConcept(action || activeTab);
1060
+ var _servicesData$find, _servicesData$find$st;
1040
1061
 
1041
- var _servicesData$filter = servicesData.filter(function (srv) {
1062
+ var concept = getConcept(action || activeTab);
1063
+ var retailerStatus = (_servicesData$find = servicesData.find(function (srv) {
1042
1064
  return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
1043
- }),
1044
- _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
1045
- retailerStatus = _servicesData$filter2[0];
1065
+ })) === null || _servicesData$find === void 0 ? void 0 : (_servicesData$find$st = _servicesData$find.status) === null || _servicesData$find$st === void 0 ? void 0 : _servicesData$find$st.replace(/.*\//, ""); //sessionStorage product
1046
1066
 
1047
- return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
1048
- user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
1067
+ var adminFacilitatorCanEvaluate = retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
1068
+ var adminAuditorCanEvaluate = ["AC", "RP", "RCA"].includes(retailerStatus) && [1, 6].includes(user.id_role);
1069
+ return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
1049
1070
  };
1050
1071
 
1051
1072
  var getSectionIcon = function getSectionIcon() {
@@ -1069,7 +1090,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1069
1090
 
1070
1091
  var sendToFacilitator = /*#__PURE__*/function () {
1071
1092
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1072
- var concept, productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
1093
+ var concept, productTemp, evalStatus, _articleId, orderId, data, res, specialistDone, _message, _JSON$parse5, newStatus, newOrderStatus;
1094
+
1073
1095
  return _regenerator.default.wrap(function _callee9$(_context9) {
1074
1096
  while (1) {
1075
1097
  switch (_context9.prev = _context9.next) {
@@ -1078,112 +1100,92 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1078
1100
  _context9.prev = 1;
1079
1101
  concept = getConcept(activeTab);
1080
1102
  productTemp = (0, _objectSpread2.default)({}, product);
1081
- evalStatus = product["".concat(concept, "_status")];
1082
- data = {};
1083
-
1084
- if (!result) {
1085
- _context9.next = 13;
1086
- break;
1087
- }
1088
-
1103
+ evalStatus = retailerStatus;
1104
+ _articleId = product.article.id_article;
1105
+ orderId = product.orderId;
1089
1106
  data = {
1090
- articleId: product.article.id_article,
1091
- orderId: product.orderId,
1107
+ articleId: _articleId,
1108
+ orderId: orderId,
1092
1109
  concept: concept,
1093
- result: result,
1094
1110
  evalStatus: evalStatus,
1095
1111
  retailerId: activeRetailer.id
1096
1112
  };
1097
- _context9.next = 10;
1113
+
1114
+ if (!result) {
1115
+ _context9.next = 16;
1116
+ break;
1117
+ }
1118
+
1119
+ data.result = result;
1120
+ _context9.next = 12;
1098
1121
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1099
1122
  headers: {
1100
1123
  Authorization: token
1101
1124
  }
1102
1125
  });
1103
1126
 
1104
- case 10:
1127
+ case 12:
1128
+ res = _context9.sent;
1105
1129
  getServices();
1106
- _context9.next = 31;
1130
+ _context9.next = 21;
1107
1131
  break;
1108
1132
 
1109
- case 13:
1110
- specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
1133
+ case 16:
1134
+ specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
1111
1135
 
1112
1136
  if (specialistDone) {
1113
- setMessage("".concat(activeTab, " enviada a facilitador"));
1137
+ _message = "".concat(activeTab, " enviada a facilitador");
1114
1138
  getSectionIcon();
1115
- } else if (evalStatus === "QF") {
1116
- setMessage("Evaluación enviada");
1117
- getSectionIcon();
1118
- } else if (evalStatus === "AF") {
1119
- setMessage("Evaluación enviada");
1120
- getSectionIcon();
1121
- } else if (evalStatus === "RP") {
1122
- setMessage("Evaluación enviada");
1123
- getSectionIcon();
1124
- } else if (evalStatus === "RC") {
1125
- setMessage("Evaluación enviada");
1139
+ } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
1140
+ _message = "Evaluación enviada";
1126
1141
  getSectionIcon();
1127
1142
  }
1128
1143
 
1129
- statusArr = [];
1130
- servicesData.forEach(function (srv) {
1131
- srv.service === concept && statusArr.push(srv.status);
1132
- });
1133
- productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
1134
- newStatus = (0, _data2.getNewStatus)([productTemp.datasheet_status, productTemp.description_status, productTemp.images_status]);
1135
- productTemp.status = newStatus;
1136
- data = {
1137
- articleId: product.article.id_article,
1138
- orderId: product.orderId,
1139
- concept: concept,
1140
- evalStatus: evalStatus,
1141
- retailerId: activeRetailer.id
1142
- };
1143
- _context9.t0 = user.id_role;
1144
- _context9.next = _context9.t0 === 7 ? 24 : _context9.t0 === 8 ? 24 : _context9.t0 === 4 ? 26 : _context9.t0 === 5 ? 26 : 28;
1145
- break;
1146
-
1147
- case 24:
1148
- data.especialist = true;
1149
- return _context9.abrupt("break", 29);
1150
-
1151
- case 26:
1152
- data.facilitator = true;
1153
- return _context9.abrupt("break", 29);
1154
-
1155
- case 28:
1156
- return _context9.abrupt("break", 29);
1157
-
1158
- case 29:
1159
- _context9.next = 31;
1144
+ _context9.next = 20;
1160
1145
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1161
1146
  headers: {
1162
1147
  Authorization: token
1163
1148
  }
1164
1149
  });
1165
1150
 
1166
- case 31:
1167
- loadData();
1151
+ case 20:
1152
+ res = _context9.sent;
1153
+
1154
+ case 21:
1155
+ if (!(res.data.statusCode === 200)) {
1156
+ _context9.next = 30;
1157
+ break;
1158
+ }
1159
+
1160
+ _JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus;
1161
+ if (newOrderStatus) productTemp.status = newOrderStatus[orderId];
1162
+ productTemp["".concat(concept, "_status")] = newStatus;
1163
+ _context9.next = 27;
1164
+ return loadData();
1165
+
1166
+ case 27:
1167
+ if (message) setMessage(message);
1168
1168
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1169
1169
  setProduct(productTemp);
1170
- _context9.next = 39;
1170
+
1171
+ case 30:
1172
+ _context9.next = 35;
1171
1173
  break;
1172
1174
 
1173
- case 36:
1174
- _context9.prev = 36;
1175
- _context9.t1 = _context9["catch"](1);
1176
- console.log(_context9.t1);
1175
+ case 32:
1176
+ _context9.prev = 32;
1177
+ _context9.t0 = _context9["catch"](1);
1178
+ console.log(_context9.t0);
1177
1179
 
1178
- case 39:
1180
+ case 35:
1179
1181
  setLoading(false);
1180
1182
 
1181
- case 40:
1183
+ case 36:
1182
1184
  case "end":
1183
1185
  return _context9.stop();
1184
1186
  }
1185
1187
  }
1186
- }, _callee9, null, [[1, 36]]);
1188
+ }, _callee9, null, [[1, 32]]);
1187
1189
  }));
1188
1190
 
1189
1191
  return function sendToFacilitator(_x) {
@@ -1290,11 +1292,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1290
1292
  var dsInputsRequired = [];
1291
1293
  var desInputsRequired = 0;
1292
1294
  datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
1293
- var _servicesData$filter3 = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
1295
+ var _servicesData$filter = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
1294
1296
  return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
1295
1297
  }),
1296
- _servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
1297
- requested = _servicesData$filter4[0];
1298
+ _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
1299
+ requested = _servicesData$filter2[0];
1298
1300
 
1299
1301
  requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
1300
1302
  return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
@@ -1304,11 +1306,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1304
1306
  });
1305
1307
  objetcTemp["Ficha técnica"] = dsInputsRequired.length;
1306
1308
  descriptionsServicesArray.forEach(function (description) {
1307
- var _servicesData$filter5 = servicesData.filter(function (srv) {
1309
+ var _servicesData$filter3 = servicesData.filter(function (srv) {
1308
1310
  return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
1309
1311
  }),
1310
- _servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
1311
- requested = _servicesData$filter6[0];
1312
+ _servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
1313
+ requested = _servicesData$filter4[0];
1312
1314
 
1313
1315
  requested && description.inputs.forEach(function (input) {
1314
1316
  return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
@@ -1409,14 +1411,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1409
1411
  case 10:
1410
1412
  productTemp = product;
1411
1413
  productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
1412
- data = (0, _defineProperty2.default)({
1414
+ data = {
1413
1415
  articleList: [{
1414
1416
  orderId: product.orderId,
1415
1417
  articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article
1416
1418
  }],
1417
- concept: concept
1418
- }, "".concat(assignationType, "Id"), assignationId);
1419
- (0, _axios.default)({
1419
+ concept: concept,
1420
+ userId: assignationId
1421
+ };
1422
+ _context12.next = 15;
1423
+ return (0, _axios.default)({
1420
1424
  method: "post",
1421
1425
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
1422
1426
  data: data,
@@ -1424,10 +1428,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1424
1428
  Authorization: token
1425
1429
  }
1426
1430
  });
1431
+
1432
+ case 15:
1427
1433
  loadAssignations(productTemp);
1428
1434
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1429
1435
 
1430
- case 16:
1436
+ case 17:
1431
1437
  case "end":
1432
1438
  return _context12.stop();
1433
1439
  }
@@ -1546,6 +1552,91 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1546
1552
  (0, _react.useEffect)(function () {
1547
1553
  setSaving(loading);
1548
1554
  }, [loading]);
1555
+
1556
+ var validateAll = /*#__PURE__*/function () {
1557
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1558
+ var evaluationArray, sendAll, conceptArray, productTemp;
1559
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1560
+ while (1) {
1561
+ switch (_context13.prev = _context13.next) {
1562
+ case 0:
1563
+ _context13.prev = 0;
1564
+ setLoading(true);
1565
+ evaluationArray = [];
1566
+ sendAll = [];
1567
+ conceptArray = ["description", "datasheet", "images"];
1568
+ servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1569
+ var _product$id_order;
1570
+
1571
+ var data = {
1572
+ articleId: product.article.id_article,
1573
+ orderId: (_product$id_order = product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId,
1574
+ concept: ret.service,
1575
+ result: result,
1576
+ evalStatus: product["".concat(ret.service, "_status")],
1577
+ retailerId: ret.id_retailer
1578
+ };
1579
+ evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1580
+ headers: {
1581
+ Authorization: token
1582
+ }
1583
+ }));
1584
+ });
1585
+ _context13.next = 8;
1586
+ return Promise.all(evaluationArray);
1587
+
1588
+ case 8:
1589
+ conceptArray === null || conceptArray === void 0 ? void 0 : conceptArray.forEach(function (concept) {
1590
+ var _product$id_order2;
1591
+
1592
+ var data = {
1593
+ articleId: product.article.id_article,
1594
+ orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
1595
+ concept: concept,
1596
+ evalStatus: product["".concat(concept, "_status")]
1597
+ };
1598
+ sendAll.push(_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1599
+ headers: {
1600
+ Authorization: token
1601
+ }
1602
+ }));
1603
+ });
1604
+ _context13.next = 11;
1605
+ return Promise.all(sendAll);
1606
+
1607
+ case 11:
1608
+ productTemp = product;
1609
+ productTemp.status = "".concat(result, "A");
1610
+ productTemp.datasheet_status = productTemp.datasheet_status === "NA" ? "NA" : "".concat(result, "A");
1611
+ productTemp.description_status = productTemp.description_status === "NA" ? "NA" : "".concat(result, "A");
1612
+ productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "A");
1613
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1614
+ setProduct(productTemp);
1615
+ _context13.next = 20;
1616
+ return loadData();
1617
+
1618
+ case 20:
1619
+ _context13.next = 25;
1620
+ break;
1621
+
1622
+ case 22:
1623
+ _context13.prev = 22;
1624
+ _context13.t0 = _context13["catch"](0);
1625
+ console.log(_context13.t0);
1626
+
1627
+ case 25:
1628
+ case "end":
1629
+ return _context13.stop();
1630
+ }
1631
+ }
1632
+ }, _callee13, null, [[0, 22]]);
1633
+ }));
1634
+
1635
+ return function validateAll(_x7) {
1636
+ return _ref14.apply(this, arguments);
1637
+ };
1638
+ }();
1639
+
1549
1640
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1550
1641
  headerTop: headerTop,
1551
1642
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1610,7 +1701,36 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1610
1701
  }
1611
1702
  })]);
1612
1703
  },
1613
- showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned())
1704
+ showApproveRejectAll: isAuditor && servicesData.every(function (serv) {
1705
+ return ["RA", "AA", "AP", "ACA", "AC"].includes(serv.status);
1706
+ }) && approveRejectButtons() && (auditorAssigned() || userAssigned()),
1707
+ showValidationButtons: approveRejectButtons() && (auditorAssigned() || userAssigned()),
1708
+ approveAll: function approveAll() {
1709
+ return validateAll("A");
1710
+ },
1711
+ rejectAll: function rejectAll() {
1712
+ validateAll("R");
1713
+ setMessage("Rechazado");
1714
+ setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1715
+ src: _errorModal.default
1716
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1717
+ text: "Agrega tu comentarios para enviar el rechazo",
1718
+ headerType: "input-name-header",
1719
+ color: "white"
1720
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1721
+ label: "Caja de Comentario",
1722
+ inputType: "textarea",
1723
+ inputId: "modal-commentary-box",
1724
+ index: 0,
1725
+ color: "white"
1726
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1727
+ buttonType: "general-default-button",
1728
+ label: "Enviar comentario",
1729
+ onClick: function onClick(e) {
1730
+ return createComment(e, document.querySelector("#modal-commentary-box .ql-container .ql-editor > p").innerHTML, activeTab);
1731
+ }
1732
+ })]);
1733
+ }
1614
1734
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1615
1735
  tabsSections: tabsSections,
1616
1736
  status: retailerStatus,
@@ -1714,23 +1834,23 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1714
1834
  reviewed: crossComment
1715
1835
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1716
1836
  buttonType: "circular-button accept-button",
1717
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1718
- return _regenerator.default.wrap(function _callee13$(_context13) {
1837
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1838
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1719
1839
  while (1) {
1720
- switch (_context13.prev = _context13.next) {
1840
+ switch (_context14.prev = _context14.next) {
1721
1841
  case 0:
1722
1842
  setCrossComment(true);
1723
1843
  commentRevised();
1724
1844
 
1725
1845
  case 2:
1726
1846
  case "end":
1727
- return _context13.stop();
1847
+ return _context14.stop();
1728
1848
  }
1729
1849
  }
1730
- }, _callee13);
1850
+ }, _callee14);
1731
1851
  }))
1732
1852
  })]
1733
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1853
+ }), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1734
1854
  buttonType: evaluationFinished(user.id_role, activeTab, statusArray) && requiredNull[activeTab] === 0 ? "general-green-button" : "general-button-disabled",
1735
1855
  label: "Enviar evaluación",
1736
1856
  onClick: function onClick() {