contentoh-components-library 21.4.67 → 21.4.69

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.
@@ -28,9 +28,7 @@ var _jsxRuntime = require("react/jsx-runtime");
28
28
  var GalleryElement = function GalleryElement(_ref) {
29
29
  var _auditImages$values$n, _auditImages$values$n2;
30
30
 
31
- var _ref$validation = _ref.validation,
32
- validation = _ref$validation === void 0 ? "null-button" : _ref$validation,
33
- image = _ref.image,
31
+ var image = _ref.image,
34
32
  _ref$gridLayout = _ref.gridLayout,
35
33
  gridLayout = _ref$gridLayout === void 0 ? false : _ref$gridLayout,
36
34
  _ref$id = _ref.id,
@@ -40,7 +38,6 @@ var GalleryElement = function GalleryElement(_ref) {
40
38
  imageInputs = _ref.imageInputs,
41
39
  imageType = _ref.imageType,
42
40
  imagePackagingType = _ref.imagePackagingType,
43
- imageShotType = _ref.imageShotType,
44
41
  changeImage = _ref.changeImage,
45
42
  selectedImages = _ref.selectedImages,
46
43
  setSelectedImages = _ref.setSelectedImages,
@@ -48,15 +45,10 @@ var GalleryElement = function GalleryElement(_ref) {
48
45
  auditImages = _ref.auditImages,
49
46
  compare = _ref.compare;
50
47
 
51
- var _useState = (0, _react.useState)(validation),
48
+ var _useState = (0, _react.useState)(false),
52
49
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
53
- statusValidation = _useState2[0],
54
- setStatusValidation = _useState2[1];
55
-
56
- var _useState3 = (0, _react.useState)(false),
57
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
58
- showValidationPanel = _useState4[0],
59
- setShowValidationPanel = _useState4[1];
50
+ showValidationPanel = _useState2[0],
51
+ setShowValidationPanel = _useState2[1];
60
52
 
61
53
  var closeValidationPanel = function closeValidationPanel(e) {
62
54
  if (!e.target.closest("#validation-panel") || e.target.closest(".validation-option") && showValidationPanel) {
@@ -117,6 +109,18 @@ var GalleryElement = function GalleryElement(_ref) {
117
109
  children: [image.width, "x", image.height]
118
110
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
119
111
  children: image.ext
112
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBox.CheckBox, {
113
+ className: "center",
114
+ id: "has-description-".concat(image.id),
115
+ defaultChecked: image.has_leyend,
116
+ onChange: function onChange(e) {
117
+ changeImage({
118
+ action: "changeImageInfo",
119
+ attribute: "has_leyend",
120
+ value: e.target.checked,
121
+ index: number
122
+ });
123
+ }
120
124
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
121
125
  width: "100%",
122
126
  placeholder: "Tipo de toma",
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &.grid-gallery {\n position: relative;\n width: 179px;\n border-radius: 3px;\n overflow: hidden;\n\n .buttons-container {\n position: absolute;\n top: 5px;\n left: 5px;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .image-container {\n border: 1px solid #f0eef2;\n\n .information-container {\n background-color: ", ";\n display: flex;\n justify-content: space-between;\n padding: 0 2px;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 11px;\n line-height: 17px;\n }\n }\n }\n }\n\n &.row-gallery {\n display: flex;\n align-items: center;\n padding-right: 10px;\n\n .buttons-container {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .image-container {\n display: flex;\n align-items: center;\n flex: 1;\n .information-container {\n display: flex;\n flex: 1;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 17px;\n text-align: center;\n\n &.highlighted-data {\n font-family: ", ";\n color: ", ";\n background-color: ", ";\n border-radius: 3px;\n font-weight: 600;\n font-size: 11px;\n line-height: 18px;\n padding: 0 10px;\n }\n\n &:nth-child(1) {\n //min-width: calc(20% - 76px);\n //flex: 1 0 20%;\n min-width: 22%;\n }\n\n &:nth-child(2),\n &:nth-child(3) {\n text-align: center;\n }\n &:nth-child(2) {\n max-width: 90px;\n min-width: 90px;\n }\n &:nth-child(3) {\n max-width: 60px;\n min-width: 60px;\n }\n /* &:nth-child(4) {\n max-width: 90px;\n min-width: 90px;\n }\n &:nth-child(5) {\n max-width: 80px;\n min-width: 80px;\n } */\n }\n\n & > * {\n flex: 1;\n padding: 5px;\n }\n }\n }\n }\n\n &.audit-class{\n border: 1px solid #8a6caa;\n background-color: #ededfc;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s2);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &.grid-gallery {\n position: relative;\n width: 179px;\n border-radius: 3px;\n overflow: hidden;\n\n .buttons-container {\n position: absolute;\n top: 5px;\n left: 5px;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .image-container {\n border: 1px solid #f0eef2;\n\n .information-container {\n background-color: ", ";\n display: flex;\n justify-content: space-between;\n padding: 0 2px;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 11px;\n line-height: 17px;\n }\n }\n }\n }\n\n &.row-gallery {\n display: flex;\n align-items: center;\n padding-right: 10px;\n\n .buttons-container {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .image-container {\n display: flex;\n align-items: center;\n flex: 1;\n .information-container {\n display: flex;\n flex: 1;\n\n .center {\n max-width: 120px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 17px;\n text-align: center;\n\n &.highlighted-data {\n font-family: ", ";\n color: ", ";\n background-color: ", ";\n border-radius: 3px;\n font-weight: 600;\n font-size: 11px;\n line-height: 18px;\n padding: 0 10px;\n }\n\n &:nth-child(1) {\n //min-width: calc(20% - 76px);\n //flex: 1 0 20%;\n min-width: 22%;\n }\n\n &:nth-child(2),\n &:nth-child(3) {\n text-align: center;\n }\n &:nth-child(2) {\n max-width: 90px;\n min-width: 90px;\n }\n &:nth-child(3) {\n max-width: 60px;\n min-width: 60px;\n }\n /* &:nth-child(4) {\n max-width: 90px;\n min-width: 90px;\n }\n &:nth-child(5) {\n max-width: 80px;\n min-width: 80px;\n } */\n }\n\n & > * {\n flex: 1;\n padding: 5px;\n }\n }\n }\n }\n\n &.audit-class{\n border: 1px solid #8a6caa;\n background-color: #ededfc;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s2);
19
19
 
20
20
  exports.Container = Container;
@@ -45,6 +45,9 @@ var GalleryHeader = function GalleryHeader(_ref) {
45
45
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
46
46
  className: "image-format",
47
47
  children: "Formato"
48
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
49
+ className: "image-description",
50
+ children: "\xBFTiene leyenda?"
48
51
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
49
52
  className: "",
50
53
  children: "Tipo de toma"
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n padding: 10px;\n padding-left: 0;\n align-items: center;\n\n p {\n font-family: ", ";\n font-style: normal;\n font-weight: 600;\n font-size: 14px;\n line-height: 21px;\n letter-spacing: -0.015em;\n color: ", ";\n flex: 1;\n text-align: center;\n\n &.value-header {\n max-width: 60px;\n }\n\n &.image-header {\n max-width: 60px;\n }\n\n &.image-name {\n min-width: 20%;\n }\n\n &.image-format {\n max-width: 60px;\n }\n\n &.image-size {\n max-width: 90px;\n }\n\n &.image-identifier {\n max-width: 80px;\n }\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n padding: 10px;\n padding-left: 0;\n align-items: center;\n\n p {\n font-family: ", ";\n font-style: normal;\n font-weight: 600;\n font-size: 14px;\n line-height: 21px;\n letter-spacing: -0.015em;\n color: ", ";\n flex: 1;\n text-align: center;\n\n &.value-header {\n max-width: 60px;\n }\n\n &.image-header {\n max-width: 60px;\n }\n\n &.image-name {\n min-width: 20%;\n }\n\n &.image-format {\n max-width: 60px;\n }\n\n &.image-size {\n max-width: 90px;\n }\n\n &.image-identifier {\n max-width: 80px;\n }\n\n &.image-description {\n max-width: 120px;\n }\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5);
19
19
 
20
20
  exports.Container = Container;
@@ -27,7 +27,7 @@ var _addVersion = _interopRequireDefault(require("../../../assets/images/version
27
27
 
28
28
  var _closeVersionSelector = _interopRequireDefault(require("../../../assets/images/versionSelector/closeVersionSelector.svg"));
29
29
 
30
- var _variables = require("contentoh-components-library/dist/global-files/variables");
30
+ var _variables = require("../../../../dist/global-files/variables");
31
31
 
32
32
  var _variables2 = require("../../../global-files/variables");
33
33
 
@@ -175,22 +175,19 @@ var Dashboard = function Dashboard(_ref) {
175
175
 
176
176
  case 8:
177
177
  response = _context.sent;
178
- console.log({
179
- res: JSON.parse(response.data.body).data
180
- });
181
178
  return _context.abrupt("return", JSON.parse(response.data.body).data);
182
179
 
183
- case 13:
184
- _context.prev = 13;
180
+ case 12:
181
+ _context.prev = 12;
185
182
  _context.t0 = _context["catch"](5);
186
183
  console.log(_context.t0);
187
184
 
188
- case 16:
185
+ case 15:
189
186
  case "end":
190
187
  return _context.stop();
191
188
  }
192
189
  }
193
- }, _callee, null, [[5, 13]]);
190
+ }, _callee, null, [[5, 12]]);
194
191
  }));
195
192
 
196
193
  return function loadProductVersions(_x) {
@@ -250,35 +247,28 @@ var Dashboard = function Dashboard(_ref) {
250
247
  while (1) {
251
248
  switch (_context3.prev = _context3.next) {
252
249
  case 0:
253
- _context3.prev = 0;
254
250
  isRetailer = user.is_retailer && company.retailers;
255
251
  isProvider = !user.is_retailer && user.id_role === 0;
256
252
  isCollaborator = user.id_role > 0;
257
- _context3.next = 6;
253
+ _context3.next = 5;
258
254
  return loadProductVersions(orderByStatus);
259
255
 
260
- case 6:
256
+ case 5:
261
257
  _context3.t0 = _context3.sent;
262
258
 
263
259
  if (_context3.t0) {
264
- _context3.next = 9;
260
+ _context3.next = 8;
265
261
  break;
266
262
  }
267
263
 
268
264
  _context3.t0 = {};
269
265
 
270
- case 9:
266
+ case 8:
271
267
  _ref5 = _context3.t0;
272
268
  ordersBydate = _ref5.ordersBydate;
273
269
  ordersByStatus = _ref5.ordersByStatus;
274
270
  ordersByActive = _ref5.ordersByActive;
275
271
  companyTrades = _ref5.companyTrades;
276
- console.log({
277
- ordersBydate: ordersBydate,
278
- ordersByStatus: ordersByStatus,
279
- ordersByActive: ordersByActive,
280
- companyTrades: companyTrades
281
- });
282
272
  if (trades.length === 0) setTrades(companyTrades);
283
273
  _ordersByStatus$total = ordersByStatus.total, total = _ordersByStatus$total === void 0 ? 0 : _ordersByStatus$total, _ordersByStatus$R = ordersByStatus.R, R = _ordersByStatus$R === void 0 ? 0 : _ordersByStatus$R, _ordersByStatus$PA = ordersByStatus.PA, PA = _ordersByStatus$PA === void 0 ? 0 : _ordersByStatus$PA, _ordersByStatus$Ex = ordersByStatus.Ex, Ex = _ordersByStatus$Ex === void 0 ? 0 : _ordersByStatus$Ex, _ordersByStatus$ACA = ordersByStatus.ACA, ACA = _ordersByStatus$ACA === void 0 ? 0 : _ordersByStatus$ACA;
284
274
  productsFinished = 0;
@@ -312,26 +302,15 @@ var Dashboard = function Dashboard(_ref) {
312
302
  setMetricsData(metricsArray);
313
303
  setTotalCount(total);
314
304
  delete ordersByStatus.total;
315
- console.log({
316
- ordersBydate: ordersBydate,
317
- ordersByStatus: ordersByStatus
318
- });
319
305
  setRequiredProducts(ordersBydate);
320
306
  setProductsByStatus(ordersByStatus);
321
- _context3.next = 36;
322
- break;
323
-
324
- case 33:
325
- _context3.prev = 33;
326
- _context3.t1 = _context3["catch"](0);
327
- console.log("Ismael", _context3.t1);
328
307
 
329
- case 36:
308
+ case 28:
330
309
  case "end":
331
310
  return _context3.stop();
332
311
  }
333
312
  }
334
- }, _callee3, null, [[0, 33]]);
313
+ }, _callee3);
335
314
  }));
336
315
 
337
316
  return function loadProductsByStatus(_x2) {
@@ -37,7 +37,7 @@ var _GalleryElement = require("../../molecules/GalleryElement");
37
37
 
38
38
  var _fileSaver = require("file-saver");
39
39
 
40
- var _data = require("../../../global-files/data");
40
+ var _data2 = require("../../../global-files/data");
41
41
 
42
42
  var _GalleryHeader = require("../../molecules/GalleryHeader");
43
43
 
@@ -541,7 +541,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
541
541
  }
542
542
 
543
543
  _context2.next = 3;
544
- 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), auditableVersion.version, token);
544
+ 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), auditableVersion.version, token);
545
545
 
