contentoh-components-library 21.3.22 → 21.3.24

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 (48) hide show
  1. package/.env.development +1 -0
  2. package/dist/assets/fonts/roboto/Roboto-Black.ttf +0 -0
  3. package/dist/assets/fonts/roboto/Roboto-BlackItalic.ttf +0 -0
  4. package/dist/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  5. package/dist/assets/fonts/roboto/Roboto-BoldItalic.ttf +0 -0
  6. package/dist/assets/fonts/roboto/Roboto-Italic.ttf +0 -0
  7. package/dist/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  8. package/dist/assets/fonts/roboto/Roboto-LightItalic.ttf +0 -0
  9. package/dist/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  10. package/dist/assets/fonts/roboto/Roboto-MediumItalic.ttf +0 -0
  11. package/dist/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  12. package/dist/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  13. package/dist/assets/fonts/roboto/Roboto-ThinItalic.ttf +0 -0
  14. package/dist/components/atoms/GeneralInput/index.js +3 -1
  15. package/dist/components/atoms/GeneralInput/styles.js +1 -1
  16. package/dist/components/molecules/GalleryElement/index.js +12 -3
  17. package/dist/components/molecules/GalleryElement/styles.js +1 -1
  18. package/dist/components/molecules/HeaderTop/index.js +12 -14
  19. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  20. package/dist/components/molecules/TagAndInput/index.js +6 -2
  21. package/dist/components/organisms/InputGroup/index.js +19 -8
  22. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -46
  23. package/dist/components/pages/RetailerProductEdition/index.js +333 -235
  24. package/dist/components/pages/RetailerProductEdition/utils.js +67 -0
  25. package/package.json +1 -1
  26. package/src/assets/fonts/roboto/Roboto-Black.ttf +0 -0
  27. package/src/assets/fonts/roboto/Roboto-BlackItalic.ttf +0 -0
  28. package/src/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
  29. package/src/assets/fonts/roboto/Roboto-BoldItalic.ttf +0 -0
  30. package/src/assets/fonts/roboto/Roboto-Italic.ttf +0 -0
  31. package/src/assets/fonts/roboto/Roboto-Light.ttf +0 -0
  32. package/src/assets/fonts/roboto/Roboto-LightItalic.ttf +0 -0
  33. package/src/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
  34. package/src/assets/fonts/roboto/Roboto-MediumItalic.ttf +0 -0
  35. package/src/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
  36. package/src/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
  37. package/src/assets/fonts/roboto/Roboto-ThinItalic.ttf +0 -0
  38. package/src/components/atoms/GeneralInput/index.js +2 -1
  39. package/src/components/atoms/GeneralInput/styles.js +9 -1
  40. package/src/components/molecules/GalleryElement/index.js +14 -2
  41. package/src/components/molecules/GalleryElement/styles.js +5 -0
  42. package/src/components/molecules/HeaderTop/index.js +9 -18
  43. package/src/components/molecules/HeaderTop/styles.js +19 -0
  44. package/src/components/molecules/TagAndInput/index.js +4 -0
  45. package/src/components/organisms/InputGroup/index.js +31 -4
  46. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -47
  47. package/src/components/pages/RetailerProductEdition/index.js +58 -19
  48. package/src/components/pages/RetailerProductEdition/utils.js +34 -0
@@ -77,6 +77,8 @@ var _VersionSelector = require("../../organisms/VersionSelector");
77
77
 
78
78
  var _customHooks = require("../../../global-files/customHooks");
79
79
 
80
+ var _utils = require("./utils");
81
+
80
82
  var _jsxRuntime = require("react/jsx-runtime");
81
83
 
82
84
  var reducerImages = function reducerImages(state, action) {
@@ -200,7 +202,7 @@ var myBucket = new _awsSdk.default.S3({
200
202
  });
201
203
 
202
204
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
203
- var _product$retailers, _product$services2, _datasheets$, _datasheets$$data, _product$article15, _comment$message;
205
+ var _product$retailers, _product$services2, _datasheets$, _datasheets$$data, _product$article18, _comment$message;
204
206
 
205
207
  var tabsSections = _ref.tabsSections,
206
208
  _ref$productSelected = _ref.productSelected,
@@ -443,25 +445,126 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
443
445
  setShowVersionSelector = _useCloseModal2[1];
444
446
 
445
447
  var shotThd = [58, 59, 60, 61].includes(activeRetailer.id);
448
+
449
+ var _useState69 = (0, _react.useState)(null),
450
+ _useState70 = (0, _slicedToArray2.default)(_useState69, 2),
451
+ auditableVersion = _useState70[0],
452
+ setAuditableVersion = _useState70[1];
453
+
454
+ var _useState71 = (0, _react.useState)([]),
455
+ _useState72 = (0, _slicedToArray2.default)(_useState71, 2),
456
+ auditServices = _useState72[0],
457
+ setAuditServices = _useState72[1];
458
+
459
+ var _useState73 = (0, _react.useState)([]),
460
+ _useState74 = (0, _slicedToArray2.default)(_useState73, 2),
461
+ auditDatasheets = _useState74[0],
462
+ setAuditDatasheets = _useState74[1];
463
+
464
+ var _useState75 = (0, _react.useState)([]),
465
+ _useState76 = (0, _slicedToArray2.default)(_useState75, 2),
466
+ auditDescriptions = _useState76[0],
467
+ setAuditDescriptions = _useState76[1];
468
+
469
+ var _useState77 = (0, _react.useState)([]),
470
+ _useState78 = (0, _slicedToArray2.default)(_useState77, 2),
471
+ auditImages = _useState78[0],
472
+ setAuditImages = _useState78[1];
473
+
474
+ var _useState79 = (0, _react.useState)(false),
475
+ _useState80 = (0, _slicedToArray2.default)(_useState79, 2),
476
+ compare = _useState80[0],
477
+ setCompare = _useState80[1];
478
+
479
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
480
+ var _ref3, id_article;
481
+
482
+ return _regenerator.default.wrap(function _callee$(_context) {
483
+ while (1) {
484
+ switch (_context.prev = _context.next) {
485
+ case 0:
486
+ _ref3 = (product === null || product === void 0 ? void 0 : product.article) || {}, id_article = _ref3.id_article;
487
+
488
+ if (!id_article) {
489
+ _context.next = 4;
490
+ break;
491
+ }
492
+
493
+ _context.next = 4;
494
+ return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
495
+
496
+ case 4:
497
+ case "end":
498
+ return _context.stop();
499
+ }
500
+ }
501
+ }, _callee);
502
+ })), []);
503
+
504
+ var loadAuditableData = /*#__PURE__*/function () {
505
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
506
+ var _product$article, _product$article2, _product$article3, _auditServices;
507
+
508
+ return _regenerator.default.wrap(function _callee2$(_context2) {
509
+ while (1) {
510
+ switch (_context2.prev = _context2.next) {
511
+ case 0:
512
+ if (!auditableVersion) {
513
+ _context2.next = 7;
514
+ break;
515
+ }
516
+
517
+ _context2.next = 3;
518
+ 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);
519
+
520
+ case 3:
521
+ _auditServices = _context2.sent;
522
+ (0, _utils.getInputsData)(_auditServices, activeRetailer, setAuditDatasheets, setAuditDescriptions);
523
+ setAuditServices(_auditServices);
524
+ setAuditImages(_auditServices[2]);
525
+
526
+ case 7:
527
+ case "end":
528
+ return _context2.stop();
529
+ }
530
+ }
531
+ }, _callee2);
532
+ }));
533
+
534
+ return function loadAuditableData() {
535
+ return _ref4.apply(this, arguments);
536
+ };
537
+ }();
538
+
539
+ (0, _react.useEffect)(function () {
540
+ if (auditableVersion) {
541
+ loadAuditableData();
542
+ }
543
+ }, [auditableVersion]);
446
544
  (0, _react.useEffect)(function () {
447
545
  checkAll && setSelectedImages(images.values);
448
546
  }, [checkAll]);
