contentoh-components-library 21.0.7 → 21.0.11

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.
@@ -44,7 +44,7 @@ var FullTabsMenu = function FullTabsMenu(_ref) {
44
44
  setImagesSection: setImagesSection,
45
45
  setActiveTab: setActiveTab
46
46
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.StatusAsignationInfo, {
47
- status: status[activeTab],
47
+ status: status(),
48
48
  activeTab: activeTab,
49
49
  setImageLayout: setImageLayout,
50
50
  imagesSection: imagesSection,
@@ -68,7 +68,7 @@ RetailerProductEditionDefault.args = {
68
68
  "Ficha técnica": false,
69
69
  Imágenes: false
70
70
  },
71
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjU2M2I0NTFlLTVhZDQtNGMzNy1iNjIzLTc3NjMwM2Y3YjJiNSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjQ4NzYwODcwLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjQ4NzY0NDcwLCJpYXQiOjE2NDg3NjA4NzAsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.Y2gmN-9KDeYyvvSJOzKJUP-WL8O4AmZhdLnfHxSB_9lAXQFns6uJUbX1nzE75cuqeQ3NeiNZy4hu8y5Y7hckPuQFy01nY3OoY3SfD06W0SciNz0txNSR7oN6KH_c_9FOwQiQ0mnOs9udo9nDM4faFFUuu9UD6RMVfeLW1gfZmtyc3lfmy6YO6feJcS3opSSQpXH4Mgh415fXFjbyz344ssd5nl7Onyh8jq5i-LAex3OPXhKzjrBnDRpGg3BQPIfpsquGZNKBiWqyos--CuohFBeyevMLGoKOcU-Ga-zIdEfonTtDVRe6CQLgOZJ2xTPdswlzRPby1gFoZjNebeeRVw",
71
+ token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJiMmNlNWIyYS02MDljLTRlNzktOWVhOS0yZjc0Y2ZmNDM4ODkiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImIyY2U1YjJhLTYwOWMtNGU3OS05ZWE5LTJmNzRjZmY0Mzg4OSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJkMGQ0NDUxYS01ODg1LTQ0ZTctYjZhNi0xODdkY2NjNDI4MTgiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1MTIyMDI2NiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1MTIyMzg2NiwiaWF0IjoxNjUxMjIwMjY2LCJlbWFpbCI6ImF6YXJhdGVAY29udGVudG9oLmNvbSJ9.lhlgp4NoHgFu4LrpIWiGCTD08MIHo-mLQ17SNx1rAmyHP5YosGp9LKJXEgNcpAIaVfFiy4Zd-YGTf2QExMcP9kAYksoKHI1G6jSg87yh3Pg3V3aGE6X6JkuOOflz2M8jZgyYMRvbkJfG7oi6uj_nZ-tCjq7VMnmZyfWL4LjTvF5E0EqzVC93fcPViwW5ozqr51VvGhIoXGHiG01i4CPbsorp0jJjlU795cq4ETNw6i0d61Wz9pLDUttYmt5RCEMrbCp3ctSymtxHuz3eJTXzsF330KAmGL2SG4hJ8l-kdyoYRSlkGy3PTy4tYdFVrcubpHL3LOFzJWMrmLn98J3MoA",
72
72
  articleId: 238,
73
73
  category: 846,
74
74
  version: 2,
@@ -78,72 +78,72 @@ RetailerProductEditionDefault.args = {
78
78
  descriptions: 1,
79
79
  images: 1
80
80
  },
81
- orderId: 123,
81
+ orderId: 125,
82
82
  status: "IN_PROGRESS",
83
- datasheet_status: "IN_PROGRESS",
83
+ datasheet_status: "QF",
84
84
  prio: "none",
85
85
  version: 2,
86
- description_status: "IN_PROGRESS",
87
- images_status: null,
86
+ description_status: "QF",
87
+ images_status: "IN_PROGRESS",
88
88
  article: {
89
- id_article: 109481,
90
- id_category: "9",
91
- name: "Barrita de nuez",
92
- upc: "168489",
93
- timestamp: "2022-04-27T15:06:59.000Z",
89
+ id_article: 109483,
90
+ id_category: "2046",
91
+ name: "Celular",
92
+ upc: "31313131",
93
+ timestamp: "2022-04-28T21:42:27.000Z",
94
94
  id_user: 28,
95
95
  status: "NULL",
96
96
  active: 1,
97
97
  company_id: 1,
98
98
  company_name: "COMPANY DEV",
99
99
  country: "Colombia",
100
- id_order: 123,
100
+ id_order: 125,
101
101
  id_datasheet_especialist: 54,
102
102
  id_datasheet_facilitator: 52,
103
103
  id_description_especialist: 54,
104
104
  id_description_facilitator: 52,
105
- id_images_especialist: null,
106
- id_images_facilitator: null,
105
+ id_images_especialist: 55,
106
+ id_images_facilitator: 53,
107
107
  id_auditor: 30,
108
108
  id_recepcionist: null,
109
- category: "ABARROTES|ABARROTES SECOS|CEREALES Y BARRAS",
109
+ category: "ELÉCTRICO|ELECTRÓNICA|ANTENAS Y ACCESORIOS",
110
110
  missingAttributes: null,
111
111
  missingDescriptions: null,
112
112
  missingImages: null
113
113
  },
114
114
  retailers: [{
115
- id: 4,
116
- name: "Walmart Super y Superama",
115
+ id: 58,
116
+ name: "The Home Depot",
117
117
  country: "México",
118
118
  id_region: 1,
119
119
  active: 1
120
120
  }, {
121
- id: 6,
122
- name: "HEB",
121
+ id: 59,
122
+ name: "Home Depot Platinum",
123
123
  country: "México",
124
124
  id_region: 1,
125
125
  active: 1
126
126
  }],
127
127
  country: "Colombia",
128
- upc: "168489"
128
+ upc: "31313131"
129
129
  },
130
130
  user: {
131
- id_user: 30,
132
- name: "Admin",
133
- last_name: "Ulises",
134
- email: "salmeron.5@hotmail.com",
135
- position: "Admin",
131
+ id_user: 52,
132
+ name: "FACILITADOR TXT PRUEBA",
133
+ last_name: "",
134
+ email: "azarate@contentoh.com",
135
+ position: null,
136
136
  telephone: null,
137
- country: "México",
137
+ country: null,
138
138
  id_company: 2,
139
- id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
139
+ id_cognito: "b2ce5b2a-609c-4e79-9ea9-2f74cff43889",
140
140
  birth_Date: null,
141
141
  about_me: null,
142
142
  zip_code: null,
143
143
  address: null,
144
144
  job: null,
145
145
  id_stripe: null,
146
- id_role: 6,
146
+ id_role: 4,
147
147
  active: 1,
148
148
  is_retailer: 0,
149
149
  membership: {
@@ -157,6 +157,6 @@ RetailerProductEditionDefault.args = {
157
157
  products_limit: "3",
158
158
  type: "PyMES"
159
159
  },
160
- src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1649896700986"
160
+ src: "https://content-management-profile.s3.amazonaws.com/id-52/52.png?1651207506986"
161
161
  }
162
162
  };
@@ -123,7 +123,7 @@ var myBucket = new _awsSdk.default.S3({
123
123
  });
124
124
 
125
125
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
126
- var _productSelected$reta, _product$services5, _product$services6, _datasheets$, _datasheets$$data, _product$services7, _product$article4, _product$services8;
126
+ var _productSelected$reta, _product$services5, _product$services6, _datasheets$, _datasheets$$data, _product$services7, _product$article6, _product$services8;
127
127
 
128
128
  var tabsSections = _ref.tabsSections,
129
129
  _ref$productSelected = _ref.productSelected,
@@ -284,7 +284,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
284
284
  message = _useState34[0],
285
285
  setMessage = _useState34[1];
286
286
 
287
- var _useState35 = (0, _react.useState)({}),
287
+ var _useState35 = (0, _react.useState)(JSON.parse(sessionStorage.getItem("productSelected")) ? JSON.parse(sessionStorage.getItem("productSelected")) : productSelected),
288
288
  _useState36 = (0, _slicedToArray2.default)(_useState35, 2),
289
289
  product = _useState36[0],
290
290
  setProduct = _useState36[1];
@@ -382,7 +382,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
382
382
  init: services[2]
383
383
  });