546
546
  case 3:
547
547
  _auditServices = _context2.sent;
@@ -581,7 +581,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
581
581
  case 0:
582
582
  _context3.prev = 0;
583
583
  _context3.next = 3;
584
- return (0, _data.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_category), version, token);
584
+ return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.category, parseInt(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_category), version, token);
585
585
 
586
586
  case 3:
587
587
  _services = _context3.sent;
@@ -598,7 +598,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
598
598
  init: _services[2]
599
599
  });
600
600
  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);
601
- (0, _data.getPercentage)({
601
+ (0, _data2.getPercentage)({
602
602
  data: [product]
603
603
  }).then(function (res) {
604
604
  return setPercentages(res[0]);
@@ -723,7 +723,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
723
723
  getComments();
724
724
  _context6.t0 = setUserGroups;
725
725
  _context6.next = 6;
726
- return (0, _data.fetchUsers)(token);
726
+ return (0, _data2.fetchUsers)(token);
727
727
 
728
728
  case 6:
729
729
  _context6.t1 = _context6.sent;
@@ -874,7 +874,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
874
874
  setSelectedImages: setSelectedImages,
875
875
  auditImages: auditImages,
876
876
  compare: compare
877
- }, index + "-" + imageType.name);
877
+ }, index + "-" + image.name);
878
878
  });