449
547
 
450
548
  var loadData = /*#__PURE__*/function () {
451
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
452
- var _product$article, _product$article2, _product$article3, _services$, _services$$values, _services;
549
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
550
+ var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _services;
453
551
 
454
- return _regenerator.default.wrap(function _callee$(_context) {
552
+ return _regenerator.default.wrap(function _callee3$(_context3) {
455
553
  while (1) {
456
- switch (_context.prev = _context.next) {
554
+ switch (_context3.prev = _context3.next) {
457
555
  case 0:
458
- _context.prev = 0;
459
- _context.next = 3;
460
- 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), version);
556
+ _context3.prev = 0;
557
+ _context3.next = 3;
558
+ 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);
461
559
 
462
560
  case 3:
463
- _services = _context.sent;
464
- //Converts the data inside the datasheets object to array
561
+ _services = _context3.sent;
562
+
563
+ if (auditableVersion) {
564
+ loadAuditableData();
565
+ } //Converts the data inside the datasheets object to array
566
+
567
+
465
568
  setServices(_services);
466
569
  getServices();
467
570
  setImages({
@@ -475,41 +578,41 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
475
578
  return setPercentages(res[0]);
476
579
  });
477
580
  setLoading(false);
478
- _context.next = 15;
581
+ _context3.next = 16;
479
582
  break;
480
583
 
481
- case 12:
482
- _context.prev = 12;
483
- _context.t0 = _context["catch"](0);
484
- console.log(_context.t0);
584
+ case 13:
585
+ _context3.prev = 13;
586
+ _context3.t0 = _context3["catch"](0);
587
+ console.log(_context3.t0);
485
588
 
486
- case 15:
589
+ case 16:
487
590
  case "end":
488
- return _context.stop();
591
+ return _context3.stop();
489
592
  }
490
593
  }
491
- }, _callee, null, [[0, 12]]);
594
+ }, _callee3, null, [[0, 13]]);
492
595
  }));
493
596
 
494
597
  return function loadData() {
495
- return _ref2.apply(this, arguments);
598
+ return _ref5.apply(this, arguments);
496
599
  };
497
600
  }();
498
601
 
499
602
  var getServices = /*#__PURE__*/function () {
500
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
501
- var _product$article4, _product$article5, _servicesResponse$dat;
603
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
604
+ var _product$article7, _product$article8, _servicesResponse$dat;
502
605
 
503
606
  var servicesResponse, parsedResponse, retailers, retailerResponse, active;
504
- return _regenerator.default.wrap(function _callee2$(_context2) {
607
+ return _regenerator.default.wrap(function _callee4$(_context4) {
505
608
  while (1) {
506
- switch (_context2.prev = _context2.next) {
609
+ switch (_context4.prev = _context4.next) {
507
610
  case 0:
508
- _context2.next = 2;
509
- return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_order) || product.orderId, "&end=true"));
611
+ _context4.next = 2;
612
+ return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&orderId=").concat((product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_order) || product.orderId, "&end=true"));
510
613
 
511
614
  case 2:
512
- servicesResponse = _context2.sent;
615
+ servicesResponse = _context4.sent;
513
616
  parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
514
617
  retailers = product.retailers || product.retailersAvailable;
515
618
  retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
@@ -523,14 +626,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
523
626
 
524
627
  case 9:
525
628
  case "end":
526
- return _context2.stop();
629
+ return _context4.stop();
527
630
  }
528
631
  }
529
- }, _callee2);
632
+ }, _callee4);
530
633
  }));
531
634
 
532
635
  return function getServices() {
533
- return _ref3.apply(this, arguments);
636
+ return _ref6.apply(this, arguments);
534
637
  };
535
638
  }();
536
639
 
@@ -544,23 +647,23 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
544
647
  };
545
648
 
546
649
  var getComments = /*#__PURE__*/function () {
547
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
548
- var _product$article6, _product$article7, _product$article8;
650
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
651
+ var _product$article9, _product$article10, _product$article11;
549
652
 
550
653
  var tab,
551
654
  commentsResponse,
552
655
  comments,
553
- _args3 = arguments;
554
- return _regenerator.default.wrap(function _callee3$(_context3) {
656
+ _args5 = arguments;
657
+ return _regenerator.default.wrap(function _callee5$(_context5) {
555
658
  while (1) {
556
- switch (_context3.prev = _context3.next) {
659
+ switch (_context5.prev = _context5.next) {
557
660
  case 0:
558
- tab = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : "Descripción";
559
- _context3.next = 3;
560
- return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
661
+ tab = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : "Descripción";
662
+ _context5.next = 3;
663
+ return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
561
664
 
562
665
  case 3:
563
- commentsResponse = _context3.sent;
666
+ commentsResponse = _context5.sent;
564
667
  comments = {};
565
668
  commentsResponse.forEach(function (comment) {
566
669
  var _comment$data, _JSON$parse, _JSON$parse$data$, _comment$data2, _comment$data3;
@@ -572,63 +675,63 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
572
675
 
573
676
  case 8:
574
677
  case "end":
575
- return _context3.stop();
678
+ return _context5.stop();
576
679
  }
577
680
  }
578
- }, _callee3);
681
+ }, _callee5);
579
682
  }));
580
683
 
581
684
  return function getComments() {
582
- return _ref4.apply(this, arguments);
685
+ return _ref7.apply(this, arguments);
583
686
  };
584
687
  }();
