contentoh-components-library 20.0.0 → 21.0.2

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/dist/components/atoms/GeneralInput/index.js +1 -1
  2. package/dist/components/atoms/GenericModal/styles.js +1 -1
  3. package/dist/components/atoms/InputFormatter/index.js +3 -2
  4. package/dist/components/atoms/LabelToInput/index.js +0 -1
  5. package/dist/components/atoms/LabelToInput/style.js +1 -1
  6. package/dist/components/atoms/Loading/index.js +26 -0
  7. package/dist/components/atoms/Loading/styles.js +22 -0
  8. package/dist/components/atoms/ScreenHeader/index.js +1 -1
  9. package/dist/components/atoms/ScreenHeader/styles.js +1 -1
  10. package/dist/components/atoms/StatusTag/index.js +37 -2
  11. package/dist/components/atoms/StatusTag/styles.js +1 -1
  12. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
  13. package/dist/components/molecules/TableHeader/index.js +1 -1
  14. package/dist/components/molecules/TableHeader/styles.js +1 -1
  15. package/dist/components/organisms/ImageDataTable/index.js +10 -10
  16. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +11 -1
  17. package/dist/components/pages/RetailerProductEdition/index.js +129 -122
  18. package/package.json +1 -1
  19. package/src/components/atoms/GeneralInput/index.js +2 -2
  20. package/src/components/atoms/GenericModal/styles.js +4 -0
  21. package/src/components/atoms/InputFormatter/index.js +5 -3
  22. package/src/components/atoms/LabelToInput/index.js +0 -1
  23. package/src/components/atoms/LabelToInput/style.js +5 -2
  24. package/src/components/atoms/Loading/index.js +12 -0
  25. package/src/components/atoms/Loading/styles.js +57 -0
  26. package/src/components/atoms/ScreenHeader/index.js +7 -3
  27. package/src/components/atoms/ScreenHeader/styles.js +9 -2
  28. package/src/components/atoms/StatusTag/index.js +30 -2
  29. package/src/components/atoms/StatusTag/styles.js +2 -1
  30. package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
  31. package/src/components/molecules/TableHeader/index.js +1 -1
  32. package/src/components/molecules/TableHeader/styles.js +5 -0
  33. package/src/components/organisms/ImageDataTable/index.js +18 -7
  34. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +11 -1
  35. package/src/components/pages/RetailerProductEdition/index.js +97 -92
@@ -69,6 +69,10 @@ var _GenericModal = require("../../atoms/GenericModal");
69
69
 
70
70
  var _ScreenHeader = require("../../atoms/ScreenHeader");
71
71
 
72
+ var _Loading = require("../../atoms/Loading");
73
+
74
+ var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalCheck.svg"));
75
+
72
76
  var _jsxRuntime = require("react/jsx-runtime");
73
77
 
74
78
  var reducerImages = function reducerImages(state, action) {
@@ -119,7 +123,7 @@ var myBucket = new _awsSdk.default.S3({
119
123
  });
120
124
 
121
125
  var RetailerProductEdition = function RetailerProductEdition(_ref) {
122
- var _productSelected$reta, _servicesData$filter$, _servicesData$filter$2, _product$services, _datasheets$, _datasheets$$data, _product$services2, _product$article4, _product$services3;
126
+ var _productSelected$reta, _product$services3, _product$services4, _datasheets$, _datasheets$$data, _product$services5, _product$article4, _product$services6;
123
127
 
124
128
  var tabsSections = _ref.tabsSections,
125
129
  _ref$productSelected = _ref.productSelected,
@@ -341,6 +345,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
341
345
  setCheckAll = _useState58[1];
342
346
 
343
347
  var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
348
+
349
+ var _useState59 = (0, _react.useState)(true),
350
+ _useState60 = (0, _slicedToArray2.default)(_useState59, 2),
351
+ loading = _useState60[0],
352
+ setLoading = _useState60[1];
353
+
344
354
  (0, _react.useEffect)(function () {
345
355
  checkAll && setSelectedImages(images.values);
346
356
  }, [checkAll]);
@@ -368,8 +378,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
368
378
  });
369
379
  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);
370
380
  setProduct(productSelected);