879
879
  };
880
880
 
@@ -1343,11 +1343,84 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1343
1343
  default:
1344
1344
  break;
1345
1345
  }
1346
- };
1346
+ }; // const sendToFacilitator = async (result) => {
1347
+ // setLoading(true);
1348
+ // try {
1349
+ // let concept = getConcept(activeTab);
1350
+ // const productTemp = { ...product };
1351
+ // const evalStatus = retailerStatus;
1352
+ // const articleId = product.article.id_article;
1353
+ // const orderId = product.orderId;
1354
+ // // const body = {
1355
+ // // orderArticleRetailers: [
1356
+ // // { orderId, articleId, retailersIds: [activeRetailer.id] },
1357
+ // // ],
1358
+ // // isAproved: false,
1359
+ // // service: concept,
1360
+ // // };
1361
+ // const body = {
1362
+ // articleId: product.article.id_article,
1363
+ // orderId: product.orderId,
1364
+ // concept: concept,
1365
+ // result: result,
1366
+ // evalStatus: evalStatus,
1367
+ // retailerId: activeRetailer.id,
1368
+ // };
1369
+ // let res;
1370
+ // let message;
1371
+ // if (result) {
1372
+ // body.isAproved = result === "A";
1373
+ // res = await axios.put(
1374
+ // `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
1375
+ // body,
1376
+ // {
1377
+ // headers: {
1378
+ // Authorization: token,
1379
+ // },
1380
+ // }
1381
+ // );
1382
+ // console.log(JSON.parse(res.data.body), "res");
1383
+ // getServices();
1384
+ // } else {
1385
+ // const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
1386
+ // if (specialistDone) {
1387
+ // message = `${activeTab} enviada a facilitador`;
1388
+ // getSectionIcon();
1389
+ // } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
1390
+ // message = "Evaluación enviada";
1391
+ // getSectionIcon();
1392
+ // }
1393
+ // res = await axios.put(
1394
+ // `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
1395
+ // body,
1396
+ // {
1397
+ // headers: {
1398
+ // Authorization: token,
1399
+ // },
1400
+ // }
1401
+ // );
1402
+ // }
1403
+ // if (res.data.statusCode === 200) {
1404
+ // const response = JSON.parse(res.data.body)?.successfulData;
1405
+ // const statusObject =
1406
+ // response[`${orderId}-${articleId}-${activeRetailer.id}`];
1407
+ // productTemp.status = statusObject["generalStatus"];
1408
+ // productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
1409
+ // await loadData();
1410
+ // if (message) setMessage(message);
1411
+ // sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1412
+ // setProduct(productTemp);
1413
+ // }
1414
+ // } catch (error) {
1415
+ // console.log(error);
1416
+ // }
1417
+ // setLoading(false);
1418
+ // };
1419
+
1347
1420
 
