contentoh-components-library 21.0.6 → 21.0.9

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.
@@ -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,
@@ -1232,7 +1256,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1232
1256
  var getRequired = function getRequired(services) {
1233
1257
  var _services$4, _services$4$inputs;
1234
1258
 
1235
- var objetcTemp = requiredNull;
1259
+ var objetcTemp = {};
1236
1260
  var datasheetServicesArray = Object.values(services[0]);
1237
1261
  var dsInputs = datasheetServicesArray.pop();
1238
1262
  var descriptionsServicesArray = services[1];
@@ -1241,7 +1265,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1241
1265
  datasheetServicesArray.forEach(function (datasheet) {
1242
1266
  return Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
1243
1267
  return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
1244
- return dsInputs[input].required && !dsInputs[input].value;
1268
+ return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
1245
1269
  })));
1246
1270
  });
1247
1271
  });
@@ -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,6 +1494,26 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1470
1494
  }
1471
1495
  };
1472
1496
 
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
+
1473
1517
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1474
1518
  headerTop: headerTop,
1475
1519
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1509,14 +1553,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1509
1553
  sendToFacilitator: sendToFacilitator,
1510
1554
  auditorAssigned: auditorAssigned,
1511
1555
  userAssigned: function userAssigned() {
1512
- return _userAssigned(activeTab, "facilitator");
1556
+ return _userAssigned(activeTab);
1513
1557
  }
1514
1558
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1515
1559
  tabsSections: tabsSections,
1516
- status: {
1517
- Descripción: product === null || product === void 0 ? void 0 : product.description_status,
1518
- "Ficha técnica": product === null || product === void 0 ? void 0 : product.datasheet_status,
1519
- 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;
1520
1594
  },
1521
1595
  activeTab: activeTab,
1522
1596
  setActiveTab: setActiveTab,
@@ -1571,7 +1645,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1571
1645
  inputGroup: descriptions[0],
1572
1646
  updatedDescriptions: updatedDescriptions,
1573
1647
  setUpdatedDescriptions: setUpdatedDescriptions,
1574
- 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,
1575
1649
  version: version,
1576
1650
  dinamicHeight: true
1577
1651
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
@@ -1591,7 +1665,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1591
1665
  headerType: "input-name-header"
1592
1666
  }))]
1593
1667
  })
1594
- }), (_userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1668
+ }), (_userAssigned(activeTab) || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1595
1669
  className: "commentary-box",
1596
1670
  children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1597
1671
  className: "commentary",
@@ -1636,7 +1710,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1636
1710
  }))
1637
1711
  })]
1638
1712
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1639
- buttonType: !approveRejectButtons() || requiredNull[activeTab] !== 0 || !evaluationComplete(activeTab) ? "general-button-disabled" : "general-green-button",
1713
+ buttonType: evaluationComplete() && requiredNull[activeTab] === 0 && approveRejectButtons() ? "general-green-button" : "general-button-disabled",
1640
1714
  label: "Enviar evaluación",