585
688
 
586
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
689
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
587
690
  var arr;
588
- return _regenerator.default.wrap(function _callee4$(_context4) {
691
+ return _regenerator.default.wrap(function _callee6$(_context6) {
589
692
  while (1) {
590
- switch (_context4.prev = _context4.next) {
693
+ switch (_context6.prev = _context6.next) {
591
694
  case 0:
592
695
  setLoading(true);
593
696
  loadData();
594
697
  getComments();
595
- _context4.t0 = setUserGroups;
596
- _context4.next = 6;
698
+ _context6.t0 = setUserGroups;
699
+ _context6.next = 6;
597
700
  return (0, _data.fetchUsers)(token);
598
701
 
599
702
  case 6:
600
- _context4.t1 = _context4.sent;
601
- (0, _context4.t0)(_context4.t1);
703
+ _context6.t1 = _context6.sent;
704
+ (0, _context6.t0)(_context6.t1);
602
705
  arr = [];
603
- _context4.t2 = user.id_role;
604
- _context4.next = _context4.t2 === 7 ? 12 : _context4.t2 === 8 ? 12 : _context4.t2 === 4 ? 14 : _context4.t2 === 5 ? 14 : _context4.t2 === 6 ? 16 : 18;
706
+ _context6.t2 = user.id_role;
707
+ _context6.next = _context6.t2 === 7 ? 12 : _context6.t2 === 8 ? 12 : _context6.t2 === 4 ? 14 : _context6.t2 === 5 ? 14 : _context6.t2 === 6 ? 16 : 18;
605
708
  break;
606
709
 
607
710
  case 12:
608
711
  arr = ["AS", "CA", "RC", "RA", "RP", "RCA"];
609
- return _context4.abrupt("break", 20);
712
+ return _context6.abrupt("break", 20);
610
713
 
611
714
  case 14:
612
715
  arr = ["RC", "AC", "AA", "AP", "ACA"];
613
- return _context4.abrupt("break", 20);
716
+ return _context6.abrupt("break", 20);
614
717
 
615
718
  case 16:
616
719
  arr = ["RP", "RCA", "AC", "RA"];
617
- return _context4.abrupt("break", 20);
720
+ return _context6.abrupt("break", 20);
618
721
 
619
722
  case 18:
620
723
  arr = [];
621
- return _context4.abrupt("break", 20);
724
+ return _context6.abrupt("break", 20);
622
725
 
623
726
  case 20:
624
727
  setStatusArray(arr);
625
728
 
626
729
  case 21:
627
730
  case "end":
628
- return _context4.stop();
731
+ return _context6.stop();
629
732
  }
630
733
  }
631
- }, _callee4);
734
+ }, _callee6);
632
735
  })), [product, version]);
633
736
 
634
737
  var loadAssignations = function loadAssignations(currentProduct) {
@@ -694,22 +797,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
694
797
  setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
695
798
  }, [percentages]);
696
799
  (0, _react.useEffect)(function () {
697
- if (services.length > 0) {
698
- var _services$0$activeRet, _services$2, _services$3;
699
-
700
- if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
701
- setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
702
- var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
703
- var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
704
-
705
- var _descriptions = (_services$3 = services[1]) === null || _services$3 === void 0 ? void 0 : _services$3.filter(function (service) {
706
- return (service === null || service === void 0 ? void 0 : service.id) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
707
- });
708
-
709
- setDatasheets([datagroups, inputs]);
710
- setDescriptions(_descriptions);
711
- }
712
-
800
+ (0, _utils.getInputsData)(services, activeRetailer, setDatasheets, setDescriptions);
801
+ auditableVersion && loadAuditableData();
802
+ setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
713
803
  (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
714
804
  action: "orderImages",
715
805
  retailerId: activeRetailer.id
@@ -744,7 +834,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
744
834
  image: image,
745
835
  gridLayout: imageLayout,
746
836
  id: "gallery-element-" + index,
747
- index: index + "-" + image.name,
837
+ index: index + "-" + image.name + "-" + compare,
748
838
  number: index,
749
839
  imageType: imageType,
750
840
  imagePackagingType: imagePackagingType,
@@ -753,38 +843,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
753
843
  setSocketType: setSocketType,
754
844
  changeImage: setImages,
755
845
  selectedImages: selectedImages,
756
- setSelectedImages: setSelectedImages
846
+ setSelectedImages: setSelectedImages,
847
+ auditImages: auditImages,
848
+ compare: compare
757
849
  }, index + "-" + imageType.name);
758
850
  });
759
851
  };
760
852
 