381
+ setLoading(false);
371
382
 
372
- case 8:
383
+ case 9:
373
384
  case "end":
374
385
  return _context2.stop();
375
386
  }
@@ -581,7 +592,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
581
592
  if (services.length > 0) {
582
593
  var _services$2, _services$3;
583
594
 
584
- services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
595
+ if (services[0][activeRetailer.id]) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
585
596
  setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
586
597
  var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
587
598
  var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
@@ -594,7 +605,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
594
605
  setDatasheets([datagroups, inputs]);
595
606
  setDescriptions(_descriptions);
596
607
  }
597
- }, [activeRetailer]);
608
+ }, [activeRetailer, services]);
598
609
 
599
610
  var thumbs = function thumbs() {
600
611
  var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
@@ -643,34 +654,37 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
643
654
  while (1) {
644
655
  switch (_context6.prev = _context6.next) {
645
656
  case 0:
657
+ setLoading(true);
646
658
  dataObject = {
647
659
  articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti6 = productSelected.article) === null || _productSelected$arti6 === void 0 ? void 0 : _productSelected$arti6.id_article,
648
660
  articleData: updatedDescriptions
649
661
  };
650
- _context6.prev = 1;
651
- _context6.next = 4;
662
+ if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) dataObject["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
663
+ _context6.prev = 3;
664
+ _context6.next = 6;
652
665
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
653
666
  headers: {
654
667
  Authorization: token
655
668
  }
656
669
  });
657
670
 
658
- case 4:
671
+ case 6:
659
672
  setMessage("Descripciones guardadas con éxito");
660
- _context6.next = 10;
673
+ loadData();
674
+ _context6.next = 13;
661
675
  break;
662
676
 
663
- case 7:
664
- _context6.prev = 7;
665
- _context6.t0 = _context6["catch"](1);
677
+ case 10:
678
+ _context6.prev = 10;
679
+ _context6.t0 = _context6["catch"](3);
666
680
  console.log(_context6.t0);
667
681
 
668
- case 10:
682
+ case 13:
669
683
  case "end":
670
684
  return _context6.stop();
671
685
  }
672
686
  }
673
- }, _callee6, null, [[1, 7]]);
687
+ }, _callee6, null, [[3, 10]]);
674
688
  }));
675
689
 
676
690
  return function saveDescriptions() {
@@ -687,34 +701,37 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
687
701
  while (1) {
688
702
  switch (_context7.prev = _context7.next) {
689
703
  case 0:
704
+ setLoading(true);
690
705
  dataObject = {
691
706
  articleId: productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti7 = productSelected.article) === null || _productSelected$arti7 === void 0 ? void 0 : _productSelected$arti7.id_article,
692
707
  articleData: updatedDatasheets
693
708
  };
694
- _context7.prev = 1;
695
- _context7.next = 4;
709
+ if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) dataObject["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
710
+ _context7.prev = 3;
711
+ _context7.next = 6;
696
712
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
697
713
  headers: {
698
714
  Authorization: token
699
715
  }
700
716
  });
701
717
 
702
- case 4:
703
- setMessage("Fichas técnicas guardadas con éxito");
704
- _context7.next = 10;
718
+ case 6:
719
+ setMessage("Fichas técnicas guardadas");
720
+ loadData();
721
+ _context7.next = 13;
705
722
  break;
706
723
 
707
- case 7:
708
- _context7.prev = 7;
709
- _context7.t0 = _context7["catch"](1);
724
+ case 10:
725
+ _context7.prev = 10;
726
+ _context7.t0 = _context7["catch"](3);
710
727
  console.log(_context7.t0);
711
728
 
712
- case 10:
729
+ case 13:
713
730
  case "end":
714
731
  return _context7.stop();
715
732
  }
716
733
  }
717
- }, _callee7, null, [[1, 7]]);
734
+ }, _callee7, null, [[3, 10]]);
718
735
  }));
719
736
 
720
737
  return function saveDatasheets() {
@@ -758,6 +775,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
758
775
  return e.id;
759
776
  })
760
777
  };
778
+ if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) data["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
761
779
  valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
762
780
  if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
763
781
  return true;
@@ -777,18 +795,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
777
795
  }