1641
1715
  onClick: function onClick() {
1642
1716
  return sendToFacilitator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.6",
3
+ "version": "21.0.9",
4
4
  "dependencies": {
5
5
  "@babel/runtime": "^7.17.2",
6
6
  "@storybook/addon-postcss": "^2.0.0",
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { Container } from "./styles";
3
3
  import { InputFormatter } from "../InputFormatter";
4
+ import { CheckBox } from "../CheckBox";
4
5
 
5
6
  export const GeneralInput = ({
6
7
  inputType,
@@ -30,19 +31,23 @@ export const GeneralInput = ({
30
31
  if (validateInput) {
31
32
  setTextValue({ value: validateInput(evt, position, inputsArray) });
32
33
  } else {
33
- setTextValue({ value: evt.target.value });
34
+ setTextValue({
35
+ value: inputType === "checkbox" ? evt.target.checked : evt.target.value,
36
+ });
34
37
  let dataSave = updatedDatasheets.slice();
35
38
  if (dataSave.length === 0)
36
39
  dataSave.push({
37
40
  articleId: articleId,
38
41
  versionId: version,
39
42
  attributeId: inputId,
40
- value: evt.target.value,
43
+ value:
44
+ inputType === "checkbox" ? evt.target.checked : evt.target.value,
41
45
  });
42
46
  else if (dataSave.some((e) => e.attributeId === inputId)) {
43
47
  dataSave.forEach((e) => {
44
48
  if (e.attributeId === inputId) {
45
- e.value = evt.target.value;
49
+ e.value =
50
+ inputType === "checkbox" ? evt.target.checked : evt.target.value;
46
51
  }
47
52
  });
48
53
  } else {
@@ -50,7 +55,8 @@ export const GeneralInput = ({
50
55
  articleId: articleId,
51
56
  versionId: version,
52
57
  attributeId: inputId,
53
- value: evt.target.value,
58
+ value:
59
+ inputType === "checkbox" ? evt.target.checked : evt.target.value,
54
60
  });
55
61
  }
56
62
  setUpdatedDatasheets(dataSave);
@@ -58,12 +64,21 @@ export const GeneralInput = ({
58
64
  };
59
65
 
60
66
  useEffect(() => {
61
- setRequiredEmpty(isRequired && textValue.value?.length === 0);
67
+ setRequiredEmpty(
68
+ isRequired &&
69
+ (textValue.value?.length === 0 || textValue.value === undefined)
70
+ );
62
71
  }, [textValue]);
63
72
 
64
73
  return (
65
74
  <Container isRequired={requiredEmpty}>
66
- {inputType !== "textarea" ? (
75
+ {inputType === "checkbox" ? (
76
+ <CheckBox
77
+ id={inputId}
78
+ onChange={(e) => onHandleChange(e)}
79
+ defaultChecked={textValue.value === "true" ? true : false}
80
+ />
81
+ ) : inputType !== "textarea" ? (
67
82
  <input
68
83
  type={inputType}
69
84
  id={inputId}
@@ -4,11 +4,20 @@ import { FontFamily, GlobalColors } from "../../../global-files/variables";
4
4
  export const Container = styled.div`
5
5
  width: 100%;
6
6
 
7
+ > div {
8
+ label {
9
+ &:before {
10
+ outline: 1px solid ${({ isRequired }) => (isRequired ? "red" : "none")};
11
+ }
12
+ }
13
+ }
14
+
7
15
  input,
8
16
  textarea {
9
17
  width: 100%;
10
18
  border: 1px solid
11
19
  ${({ isRequired }) => (isRequired ? "red" : `${GlobalColors.s2}`)};
20
+
12
21
  font-family: ${FontFamily.AvenirNext};
13
22
  color: ${GlobalColors.s4};
14
23
  font-weight: normal;
@@ -39,13 +39,19 @@ export const InputFormatter = ({
39
39
 
40
40
  const onChange = (valueInput, delta, user, h) => {
41
41
  let value = "";
42
- if (h.getLength() - 1 <= maxLength) {
43
- setInputValue((val) => (val = valueInput.replace(/<\/?span.*?>/gm, "")));
44
- value = valueInput;
45
- } else {
46
- quillState.deleteText(maxLength, quillState.getLength());
47
- setInputValue((val) => (val = quillState.getText()));
48
- value = quillState.getText();
42
+ try {
43
+ if (h.getLength() - 1 <= maxLength) {
44
+ setInputValue(
45
+ (val) => (val = valueInput.replace(/<\/?span.*?>/gm, ""))
46
+ );
47
+ value = valueInput;
48
+ } else {
49
+ quillState.deleteText(maxLength, quillState.getLength());
50
+ setInputValue((val) => (val = quillState.getText()));
51
+ value = quillState.getText();
52
+ }
53
+ } catch (error) {
54
+ console.log(error);
49
55
  }
50
56
  setCharsCounter(h.getLength() - 1);
51
57
  value = valueFormater(value);
@@ -66,7 +66,6 @@ export const SelectCustom = styled.select`
66
66
  display: none;
67
67
  }
68
68
  option {
69
- background-color: blue;
70
69
  &:disabled {
71
70
  color: #d4d1d7;
72
71
  }
@@ -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}
@@ -42,7 +42,13 @@ export const InputGroup = ({
42
42
  {inputGroup?.inputs?.map((input, index) =>
43
43
  activeSection === "Ficha técnica" ? (
44
44
  <TagAndInput
45
- key={index + "-" + dataInputs[input]?.value}
45
+ key={
46
+ index +
47
+ "-" +
48
+ dataInputs[input]?.value +
49
+ "-" +
50
+ dataInputs[input]?.id
51
+ }
46
52
  inputId={dataInputs[input]?.id}
47
53
  version={version}
48
54
  inputType={inputTypeValue(dataInputs[input]?.type)}