761
853
  var saveDescriptions = /*#__PURE__*/function () {
762
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
763
- var dataClean, _product$article9, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
854
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
855
+ var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
764
856
 
765
- return _regenerator.default.wrap(function _callee5$(_context5) {
857
+ return _regenerator.default.wrap(function _callee7$(_context7) {
766
858
  while (1) {
767
- switch (_context5.prev = _context5.next) {
859
+ switch (_context7.prev = _context7.next) {
768
860
  case 0:
769
861
  dataClean = updatedDescriptions.filter(function (f) {
770
- return f.value !== '';
862
+ return f.value !== "";
771
863
  });
772
864
 
773
865
  if (!(dataClean.length > 0)) {
774
- _context5.next = 25;
866
+ _context7.next = 25;
775
867
  break;
776
868
  }
777
869
 
778
870
  setLoading(true);
779
871
  productTemp = product;
780
- articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
872
+ articleId = product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article;
781
873
  dataObject = {
782
874
  articleId: articleId,
783
875
  articleData: dataClean
784
876
  };
785
877
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
786
- _context5.prev = 7;
787
- _context5.next = 10;
878
+ _context7.prev = 7;
879
+ _context7.next = 10;
788
880
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
789
881
  headers: {
790
882
  Authorization: token
@@ -792,10 +884,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
792
884
  });
793
885
 
794
886
  case 10:
795
- res = _context5.sent;
887
+ res = _context7.sent;
796
888
 
797
889
  if (!(res.data.statusCode === 200)) {
798
- _context5.next = 20;
890
+ _context7.next = 20;
799
891
  break;
800
892
  }
801
893
 
@@ -805,58 +897,58 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
805
897
  setProduct(productTemp);
806
898
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
807
899
  setMessage("Descripciones guardadas con éxito");
808
- _context5.next = 20;
900
+ _context7.next = 20;
809
901
  return loadData();
810
902
 
811
903
  case 20:
812
- _context5.next = 25;
904
+ _context7.next = 25;
813
905
  break;
814
906
 
815
907
  case 22:
816
- _context5.prev = 22;
817
- _context5.t0 = _context5["catch"](7);
818
- console.log(_context5.t0);
908
+ _context7.prev = 22;
909
+ _context7.t0 = _context7["catch"](7);
910
+ console.log(_context7.t0);
819
911
 
820
912
  case 25:
821
913
  case "end":
822
- return _context5.stop();
914
+ return _context7.stop();
823
915
  }
824
916
  }
825
- }, _callee5, null, [[7, 22]]);
917
+ }, _callee7, null, [[7, 22]]);
826
918
  }));
827
919
 
828
920
  return function saveDescriptions() {
829
- return _ref6.apply(this, arguments);
921
+ return _ref9.apply(this, arguments);
830
922
  };
831
923
  }();
832
924
 
833
925
  var saveDatasheets = /*#__PURE__*/function () {
834
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
835
- var dataClean, _product$article10, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
926
+ var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
927
+ var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
836
928
 
837
- return _regenerator.default.wrap(function _callee6$(_context6) {
929
+ return _regenerator.default.wrap(function _callee8$(_context8) {
838
930
  while (1) {
839
- switch (_context6.prev = _context6.next) {
931
+ switch (_context8.prev = _context8.next) {
840
932
  case 0:
841
933
  dataClean = updatedDatasheets.filter(function (f) {
842
- return f.value !== '';
934
+ return f.value !== "";
843
935
  });
844
936
 
845
937
  if (!(dataClean.length > 0)) {
846
- _context6.next = 25;
938
+ _context8.next = 25;
847
939
  break;
848
940
  }
849
941
 
850
942
  setLoading(true);
851
943
  productTemp = product;
852
- articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
944
+ articleId = product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article;
853
945
  dataObject = {
854
946
  articleId: articleId,
855
947
  articleData: dataClean
856
948
  };
857
949
  if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
858
- _context6.prev = 7;
859
- _context6.next = 10;
950
+ _context8.prev = 7;
951
+ _context8.next = 10;
860
952
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
861
953
  headers: {
862
954
  Authorization: token
@@ -864,10 +956,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
864
956
  });
865
957
 
866
958
  case 10:
867
- res = _context6.sent;
959
+ res = _context8.sent;
868
960
 
869
961
  if (!(res.data.statusCode === 200)) {
870
- _context6.next = 20;
962
+ _context8.next = 20;
871
963
  break;
872
964
  }
873
965
 
@@ -877,28 +969,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
877
969
  setProduct(productTemp);
878
970
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
879
971
  setMessage("Fichas técnicas guardadas");
880
- _context6.next = 20;
972
+ _context8.next = 20;
881
973
  return loadData();
882
974
 
883
975
  case 20:
884
- _context6.next = 25;
976
+ _context8.next = 25;
885
977
  break;
886
978
 
887
979
  case 22:
888
- _context6.prev = 22;
889
- _context6.t0 = _context6["catch"](7);
890
- console.log(_context6.t0);
980
+ _context8.prev = 22;
981
+ _context8.t0 = _context8["catch"](7);
982
+ console.log(_context8.t0);
891
983
 
892
984
  case 25:
893
985
  case "end":
894
- return _context6.stop();
986
+ return _context8.stop();
895
987
  }
896
988
  }
897
- }, _callee6, null, [[7, 22]]);
989
+ }, _callee8, null, [[7, 22]]);
898
990
  }));
899
991
 
900
992
  return function saveDatasheets() {
901
- return _ref7.apply(this, arguments);
993
+ return _ref10.apply(this, arguments);
902
994
  };
903
995
  }();
904
996
 
@@ -919,14 +1011,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
919
1011
  });
920
1012
  setSocketType(imageInputs);
921
1013
  }, [images]);
922
- var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
923
- var _images$values3, _images$attrForImgs, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
1014
+ var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1015
+ var _images$values3, _images$attrForImgs, _product$article14, _data$articleData, _data$articleData2, _data$updateImages;
924
1016
 
925
1017
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
926
1018
 
927
- return _regenerator.default.wrap(function _callee7$(_context7) {
1019
+ return _regenerator.default.wrap(function _callee9$(_context9) {
928
1020
  while (1) {
929
- switch (_context7.prev = _context7.next) {
1021
+ switch (_context9.prev = _context9.next) {
930
1022
  case 0:
931
1023
  imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
932
1024
  imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
@@ -938,7 +1030,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
938
1030
  });
939
1031
  attrForImgs = Object.values((_images$attrForImgs = images === null || images === void 0 ? void 0 : images.attrForImgs) !== null && _images$attrForImgs !== void 0 ? _images$attrForImgs : {}).pop();
940
1032
  data = {
941
- articleId: product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article,
1033
+ articleId: product === null || product === void 0 ? void 0 : (_product$article14 = product.article) === null || _product$article14 === void 0 ? void 0 : _product$article14.id_article,
942
1034
  attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
943
1035
  var _e$value;
944
1036
 
@@ -974,19 +1066,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
974
1066
  }
975
1067
 
976
1068
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
977
- _context7.next = 30;
1069
+ _context9.next = 30;
978
1070
  break;
979
1071
  }
980
1072
 
981
1073
  setLoading(true);
982
- _context7.prev = 10;
1074
+ _context9.prev = 10;
983
1075
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
984
1076
  e.uuid = (0, _uuid.v4)();
985
1077
  });
986
1078
  setDataImages(data);
987
1079
 
988
1080
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
989
- _context7.next = 22;
1081
+ _context9.next = 22;
990
1082
  break;
991
1083
  }
992
1084
 
@@ -1002,28 +1094,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1002
1094
  };