778
796
 
779
797
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
780
- _context8.next = 29;
798
+ _context8.next = 30;
781
799
  break;
782
800
  }
783
801
 
784
- _context8.prev = 9;
802
+ _context8.prev = 10;
785
803
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
786
804
  e.uuid = (0, _uuid.v4)();
787
805
  });
788
806
  setDataImages(data);
789
807
 
790
808
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
791
- _context8.next = 21;
809
+ _context8.next = 22;
792
810
  break;
793
811
  }
794
812
 
@@ -804,40 +822,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
804
822
  };
805
823
  promiseArray.push(myBucket.putObject(params).promise());
806
824
  });
807
- _context8.next = 18;
825
+ _context8.next = 19;
808
826
  return Promise.all(promiseArray);
809
827
 
810
- case 18:
828
+ case 19:
811
829
  setImagesUploaded(true);
812
- _context8.next = 22;
830
+ _context8.next = 23;
813
831
  break;
814
832
 
815
- case 21:
833
+ case 22:
816
834
  setImagesUploaded(true);
817
835
 
818
- case 22:
819
- _context8.next = 27;
836
+ case 23:
837
+ _context8.next = 28;
820
838
  break;
821
839
 
822
- case 24:
823
- _context8.prev = 24;
824
- _context8.t0 = _context8["catch"](9);
840
+ case 25:
841
+ _context8.prev = 25;
842
+ _context8.t0 = _context8["catch"](10);
825
843
  console.log(_context8.t0); // setMainLoading(false);
826
844
 
827
- case 27:
828
- _context8.next = 30;
845
+ case 28:
846
+ _context8.next = 31;
829
847
  break;
830
848
 
831
- case 29:
849
+ case 30:
832
850
  // setMainLoading(false);
833
851
  setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
834
852
 
835
- case 30:
853
+ case 31:
836
854
  case "end":
837
855
  return _context8.stop();
838
856
  }
839
857
  }
840
- }, _callee8, null, [[9, 24]]);
858
+ }, _callee8, null, [[10, 25]]);
841
859
  })), [images, imagesUploaded]);
842
860
  (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
843
861
  return _regenerator.default.wrap(function _callee9$(_context9) {
@@ -845,41 +863,44 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
845
863
  switch (_context9.prev = _context9.next) {
846
864
  case 0:
847
865
  if (!imagesUploaded) {
848
- _context9.next = 11;
866
+ _context9.next = 13;
849
867
  break;
850
868
  }
851
869
 
870
+ setLoading(true);
852
871
  dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
853
872
  delete e.src;
854
873
  e.imageID = e.image_id;
855
874
  e.packingType = e.packing_type;
856
875
  e.imageType = e.image_type;
876
+ if (productSelected !== null && productSelected !== void 0 && productSelected.orderId) e["orderId"] = productSelected === null || productSelected === void 0 ? void 0 : productSelected.orderId;
857
877
  return e;
858
878
  });
859
- _context9.prev = 2;
860
- _context9.next = 5;
879
+ _context9.prev = 3;
880
+ _context9.next = 6;
861
881
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
862
882
  headers: {
863
883
  Authorization: token
864
884
  }
865
885
  });
866
886
 
867
- case 5:
887
+ case 6:
868
888
  setMessage("Imágenes guardadas con éxito");
869
- _context9.next = 11;
889
+ loadData();
890
+ _context9.next = 13;
870
891
  break;
871
892
 
872
- case 8:
873
- _context9.prev = 8;
874
- _context9.t0 = _context9["catch"](2);
893
+ case 10:
894
+ _context9.prev = 10;
895
+ _context9.t0 = _context9["catch"](3);
875
896
  console.log(_context9.t0);
876
897
 
877
- case 11:
898
+ case 13:
878
899
  case "end":
879
900
  return _context9.stop();
880
901
  }
881
902
  }
882
- }, _callee9, null, [[2, 8]]);
903
+ }, _callee9, null, [[3, 10]]);
883
904
  })), [dataImages, imagesUploaded]);
884
905
 
885
906
  var approveRejectButtons = function approveRejectButtons(action) {
@@ -1141,30 +1162,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1141
1162
  return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.article["id_auditor"]) === user.id_user;
1142
1163
  };
1143
1164
 
1144
- function specialistValid(tab) {
1145
- var concept = "";
1146
-
1147
- switch (tab) {
1148
- case "Ficha técnica":
1149
- concept = "datasheet";
1150
- break;
1151
-
1152
- case "Imágenes":
1153
- concept = "images";
1154
- break;
1155
-
1156
- default:
1157
- concept = "description";
1158
- break;
1159
- }
1160
-
1161
- return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
1162
- }
1163
-
1164
- function versionMatch() {
1165
- return (productSelected === null || productSelected === void 0 ? void 0 : productSelected.version) === version;
1166
- }
1167
-
1168
1165
  var createComment = /*#__PURE__*/function () {
1169
1166
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
1170
1167
  var _product$article2;
@@ -1407,6 +1404,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1407
1404
  Authorization: token
1408
1405
  }
1409
1406
  });
1407
+
1408
+ loadData();
1410
1409
  } catch (err) {
1411
1410
  console.log(err);
1412
1411
  }
@@ -1460,7 +1459,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1460
1459
  setAssignation: setAssignation,
1461
1460
  isRetailer: isRetailer,
1462
1461
  onClickSave: function onClickSave() {
1463
- return updateImages();
1462
+ var _product$services;
1463
+
1464
+ return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
1464
1465
  }
1465
1466
  })]
1466
1467
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -1477,12 +1478,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1477
1478
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1478
1479
  tabsSections: tabsSections,
1479
1480
  status: {
1480
- Descripción: (_servicesData$filter$ = servicesData.filter(function (service) {
1481
- return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "description";
1482
- })[0]) === null || _servicesData$filter$ === void 0 ? void 0 : _servicesData$filter$.status,
1483
- "Ficha técnica": (_servicesData$filter$2 = servicesData.filter(function (service) {
1484
- return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === "datasheet";
1485
- })[0]) === null || _servicesData$filter$2 === void 0 ? void 0 : _servicesData$filter$2.status,
1481
+ Descripción: product === null || product === void 0 ? void 0 : product.description_status,
1482
+ "Ficha técnica": product === null || product === void 0 ? void 0 : product.datasheet_status,
1486
1483
  Imágenes: product === null || product === void 0 ? void 0 : product.images_status
1487
1484
  },
1488
1485
  activeTab: activeTab,
@@ -1494,6 +1491,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1494
1491
  setAssignation: setAssignation,
1495
1492
  isRetailer: isRetailer,
1496
1493
  onClickSave: function onClickSave() {
1494
+ var _product$services2;
1495
+
1497
1496
  switch (activeTab) {
1498
1497
  case "Descripción":
1499
1498
  saveDescriptions();
@@ -1504,53 +1503,58 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1504
1503
  break;
1505
1504
 
1506
1505
  case "Imágenes":
1507
- updateImages();
1506
+ (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.images) === 1 && updateImages();
1508
1507
  break;
1509
1508
 
1510
1509
  default:
1511
1510
  break;
1512
1511
  }
1513
1512
  }
1514
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1513
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1515
1514
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1516
- children: [!imageLayout && activeTab === "Imágenes" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1517
- setSelectedImages: setSelectedImages,
1518
- checkAll: checkAll,
1519
- setCheckAll: setCheckAll
1520
- }), 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) {
1521
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1522
- articleId: productSelected.article.id_article,
1523
- version: version,
1515
+ children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1516
+ children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1517
+ setSelectedImages: setSelectedImages,
1518
+ checkAll: checkAll,
1519
+ setCheckAll: setCheckAll
1520
+ }), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : (_product$services4 = product.services) === null || _product$services4 === void 0 ? void 0 : _product$services4.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) {
1521
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1522
+ articleId: productSelected.article.id_article,
1523
+ version: version,
1524
+ activeSection: activeTab,
1525
+ inputGroup: dataGroup,
1526
+ dataInputs: datasheets[1],
1527
+ updatedDatasheets: updatedDatasheets,
1528
+ setUpdatedDatasheets: setUpdatedDatasheets
1529
+ }, index + "-" + activeRetailer.name);
1530
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1531
+ text: "No cuentas con este servicio",
1532
+ headerType: "input-name-header"
1533
+ })), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : (_product$services5 = product.services) === null || _product$services5 === void 0 ? void 0 : _product$services5.descriptions) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1524
1534
  activeSection: activeTab,