384
384
  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);
385
- setProduct(productSelected);
386
385
  (0, _data2.getPercentage)({
387
386
  data: [productSelected]
388
387
  }).then(function (res) {
@@ -390,7 +389,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
390
389
  });
391
390
  setLoading(false);
392
391
 
393
- case 10:
392
+ case 9:
394
393
  case "end":
395
394
  return _context2.stop();
396
395
  }
@@ -405,7 +404,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
405
404
 
406
405
  var getServices = /*#__PURE__*/function () {
407
406
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tab) {
408
- var _selected$article, _selected$article2, _servicesResponse$dat;
407
+ var _product$article, _product$article2, _servicesResponse$dat;
409
408
 
410
409
  var serviceActive, selected, servicesResponse, parsedResponse;
411
410
  return _regenerator.default.wrap(function _callee3$(_context3) {
@@ -432,7 +431,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
432
431
  case 10:
433
432
  selected = productSelected;
434
433
  _context3.next = 13;
435
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(selected === null || selected === void 0 ? void 0 : (_selected$article = selected.article) === null || _selected$article === void 0 ? void 0 : _selected$article.id_article, "&orderId=").concat(selected === null || selected === void 0 ? void 0 : (_selected$article2 = selected.article) === null || _selected$article2 === void 0 ? void 0 : _selected$article2.id_order, "&end=true"));
434
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_order, "&end=true"));
436
435
 
437
436
  case 13:
438
437
  servicesResponse = _context3.sent;
@@ -746,7 +745,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
746
745
  }();
747
746
 
748
747
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
749
- var _images$values2, _product$article, _data$articleData, _data$articleData2, _data$updateImages;
748
+ var _images$values2, _product$article3, _data$articleData, _data$articleData2, _data$updateImages;
750
749
 
751
750
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
752
751
 
@@ -765,7 +764,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
765
764
  attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
766
765
  attrForImgs.pop();
767
766
  data = {
768
- articleId: product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article,
767
+ articleId: product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article,
769
768
  attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
770
769
  var _e$, _e$2;
771
770
 
@@ -930,7 +929,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
930
929
  }
931
930
 
932
931
  concept = action ? action : concept;
933
- return productSelected["".concat(concept, "_status")] === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || productSelected["".concat(concept, "_status")] === "AF" && (user.id_role === 1 || user.id_role === 6) || productSelected["".concat(concept, "_status")] === "RP" && (user.id_role === 1 || user.id_role === 6);
932
+ return product["".concat(concept, "_status")] === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || product["".concat(concept, "_status")] === "AF" && ( //sessionStorage productSelected
933
+ user.id_role === 1 || user.id_role === 6) || product["".concat(concept, "_status")] === "RP" && (user.id_role === 1 || user.id_role === 6) || product["".concat(concept, "_status")] === "RC" && (user.id_role === 1 || user.id_role === 6);
934
934
  };