1003
1095
  promiseArray.push(myBucket.putObject(params).promise());
1004
1096
  });
1005
- _context7.next = 19;
1097
+ _context9.next = 19;
1006
1098
  return Promise.all(promiseArray);
1007
1099
 
1008
1100
  case 19:
1009
1101
  setImagesUploaded(true);
1010
- _context7.next = 23;
1102
+ _context9.next = 23;
1011
1103
  break;
1012
1104
 
1013
1105
  case 22:
1014
1106
  setImagesUploaded(true);
1015
1107
 
1016
1108
  case 23:
1017
- _context7.next = 28;
1109
+ _context9.next = 28;
1018
1110
  break;
1019
1111
 
1020
1112
  case 25:
1021
- _context7.prev = 25;
1022
- _context7.t0 = _context7["catch"](10);
1023
- console.log(_context7.t0); // setMainLoading(false);
1113
+ _context9.prev = 25;
1114
+ _context9.t0 = _context9["catch"](10);
1115
+ console.log(_context9.t0); // setMainLoading(false);
1024
1116
 
1025
1117
  case 28:
1026
- _context7.next = 31;
1118
+ _context9.next = 31;
1027
1119
  break;
1028
1120
 
1029
1121
  case 30:
@@ -1032,20 +1124,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1032
1124
 
1033
1125
  case 31:
1034
1126
  case "end":
1035
- return _context7.stop();
1127
+ return _context9.stop();
1036
1128
  }
1037
1129
  }
1038
- }, _callee7, null, [[10, 25]]);
1130
+ }, _callee9, null, [[10, 25]]);
1039
1131
  })), [images, imagesUploaded]);
1040
- (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1041
- var res, _product$article12, productTemp, _JSON$parse4, newStatus, newArticleStatus;
1132
+ (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1133
+ var res, _product$article15, productTemp, _JSON$parse4, newStatus, newArticleStatus;
1042
1134
 
1043
- return _regenerator.default.wrap(function _callee8$(_context8) {
1135
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1044
1136
  while (1) {
1045
- switch (_context8.prev = _context8.next) {
1137
+ switch (_context10.prev = _context10.next) {
1046
1138
  case 0:
1047
1139
  if (!imagesUploaded) {
1048
- _context8.next = 22;
1140
+ _context10.next = 22;
1049
1141
  break;
1050
1142
  }
1051
1143
 
@@ -1057,8 +1149,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1057
1149
  if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
1058
1150
  return e;
1059
1151
  });
1060
- _context8.prev = 2;
1061
- _context8.next = 5;
1152
+ _context10.prev = 2;
1153
+ _context10.next = 5;
1062
1154
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
1063
1155
  headers: {
1064
1156
  Authorization: token
@@ -1066,39 +1158,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1066
1158
  });
1067
1159
 
1068
1160
  case 5:
1069
- res = _context8.sent;
1161
+ res = _context10.sent;
1070
1162
 
1071
1163
  if (!(res.data.statusCode === 200)) {
1072
- _context8.next = 17;
1164
+ _context10.next = 17;
1073
1165
  break;
1074
1166
  }
1075
1167
 
1076
1168
  productTemp = product;
1077
1169
  _JSON$parse4 = JSON.parse(res.data.body), newStatus = _JSON$parse4.newStatus, newArticleStatus = _JSON$parse4.newArticleStatus;
1078
- if (newArticleStatus) productTemp.status = newArticleStatus[product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article];
1170
+ if (newArticleStatus) productTemp.status = newArticleStatus[product === null || product === void 0 ? void 0 : (_product$article15 = product.article) === null || _product$article15 === void 0 ? void 0 : _product$article15.id_article];
1079
1171
  if (newStatus) productTemp.images_status = newStatus;
1080
1172
  setProduct(productTemp);
1081
1173
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1082
1174
  setMessage("Imágenes guardadas con éxito");
1083
1175
  sessionStorage.removeItem("imagesList");
1084
- _context8.next = 17;
1176
+ _context10.next = 17;
1085
1177
  return loadData();
1086
1178
 
1087
1179
  case 17:
1088
- _context8.next = 22;
1180
+ _context10.next = 22;
1089
1181
  break;
1090
1182
 
1091
1183
  case 19:
1092
- _context8.prev = 19;
1093
- _context8.t0 = _context8["catch"](2);
1094
- console.log(_context8.t0);
1184
+ _context10.prev = 19;
1185
+ _context10.t0 = _context10["catch"](2);
1186
+ console.log(_context10.t0);
1095
1187
 
1096
1188
  case 22:
1097
1189
  case "end":
1098
- return _context8.stop();
1190
+ return _context10.stop();
1099
1191
  }
1100
1192
  }
1101
- }, _callee8, null, [[2, 19]]);
1193
+ }, _callee10, null, [[2, 19]]);
1102
1194
  })), [dataImages, imagesUploaded]);
1103
1195
 
1104
1196
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
@@ -1184,8 +1276,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1184
1276
  break;
1185
1277
  }
1186
1278
 