1348
1421
  var sendToFacilitator = /*#__PURE__*/function () {
1349
1422
  var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1350
- var concept, productTemp, evalStatus, articleId, orderId, body, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, data;
1423
+ var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
1351
1424
 
1352
1425
  return _regenerator.default.wrap(function _callee11$(_context11) {
1353
1426
  while (1) {
@@ -1360,24 +1433,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1360
1433
  evalStatus = retailerStatus;
1361
1434
  articleId = product.article.id_article;
1362
1435
  orderId = product.orderId;
1363
- body = {
1364
- orderArticleRetailers: [{
1365
- orderId: orderId,
1366
- articleId: articleId,
1367
- retailersIds: [activeRetailer.id]
1368
- }],
1369
- isAproved: false,
1370
- service: concept
1436
+ data = {
1437
+ articleId: articleId,
1438
+ orderId: orderId,
1439
+ concept: concept,
1440
+ evalStatus: evalStatus,
1441
+ retailerId: activeRetailer.id
1371
1442
  };
1372
1443
 
1373
1444
  if (!result) {
1374
- _context11.next = 17;
1445
+ _context11.next = 16;
1375
1446
  break;
1376
1447
  }
1377
1448
 
1378
- body.isAproved = result === "A";
1449
+ data.result = result;
1379
1450
  _context11.next = 12;
1380
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1451
+ return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1381
1452
  headers: {
1382
1453
  Authorization: token
1383
1454
  }
@@ -1385,12 +1456,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1385
1456
 
1386
1457
  case 12:
1387
1458
  res = _context11.sent;
1388
- console.log(JSON.parse(res.data.body), "res");
1389
1459
  getServices();
1390
- _context11.next = 22;
1460
+ _context11.next = 21;
1391
1461
  break;
1392
1462
 
1393
- case 17:
1463
+ case 16:
1394
1464
  specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
1395
1465
 
1396
1466
  if (specialistDone) {
@@ -1401,25 +1471,25 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1401
1471
  getSectionIcon();
1402
1472
  }
1403
1473
 
1404
- _context11.next = 21;
1405
- return _axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1474
+ _context11.next = 20;
1475
+ return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1406
1476
  headers: {
1407
1477
  Authorization: token
1408
1478
  }
1409
1479
  });
1410
1480
 
1411
- case 21:
1481
+ case 20:
1412
1482
  res = _context11.sent;
1413
1483
 
1414
- case 22:
1484
+ case 21:
1415
1485
  if (!(res.data.statusCode === 200)) {
1416
- _context11.next = 35;
1486
+ _context11.next = 34;
1417
1487
  break;
1418
1488
  }
1419
1489
 
1420
1490
  _JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus, newArticleStatus = _JSON$parse5.newArticleStatus;
1421
1491
  messageToChat = (0, _utils.createMessage)(product.retailers, activeRetailer.id, evalStatus, newStatus, activeTab);
1422
- data = {
1492
+ _data = {
1423
1493
  paramsBody: {
1424
1494
  id: product.article.id_article,
1425
1495
  version: version,
@@ -1434,38 +1504,38 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1434
1504
  Authorization: token
1435
1505
  }
1436
1506
  };
1437
- _context11.next = 28;
1438
- return (0, _utils.sendMessage)(data);
1507
+ _context11.next = 27;
1508
+ return (0, _utils.sendMessage)(_data);
1439
1509
 
1440
- case 28:
1510
+ case 27:
1441
1511
  if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
1442
1512
  productTemp["".concat(concept, "_status")] = newStatus;
1443
- _context11.next = 32;
1513
+ _context11.next = 31;
1444
1514
  return loadData();
1445
1515
 
1446
- case 32:
1516
+ case 31:
1447
1517
  if (_message) setMessage(_message);
1448
1518
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1449
1519
  setProduct(productTemp);
1450
1520
 
1451
- case 35:
1452
- _context11.next = 40;
1521
+ case 34:
1522
+ _context11.next = 39;
1453
1523
  break;
1454
1524
 
1455
- case 37:
1456
- _context11.prev = 37;
1525
+ case 36:
1526
+ _context11.prev = 36;
1457
1527
  _context11.t0 = _context11["catch"](1);
1458
1528
  console.log(_context11.t0);
1459
1529
 
1460
- case 40:
1530
+ case 39:
1461
1531
  setLoading(false);
1462
1532
 
1463
- case 41:
1533
+ case 40:
1464
1534
  case "end":
1465
1535
  return _context11.stop();
1466
1536
  }
1467
1537
  }
1468
- }, _callee11, null, [[1, 37]]);
1538
+ }, _callee11, null, [[1, 36]]);
1469
1539
  }));
1470
1540
 
1471
1541
  return function sendToFacilitator(_x) {
@@ -1817,12 +1887,68 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1817
1887
  }, [services, servicesData, activeTab]);
1818
1888
  (0, _react.useEffect)(function () {
1819
1889
  setSaving(loading);
1820
- }, [loading]);
1890
+ }, [loading]); // const validateAll = async (result) => {
1891
+ // try {
1892
+ // setLoading(true);
1893
+ // const evaluationArray = [];
1894
+ // let conceptArray = ["description", "datasheet", "images"];
1895
+ // switch (user.id_role) {
1896
+ // case 4:
1897
+ // conceptArray = ["description", "datasheet"];
1898
+ // break;
1899
+ // case 5:
1900
+ // conceptArray = ["images"];
1901
+ // break;
1902
+ // default:
1903
+ // conceptArray = ["description", "datasheet", "images"];
1904
+ // break;
1905
+ // }
1906
+ // const isAproved = result === "A";
1907
+ // const retailersIds = [];
1908
+ // servicesData?.forEach((ret) => {
1909
+ // if (!retailersIds.includes(ret.id_retailer))
1910
+ // retailersIds.push(ret.id_retailer);
1911
+ // });
1912
+ // const body = {
1913
+ // orderArticleRetailers: [
1914
+ // {
1915
+ // orderId: product.id_order ?? product.orderId,
1916
+ // articleId: product.article.id_article,
1917
+ // retailersIds,
1918
+ // },
1919
+ // ],
1920
+ // isAproved,
1921
+ // };
1922
+ // conceptArray.forEach((concept) => {
1923
+ // body.service = concept;
1924
+ // evaluationArray.push(
1925
+ // axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1926
+ // headers: {
1927
+ // Authorization: token,
1928
+ // },
1929
+ // })
1930
+ // );
1931
+ // });
1932
+ // await Promise.all(evaluationArray);
1933
+ // const productTemp = product;
1934
+ // productTemp.status = `${result}A`;
1935
+ // productTemp.datasheet_status =
1936
+ // productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
1937
+ // productTemp.description_status =
1938
+ // productTemp.description_status === "NA" ? "NA" : `${result}A`;
1939
+ // productTemp.images_status =
1940
+ // productTemp.images_status === "NA" ? "NA" : `${result}A`;
1941
+ // sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1942
+ // setProduct(productTemp);
1943
+ // await loadData();
1944
+ // } catch (error) {
1945
+ // console.log(error);
1946
+ // }
1947
+ // };
1821
1948
 
