contentoh-components-library 11.0.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.env.development +12 -10
  2. package/.env.production +2 -0
  3. package/dist/components/atoms/AsignationOption/index.js +1 -1
  4. package/dist/components/atoms/AsignationOption/styles.js +1 -1
  5. package/dist/components/atoms/Commentary/index.js +3 -1
  6. package/dist/components/atoms/Commentary/styles.js +4 -1
  7. package/dist/components/atoms/GeneralInput/index.js +2 -2
  8. package/dist/components/molecules/StatusAsignationInfo/index.js +21 -10
  9. package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
  10. package/dist/components/molecules/TableHeader/index.js +6 -2
  11. package/dist/components/organisms/FullTabsMenu/index.js +7 -4
  12. package/dist/components/organisms/ImageDataTable/index.js +6 -2
  13. package/dist/components/organisms/ProductImageModal/index.js +0 -3
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +1 -0
  15. package/dist/components/pages/RetailerProductEdition/index.js +421 -146
  16. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  17. package/dist/global-files/data.js +51 -4
  18. package/dist/index.js +0 -70
  19. package/package.json +1 -1
  20. package/src/components/atoms/AsignationOption/index.js +1 -1
  21. package/src/components/atoms/AsignationOption/styles.js +6 -0
  22. package/src/components/atoms/Commentary/index.js +2 -2
  23. package/src/components/atoms/Commentary/styles.js +1 -0
  24. package/src/components/atoms/GeneralInput/index.js +12 -6
  25. package/src/components/molecules/StatusAsignationInfo/index.js +38 -24
  26. package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
  27. package/src/components/molecules/TableHeader/index.js +9 -1
  28. package/src/components/organisms/FullTabsMenu/index.js +6 -3
  29. package/src/components/organisms/ImageDataTable/index.js +4 -0
  30. package/src/components/organisms/ProductImageModal/index.js +0 -4
  31. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -0
  32. package/src/components/pages/RetailerProductEdition/index.js +195 -55
  33. package/src/components/pages/RetailerProductEdition/styles.js +6 -0
  34. package/src/global-files/data.js +29 -2
  35. package/src/index.js +0 -7
@@ -9,6 +9,8 @@ exports.RetailerProductEdition = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
13
+
12
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
15
 
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
@@ -35,7 +37,7 @@ var _react = require("react");
35
37
 
36
38
  var _GalleryElement = require("../../molecules/GalleryElement");
37
39
 
38
- var _data = require("../../../global-files/data");
40
+ var _data2 = require("../../../global-files/data");
39
41
 
40
42
  var _GalleryHeader = require("../../molecules/GalleryHeader");
41
43
 
@@ -119,7 +121,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
119
121
  _ref$productSelected = _ref.productSelected,
120
122
  productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
121
123
  _ref$user = _ref.user,
122
- user = _ref$user === void 0 ? {} : _ref$user;
124
+ user = _ref$user === void 0 ? {} : _ref$user,
125
+ token = _ref.token;
123
126
 
124
127
  var _useState = (0, _react.useState)("Descripción"),
125
128
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -299,10 +302,32 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
299
302
  comments = _useState44[0],
300
303
  setComments = _useState44[1];
301
304
 
302
- var _useState45 = (0, _react.useState)(0),
305
+ var _useState45 = (0, _react.useState)(""),
303
306
  _useState46 = (0, _slicedToArray2.default)(_useState45, 2),
304
- requiredNull = _useState46[0],
305
- setRequiredNull = _useState46[1];
307
+ comment = _useState46[0],
308
+ setComment = _useState46[1];
309
+
310
+ var _useState47 = (0, _react.useState)(0),
311
+ _useState48 = (0, _slicedToArray2.default)(_useState47, 2),
312
+ requiredNull = _useState48[0],
313
+ setRequiredNull = _useState48[1];
314
+
315
+ var _useState49 = (0, _react.useState)(false),
316
+ _useState50 = (0, _slicedToArray2.default)(_useState49, 2),
317
+ crossComment = _useState50[0],
318
+ setCrossComment = _useState50[1];
319
+
320
+ var _useState51 = (0, _react.useState)([]),
321
+ _useState52 = (0, _slicedToArray2.default)(_useState51, 2),
322
+ userGroups = _useState52[0],
323
+ setUserGroups = _useState52[1];
324
+
325
+ var _useState53 = (0, _react.useState)({}),
326
+ _useState54 = (0, _slicedToArray2.default)(_useState53, 2),
327
+ assig = _useState54[0],
328
+ setAssig = _useState54[1];
329
+
330
+ var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
306
331
 