1187
- var services = servicesData.filter(function (_ref10) {
1188
- var service = _ref10.service;
1279
+ var services = servicesData.filter(function (_ref13) {
1280
+ var service = _ref13.service;
1189
1281
  return concepts.includes(service);
1190
1282
  });
1191
1283
  var adminFacilitatorCanEvaluate = services.every(function (srv) {
@@ -1222,15 +1314,15 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1222
1314
  };
1223
1315
 
1224
1316
  var sendToFacilitator = /*#__PURE__*/function () {
1225
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1317
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
1226
1318
  var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus;
1227
1319
 
1228
- return _regenerator.default.wrap(function _callee9$(_context9) {
1320
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1229
1321
  while (1) {
1230
- switch (_context9.prev = _context9.next) {
1322
+ switch (_context11.prev = _context11.next) {
1231
1323
  case 0:
1232
1324
  setLoading(true);
1233
- _context9.prev = 1;
1325
+ _context11.prev = 1;
1234
1326
  concept = getConcept(activeTab);
1235
1327
  productTemp = (0, _objectSpread2.default)({}, product);
1236
1328
  evalStatus = retailerStatus;
@@ -1245,12 +1337,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1245
1337
  };
1246
1338
 
1247
1339
  if (!result) {
1248
- _context9.next = 16;
1340
+ _context11.next = 16;
1249
1341
  break;
1250
1342
  }
1251
1343
 
1252
1344
  data.result = result;
1253
- _context9.next = 12;
1345
+ _context11.next = 12;
1254
1346
  return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
1255
1347
  headers: {
1256
1348
  Authorization: token
@@ -1258,9 +1350,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1258
1350
  });
1259
1351
 
1260
1352
  case 12:
1261
- res = _context9.sent;
1353
+ res = _context11.sent;
1262
1354
  getServices();
1263
- _context9.next = 21;
1355
+ _context11.next = 21;
1264
1356
  break;
1265
1357
 
1266
1358
  case 16:
@@ -1274,7 +1366,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1274
1366
  getSectionIcon();
1275
1367
  }
1276
1368
 
1277
- _context9.next = 20;
1369
+ _context11.next = 20;
1278
1370
  return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
1279
1371
  headers: {
1280
1372
  Authorization: token
@@ -1282,18 +1374,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1282
1374
  });
1283
1375
 
1284
1376
  case 20:
1285
- res = _context9.sent;
1377
+ res = _context11.sent;
1286
1378
 
1287
1379
  case 21:
1288
1380
  if (!(res.data.statusCode === 200)) {
1289
- _context9.next = 30;
1381
+ _context11.next = 30;
1290
1382
  break;
1291
1383
  }
1292
1384
 
1293
1385
  _JSON$parse5 = JSON.parse(res.data.body), newStatus = _JSON$parse5.newStatus, newOrderStatus = _JSON$parse5.newOrderStatus, newArticleStatus = _JSON$parse5.newArticleStatus;
1294
1386
  if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
1295
1387
  productTemp["".concat(concept, "_status")] = newStatus;
1296
- _context9.next = 27;
1388
+ _context11.next = 27;
1297
1389
  return loadData();
1298
1390
 
1299
1391
  case 27:
@@ -1302,27 +1394,27 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1302
1394
  setProduct(productTemp);
1303
1395
 
1304
1396
  case 30:
1305
- _context9.next = 35;
1397
+ _context11.next = 35;
1306
1398
  break;
1307
1399
 
1308
1400
  case 32:
1309
- _context9.prev = 32;
1310
- _context9.t0 = _context9["catch"](1);
1311
- console.log(_context9.t0);
1401
+ _context11.prev = 32;
1402
+ _context11.t0 = _context11["catch"](1);
1403
+ console.log(_context11.t0);
1312
1404
 
1313
1405
  case 35:
1314
1406
  setLoading(false);
1315
1407
 
1316
1408
  case 36:
1317
1409
  case "end":
1318
- return _context9.stop();
1410
+ return _context11.stop();
1319
1411
  }
1320
1412
  }
1321
- }, _callee9, null, [[1, 32]]);
1413
+ }, _callee11, null, [[1, 32]]);
1322
1414
  }));
1323
1415
 
1324
1416
  return function sendToFacilitator(_x) {
1325
- return _ref11.apply(this, arguments);
1417
+ return _ref14.apply(this, arguments);
1326
1418
  };
1327
1419
  }();
1328
1420
 
@@ -1353,40 +1445,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1353
1445
  };
1354
1446
 
1355
1447
  var createComment = /*#__PURE__*/function () {
1356
- var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
1357
- var _product$article13;
1448
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(e, body, tab) {
1449
+ var _product$article16;
1358
1450
 
1359
1451
  var concept, data;
1360
- return _regenerator.default.wrap(function _callee10$(_context10) {
1452
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1361
1453
  while (1) {
1362
- switch (_context10.prev = _context10.next) {
1454
+ switch (_context12.prev = _context12.next) {
1363
1455
  case 0:
1364
1456
  concept = "";
1365
- _context10.t0 = activeTab;
1366
- _context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
1457
+ _context12.t0 = activeTab;
1458
+ _context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
1367
1459
  break;
1368
1460
 
1369
1461
  case 4:
1370
1462
  concept = "datasheet";
1371
- return _context10.abrupt("break", 10);
1463
+ return _context12.abrupt("break", 10);
1372
1464
 
1373
1465
  case 6:
1374
1466
  concept = "images";
1375
- return _context10.abrupt("break", 10);
1467
+ return _context12.abrupt("break", 10);
1376
1468
 
1377
1469
  case 8:
1378
1470
  concept = "description";
1379
- return _context10.abrupt("break", 10);
1471
+ return _context12.abrupt("break", 10);
1380
1472
 
1381
1473
  case 10:
1382
1474
  data = {
1383
- articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article,
1475
+ articleId: product === null || product === void 0 ? void 0 : (_product$article16 = product.article) === null || _product$article16 === void 0 ? void 0 : _product$article16.id_article,
1384
1476
  orderId: product === null || product === void 0 ? void 0 : product.orderId,
1385
1477
  message: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, ""),
1386
1478
  concept: concept,
1387
1479
  version: version
1388
1480
  };
1389
- _context10.next = 13;
1481
+ _context12.next = 13;
1390
1482
  return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1391
1483
  headers: {
1392
1484
  Authorization: token
@@ -1394,7 +1486,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1394
1486
  });
1395
1487
 
1396
1488
  case 13:
1397
- _context10.next = 15;
1489
+ _context12.next = 15;
1398
1490
  return getComments(tab);
1399
1491
 
1400
1492
  case 15:
@@ -1403,20 +1495,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1403
1495
 
1404
1496
  case 17:
1405
1497
  case "end":
1406
- return _context10.stop();
1498
+ return _context12.stop();
1407
1499
  }
1408
1500
  }
1409
- }, _callee10);
1501
+ }, _callee12);
1410
1502
  }));
1411
1503
 
1412
1504
  return function createComment(_x2, _x3, _x4) {
1413
- return _ref12.apply(this, arguments);
1505
+ return _ref15.apply(this, arguments);
1414
1506
  };
1415
1507
  }();
1416
1508
 
1417
1509
  var getRequired = function getRequired(services) {
1418
1510
  try {
1419
- var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1511
+ var _services$2, _services$2$retailerM, _services$3, _services$3$inputs;
1420
1512
 
1421
1513
  var objetcTemp = {};
1422
1514
  var datasheetServicesArray = Object.values(services[0]);
@@ -1458,12 +1550,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1458
1550
  });