1822
1949
  var validateAll = /*#__PURE__*/function () {
1823
1950
  var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1824
- var _product$id_order, evaluationArray, conceptArray, messages, body, productTemp, messagesResponse;
1825
-
1951
+ var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
1826
1952
  return _regenerator.default.wrap(function _callee15$(_context15) {
1827
1953
  while (1) {
1828
1954
  switch (_context15.prev = _context15.next) {
@@ -1830,7 +1956,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1830
1956
  _context15.prev = 0;
1831
1957
  setLoading(true);
1832
1958
  evaluationArray = [];
1833
- conceptArray = ["description", "datasheet", "images"];
1959
+ conceptArray = [];
1834
1960
  _context15.t0 = user.id_role;
1835
1961
  _context15.next = _context15.t0 === 4 ? 7 : _context15.t0 === 5 ? 9 : 11;
1836
1962
  break;
@@ -1850,28 +1976,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1850
1976
  case 13:
1851
1977
  messages = [];
1852
1978
  servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
1853
- if (!retailersIds.includes(ret.id_retailer)) retailersIds.push(ret.id_retailer);
1854
- });
1855
- body = {
1856
- orderArticleRetailers: [{
1857
- orderId: (_product$id_order = product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId,
1858
- articleId: product.article.id_article,
1859
- retailersIds: retailersIds
1860
- }],
1861
- isAproved: isAproved
1862
- };
1863
- conceptArray.forEach(function (concept) {
1864
- body.service = concept;
1865
- evaluationArray.push(_axios.default.post("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), body, {
1866
- headers: {
1867
- Authorization: token
1868
- }
1869
- }));
1979
+ if (conceptArray.includes(ret.service)) {
1980
+ var _product$id_order;
1981
+
1982
+ var data = {
1983
+ articleId: product.article.id_article,
1984
+ orderId: (_product$id_order = product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId,
1985
+ concept: ret.service,
1986
+ result: result,
1987
+ evalStatus: ret.status,
1988
+ retailerId: ret.id_retailer
1989
+ };
1990
+ evaluationArray.push(_axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1991
+ headers: {
1992
+ Authorization: token
1993
+ }
1994
+ }));
1995
+ }
1870
1996
  });
1871
- _context15.next = 19;
1997
+ _context15.next = 17;
1872
1998
  return Promise.all(evaluationArray);
1873
1999
 
1874
- case 19:
2000
+ case 17:
1875
2001
  productTemp = product;
1876
2002
  productTemp.status = "".concat(result, "A");
1877
2003
  productTemp.datasheet_status = productTemp.datasheet_status === "NS" ? "NS" : "".concat(result, "A");
@@ -1879,29 +2005,29 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1879
2005
  productTemp.images_status = productTemp.images_status === "NS" ? "NS" : "".concat(result, "A");
1880
2006
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1881
2007
  setProduct(productTemp);
1882
- _context15.next = 28;
2008
+ _context15.next = 26;
1883
2009
  return Promise.all(messages);
1884
2010
 
1885
- case 28:
2011
+ case 26:
1886
2012
  messagesResponse = _context15.sent;
1887
- _context15.next = 31;
2013
+ _context15.next = 29;
1888
2014
  return loadData();
1889
2015
 
1890
- case 31:
1891
- _context15.next = 36;
2016
+ case 29:
2017
+ _context15.next = 34;
1892
2018
  break;
1893
2019
 
1894
- case 33:
1895
- _context15.prev = 33;
2020
+ case 31:
2021
+ _context15.prev = 31;
1896
2022
  _context15.t1 = _context15["catch"](0);
1897
2023
  console.log(_context15.t1);
1898
2024
 
1899
- case 36:
2025
+ case 34:
1900
2026
  case "end":
1901
2027
  return _context15.stop();
1902
2028
  }
1903
2029
  }
1904
- }, _callee15, null, [[0, 33]]);
2030
+ }, _callee15, null, [[0, 31]]);
1905
2031
  }));
1906
2032
 
1907
2033
  return function validateAll(_x4) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.67",
3
+ "version": "21.4.69",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -27,7 +27,6 @@
27
27
  "babel-preset-react-app": "^10.0.1",
28
28
  "caniuse-lite": "^1.0.30001472",
29
29
  "chart.js": "^3.7.1",
30
- "contentoh-components-library": "^21.0.18",
31
30
  "draft-js": "^0.11.7",
32
31
  "file-saver": "^2.0.5",
33
32
  "infinite-react-carousel": "^1.2.11",
@@ -104,7 +103,6 @@
104
103
  "auto": "^10.36.5",
105
104
  "babel-loader": "^8.2.3",
106
105
  "chromatic": "^6.3.3",
107
- "contentoh-components-library": "21.0.61",
108
106
  "cross-env": "^7.0.3",
109
107
  "storybook-css-modules-preset": "^1.1.1"
110
108
  },