935
935
 
936
936
  var getSectionIcon = function getSectionIcon() {
@@ -954,7 +954,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
954
954
 
955
955
  var updateCompaniesList = function updateCompaniesList(status, result, retailerId, concept) {
956
956
  var serv = servicesData.slice();
957
- var item = serv === null || serv === void 0 ? void 0 : serv.find(function (item) {
957
+ var item = serv.find(function (item) {
958
958
  return item.id_retailer === retailerId && item.service === concept;
959
959
  });
960
960
  var index = serv.indexOf(item);
@@ -1016,7 +1016,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1016
1016
 
1017
1017
  var sendToFacilitator = /*#__PURE__*/function () {
1018
1018
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
1019
- var concept, evalStatus, productTemp, specialistDone, data;
1019
+ var concept, productTemp, evalStatus, specialistDone, data;
1020
1020
  return _regenerator.default.wrap(function _callee10$(_context10) {
1021
1021
  while (1) {
1022
1022
  switch (_context10.prev = _context10.next) {
@@ -1028,116 +1028,125 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1028
1028
 
1029
1029
  case 4:
1030
1030
  concept = "description";
1031
- return _context10.abrupt("break", 11);
1031
+ return _context10.abrupt("break", 10);
1032
1032
 
1033
1033
  case 6:
1034
1034
  concept = "datasheet";
1035
- return _context10.abrupt("break", 11);
1035
+ return _context10.abrupt("break", 10);
1036
1036
 
1037
1037
  case 8:
1038
1038
  concept = "images";
1039
- return _context10.abrupt("break", 11);
1039
+ return _context10.abrupt("break", 10);
1040
1040
 
1041
1041
  case 10:
1042
- return _context10.abrupt("break", 11);
1043
-
1044
- case 11:
1045
- evalStatus = "";
1046
- productTemp = productSelected;
1047
- evalStatus = productSelected["".concat(concept, "_status")];
1042
+ productTemp = (0, _objectSpread2.default)({}, product);
1043
+ evalStatus = product["".concat(concept, "_status")];
1048
1044
  specialistDone = evalStatus === "RF" || evalStatus === "RA" || evalStatus === "IN_PROGRESS";
1049
1045
 
1050
1046
  if (specialistDone) {
1051
1047
  setMessage("".concat(activeTab, " enviada a facilitador"));
1052
1048
  getSectionIcon();
1053
1049
  productTemp["".concat(concept, "_status")] = "QF";
1054
- evalStatus = "QF";
1055
1050
  } else if (evalStatus === "QF") {
1056
1051
  setMessage("Evaluación enviada");
1057
1052
  getSectionIcon();
1058
1053
  productTemp["".concat(concept, "_status")] = "AF";
1059
- evalStatus = "AF";
1060
1054
  } else if (evalStatus === "AF") {
1061
1055
  setMessage("Evaluación enviada");
1062
1056
  getSectionIcon();
1063
1057
  productTemp["".concat(concept, "_status")] = "AA";
1064
- evalStatus = "AA";
1065
1058
  } else if (evalStatus === "RP") {
1066
1059
  setMessage("Evaluación enviada");
1067
1060
  getSectionIcon();
1068
1061
  productTemp["".concat(concept, "_status")] = "AA";
1069
- evalStatus = "AA";
1062
+ } else if (evalStatus === "RC") {
1063
+ setMessage("Evaluación enviada");
1064
+ getSectionIcon();
1065
+ productTemp["".concat(concept, "_status")] = "AP";
1070
1066
  }
1071
1067
 
1072
1068
  data = {};
1073
1069
 
1074
1070
  if (!result) {
1075
- _context10.next = 24;
1071
+ _context10.next = 28;
1076
1072
  break;
1077
1073
  }
1078
1074
 
1079
1075
  updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
1080
1076
  data = {
1081
- articleId: productSelected.article.id_article,
1082
- orderId: productSelected.orderId,
1077
+ articleId: product.article.id_article,
1078
+ orderId: product.orderId,
1083
1079
  concept: concept,
1084
1080
  result: result,
1085
1081
  evalStatus: evalStatus,
1086
1082
  retailerId: activeRetailer.id
1087
1083
  };
1088
- _context10.next = 22;
1084
+ _context10.prev = 18;
1085
+ _context10.next = 21;
1089
1086
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1090
1087
  headers: {
1091
1088
  Authorization: token
1092
1089
  }
1093
1090
  });
1094
1091
 
1095
- case 22:
1096
- _context10.next = 36;
1092
+ case 21:
1093
+ _context10.next = 26;
1097
1094
  break;
1098
1095
 
1099
- case 24:
1096
+ case 23:
1097
+ _context10.prev = 23;
1098
+ _context10.t1 = _context10["catch"](18);
1099
+ console.log(_context10.t1);
1100
+
1101
+ case 26:
1102
+ _context10.next = 42;
1103
+ break;
1104
+
1105
+ case 28:
1100
1106
  if (specialistDone) {
1101
- updateCompaniesList(evalStatus, result, activeRetailer.id);
1107
+ updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
1102
1108
  }
1103
1109
 
1104
1110
  data = {
1105
- articleId: productSelected.article.id_article,
1106
- orderId: productSelected.orderId,
1111
+ articleId: product.article.id_article,
1112
+ orderId: product.orderId,
1107
1113
  concept: concept,
1108
1114
  evalStatus: evalStatus,
1109
1115
  retailerId: activeRetailer.id
1110
1116
  };
1111
- _context10.t1 = user.id_role;
1112
- _context10.next = _context10.t1 === 7 ? 29 : _context10.t1 === 8 ? 29 : _context10.t1 === 4 ? 31 : _context10.t1 === 5 ? 31 : 33;
1117
+ _context10.t2 = user.id_role;
1118
+ _context10.next = _context10.t2 === 7 ? 33 : _context10.t2 === 8 ? 33 : _context10.t2 === 4 ? 35 : _context10.t2 === 5 ? 35 : 37;
1113
1119
  break;
1114
1120
 
1115
- case 29:
1121
+ case 33:
1116
1122
  data.especialist = true;
1117
- return _context10.abrupt("break", 34);
1123
+ return _context10.abrupt("break", 38);
1118
1124
 
1119
- case 31:
1125
+ case 35:
1120
1126
  data.facilitator = true;
1121
- return _context10.abrupt("break", 34);
1127
+ return _context10.abrupt("break", 38);
1122
1128
 
1123
- case 33:
1124
- return _context10.abrupt("break", 34);
1129
+ case 37:
1130
+ return _context10.abrupt("break", 38);
1131
+
1132
+ case 38:
1133
+ console.log(data);
1125
1134
 
1126
- case 34:
1127
1135
  _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1128
1136
  headers: {
1129
1137
  Authorization: token
1130
1138
  }
1131
1139
  });
1132
1140
 
1141
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1133
1142
  setProduct(productTemp); //setModalSent(true);
1134
1143
 
1135
- case 36:
1144
+ case 42:
1136
1145
  case "end":
1137
1146
  return _context10.stop();
1138
1147
  }
1139
1148
  }
1140
- }, _callee10);
1149
+ }, _callee10, null, [[18, 23]]);
1141
1150
  }));