1459
1551
  objetcTemp["Descripción"] = desInputsRequired;
1460
1552
  var retailersRequested = [];
1461
- (_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$retailerM = _services$4.retailerMandatories) === null || _services$4$retailerM === void 0 ? void 0 : _services$4$retailerM.forEach(function (retMan) {
1553
+ (_services$2 = services[2]) === null || _services$2 === void 0 ? void 0 : (_services$2$retailerM = _services$2.retailerMandatories) === null || _services$2$retailerM === void 0 ? void 0 : _services$2$retailerM.forEach(function (retMan) {
1462
1554
  return retMan.forEach(function (rm) {
1463
1555
  return retailersRequested.push(rm);
1464
1556
  });
1465
1557
  });
1466
- var requiredImages = (_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$inputs = _services$5.inputs) === null || _services$5$inputs === void 0 ? void 0 : _services$5$inputs.filter(function (e) {
1558
+ var requiredImages = (_services$3 = services[2]) === null || _services$3 === void 0 ? void 0 : (_services$3$inputs = _services$3.inputs) === null || _services$3$inputs === void 0 ? void 0 : _services$3$inputs.filter(function (e) {
1467
1559
  return e.required === 1 && retailersRequested.filter(function (ret) {
1468
1560
  return ret.id_image === e.id && servicesData.filter(function (srv) {
1469
1561
  return srv.id_retailer === ret.id_retailer;
@@ -1488,16 +1580,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1488
1580
  }, [activeTab]);
1489
1581
 
1490
1582
  var commentRevised = /*#__PURE__*/function () {
1491
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1583
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1492
1584
  var data;
1493
- return _regenerator.default.wrap(function _callee11$(_context11) {
1585
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1494
1586
  while (1) {
1495
- switch (_context11.prev = _context11.next) {
1587
+ switch (_context13.prev = _context13.next) {
1496
1588
  case 0:
1497
1589
  data = {
1498
1590
  commentId: comment.id
1499
1591
  };
1500
- _context11.next = 3;
1592
+ _context13.next = 3;
1501
1593
  return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
1502
1594
  headers: {
1503
1595
  Authorization: sessionStorage.getItem("jwt")
@@ -1506,47 +1598,47 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1506
1598
 
1507
1599
  case 3:
1508
1600
  setCrossComment(false);
1509
- _context11.next = 6;
1601
+ _context13.next = 6;
1510
1602
  return getComments();
1511
1603
 
1512
1604
  case 6:
1513
1605
  case "end":
1514
- return _context11.stop();
1606
+ return _context13.stop();
1515
1607
  }
1516
1608
  }
1517
- }, _callee11);
1609
+ }, _callee13);
1518
1610
  }));
1519
1611
 
1520
1612
  return function commentRevised() {
1521
- return _ref13.apply(this, arguments);
1613
+ return _ref16.apply(this, arguments);
1522
1614
  };
1523
1615
  }();
1524
1616
 
1525
1617
  var setAssignation = /*#__PURE__*/function () {
1526
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
1527
- var _product$article14;
1618
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
1619
+ var _product$article17;
1528
1620
 
1529
1621
  var concept, productTemp, data;
1530
- return _regenerator.default.wrap(function _callee12$(_context12) {
1622
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1531
1623
  while (1) {
1532
- switch (_context12.prev = _context12.next) {
1624
+ switch (_context14.prev = _context14.next) {
1533
1625
  case 0:
1534
1626
  concept = "";
1535
- _context12.t0 = activeTab;
1536
- _context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
1627
+ _context14.t0 = activeTab;
1628
+ _context14.next = _context14.t0 === "Ficha técnica" ? 4 : _context14.t0 === "Imágenes" ? 6 : 8;
1537
1629
  break;
1538
1630
 
1539
1631
  case 4:
1540
1632
  concept = "datasheet";
1541
- return _context12.abrupt("break", 10);
1633
+ return _context14.abrupt("break", 10);
1542
1634
 
1543
1635
  case 6:
1544
1636
  concept = "images";
1545
- return _context12.abrupt("break", 10);
1637
+ return _context14.abrupt("break", 10);
1546
1638
 
1547
1639
  case 8:
1548
1640
  concept = "description";
1549
- return _context12.abrupt("break", 10);
1641
+ return _context14.abrupt("break", 10);
1550
1642
 
1551
1643
  case 10:
1552
1644
  productTemp = product;
@@ -1554,12 +1646,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1554
1646
  data = {
1555
1647
  articleList: [{
1556
1648
  orderId: product.orderId,
1557
- articleId: product === null || product === void 0 ? void 0 : (_product$article14 = product.article) === null || _product$article14 === void 0 ? void 0 : _product$article14.id_article
1649
+ articleId: product === null || product === void 0 ? void 0 : (_product$article17 = product.article) === null || _product$article17 === void 0 ? void 0 : _product$article17.id_article
1558
1650
  }],
1559
1651
  concept: concept,
1560
1652
  userId: assignationId
1561
1653
  };
1562
- _context12.next = 15;
1654
+ _context14.next = 15;
1563
1655
  return (0, _axios.default)({
1564
1656
  method: "post",
1565
1657
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
@@ -1575,14 +1667,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1575
1667
 
1576
1668
  case 17:
1577
1669
  case "end":
1578
- return _context12.stop();
1670
+ return _context14.stop();
1579
1671
  }
1580
1672
  }
1581
- }, _callee12);
1673
+ }, _callee14);
1582
1674
  }));
1583
1675
 
1584
1676
  return function setAssignation(_x5, _x6) {
1585
- return _ref14.apply(this, arguments);
1677
+ return _ref17.apply(this, arguments);
1586
1678
  };
1587
1679
  }();
1588
1680
 
@@ -1694,33 +1786,33 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1694
1786
  }, [loading]);
1695
1787
 
1696
1788
  var validateAll = /*#__PURE__*/function () {
1697
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
1789
+ var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
1698
1790
  var _conceptArray, evaluationArray, sendAll, conceptArray, productTemp;
1699
1791
 
1700
- return _regenerator.default.wrap(function _callee13$(_context13) {
1792
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1701
1793
  while (1) {
1702
- switch (_context13.prev = _context13.next) {
1794
+ switch (_context15.prev = _context15.next) {
1703
1795
  case 0:
1704
- _context13.prev = 0;
1796
+ _context15.prev = 0;
1705
1797
  setLoading(true);
1706
1798
  evaluationArray = [];
1707
1799
  sendAll = [];
1708
1800
  conceptArray = [];
1709
- _context13.t0 = user.id_role;
1710
- _context13.next = _context13.t0 === 4 ? 8 : _context13.t0 === 5 ? 10 : 12;
1801
+ _context15.t0 = user.id_role;
1802
+ _context15.next = _context15.t0 === 4 ? 8 : _context15.t0 === 5 ? 10 : 12;
1711
1803
  break;
1712
1804
 
1713
1805
  case 8:
1714
1806
  conceptArray = ["description", "datasheet"];
1715
- return _context13.abrupt("break", 14);
1807
+ return _context15.abrupt("break", 14);
1716
1808
 
1717
1809
  case 10:
1718
1810
  conceptArray = ["images"];
1719
- return _context13.abrupt("break", 14);
1811
+ return _context15.abrupt("break", 14);
1720
1812
 
1721
1813
  case 12:
1722
1814
  conceptArray = ["description", "datasheet", "images"];
1723
- return _context13.abrupt("break", 14);
1815
+ return _context15.abrupt("break", 14);
1724
1816
 
1725
1817
  case 14:
1726
1818
  servicesData === null || servicesData === void 0 ? void 0 : servicesData.forEach(function (ret) {
@@ -1742,7 +1834,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1742
1834
  }));
1743
1835
  }
1744
1836
  });
1745
- _context13.next = 17;
1837
+ _context15.next = 17;
1746
1838
  return Promise.all(evaluationArray);
1747
1839
 
1748
1840
  case 17:
@@ -1761,7 +1853,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1761
1853
  }
1762
1854
  }));