@@ -7,7 +7,6 @@ import { useState, useEffect } from "react";
7
7
  import Select from "../../atoms/Select";
8
8
 
9
9
  export const GalleryElement = ({
10
- validation = "null-button",
11
10
  image,
12
11
  gridLayout = false,
13
12
  id = "chk-default",
@@ -16,7 +15,6 @@ export const GalleryElement = ({
16
15
  imageInputs,
17
16
  imageType,
18
17
  imagePackagingType,
19
- imageShotType,
20
18
  changeImage,
21
19
  selectedImages,
22
20
  setSelectedImages,
@@ -24,7 +22,6 @@ export const GalleryElement = ({
24
22
  auditImages,
25
23
  compare,
26
24
  }) => {
27
- const [statusValidation, setStatusValidation] = useState(validation);
28
25
  const [showValidationPanel, setShowValidationPanel] = useState(false);
29
26
 
30
27
  const closeValidationPanel = (e) => {
@@ -62,7 +59,6 @@ export const GalleryElement = ({
62
59
  };
63
60
 
64
61
  return (
65
-
66
62
  <Container
67
63
  className={`${gridLayout ? "grid-gallery" : "row-gallery"} ${
68
64
  compare && !isEquals(image?.uuid, auditImages?.values[number]?.uuid)
@@ -70,8 +66,6 @@ export const GalleryElement = ({
70
66
  : ""
71
67
  }`}
72
68
  >
73
-
74
-
75
69
  <div className="buttons-container">
76
70
  <CheckBox id={id} label={label} onChange={(e) => checkOnChange(e)} />
77
71
  </div>
@@ -89,6 +83,19 @@ export const GalleryElement = ({
89
83
  {image.width}x{image.height}
90
84
  </p>
91
85
  <p>{image.ext}</p>
86
+ <CheckBox
87
+ className="center"
88
+ id={`has-description-${image.id}`}
89
+ defaultChecked={image.has_leyend}
90
+ onChange={(e) => {
91
+ changeImage({
92
+ action: "changeImageInfo",
93
+ attribute: "has_leyend",
94
+ value: e.target.checked,
95
+ index: number,
96
+ });
97
+ }}
98
+ />
92
99
  <Select
93
100
  width="100%"
94
101
  placeholder="Tipo de toma"
@@ -102,7 +109,6 @@ export const GalleryElement = ({
102
109
  attribute: "image_id",
103
110
  value: +e.target.value,
104
111
  index: number,
105
-
106
112
  });
107
113
  }}
108
114
  />
@@ -120,7 +126,7 @@ export const GalleryElement = ({
120
126
  });
121
127
  }}
122
128
  />
123
-
129
+
124
130
  <Select
125
131
  width="100%"
126
132
  placeholder="Tipo de empaque"
@@ -57,6 +57,13 @@ export const Container = styled.div`
57
57
  display: flex;
58
58
  flex: 1;
59
59
 
60
+ .center {
61
+ max-width: 120px;
62
+ display: flex;
63
+ justify-content: center;
64
+ align-items: center;
65
+ }
66
+
60
67
  p {
61
68
  font-family: ${FontFamily.Lato};
62
69
  color: ${GlobalColors.s4};
@@ -17,6 +17,7 @@ export const GalleryHeader = ({ setCheckAll, setSelectedImages, shotThd }) => {
17
17
  <p className="image-name">Nombre</p>
18
18
  <p className="image-size">Tamaño</p>
19
19
  <p className="image-format">Formato</p>
20
+ <p className="image-description">¿Tiene leyenda?</p>
20
21
  <p className="">Tipo de toma</p>
21
22
  <p className="">Tipo de imagen</p>
22
23
  <p className="">Tipo de empaque</p>
@@ -41,5 +41,9 @@ export const Container = styled.div`
41
41
  &.image-identifier {
42
42
  max-width: 80px;
43
43
  }
44
+
45
+ &.image-description {
46
+ max-width: 120px;
47
+ }
44
48
  }
45
49
  `;
@@ -5,7 +5,7 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
5
5
  import { Button } from "../../atoms/GeneralButton";
6
6
  import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
7
7
  import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
8
- import { GlobalColors } from "contentoh-components-library/dist/global-files/variables";
8
+ import { GlobalColors } from "../../../../dist/global-files/variables";
9
9
  import { FontFamily } from "../../../global-files/variables";
10
10
  import { VersionItem } from "../../molecules/VersionItem";
11
11
  import { CreateVersion } from "../../organisms/CreateVersion";
@@ -55,7 +55,6 @@ export const Dashboard = ({ jwt, user, company }) => {
55
55
  Authorization: jwt,
56
56
  },
57
57
  });
58
- console.log({ res: JSON.parse(response.data.body).data });
59
58
  return JSON.parse(response.data.body).data;
60
59
  } catch (error) {
61
60
  console.log(error);
@@ -84,57 +83,46 @@ export const Dashboard = ({ jwt, user, company }) => {
84
83
  };
85
84
 
86
85
  const loadProductsByStatus = async (orderByStatus) => {
87
- try {
88
- const isRetailer = user.is_retailer && company.retailers;
89
- const isProvider = !user.is_retailer && user.id_role === 0;
90
- const isCollaborator = user.id_role > 0;
91
- const { ordersBydate, ordersByStatus, ordersByActive, companyTrades } =
92
- (await loadProductVersions(orderByStatus)) || {};
93
- console.log({
94
- ordersBydate,
95
- ordersByStatus,
96
- ordersByActive,
97
- companyTrades,
98
- });
86
+ const isRetailer = user.is_retailer && company.retailers;
87
+ const isProvider = !user.is_retailer && user.id_role === 0;
88
+ const isCollaborator = user.id_role > 0;
89
+ const { ordersBydate, ordersByStatus, ordersByActive, companyTrades } =
90
+ (await loadProductVersions(orderByStatus)) || {};
99
91
 
100
- if (trades.length === 0) setTrades(companyTrades);
101
- const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
102
- let productsFinished = 0;
103
- if (isRetailer) productsFinished = Ex;
104
- if (isProvider) productsFinished = ACA;
105
- if (isCollaborator) productsFinished = Ex + ACA;
92
+ if (trades.length === 0) setTrades(companyTrades);
93
+ const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
94
+ let productsFinished = 0;
95
+ if (isRetailer) productsFinished = Ex;
96
+ if (isProvider) productsFinished = ACA;
97
+ if (isCollaborator) productsFinished = Ex + ACA;
106
98
 
107
- const inProcess = Object.keys(ordersByStatus).reduce(
108
- (prev, curr) =>
109
- !["total", "PA", "R", "Ex", "ACA"].includes(curr)
110
- ? prev + ordersByStatus[curr]
111
- : prev,
112
- 0
113
- );
99
+ const inProcess = Object.keys(ordersByStatus).reduce(
100
+ (prev, curr) =>
101
+ !["total", "PA", "R", "Ex", "ACA"].includes(curr)
102
+ ? prev + ordersByStatus[curr]
103
+ : prev,
104
+ 0
105
+ );
114
106
 
115
- const registeredProducts = ordersByActive.registered;
116
- let metricsArray = [
117
- metricsData[0]
118
- ? metricsData[0]
119
- : { label: "Productos totales", value: total },
120
- ];
107
+ const registeredProducts = ordersByActive.registered;
108
+ let metricsArray = [
109
+ metricsData[0]
110
+ ? metricsData[0]
111
+ : { label: "Productos totales", value: total },
112
+ ];
121
113
 
122
- metricsArray.push(
123
- { label: "Productos activos", value: registeredProducts },
124
- { label: "Productos filtrados", value: total },
125
- { label: "Productos sin asignar", value: PA + R },
126
- { label: "Productos en proceso", value: inProcess },
127
- { label: "Productos terminados", value: productsFinished }
128
- );
129
- setMetricsData(metricsArray);
130
- setTotalCount(total);
131
- delete ordersByStatus.total;
132
- console.log({ ordersBydate, ordersByStatus });
133
- setRequiredProducts(ordersBydate);
134
- setProductsByStatus(ordersByStatus);
135
- } catch (err) {
136
- console.log("Ismael", err);
137
- }
114
+ metricsArray.push(
115
+ { label: "Productos activos", value: registeredProducts },
116
+ { label: "Productos filtrados", value: total },
117
+ { label: "Productos sin asignar", value: PA + R },
118
+ { label: "Productos en proceso", value: inProcess },
119
+ { label: "Productos terminados", value: productsFinished }
120
+ );
121
+ setMetricsData(metricsArray);
122
+ setTotalCount(total);
123
+ delete ordersByStatus.total;
124
+ setRequiredProducts(ordersBydate);
125
+ setProductsByStatus(ordersByStatus);
138
126
  };
139
127
 
140
128
  const datesSelect = () => {
@@ -463,7 +463,7 @@ export const RetailerProductEdition = ({
463
463
  return images?.values?.map((image, index) => (
464
464
  <GalleryElement
465
465
  setCheckAll={setCheckAll}
466
- key={index + "-" + imageType.name}
466
+ key={index + "-" + image.name}
467
467
  image={image}
468
468
  gridLayout={imageLayout}
469
469
  id={"gallery-element-" + index}
@@ -820,6 +820,84 @@ export const RetailerProductEdition = ({
820
820
  }
821
821
  };
822
822
 
823
+ // const sendToFacilitator = async (result) => {
824
+ // setLoading(true);
825
+ // try {
826
+ // let concept = getConcept(activeTab);
827
+
828
+ // const productTemp = { ...product };
829
+ // const evalStatus = retailerStatus;
830
+ // const articleId = product.article.id_article;
831
+ // const orderId = product.orderId;
832
+
833
+ // // const body = {
834
+ // // orderArticleRetailers: [
835
+ // // { orderId, articleId, retailersIds: [activeRetailer.id] },
836
+ // // ],
837
+ // // isAproved: false,
838
+ // // service: concept,
839
+ // // };
840
+
841
+ // const body = {
842
+ // articleId: product.article.id_article,
843
+ // orderId: product.orderId,
844
+ // concept: concept,
845
+ // result: result,
846
+ // evalStatus: evalStatus,
847
+ // retailerId: activeRetailer.id,
848
+ // };
849
+
850
+ // let res;
851
+ // let message;
852
+ // if (result) {
853
+ // body.isAproved = result === "A";
854
+ // res = await axios.put(
855
+ // `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
856
+ // body,
857
+ // {
858
+ // headers: {
859
+ // Authorization: token,
860
+ // },
861
+ // }
862
+ // );
863
+ // console.log(JSON.parse(res.data.body), "res");
864
+ // getServices();
865
+ // } else {
866
+ // const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
867
+
868
+ // if (specialistDone) {
869
+ // message = `${activeTab} enviada a facilitador`;
870
+ // getSectionIcon();
871
+ // } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
872
+ // message = "Evaluación enviada";
873
+ // getSectionIcon();
874
+ // }
875
+ // res = await axios.put(
876
+ // `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
877
+ // body,
878
+ // {
879
+ // headers: {
880
+ // Authorization: token,
881
+ // },
882
+ // }
883
+ // );
884
+ // }
885
+ // if (res.data.statusCode === 200) {
886
+ // const response = JSON.parse(res.data.body)?.successfulData;
887
+ // const statusObject =
888
+ // response[`${orderId}-${articleId}-${activeRetailer.id}`];
889
+ // productTemp.status = statusObject["generalStatus"];
890
+ // productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
891
+ // await loadData();
892
+ // if (message) setMessage(message);
893
+ // sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
894
+ // setProduct(productTemp);
895
+ // }
896
+ // } catch (error) {
897
+ // console.log(error);
898
+ // }
899
+ // setLoading(false);
900
+ // };
823
901
  const sendToFacilitator = async (result) => {
824
902
  setLoading(true);
825
903
  try {
@@ -830,27 +908,26 @@ export const RetailerProductEdition = ({
830
908
  const articleId = product.article.id_article;
831
909
  const orderId = product.orderId;
832
910
 
833
- const body = {
834
- orderArticleRetailers: [
835
- { orderId, articleId, retailersIds: [activeRetailer.id] },
836
- ],
837
- isAproved: false,
838
- service: concept,
911
+ let data = {
912
+ articleId,
913
+ orderId,
914
+ concept,
915
+ evalStatus,
916
+ retailerId: activeRetailer.id,
839
917
  };
840
918
  let res;
841
919
  let message;
842
920
  if (result) {
843
- body.isAproved = result === "A";
844
- res = await axios.post(
921
+ data.result = result;
922
+ res = await axios.put(
845
923
  `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
846
- body,
924
+ data,
847
925
  {
848
926
  headers: {
849
927
  Authorization: token,
850
928
  },
851
929
  }
852
930
  );
853
- console.log(JSON.parse(res.data.body), "res");
854
931
  getServices();
855
932
  } else {
856
933
  const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
@@ -862,15 +939,11 @@ export const RetailerProductEdition = ({
862
939
  message = "Evaluación enviada";
863
940
  getSectionIcon();
864
941
  }
865
- res = await axios.post(
866
- `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
867
- body,
868
- {
869
- headers: {
870
- Authorization: token,
871
- },
872
- }
873
- );
942
+ res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
943
+ headers: {
944
+ Authorization: token,
945
+ },
946
+ });
874
947
  }
875
948
  if (res.data.statusCode === 200) {
876
949
  const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
@@ -1214,11 +1287,75 @@ export const RetailerProductEdition = ({
1214
1287
  setSaving(loading);
1215
1288
  }, [loading]);
1216
1289
 
1290
+ // const validateAll = async (result) => {
1291
+ // try {
1292
+ // setLoading(true);
1293
+ // const evaluationArray = [];
1294
+ // let conceptArray = ["description", "datasheet", "images"];
1295
+ // switch (user.id_role) {
1296
+ // case 4:
1297
+ // conceptArray = ["description", "datasheet"];
1298
+ // break;
1299
+ // case 5:
1300
+ // conceptArray = ["images"];
1301
+ // break;
1302
+
1303
+ // default:
1304
+ // conceptArray = ["description", "datasheet", "images"];
1305
+ // break;
1306
+ // }
1307
+
1308
+ // const isAproved = result === "A";
1309
+ // const retailersIds = [];
1310
+ // servicesData?.forEach((ret) => {
1311
+ // if (!retailersIds.includes(ret.id_retailer))
1312
+ // retailersIds.push(ret.id_retailer);
1313
+ // });
1314
+ // const body = {
1315
+ // orderArticleRetailers: [
1316
+ // {
1317
+ // orderId: product.id_order ?? product.orderId,
1318
+ // articleId: product.article.id_article,
1319
+ // retailersIds,
1320
+ // },
1321
+ // ],
1322
+ // isAproved,
1323
+ // };
1324
+ // conceptArray.forEach((concept) => {
1325
+ // body.service = concept;
1326
+ // evaluationArray.push(
1327
+ // axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1328
+ // headers: {
1329
+ // Authorization: token,
1330
+ // },
1331
+ // })
1332
+ // );
1333
+ // });
1334
+
1335
+ // await Promise.all(evaluationArray);
1336
+
1337
+ // const productTemp = product;
1338
+ // productTemp.status = `${result}A`;
1339
+ // productTemp.datasheet_status =
1340
+ // productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
1341
+ // productTemp.description_status =
1342
+ // productTemp.description_status === "NA" ? "NA" : `${result}A`;
1343
+ // productTemp.images_status =
1344
+ // productTemp.images_status === "NA" ? "NA" : `${result}A`;
1345
+ // sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1346
+ // setProduct(productTemp);
1347
+
1348
+ // await loadData();
1349
+ // } catch (error) {
1350
+ // console.log(error);
1351
+ // }
1352
+ // };
1353
+
1217
1354
  const validateAll = async (result) => {
1218
1355
  try {
1219
1356
  setLoading(true);
1220
1357
  const evaluationArray = [];
1221
- let conceptArray = ["description", "datasheet", "images"];
1358
+ let conceptArray = [];
1222
1359
  switch (user.id_role) {
1223
1360
  case 4:
1224
1361
  conceptArray = ["description", "datasheet"];
@@ -1235,28 +1372,23 @@ export const RetailerProductEdition = ({
1235
1372
  const messages = [];
1236
1373
 
1237
1374
  servicesData?.forEach((ret) => {
1238
- if (!retailersIds.includes(ret.id_retailer))
1239
- retailersIds.push(ret.id_retailer);
1240
- });
1241
- const body = {
1242
- orderArticleRetailers: [
1243
- {
1244
- orderId: product.id_order ?? product.orderId,
1375
+ if (conceptArray.includes(ret.service)) {
1376
+ let data = {
1245
1377
  articleId: product.article.id_article,
1246
- retailersIds,
1247
- },
1248
- ],
1249
- isAproved,
1250
- };
1251
- conceptArray.forEach((concept) => {
1252
- body.service = concept;
1253
- evaluationArray.push(
1254
- axios.post(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1255
- headers: {
1256
- Authorization: token,
1257
- },
1258
- })
1259
- );
1378
+ orderId: product.id_order ?? product.orderId,
1379
+ concept: ret.service,
1380
+ result: result,
1381
+ evalStatus: ret.status,
1382
+ retailerId: ret.id_retailer,
1383
+ };
1384
+ evaluationArray.push(
1385
+ axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1386
+ headers: {
1387
+ Authorization: token,
1388
+ },
1389
+ })
1390
+ );
1391
+ }
1260
1392
  });
1261
1393
  await Promise.all(evaluationArray);
1262
1394