1142
1151
 
1143
1152
  return function sendToFacilitator(_x3) {
@@ -1164,6 +1173,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1164
1173
 
1165
1174
  var allowedRoles = [1, 4, 5, 6, 7, 8];
1166
1175
  var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
1176
+
1177
+ if (!rol) {
1178
+ switch (user.id_role) {
1179
+ case 4:
1180
+ case 5:
1181
+ rol = "facilitator";
1182
+ break;
1183
+
1184
+ case 7:
1185
+ case 8:
1186
+ rol = "especialist";
1187
+ break;
1188
+ }
1189
+ }
1190
+
1167
1191
  return productSelected.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1168
1192
  };
1169
1193
 
@@ -1173,7 +1197,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1173
1197
 
1174
1198
  var createComment = /*#__PURE__*/function () {
1175
1199
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
1176
- var _product$article2;
1200
+ var _product$article4;
1177
1201
 
1178
1202
  var concept, data;
1179
1203
  return _regenerator.default.wrap(function _callee11$(_context11) {
@@ -1199,7 +1223,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1199
1223
 
1200
1224
  case 10:
1201
1225
  data = {
1202
- articleId: product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_article,
1226
+ articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
1203
1227
  orderId: product === null || product === void 0 ? void 0 : product.orderId,
1204
1228
  message: body,
1205
1229
  concept: concept,
@@ -1306,7 +1330,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1306
1330
 
1307
1331
  var setAssignation = /*#__PURE__*/function () {
1308
1332
  var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
1309
- var _product$article3;
1333
+ var _product$article5;
1310
1334
 
1311
1335
  var concept, productTemp, data;
1312
1336
  return _regenerator.default.wrap(function _callee13$(_context13) {
@@ -1336,7 +1360,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1336
1360
  data = (0, _defineProperty2.default)({
1337
1361
  articleList: [{
1338
1362
  orderId: product.orderId,
1339
- articleId: product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article
1363
+ articleId: product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_article
1340
1364
  }],
1341
1365
  concept: concept
1342
1366
  }, "".concat(assignationType, "Id"), assignationId);
@@ -1364,10 +1388,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1364
1388
  };
1365
1389
  }();
1366
1390
 
1367
- var evaluationComplete = function evaluationComplete(tab) {
1391
+ var evaluationComplete = function evaluationComplete() {
1368
1392
  var concept = "";
1369
1393
 
1370
- switch (tab) {
1394
+ switch (activeTab) {
1371
1395
  case "Ficha técnica":
1372
1396
  concept = "datasheet";
1373
1397
  break;
@@ -1376,7 +1400,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1376
1400
  concept = "images";
1377
1401
  break;
1378
1402
 
1379
- default:
1403
+ case "Descripción":
1380
1404
  concept = "description";
1381
1405
  break;
1382
1406
  }
@@ -1470,9 +1494,26 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1470
1494
  }
1471
1495
  };
1472
1496
 
1473
- (0, _react.useEffect)(function () {
1474
- console.log(requiredNull[activeTab], evaluationComplete(activeTab));
1475
- }, [activeTab]);
1497
+ var specialistValid = function specialistValid(tab) {
1498
+ var concept = "";
1499
+
1500
+ switch (tab) {
1501
+ case "Ficha técnica":
1502
+ concept = "datasheet";
1503
+ break;
1504
+
1505
+ case "Imágenes":
1506
+ concept = "images";
1507
+ break;
1508
+
1509
+ case "Descripción":
1510
+ concept = "description";
1511
+ break;
1512
+ }
1513
+
1514
+ return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
1515
+ };
1516
+
1476
1517
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1477
1518
  headerTop: headerTop,
1478
1519
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1512,14 +1553,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1512
1553
  sendToFacilitator: sendToFacilitator,
1513
1554
  auditorAssigned: auditorAssigned,
1514
1555
  userAssigned: function userAssigned() {
1515
- return _userAssigned(activeTab, "facilitator");
1556
+ return _userAssigned(activeTab);
1516
1557
  }
1517
1558
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1518
1559
  tabsSections: tabsSections,
1519
- status: {
1520
- Descripción: product === null || product === void 0 ? void 0 : product.description_status,
1521
- "Ficha técnica": product === null || product === void 0 ? void 0 : product.datasheet_status,
1522
- Imágenes: product === null || product === void 0 ? void 0 : product.images_status
1560
+ status: // {
1561
+ // Descripción: product?.description_status,
1562
+ // "Ficha técnica": product?.datasheet_status,
1563
+ // Imágenes: product?.images_status,
1564
+ // }
1565
+ function status() {
1566
+ var _retailerService;
1567
+
1568
+ var concept = "";
1569
+
1570
+ switch (activeTab) {
1571
+ case "Ficha técnica":
1572
+ concept = "datasheet";
1573
+ break;
1574
+
1575
+ case "Imágenes":
1576
+ concept = "images";
1577
+ break;
1578
+
1579
+ case "Descripción":
1580
+ concept = "description";
1581
+ break;
1582
+ }
1583
+
1584
+ var retailerService = {};
1585
+
1586
+ var _servicesData$filter = servicesData.filter(function (service) {
1587
+ return service.id_retailer === activeRetailer.id && service.service === concept;
1588
+ });
1589
+
1590
+ var _servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1);
1591
+
1592
+ retailerService = _servicesData$filter2[0];
1593
+ return (_retailerService = retailerService) === null || _retailerService === void 0 ? void 0 : _retailerService.status;
1523
1594
  },
1524
1595
  activeTab: activeTab,
1525
1596
  setActiveTab: setActiveTab,
@@ -1574,7 +1645,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1574
1645
  inputGroup: descriptions[0],
1575
1646
  updatedDescriptions: updatedDescriptions,
1576
1647
  setUpdatedDescriptions: setUpdatedDescriptions,
1577
- articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
1648
+ articleId: product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article,
1578
1649
  version: version,
1579
1650
  dinamicHeight: true
1580
1651
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
@@ -1594,7 +1665,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1594
1665
  headerType: "input-name-header"
1595
1666
  }))]
1596
1667
  })
1597
- }), (_userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1668
+ }), (_userAssigned(activeTab) || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1598
1669
  className: "commentary-box",
1599
1670
  children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1600
1671
  className: "commentary",
@@ -1639,7 +1710,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1639
1710
  }))
1640
1711
  })]
1641
1712
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1642
- buttonType: approveRejectButtons() || requiredNull[activeTab] === 0 || evaluationComplete(activeTab) ? "general-green-button" : "general-button-disabled",
1713
+ buttonType: evaluationComplete() && requiredNull[activeTab] === 0 && approveRejectButtons() ? "general-green-button" : "general-button-disabled",
1643
1714
  label: "Enviar evaluación",
1644
1715
  onClick: function onClick() {
1645
1716
  return sendToFacilitator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.7",
3
+ "version": "21.0.11",
4
4
  "dependencies": {
5
5
  "@babel/runtime": "^7.17.2",
6
6
  "@storybook/addon-postcss": "^2.0.0",
@@ -26,7 +26,7 @@ export const FullTabsMenu = ({
26
26
  setActiveTab={setActiveTab}
27
27
  />
28
28
  <StatusAsignationInfo
29
- status={status[activeTab]}
29
+ status={status()}
30
30
  activeTab={activeTab}
31
31
  setImageLayout={setImageLayout}
32
32
  imagesSection={imagesSection}
@@ -44,7 +44,7 @@ RetailerProductEditionDefault.args = {
44
44
  Imágenes: false,
45
45
  },
46
46
  token:
47
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjU2M2I0NTFlLTVhZDQtNGMzNy1iNjIzLTc3NjMwM2Y3YjJiNSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjQ4NzYwODcwLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjQ4NzY0NDcwLCJpYXQiOjE2NDg3NjA4NzAsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.Y2gmN-9KDeYyvvSJOzKJUP-WL8O4AmZhdLnfHxSB_9lAXQFns6uJUbX1nzE75cuqeQ3NeiNZy4hu8y5Y7hckPuQFy01nY3OoY3SfD06W0SciNz0txNSR7oN6KH_c_9FOwQiQ0mnOs9udo9nDM4faFFUuu9UD6RMVfeLW1gfZmtyc3lfmy6YO6feJcS3opSSQpXH4Mgh415fXFjbyz344ssd5nl7Onyh8jq5i-LAex3OPXhKzjrBnDRpGg3BQPIfpsquGZNKBiWqyos--CuohFBeyevMLGoKOcU-Ga-zIdEfonTtDVRe6CQLgOZJ2xTPdswlzRPby1gFoZjNebeeRVw",
47
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJiMmNlNWIyYS02MDljLTRlNzktOWVhOS0yZjc0Y2ZmNDM4ODkiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImIyY2U1YjJhLTYwOWMtNGU3OS05ZWE5LTJmNzRjZmY0Mzg4OSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJkMGQ0NDUxYS01ODg1LTQ0ZTctYjZhNi0xODdkY2NjNDI4MTgiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1MTIyMDI2NiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1MTIyMzg2NiwiaWF0IjoxNjUxMjIwMjY2LCJlbWFpbCI6ImF6YXJhdGVAY29udGVudG9oLmNvbSJ9.lhlgp4NoHgFu4LrpIWiGCTD08MIHo-mLQ17SNx1rAmyHP5YosGp9LKJXEgNcpAIaVfFiy4Zd-YGTf2QExMcP9kAYksoKHI1G6jSg87yh3Pg3V3aGE6X6JkuOOflz2M8jZgyYMRvbkJfG7oi6uj_nZ-tCjq7VMnmZyfWL4LjTvF5E0EqzVC93fcPViwW5ozqr51VvGhIoXGHiG01i4CPbsorp0jJjlU795cq4ETNw6i0d61Wz9pLDUttYmt5RCEMrbCp3ctSymtxHuz3eJTXzsF330KAmGL2SG4hJ8l-kdyoYRSlkGy3PTy4tYdFVrcubpHL3LOFzJWMrmLn98J3MoA",
48
48
  articleId: 238,
49
49
  category: 846,
50
50
  version: 2,
@@ -54,75 +54,75 @@ RetailerProductEditionDefault.args = {
54
54
  descriptions: 1,
55
55
  images: 1,
56
56
  },
57
- orderId: 123,
57
+ orderId: 125,
58
58
  status: "IN_PROGRESS",
59
- datasheet_status: "IN_PROGRESS",
59
+ datasheet_status: "QF",
60
60
  prio: "none",
61
61
  version: 2,
62
- description_status: "IN_PROGRESS",
63
- images_status: null,
62
+ description_status: "QF",
63
+ images_status: "IN_PROGRESS",
64
64
  article: {
65
- id_article: 109481,
66
- id_category: "9",
67
- name: "Barrita de nuez",
68
- upc: "168489",
69
- timestamp: "2022-04-27T15:06:59.000Z",
65
+ id_article: 109483,
66
+ id_category: "2046",
67
+ name: "Celular",
68
+ upc: "31313131",
69
+ timestamp: "2022-04-28T21:42:27.000Z",
70
70
  id_user: 28,
71
71
  status: "NULL",
72
72
  active: 1,
73
73
  company_id: 1,
74
74
  company_name: "COMPANY DEV",
75
75
  country: "Colombia",
76
- id_order: 123,
76
+ id_order: 125,
77
77
  id_datasheet_especialist: 54,
78
78
  id_datasheet_facilitator: 52,
79
79
  id_description_especialist: 54,
80
80
  id_description_facilitator: 52,
81
- id_images_especialist: null,
82
- id_images_facilitator: null,
81
+ id_images_especialist: 55,
82
+ id_images_facilitator: 53,
83
83
  id_auditor: 30,
84
84
  id_recepcionist: null,
85
- category: "ABARROTES|ABARROTES SECOS|CEREALES Y BARRAS",
85
+ category: "ELÉCTRICO|ELECTRÓNICA|ANTENAS Y ACCESORIOS",
86
86
  missingAttributes: null,
87
87
  missingDescriptions: null,
88
88
  missingImages: null,
89
89
  },
90
90
  retailers: [
91
91
  {
92
- id: 4,
93
- name: "Walmart Super y Superama",
92
+ id: 58,
93
+ name: "The Home Depot",
94
94
  country: "México",
95
95
  id_region: 1,
96
96
  active: 1,
97
97
  },
98
98
  {
99
- id: 6,
100
- name: "HEB",
99
+ id: 59,
100
+ name: "Home Depot Platinum",
101
101
  country: "México",
102
102
  id_region: 1,
103
103
  active: 1,
104
104
  },
105
105
  ],
106
106
  country: "Colombia",
107
- upc: "168489",
107
+ upc: "31313131",
108
108
  },
109
109
  user: {
110
- id_user: 30,
111
- name: "Admin",
112
- last_name: "Ulises",
113
- email: "salmeron.5@hotmail.com",
114
- position: "Admin",
110
+ id_user: 52,
111
+ name: "FACILITADOR TXT PRUEBA",
112
+ last_name: "",
113
+ email: "azarate@contentoh.com",
114
+ position: null,
115
115
  telephone: null,
116
- country: "México",
116
+ country: null,
117
117
  id_company: 2,
118
- id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
118
+ id_cognito: "b2ce5b2a-609c-4e79-9ea9-2f74cff43889",
119
119
  birth_Date: null,
120
120
  about_me: null,
121
121
  zip_code: null,
122
122
  address: null,
123
123
  job: null,
124
124
  id_stripe: null,
125
- id_role: 6,
125
+ id_role: 4,
126
126
  active: 1,
127
127
  is_retailer: 0,
128
128
  membership: {
@@ -136,6 +136,6 @@ RetailerProductEditionDefault.args = {
136
136
  products_limit: "3",
137
137
  type: "PyMES",
138
138
  },
139
- src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1649896700986",
139
+ src: "https://content-management-profile.s3.amazonaws.com/id-52/52.png?1651207506986",
140
140
  },
141
141
  };
@@ -126,7 +126,11 @@ export const RetailerProductEdition = ({
126
126
  const [services, setServices] = useState([]);
127
127
  const [servicesData, setServicesData] = useState([]);
128
128
  const [message, setMessage] = useState("");
129
- const [product, setProduct] = useState({});
129
+ const [product, setProduct] = useState(
130
+ JSON.parse(sessionStorage.getItem("productSelected"))
131
+ ? JSON.parse(sessionStorage.getItem("productSelected"))
132
+ : productSelected
133
+ );
130
134
  const [icon, setIcon] = useState(null);
131
135
  const [version, setVersion] = useState(productSelected?.version);
132
136
  const [comments, setComments] = useState({});
@@ -164,7 +168,7 @@ export const RetailerProductEdition = ({
164
168
  init: services[2],
165
169
  });
166
170
  if (services[2]?.values?.length > 0) setActiveImage(0);
167
- setProduct(productSelected);
171
+
168
172
  getPercentage({ data: [productSelected] }).then((res) =>
169
173
  setPercentages(res)
170
174
  );
@@ -186,7 +190,7 @@ export const RetailerProductEdition = ({
186
190
  }
187
191
  const selected = productSelected;
188
192
  const servicesResponse = await axios.get(
189
- `${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${selected?.article?.id_article}&orderId=${selected?.article?.id_order}&end=true`
193
+ `${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${product?.article?.id_article}&orderId=${product?.article?.id_order}&end=true`
190
194
  );
191
195
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
192
196
  setServicesData(parsedResponse);
@@ -530,11 +534,13 @@ export const RetailerProductEdition = ({
530
534
  }
531
535
  concept = action ? action : concept;
532
536
  return (
533
- (productSelected[`${concept}_status`] === "QF" &&
537
+ (product[`${concept}_status`] === "QF" &&
534
538
  (user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
535
- (productSelected[`${concept}_status`] === "AF" &&
539
+ (product[`${concept}_status`] === "AF" && //sessionStorage productSelected
536
540
  (user.id_role === 1 || user.id_role === 6)) ||
537
- (productSelected[`${concept}_status`] === "RP" &&
541
+ (product[`${concept}_status`] === "RP" &&
542
+ (user.id_role === 1 || user.id_role === 6)) ||
543
+ (product[`${concept}_status`] === "RC" &&
538
544
  (user.id_role === 1 || user.id_role === 6))
539
545
  );
540
546
  };
@@ -557,7 +563,7 @@ export const RetailerProductEdition = ({
557
563
 
558
564
  const updateCompaniesList = (status, result, retailerId, concept) => {
559
565
  let serv = servicesData.slice();
560
- let item = serv?.find(
566
+ let item = serv.find(
561
567
  (item) => item.id_retailer === retailerId && item.service === concept
562
568
  );
563
569
  let index = serv.indexOf(item);
@@ -631,12 +637,9 @@ export const RetailerProductEdition = ({
631
637
  case "Imágenes":
632
638
  concept = "images";
633
639
  break;
634
- default:
635
- break;
636
640
  }
637
- let evalStatus = "";
638
- let productTemp = productSelected;
639
- evalStatus = productSelected[`${concept}_status`];
641
+ let productTemp = { ...product };
642
+ let evalStatus = product[`${concept}_status`];
640
643
  const specialistDone =
641
644
  evalStatus === "RF" ||
642
645
  evalStatus === "RA" ||
@@ -646,46 +649,51 @@ export const RetailerProductEdition = ({
646
649
  setMessage(`${activeTab} enviada a facilitador`);
647
650
  getSectionIcon();
648
651
  productTemp[`${concept}_status`] = "QF";
649
- evalStatus = "QF";
650
652
  } else if (evalStatus === "QF") {
651
653
  setMessage("Evaluación enviada");
652
654
  getSectionIcon();
653
655
  productTemp[`${concept}_status`] = "AF";
654
- evalStatus = "AF";
655
656
  } else if (evalStatus === "AF") {
656
657
  setMessage("Evaluación enviada");
657
658
  getSectionIcon();
658
659
  productTemp[`${concept}_status`] = "AA";
659
- evalStatus = "AA";
660
660
  } else if (evalStatus === "RP") {
661
661
  setMessage("Evaluación enviada");
662
662
  getSectionIcon();
663
663
  productTemp[`${concept}_status`] = "AA";
664
- evalStatus = "AA";
664
+ } else if (evalStatus === "RC") {
665
+ setMessage("Evaluación enviada");
666
+ getSectionIcon();
667
+ productTemp[`${concept}_status`] = "AP";
665
668
  }
669
+
666
670
  let data = {};
667
671
  if (result) {
668
672
  updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
669
673
  data = {
670
- articleId: productSelected.article.id_article,
671
- orderId: productSelected.orderId,
674
+ articleId: product.article.id_article,
675
+ orderId: product.orderId,
672
676
  concept: concept,
673
677
  result: result,
674
678
  evalStatus: evalStatus,
675
679
  retailerId: activeRetailer.id,
676
680
  };
677
- await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
678
- headers: {
679
- Authorization: token,
680
- },
681
- });
681
+ try {
682
+ await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
683
+ headers: {
684
+ Authorization: token,
685
+ },
686
+ });
687
+ } catch (error) {
688
+ console.log(error);
689
+ }
682
690
  } else {
683
691
  if (specialistDone) {
684
- updateCompaniesList(evalStatus, result, activeRetailer.id);
692
+ updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
685
693
  }
686
694
  data = {
687
- articleId: productSelected.article.id_article,
688
- orderId: productSelected.orderId,
695
+ articleId: product.article.id_article,
696
+ orderId: product.orderId,
689
697
  concept: concept,
690
698
  evalStatus: evalStatus,
691
699
  retailerId: activeRetailer.id,
@@ -704,11 +712,14 @@ export const RetailerProductEdition = ({
704
712
  break;
705
713
  }
706
714
 
715
+ console.log(data);
716
+
707
717
  axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
708
718
  headers: {
709
719
  Authorization: token,
710
720
  },
711
721
  });
722
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
712
723
  setProduct(productTemp);
713
724
  //setModalSent(true);
714
725
  }
@@ -730,9 +741,21 @@ export const RetailerProductEdition = ({
730
741
  }
731
742
 
732
743
  const allowedRoles = [1, 4, 5, 6, 7, 8];
733
-
734
744
  const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
735
745
 
746
+ if (!rol) {
747
+ switch (user.id_role) {
748
+ case 4:
749
+ case 5:
750
+ rol = "facilitator";
751
+ break;
752
+ case 7:
753
+ case 8:
754
+ rol = "especialist";
755
+ break;
756
+ }
757
+ }
758
+
736
759
  return (
737
760
  productSelected.article[`id_${concept}_${rol}`] === user.id_user &&
738
761
  validUser
@@ -872,20 +895,20 @@ export const RetailerProductEdition = ({
872
895
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
873
896
  };
874
897
 
875
- const evaluationComplete = (tab) => {
898
+ const evaluationComplete = () => {
876
899
  let concept = "";
877
- switch (tab) {
900
+ switch (activeTab) {
878
901
  case "Ficha técnica":
879
902
  concept = "datasheet";
880
903
  break;
881
904
  case "Imágenes":
882
905
  concept = "images";
883
906
  break;
884
-
885
- default:
907
+ case "Descripción":
886
908
  concept = "description";
887
909
  break;
888
910
  }
911
+
889
912
  let serv = servicesData.filter((item) => item.service === concept);
890
913
  let approved = "";
891
914
  let rejected = "";
@@ -998,9 +1021,25 @@ export const RetailerProductEdition = ({
998
1021
  }
999
1022
  };
1000
1023
 
1001
- useEffect(() => {
1002
- console.log(requiredNull[activeTab], evaluationComplete(activeTab));
1003
- }, [activeTab]);
1024
+ const specialistValid = (tab) => {
1025
+ let concept = "";
1026
+ switch (tab) {
1027
+ case "Ficha técnica":
1028
+ concept = "datasheet";
1029
+ break;
1030
+ case "Imágenes":
1031
+ concept = "images";
1032
+ break;
1033
+ case "Descripción":
1034
+ concept = "description";
1035
+ break;
1036
+ }
1037
+ return (
1038
+ product[`${concept}_status`] === "IN_PROGRESS" ||
1039
+ product[`${concept}_status`] === "RF" ||
1040
+ product[`${concept}_status`] === "RA"
1041
+ );
1042
+ };
1004
1043
 
1005
1044
  return (
1006
1045
  <Container headerTop={headerTop}>
@@ -1036,15 +1075,38 @@ export const RetailerProductEdition = ({
1036
1075
  approveRejectButtons={approveRejectButtons}
1037
1076
  sendToFacilitator={sendToFacilitator}
1038
1077
  auditorAssigned={auditorAssigned}
1039
- userAssigned={() => userAssigned(activeTab, "facilitator")}
1078
+ userAssigned={() => userAssigned(activeTab)}
1040
1079
  />
1041
1080
  <FullTabsMenu
1042
1081
  tabsSections={tabsSections}
1043
- status={{
1044
- Descripción: product?.description_status,
1045
- "Ficha técnica": product?.datasheet_status,
1046
- Imágenes: product?.images_status,
1047
- }}
1082
+ status={
1083
+ // {
1084
+ // Descripción: product?.description_status,
1085
+ // "Ficha técnica": product?.datasheet_status,
1086
+ // Imágenes: product?.images_status,
1087
+ // }
1088
+ () => {
1089
+ let concept = "";
1090
+ switch (activeTab) {
1091
+ case "Ficha técnica":
1092
+ concept = "datasheet";
1093
+ break;
1094
+ case "Imágenes":
1095
+ concept = "images";
1096
+ break;
1097
+ case "Descripción":
1098
+ concept = "description";
1099
+ break;
1100
+ }
1101
+ let retailerService = {};
1102
+ [retailerService] = servicesData.filter(
1103
+ (service) =>
1104
+ service.id_retailer === activeRetailer.id &&
1105
+ service.service === concept
1106
+ );
1107
+ return retailerService?.status;
1108
+ }
1109
+ }
1048
1110
  activeTab={activeTab}
1049
1111
  setActiveTab={setActiveTab}
1050
1112
  setImageLayout={setImageLayout}
@@ -1144,8 +1206,7 @@ export const RetailerProductEdition = ({
1144
1206
  </>
1145
1207
  )}
1146
1208
  </div>
1147
- {(userAssigned(activeTab, "especialist" || "facilitator") ||
1148
- auditorAssigned()) && (
1209
+ {(userAssigned(activeTab) || auditorAssigned()) && (
1149
1210
  <div className="commentary-box">
1150
1211
  {!comment ? (
1151
1212
  <div className="commentary">
@@ -1190,9 +1251,9 @@ export const RetailerProductEdition = ({
1190
1251
  )}
1191
1252
  <Button
1192
1253
  buttonType={
1193
- approveRejectButtons() ||
1194
- requiredNull[activeTab] === 0 ||
1195
- evaluationComplete(activeTab)
1254
+ evaluationComplete() &&
1255
+ requiredNull[activeTab] === 0 &&
1256
+ approveRejectButtons()
1196
1257
  ? "general-green-button"
1197
1258
  : "general-button-disabled"
1198
1259
  }