307
332
  var loadData = /*#__PURE__*/function () {
308
333
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
@@ -314,12 +339,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
314
339
  switch (_context2.prev = _context2.next) {
315
340
  case 0:
316
341
  _context2.next = 2;
317
- return (0, _data.getRetailerServices)(productSelected.article.id_article, parseInt(productSelected.article.id_category), productSelected.version);
342
+ return (0, _data2.getRetailerServices)(productSelected.article.id_article, parseInt(productSelected.article.id_category), productSelected.version);
318
343
 
319
344
  case 2:
320
345
  services = _context2.sent;
321
- console.log(services, "parsedResponse"); //Converts the data inside the datasheets object to array
322
-
346
+ //Converts the data inside the datasheets object to array
323
347
  setServices(services);
324
348
  setActiveRetailer(productSelected === null || productSelected === void 0 ? void 0 : productSelected.retailers[0]);
325
349
  setImages({
@@ -329,7 +353,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
329
353
  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);
330
354
  setProduct(productSelected);
331
355
 
332
- case 9:
356
+ case 8:
333
357
  case "end":
334
358
  return _context2.stop();
335
359
  }
@@ -393,7 +417,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
393
417
  var translation = "";
394
418
 
395
419
  if (concept === "datasheet") {
396
- translation = "Ficha ténica";
420
+ translation = "Ficha técnica";
397
421
  } else if (concept === "description") {
398
422
  translation = "Descripción";
399
423
  } else if (concept === "images") {
@@ -404,29 +428,33 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
404
428
  };
405
429
 
406
430
  var getComments = /*#__PURE__*/function () {
407
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(tab) {
431
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
408
432
  var _productSelected$arti, _productSelected$arti2, _productSelected$arti3;
409
433
 
410
- var commentsResponse, comments;
434
+ var tab,
435
+ commentsResponse,
436
+ comments,
437
+ _args4 = arguments;
411
438
  return _regenerator.default.wrap(function _callee4$(_context4) {
412
439
  while (1) {
413
440
  switch (_context4.prev = _context4.next) {
414
441
  case 0:
415
- _context4.next = 2;
442
+ tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
443
+ _context4.next = 3;
416
444
  return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.id_article, "&concept=description&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti2 = productSelected.article) === null || _productSelected$arti2 === void 0 ? void 0 : _productSelected$arti2.id_article, "&concept=datasheet&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti3 = productSelected.article) === null || _productSelected$arti3 === void 0 ? void 0 : _productSelected$arti3.id_article, "&concept=images&orderIdColab=").concat(productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId, "&version=").concat(version))]);
417
445
 
418
- case 2:
446
+ case 3:
419
447
  commentsResponse = _context4.sent;
420
448
  comments = {};
421
- commentsResponse.map(function (comment) {
449
+ commentsResponse.forEach(function (comment) {
422
450
  var _JSON$parse$data$;
423
451
 
424
452
  return JSON.parse(comment.data.body).data[0] && (comments[translateConcept((_JSON$parse$data$ = JSON.parse(comment.data.body).data[0]) === null || _JSON$parse$data$ === void 0 ? void 0 : _JSON$parse$data$.concept)] = JSON.parse(comment.data.body).data[0]);
425
453
  });
426
- setComments(comments); //const comment = JSON.parse(commentsResponse.data.body).data;
427
- //setComment(comment[0]);
454
+ setComment(comments[tab]);
455
+ setComments(comments);
428
456
 
429
- case 6:
457
+ case 8:
430
458
  case "end":
431
459
  return _context4.stop();
432
460
  }
@@ -434,21 +462,89 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
434
462
  }, _callee4);
435
463
  }));
436
464
 
437
- return function getComments(_x3) {
465
+ return function getComments() {
438
466
  return _ref5.apply(this, arguments);
439
467
  };
440
468
  }();
441
469
 
442
- (0, _react.useEffect)(function () {
443
- loadData();
444
- (0, _data.getPercentage)({
445
- data: [productSelected]
446
- }).then(function (res) {
447
- return setPercentages(res);
470
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
471
+ return _regenerator.default.wrap(function _callee5$(_context5) {
472
+ while (1) {
473
+ switch (_context5.prev = _context5.next) {
474
+ case 0:
475
+ loadData();
476
+ (0, _data2.getPercentage)({
477
+ data: [productSelected]
478
+ }).then(function (res) {
479
+ return setPercentages(res);
480
+ });
481
+ getServices();
482
+ getComments();
483
+ _context5.t0 = setUserGroups;
484
+ _context5.next = 7;
485
+ return (0, _data2.fetchUsers)(token);
486
+
487
+ case 7:
488
+ _context5.t1 = _context5.sent;
489
+ (0, _context5.t0)(_context5.t1);
490
+
491
+ case 9:
492
+ case "end":
493
+ return _context5.stop();
494
+ }
495
+ }
496
+ }, _callee5);
497
+ })), []);
498
+
499
+ var loadAssignations = function loadAssignations(currentProduct) {
500
+ var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
501
+
502
+ setAssig({
503
+ Descripción: {
504
+ assignations: [{
505
+ collaboratorType: "especialist",
506
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic = currentProduct.article) === null || _currentProduct$artic === void 0 ? void 0 : _currentProduct$artic.id_description_especialist
507
+ }, {
508
+ collaboratorType: "facilitator",
509
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic2 = currentProduct.article) === null || _currentProduct$artic2 === void 0 ? void 0 : _currentProduct$artic2.id_description_facilitator
510
+ }],
511
+ collaborators: {
512
+ especialist: userGroups[0] || [],
513
+ facilitator: userGroups[2] || []
514
+ }
515
+ },
516
+ "Ficha técnica": {
517
+ assignations: [{
518
+ collaboratorType: "especialist",
519
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic3 = currentProduct.article) === null || _currentProduct$artic3 === void 0 ? void 0 : _currentProduct$artic3.id_datasheet_especialist
520
+ }, {
521
+ collaboratorType: "facilitator",
522
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic4 = currentProduct.article) === null || _currentProduct$artic4 === void 0 ? void 0 : _currentProduct$artic4.id_datasheet_facilitator
523
+ }],
524
+ collaborators: {
525
+ especialist: userGroups[0] || [],
526
+ facilitator: userGroups[2] || []
527
+ }
528
+ },
529
+ Imágenes: {
530
+ assignations: [{
531
+ collaboratorType: "especialist",
532
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic5 = currentProduct.article) === null || _currentProduct$artic5 === void 0 ? void 0 : _currentProduct$artic5.id_images_especialist
533
+ }, {
534
+ collaboratorType: "facilitator",
535
+ id: currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$artic6 = currentProduct.article) === null || _currentProduct$artic6 === void 0 ? void 0 : _currentProduct$artic6.id_images_facilitator
536
+ }],
537
+ collaborators: {
538
+ especialist: userGroups[1] || [],
539
+ facilitator: userGroups[3] || []
540
+ }
541
+ }
448
542
  });
449
- getServices();
450
- getComments();
451
- }, []);
543
+ };
544
+
545
+ (0, _react.useEffect)(function () {
546
+ loadAssignations(productSelected);
547
+ }, [userGroups]);
452
548
  (0, _react.useEffect)(function () {
453
549
  var _productSelected$reta;
454
550
 
@@ -508,99 +604,99 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
508
604
  };
509
605
 
510
606
  var saveDescriptions = /*#__PURE__*/function () {
511
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
607
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
512
608
  var _productSelected$arti4;
513
609
 
514
610
  var dataObject;
515
- return _regenerator.default.wrap(function _callee5$(_context5) {
611
+ return _regenerator.default.wrap(function _callee6$(_context6) {
516
612
  while (1) {
517
- switch (_context5.prev = _context5.next) {
613
+ switch (_context6.prev = _context6.next) {
518
614
  case 0:
519
615
  dataObject = {
520
616
  articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti4 = productSelected.article) === null || _productSelected$arti4 === void 0 ? void 0 : _productSelected$arti4.id_article,
521
617
  articleData: updatedDescriptions
522
618
  };
523
- _context5.prev = 1;
524
- _context5.next = 4;
619
+ _context6.prev = 1;
620
+ _context6.next = 4;
525
621
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
526
622
  headers: {
527
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
623
+ Authorization: token
528
624
  }
529
625
  });
530
626
 
531
627
  case 4:
532
- _context5.next = 9;
628
+ _context6.next = 9;
533
629
  break;
534
630
 
535
631
  case 6:
536
- _context5.prev = 6;
537
- _context5.t0 = _context5["catch"](1);
538
- console.log(_context5.t0);
632
+ _context6.prev = 6;
633
+ _context6.t0 = _context6["catch"](1);
634
+ console.log(_context6.t0);
539
635
 
540
636
  case 9:
541
637
  case "end":
542
- return _context5.stop();
638
+ return _context6.stop();
543
639
  }
544
640
  }
545
- }, _callee5, null, [[1, 6]]);
641
+ }, _callee6, null, [[1, 6]]);
546
642
  }));
547
643
 
548
644
  return function saveDescriptions() {
549
- return _ref6.apply(this, arguments);
645
+ return _ref7.apply(this, arguments);
550
646
  };
551
647
  }();
552
648
 
553
649
  var saveDatasheets = /*#__PURE__*/function () {
554
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
650
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
555
651
  var _productSelected$arti5;
556
652
 
557
653
  var dataObject;
558
- return _regenerator.default.wrap(function _callee6$(_context6) {
654
+ return _regenerator.default.wrap(function _callee7$(_context7) {
559
655
  while (1) {
560
- switch (_context6.prev = _context6.next) {
656
+ switch (_context7.prev = _context7.next) {
561
657
  case 0:
562
658
  dataObject = {
563
659
  articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti5 = productSelected.article) === null || _productSelected$arti5 === void 0 ? void 0 : _productSelected$arti5.id_article,
564
660
  articleData: updatedDatasheets
565
661
  };
566
- _context6.prev = 1;
567
- _context6.next = 4;
662
+ _context7.prev = 1;
663
+ _context7.next = 4;
568
664
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
569
665
  headers: {
570
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
666
+ Authorization: token
571
667
  }
572
668
  });
573
669
 
574
670
  case 4:
575
671
  console.log("saved");
576
- _context6.next = 10;
672
+ _context7.next = 10;
577
673
  break;
578
674
 
579
675
  case 7:
580
- _context6.prev = 7;
581
- _context6.t0 = _context6["catch"](1);
582
- console.log(_context6.t0);
676
+ _context7.prev = 7;
677
+ _context7.t0 = _context7["catch"](1);
678
+ console.log(_context7.t0);
583
679
 
584
680
  case 10:
585
681
  case "end":
586
- return _context6.stop();
682
+ return _context7.stop();
587
683
  }
588
684
  }
589
- }, _callee6, null, [[1, 7]]);
685
+ }, _callee7, null, [[1, 7]]);
590
686
  }));
591
687
 
592
688
  return function saveDatasheets() {
593
- return _ref7.apply(this, arguments);
689
+ return _ref8.apply(this, arguments);
594
690
  };
595
691
  }();
596
692
 
597
- var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
693
+ var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
598
694
  var _images$values2;
599
695
 
600
696
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, promiseArray;
601
- return _regenerator.default.wrap(function _callee7$(_context7) {
697
+ return _regenerator.default.wrap(function _callee8$(_context8) {
602
698
  while (1) {
603
- switch (_context7.prev = _context7.next) {
699
+ switch (_context8.prev = _context8.next) {
604
700
  case 0:
605
701
  imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
606
702
  imagesListTemp = imagesList.reduce(function (acc, image) {
@@ -646,18 +742,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
646
742
  }
647
743
 
648
744
  if (!(valid && duplicated.length === 0)) {
649
- _context7.next = 29;
745
+ _context8.next = 29;
650
746
  break;
651
747
  }
652
748
 
653
- _context7.prev = 9;
749
+ _context8.prev = 9;
654
750
  data.articleData.forEach(function (e) {
655
751
  e.uuid = (0, _uuid.v4)();
656
752
  });
657
753
  setDataImages(data);
658
754
 
659
755
  if (!(data.articleData.length > 0)) {
660
- _context7.next = 21;
756
+ _context8.next = 21;
661
757
  break;
662
758
  }
663
759
 
@@ -673,28 +769,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
673
769
  };
674
770
  promiseArray.push(myBucket.putObject(params).promise());
675
771
  });
676
- _context7.next = 18;
772
+ _context8.next = 18;
677
773
  return Promise.all(promiseArray);
678
774
 
679
775
  case 18:
680
776
  setImagesUploaded(true);
681
- _context7.next = 22;
777
+ _context8.next = 22;
682
778
  break;
683
779
 
684
780
  case 21:
685
781
  setImagesUploaded(true);
686
782
 
687
783
  case 22:
688
- _context7.next = 27;
784
+ _context8.next = 27;
689
785
  break;
690
786
 
691
787
  case 24:
692
- _context7.prev = 24;
693
- _context7.t0 = _context7["catch"](9);
694
- console.log(_context7.t0); // setMainLoading(false);
788
+ _context8.prev = 24;
789
+ _context8.t0 = _context8["catch"](9);
790
+ console.log(_context8.t0); // setMainLoading(false);
695
791
 
696
792
  case 27:
697
- _context7.next = 30;
793
+ _context8.next = 30;
698
794
  break;
699
795
 
700
796
  case 29:
@@ -710,18 +806,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
710
806
 
711
807
  case 30:
712
808
  case "end":
713
- return _context7.stop();
809
+ return _context8.stop();
714
810
  }
715
811
  }
716
- }, _callee7, null, [[9, 24]]);
812
+ }, _callee8, null, [[9, 24]]);
717
813
  })), [images, imagesUploaded]);
718
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
719
- return _regenerator.default.wrap(function _callee8$(_context8) {
814
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
815
+ return _regenerator.default.wrap(function _callee9$(_context9) {
720
816
  while (1) {
721
- switch (_context8.prev = _context8.next) {
817
+ switch (_context9.prev = _context9.next) {
722
818
  case 0:
723
819
  if (!imagesUploaded) {
724
- _context8.next = 11;
820
+ _context9.next = 11;
725
821
  break;
726
822
  }
727
823
 
@@ -732,30 +828,30 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
732
828
  e.imageType = e.image_type;
733
829
  return e;
734
830
  });
735
- _context8.prev = 2;
736
- _context8.next = 5;
831
+ _context9.prev = 2;
832
+ _context9.next = 5;
737
833
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
738
834
  headers: {
739
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
835
+ Authorization: token
740
836
  }
741
837
  });
742
838
 
743
839
  case 5:
744
840
  console.log("imágenes guardadas con éxito");
745
- _context8.next = 11;
841
+ _context9.next = 11;
746
842
  break;
747
843
 
748
844
  case 8:
749
- _context8.prev = 8;
750
- _context8.t0 = _context8["catch"](2);
751
- console.log(_context8.t0);
845
+ _context9.prev = 8;
846
+ _context9.t0 = _context9["catch"](2);
847
+ console.log(_context9.t0);
752
848
 
753
849
  case 11:
754
850
  case "end":
755
- return _context8.stop();
851
+ return _context9.stop();
756
852
  }
757
853
  }
758
- }, _callee8, null, [[2, 8]]);
854
+ }, _callee9, null, [[2, 8]]);
759
855
  })), [dataImages, imagesUploaded]);
760
856
 
761
857
  var approveRejectButtons = function approveRejectButtons(action) {
@@ -858,41 +954,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
858
954
  serv[index].status = "RA";
859
955
  }
860
956
  }
861
- } //console.log(serv, "serv");
862
-
957
+ }
863
958
 
864
959
  setServicesData(serv);
865
960
  };
866
961
 
867
962
  var sendToFacilitator = /*#__PURE__*/function () {
868
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
963
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
869
964
  var concept, evalStatus, productTemp, specialistDone, data;
870
- return _regenerator.default.wrap(function _callee9$(_context9) {
965
+ return _regenerator.default.wrap(function _callee10$(_context10) {
871
966
  while (1) {
872
- switch (_context9.prev = _context9.next) {
967
+ switch (_context10.prev = _context10.next) {
873
968
  case 0:
874
- console.log("exce");
875
969
  concept = "";
876
- _context9.t0 = activeTab;
877
- _context9.next = _context9.t0 === "Descripción" ? 5 : _context9.t0 === "Ficha técnica" ? 7 : _context9.t0 === "Imágenes" ? 9 : 11;
970
+ _context10.t0 = activeTab;
971
+ _context10.next = _context10.t0 === "Descripción" ? 4 : _context10.t0 === "Ficha técnica" ? 6 : _context10.t0 === "Imágenes" ? 8 : 10;
878
972
  break;
879
973
 
880
- case 5:
974
+ case 4:
881
975
  concept = "description";
882
- return _context9.abrupt("break", 12);
976
+ return _context10.abrupt("break", 11);
883
977
 
884
- case 7:
978
+ case 6:
885
979
  concept = "datasheet";
886
- return _context9.abrupt("break", 12);
980
+ return _context10.abrupt("break", 11);
887
981
 
888
- case 9:
982
+ case 8:
889
983
  concept = "images";
890
- return _context9.abrupt("break", 12);
984
+ return _context10.abrupt("break", 11);
891
985
 
892
- case 11:
893
- return _context9.abrupt("break", 12);
986
+ case 10:
987
+ return _context10.abrupt("break", 11);
894
988
 
895
- case 12:
989
+ case 11:
896
990
  evalStatus = "";
897
991
  productTemp = (0, _objectSpread2.default)({}, productSelected);
898
992
  evalStatus = productSelected["".concat(concept, "_status")];
@@ -919,7 +1013,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
919
1013
  data = {};
920
1014
 
921
1015
  if (!result) {
922
- _context9.next = 25;
1016
+ _context10.next = 24;
923
1017
  break;
924
1018
  }
925
1019
 
@@ -932,18 +1026,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
932
1026
  evalStatus: evalStatus,
933
1027
  retailerId: activeRetailer.id
934
1028
  };
935
- _context9.next = 23;
1029
+ _context10.next = 22;
936
1030
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
937
1031
  headers: {
938
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
1032
+ Authorization: token
939
1033
  }
940
1034
  });
941
1035
 
942
- case 23:
943
- _context9.next = 38;
1036
+ case 22:
1037
+ _context10.next = 37;
944
1038
  break;
945
1039
 
946
- case 25:
1040
+ case 24:
947
1041
  if (specialistDone) {
948
1042
  updateCompaniesList(evalStatus, result, activeRetailer.id);
949
1043
  }
@@ -955,41 +1049,41 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
955
1049
  evalStatus: evalStatus,
956
1050
  retailerId: activeRetailer.id
957
1051
  };
958
- _context9.t1 = user.id_role;
959
- _context9.next = _context9.t1 === 7 ? 30 : _context9.t1 === 8 ? 30 : _context9.t1 === 4 ? 32 : _context9.t1 === 5 ? 32 : 34;
1052
+ _context10.t1 = user.id_role;
1053
+ _context10.next = _context10.t1 === 7 ? 29 : _context10.t1 === 8 ? 29 : _context10.t1 === 4 ? 31 : _context10.t1 === 5 ? 31 : 33;
960
1054
  break;
961
1055
 
962
- case 30:
1056
+ case 29:
963
1057
  data.especialist = true;
964
- return _context9.abrupt("break", 35);
1058
+ return _context10.abrupt("break", 34);
965
1059
 
966
- case 32:
1060
+ case 31:
967
1061
  data.facilitator = true;
968
- return _context9.abrupt("break", 35);
1062
+ return _context10.abrupt("break", 34);
969
1063
 
970
- case 34:
971
- return _context9.abrupt("break", 35);
1064
+ case 33:
1065
+ return _context10.abrupt("break", 34);
972
1066
 
973
- case 35:
1067
+ case 34:
974
1068
  _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
975
1069
  headers: {
976
- Authorization: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A"
1070
+ Authorization: token
977
1071
  }
978
1072
  });
979
1073
 
980
1074
  setProduct(productTemp);
981
1075
  setModalSent(true);
982
1076
 
983
- case 38:
1077
+ case 37:
984
1078
  case "end":
985
- return _context9.stop();
1079
+ return _context10.stop();
986
1080
  }
987
1081
  }
988
- }, _callee9);
1082
+ }, _callee10);
989
1083
  }));
990
1084
 
991
- return function sendToFacilitator(_x4) {
992
- return _ref10.apply(this, arguments);
1085
+ return function sendToFacilitator(_x3) {
1086
+ return _ref11.apply(this, arguments);
993
1087
  };
994
1088
  }();
995
1089
 
@@ -1043,20 +1137,175 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1043
1137
  return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.version) === version;
1044
1138
  }
1045
1139
 
1046
- (0, _react.useEffect)(function () {// let concept = "";
1047
- // switch (activeTab) {
1048
- // case "Ficha técnica":
1049
- // concept = "datasheet";
1050
- // break;
1051
- // case "Imágenes":
1052
- // concept = "images";
1053
- // break;
1054
- // default:
1055
- // concept = "description";
1056
- // break;
1057
- // }
1058
- // getComments(concept);
1059
- }, [activeTab]);
1140
+ var createComment = /*#__PURE__*/function () {
1141
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
1142
+ var _product$article;
1143
+
1144
+ var concept, data;
1145
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1146
+ while (1) {
1147
+ switch (_context11.prev = _context11.next) {
1148
+ case 0:
1149
+ concept = "";
1150
+ _context11.t0 = activeTab;
1151
+ _context11.next = _context11.t0 === "Ficha técnica" ? 4 : _context11.t0 === "Imágenes" ? 6 : 8;
1152
+ break;
1153
+
1154
+ case 4:
1155
+ concept = "datasheet";
1156
+ return _context11.abrupt("break", 10);
1157
+
1158
+ case 6:
1159
+ concept = "images";
1160
+ return _context11.abrupt("break", 10);
1161
+
1162
+ case 8:
1163
+ concept = "description";
1164
+ return _context11.abrupt("break", 10);
1165
+
1166
+ case 10:
1167
+ data = {
1168
+ articleId: product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article,
1169
+ orderId: product === null || product === void 0 ? void 0 : product.orderId,
1170
+ message: body,
1171
+ concept: concept,
1172
+ version: version
1173
+ };
1174
+ e.preventDefault();
1175
+ _context11.next = 14;
1176
+ return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1177
+ headers: {
1178
+ Authorization: token
1179
+ }
1180
+ });
1181
+
1182
+ case 14:
1183
+ _context11.next = 16;
1184
+ return getComments(tab);
1185
+
1186
+ case 16:
1187
+ case "end":
1188
+ return _context11.stop();
1189
+ }
1190
+ }
1191
+ }, _callee11);
1192
+ }));
1193
+
1194
+ return function createComment(_x4, _x5, _x6) {
1195
+ return _ref12.apply(this, arguments);
1196
+ };
1197
+ }();
1198
+
1199
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1200
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1201
+ while (1) {
1202
+ switch (_context12.prev = _context12.next) {
1203
+ case 0:
1204
+ setComment(comments[activeTab]);
1205
+
1206
+ case 1:
1207
+ case "end":
1208
+ return _context12.stop();
1209
+ }
1210
+ }
1211
+ }, _callee12);
1212
+ })), [activeTab]);
1213
+
1214
+ var commentRevised = /*#__PURE__*/function () {
1215
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1216
+ var data;
1217
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1218
+ while (1) {
1219
+ switch (_context13.prev = _context13.next) {
1220
+ case 0:
1221
+ data = {
1222
+ commentId: comment.id
1223
+ };
1224
+ _context13.next = 3;
1225
+ return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1226
+ headers: {
1227
+ Authorization: sessionStorage.getItem("jwt")
1228
+ }
1229
+ });
1230
+
1231
+ case 3:
1232
+ setCrossComment(false);
1233
+ _context13.next = 6;
1234
+ return getComments();
1235
+
1236
+ case 6:
1237
+ case "end":
1238
+ return _context13.stop();
1239
+ }
1240
+ }
1241
+ }, _callee13);
1242
+ }));
1243
+
1244
+ return function commentRevised() {
1245
+ return _ref14.apply(this, arguments);
1246
+ };
1247
+ }();
1248
+
1249
+ var setAssignation = /*#__PURE__*/function () {
1250
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
1251
+ var _product$article2;
1252
+
1253
+ var concept, productTemp, data;
1254
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1255
+ while (1) {
1256
+ switch (_context14.prev = _context14.next) {
1257
+ case 0:
1258
+ concept = "";
1259
+ _context14.t0 = activeTab;
1260
+ _context14.next = _context14.t0 === "Ficha técnica" ? 4 : _context14.t0 === "Imágenes" ? 6 : 8;
1261
+ break;
1262
+
1263
+ case 4:
1264
+ concept = "datasheet";
1265
+ return _context14.abrupt("break", 10);
1266
+
1267
+ case 6:
1268
+ concept = "images";
1269
+ return _context14.abrupt("break", 10);
1270
+
1271
+ case 8:
1272
+ concept = "description";
1273
+ return _context14.abrupt("break", 10);
1274
+
1275
+ case 10:
1276
+ productTemp = productSelected;
1277
+ productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
1278
+ data = (0, _defineProperty2.default)({
1279
+ articleList: [{
1280
+ orderId: product.orderId,
1281
+ articleId: product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_article
1282
+ }],
1283
+ concept: concept
1284
+ }, "".concat(assignationType, "Id"), assignationId);
1285
+ (0, _axios.default)({
1286
+ method: "post",
1287
+ url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
1288
+ data: data,
1289
+ headers: {
1290
+ Authorization: token
1291
+ }
1292
+ });
1293
+ loadAssignations(productTemp);
1294
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1295
+
1296
+ case 16:
1297
+ case "end":
1298
+ return _context14.stop();
1299
+ }
1300
+ }
1301
+ }, _callee14);
1302
+ }));
1303
+
1304
+ return function setAssignation(_x7, _x8) {
1305
+ return _ref15.apply(this, arguments);
1306
+ };
1307
+ }();
1308
+
1060
1309
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1061
1310
  headerTop: headerTop,
1062
1311
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1075,8 +1324,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1075
1324
  activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
1076
1325
  retailerSelected: activeRetailer.id,
1077
1326
  setImages: setImages,
1078
- assignationsImages: [productSelected.article.id_images_especialist, productSelected.article.id_images_facilitator],
1079
- imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status
1327
+ assignationsImages: assig["Imágenes"],
1328
+ imagesStatus: productSelected === null || productSelected === void 0 ? void 0 : productSelected.images_status,
1329
+ setAssignation: setAssignation,
1330
+ isRetailer: isRetailer
1080
1331
  })]
1081
1332
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1082
1333
  className: "product-information",
@@ -1107,11 +1358,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1107
1358
  saveDescriptions: saveDescriptions,
1108
1359
  saveDatasheets: saveDatasheets,
1109
1360
  updateImages: updateImages,
1110
- assignations: {
1111
- Descripción: [productSelected.article.id_description_especialist, productSelected.article.id_description_facilitator],
1112
- "Ficha técnica": [productSelected.article.id_datasheet_especialist, productSelected.article.id_datasheet_facilitator],
1113
- Imágenes: [productSelected.article.id_images_especialist, productSelected.article.id_images_facilitator]
1114
- }
1361
+ assig: assig[activeTab],
1362
+ setAssignation: setAssignation,
1363
+ isRetailer: isRetailer
1115
1364
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1116
1365
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1117
1366
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.datasheets) === 1 ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
@@ -1150,18 +1399,23 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1150
1399
  }))]
1151
1400
  }), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1152
1401
  className: "commentary-box",
1153
- children: !comments[activeTab] ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1402
+ children: !comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1154
1403
  className: "commentary",
1155
1404
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
1156
1405
  label: "Caja de Comentario",
1157
1406
  inputType: "textarea",
1158
1407
  inputCols: 80,
1159
- inputRows: 4
1408
+ inputRows: 4,
1409
+ inputId: "commentary-box",
1410
+ index: 0
1160
1411
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1161
1412
  className: "buttons-box",
1162
1413
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1163
1414
  buttonType: "general-transparent-button",
1164
- label: "Enviar comentario"
1415
+ label: "Enviar comentario",
1416
+ onClick: function onClick(e) {
1417
+ return createComment(e, document.getElementById("description-commentary-box-0").value, activeTab);
1418
+ }
1165
1419
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1166
1420
  buttonType: requiredNull !== 0 || !specialistValid(activeTab) || !versionMatch() ? "general-button-disabled" : "general-green-button",
1167
1421
  label: "Enviar evaluación",
@@ -1170,8 +1424,29 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1170
1424
  }
1171
1425
  })]
1172
1426
  })]
1173
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
1174
- comment: comments[activeTab].message
1427
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1428
+ className: "feedback-box",
1429
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
1430
+ comment: comment.message,
1431
+ reviewed: crossComment
1432
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
1433
+ buttonType: "circular-button accept-button",
1434
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1435
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1436
+ while (1) {
1437
+ switch (_context15.prev = _context15.next) {
1438
+ case 0:
1439
+ setCrossComment(true);
1440
+ commentRevised();
1441
+
1442
+ case 2:
1443
+ case "end":
1444
+ return _context15.stop();
1445
+ }
1446
+ }
1447
+ }, _callee15);
1448
+ }))
1449
+ })]
1175
1450
  })
1176
1451
  })]
1177
1452
  })]