1525
- inputGroup: dataGroup,
1526
- dataInputs: datasheets[1],
1527
- updatedDatasheets: updatedDatasheets,
1528
- setUpdatedDatasheets: setUpdatedDatasheets
1529
- }, index + "-" + activeRetailer.name);
1530
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1531
- children: "no tienes este servicio"
1532
- })), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.descriptions) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1533
- activeSection: activeTab,
1534
- inputGroup: descriptions[0],
1535
- updatedDescriptions: updatedDescriptions,
1536
- setUpdatedDescriptions: setUpdatedDescriptions,
1537
- articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
1538
- version: version,
1539
- dinamicHeight: true
1540
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1541
- children: "no tienes este servicio"
1542
- })), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : (_product$services3 = product.services) === null || _product$services3 === void 0 ? void 0 : _product$services3.images) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
1543
- className: "container",
1544
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
1545
- className: "dropzone"
1546
- })), {}, {
1547
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1548
- children: thumbs()
1549
- })]
1550
- }))
1551
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
1552
- children: "no tienes este servicio"
1553
- }))]
1535
+ inputGroup: descriptions[0],
1536
+ updatedDescriptions: updatedDescriptions,
1537
+ setUpdatedDescriptions: setUpdatedDescriptions,
1538
+ articleId: product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article,
1539
+ version: version,
1540
+ dinamicHeight: true
1541
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1542
+ text: "No cuentas con este servicio",
1543
+ headerType: "input-name-header"
1544
+ })), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : (_product$services6 = product.services) === null || _product$services6 === void 0 ? void 0 : _product$services6.images) === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
1545
+ className: "container",
1546
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getRootProps({
1547
+ className: "dropzone"
1548
+ })), {}, {
1549
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread2.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
1550
+ children: thumbs()
1551
+ })]
1552
+ }))
1553
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1554
+ text: "No cuentas con este servicio",
1555
+ headerType: "input-name-header"
1556
+ }))]
1557
+ })
1554
1558
  }), (userAssigned(activeTab, "especialist" || "facilitator") || auditorAssigned()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1555
1559
  className: "commentary-box",
1556
1560
  children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -1610,8 +1614,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1610
1614
  sendToFacilitator: sendToFacilitator,
1611
1615
  approveRejectButtons: approveRejectButtons
1612
1616
  }), message.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
1613
- buttonType: "delete-product",
1614
- componentsArray: componentsArray.length > 0 ? componentsArray : [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1617
+ buttonType: componentsArray.length > 0 && "delete-product",
1618
+ componentsArray: componentsArray.length > 0 ? componentsArray : [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
1619
+ src: _genericModalCheck.default,
1620
+ alt: "success icon"
1621
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1615
1622
  headerType: "retailer-name-header",
1616
1623
  text: message,
1617
1624
  color: "white"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "20.0.0",
3
+ "version": "21.0.2",
4
4
  "dependencies": {
5
5
  "@babel/runtime": "^7.17.2",
6
6
  "@storybook/addon-postcss": "^2.0.0",
@@ -77,8 +77,8 @@ export const GeneralInput = ({
77
77
  updatedDescriptions={updatedDatasheets}
78
78
  setUpdatedDescriptions={setUpdatedDescriptions}
79
79
  inputValue={inputValue?.replace(/<br>/gm, "<p><br></p>")}
80
- isRequired={isRequired && !inputValue}
81
- ></InputFormatter>
80
+ isRequired={isRequired}
81
+ />
82
82
  )}
83
83
  </Container>
84
84
  );
@@ -16,6 +16,10 @@ export const Container = styled.div`
16
16
  left: 0;
17
17
  z-index: 100;
18
18
 
19
+ h2 {
20
+ overflow: initial;
21
+ }
22
+
19
23
  .global-styles {
20
24
  background-color: ${GlobalColors.deep_gray};
21
25
  height: auto;
@@ -20,7 +20,7 @@ export const InputFormatter = ({
20
20
  setConvertedText((current) => (current = value));
21
21
  !id.includes("commentary") &&
22
22
  addTextAreaToArray(
23
- value.replace(/<\/?p>/gm, ""),
23
+ value.trim().replace(/<\/?p>/gm, ""),
24
24
  updatedDescriptions,
25
25
  setUpdatedDescriptions
26
26
  );
@@ -47,13 +47,15 @@ export const InputFormatter = ({
47
47
  top: e.clientY - elementPosition.y,
48
48
  });
49
49
  };
50
-
50
+ console.log(convertedText);
51
51
  return (
52
52
  <Container
53
53
  focus={focus}
54
54
  selection={selection}
55
55
  position={position}
56
- isRequired={isRequired}
56
+ isRequired={
57
+ isRequired && convertedText.replace(/<\/?p>/gm, "") === "<br>"
58
+ }
57
59
  onClick={(e) => {
58
60
  getCursorPosition(e);
59
61
  }}
@@ -15,7 +15,6 @@ export default function LabelToInput(props) {
15
15
  ) : (
16
16
  <Input
17
17
  {...props}
18
- width={"100%"}
19
18
  onBlur={() => {
20
19
  props.onBlur && props.onBlur();
21
20
  setIsActive(false);
@@ -6,13 +6,13 @@ export const MainContainer = styled.div`
6
6
  align-items: center;
7
7
  width: fit-content;
8
8
  height: 20px;
9
- padding: 0 5px;
10
9
  box-sizing: border-box;
11
10
  border-radius: 2px;
12
- margin-left: 15px;
11
+ margin-left: auto;
13
12
  white-space: nowrap;
14
13
  overflow-x: auto;
15
14
  overflow-y: hidden;
15
+
16
16
  & > p {
17
17
  font-family: ${FontFamily.AvenirNext};
18
18
  font-weight: 400;
@@ -22,6 +22,9 @@ export const MainContainer = styled.div`
22
22
  background-color: ${GlobalColors.s2};
23
23
  padding: 1px 3px;
24
24
  border-radius: 3px;
25
+ min-width: 50px;
26
+ height: 21px;
27
+ text-align: center;
25
28
  }
26
29
  border: ${(props) => props.error && "1px solid red"};
27
30
  ::-webkit-scrollbar {
@@ -0,0 +1,12 @@
1
+ import { Container, Loader } from "./styles";
2
+ export const Loading = () => {
3
+ return (
4
+ <Container>
5
+ <Loader>
6
+ <span className="first"></span>
7
+ <span className="second"></span>
8
+ <span className="third"></span>
9
+ </Loader>
10
+ </Container>
11
+ );
12
+ };
@@ -0,0 +1,57 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+ height: 100%;
8
+ width: 100%;
9
+ `;
10
+ export const Loader = styled.div`
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ height: 100%;
15
+ width: 100%;
16
+ span {
17
+ display: inline-block;
18
+ border-radius: 100%;
19
+ margin: 35px 5px;
20
+ opacity: 1;
21
+ }
22
+ .first {
23
+ background-color: #ff75cf;
24
+ }
25
+ .second {
26
+ background-color: #e33aa9;
27
+ }
28
+ .third {
29
+ background-color: #b12d84;
30
+ }
31
+ span:nth-child(1) {
32
+ width: 16px;
33
+ height: 16px;
34
+ animation: opacitychange 1s ease-in-out infinite;
35
+ }
36
+ span:nth-child(2) {
37
+ width: 18px;
38
+ height: 18px;
39
+
40
+ animation: opacitychange 1s ease-in-out 0.33s infinite;
41
+ }
42
+ span:nth-child(3) {
43
+ width: 20px;
44
+ height: 20px;
45
+
46
+ animation: opacitychange 1s ease-in-out 0.66s infinite;
47
+ }
48
+ @keyframes opacitychange {
49
+ 0%,
50
+ 100% {
51
+ opacity: 0;
52
+ }
53
+ 60% {
54
+ opacity: 1;
55
+ }
56
+ }
57
+ `;