1763
1855
  });
1764
- _context13.next = 20;
1856
+ _context15.next = 20;
1765
1857
  return Promise.all(sendAll);
1766
1858
 
1767
1859
  case 20:
@@ -1772,35 +1864,37 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1772
1864
  productTemp.images_status = productTemp.images_status === "NA" ? "NA" : "".concat(result, "A");
1773
1865
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1774
1866
  setProduct(productTemp);
1775
- _context13.next = 29;
1867
+ _context15.next = 29;
1776
1868
  return loadData();
1777
1869
 
1778
1870
  case 29:
1779
- _context13.next = 34;
1871
+ _context15.next = 34;
1780
1872
  break;
1781
1873
 
1782
1874
  case 31:
1783
- _context13.prev = 31;
1784
- _context13.t1 = _context13["catch"](0);
1785
- console.log(_context13.t1);
1875
+ _context15.prev = 31;
1876
+ _context15.t1 = _context15["catch"](0);
1877
+ console.log(_context15.t1);
1786
1878
 
1787
1879
  case 34:
1788
1880
  case "end":
1789
- return _context13.stop();
1881
+ return _context15.stop();
1790
1882
  }
1791
1883
  }
1792
- }, _callee13, null, [[0, 31]]);
1884
+ }, _callee15, null, [[0, 31]]);
1793
1885
  }));
1794
1886
 
1795
1887
  return function validateAll(_x7) {
1796
- return _ref15.apply(this, arguments);
1888
+ return _ref18.apply(this, arguments);
1797
1889
  };
1798
1890
  }();
1799
1891
 
1800
1892
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1801
1893
  headerTop: headerTop,
1802
1894
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
1803
- setHeaderTop: setHeaderTop
1895
+ setHeaderTop: setHeaderTop,
1896
+ auditableVersion: auditableVersion,
1897
+ setCompare: setCompare
1804
1898
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1805
1899
  className: "data-container",
1806
1900
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -1940,8 +2034,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1940
2034
  activeSection: activeTab,
1941
2035
  inputGroup: dataGroup,
1942
2036
  dataInputs: datasheets[1],
2037
+ auditInputs: auditDatasheets[1],
1943
2038
  updatedDatasheets: updatedDatasheets,
1944
- setUpdatedDatasheets: setUpdatedDatasheets
2039
+ setUpdatedDatasheets: setUpdatedDatasheets,
2040
+ compare: compare
1945
2041
  }, index + "-" + activeRetailer.name);
1946
2042
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1947
2043
  text: "No cuentas con este servicio",
@@ -1949,11 +2045,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1949
2045
  })), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : product.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1950
2046
  activeSection: activeTab,
1951
2047
  inputGroup: descriptions[0],
2048
+ auditInputGroup: auditDescriptions[0],
1952
2049
  updatedDescriptions: updatedDescriptions,
1953
2050
  setUpdatedDescriptions: setUpdatedDescriptions,
1954
- articleId: product === null || product === void 0 ? void 0 : (_product$article15 = product.article) === null || _product$article15 === void 0 ? void 0 : _product$article15.id_article,
2051
+ articleId: product === null || product === void 0 ? void 0 : (_product$article18 = product.article) === null || _product$article18 === void 0 ? void 0 : _product$article18.id_article,
1955
2052
  version: version,
1956
- dinamicHeight: true
2053
+ dinamicHeight: true,
2054
+ compare: compare
1957
2055
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1958
2056
  text: "No cuentas con este servicio",
1959
2057
  headerType: "input-name-header"
@@ -1999,20 +2097,20 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1999
2097
  reviewed: crossComment
2000
2098
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
2001
2099
  buttonType: "circular-button accept-button",
2002
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
2003
- return _regenerator.default.wrap(function _callee14$(_context14) {
2100
+ onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
2101
+ return _regenerator.default.wrap(function _callee16$(_context16) {
2004
2102
  while (1) {
2005
- switch (_context14.prev = _context14.next) {
2103
+ switch (_context16.prev = _context16.next) {
2006
2104
  case 0:
2007
2105
  setCrossComment(true);
2008
2106
  commentRevised();
2009
2107
 
2010
2108
  case 2:
2011
2109
  case "end":
2012
- return _context14.stop();
2110
+ return _context16.stop();
2013
2111
  }
2014
2112
  }
2015
- }, _callee14);
2113
+ }, _callee16);
2016
2114
  }))
2017
2115
  })]
2018
2116
  }), [7, 8].includes(user.id_role) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {