contentoh-components-library 21.4.68 → 21.4.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  2. package/dist/components/atoms/Avatar/index.js +3 -2
  3. package/dist/components/atoms/CheckBox/styles.js +1 -1
  4. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +90 -0
  5. package/dist/components/atoms/ImageCarousel/index.js +120 -0
  6. package/dist/components/atoms/ImageCarousel/styles.js +18 -0
  7. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  8. package/dist/components/atoms/PercentTag/PercentTag.stories.js +31 -0
  9. package/dist/components/atoms/PercentTag/index.js +23 -0
  10. package/dist/components/atoms/PercentTag/styles.js +22 -0
  11. package/dist/components/atoms/RatingStars/RatingStars.stories.js +30 -0
  12. package/dist/components/atoms/RatingStars/index.js +53 -0
  13. package/dist/components/atoms/RatingStars/styles.js +18 -0
  14. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +48 -0
  15. package/dist/components/atoms/RetailerCatalog/index.js +69 -0
  16. package/dist/components/atoms/RetailerCatalog/styles.js +20 -0
  17. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +33 -0
  18. package/dist/components/atoms/RetailerOption/index.js +62 -0
  19. package/dist/components/atoms/RetailerOption/styles.js +20 -0
  20. package/dist/components/atoms/RetailersList/RetailersList.stories.js +45 -0
  21. package/dist/components/atoms/RetailersList/index.js +46 -0
  22. package/dist/components/atoms/RetailersList/styles.js +18 -0
  23. package/dist/components/atoms/SliderToolTip/styles.js +1 -1
  24. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +73 -0
  25. package/dist/components/atoms/UserCatalog/index.js +101 -0
  26. package/dist/components/atoms/UserCatalog/styles.js +18 -0
  27. package/dist/components/atoms/UserOption/UserOption.stories.js +40 -0
  28. package/dist/components/atoms/UserOption/index.js +130 -0
  29. package/dist/components/atoms/UserOption/styles.js +20 -0
  30. package/dist/components/atoms/UserSelector/UserSelector.stories.js +40 -0
  31. package/dist/components/atoms/UserSelector/index.js +98 -0
  32. package/dist/components/atoms/UserSelector/styles.js +32 -0
  33. package/dist/components/molecules/BoxAttribute/index.js +3 -3
  34. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  35. package/dist/components/molecules/BoxButtons/index.js +0 -1
  36. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  37. package/dist/components/molecules/GalleryElement/index.js +16 -12
  38. package/dist/components/molecules/GalleryElement/styles.js +1 -1
  39. package/dist/components/molecules/GalleryHeader/index.js +3 -0
  40. package/dist/components/molecules/GalleryHeader/styles.js +1 -1
  41. package/dist/components/molecules/GridItem/GridItem.stories.js +123 -0
  42. package/dist/components/molecules/GridItem/index.js +152 -0
  43. package/dist/components/molecules/GridItem/styles.js +20 -0
  44. package/dist/components/molecules/HeaderItem/ColumnItem.js +23 -0
  45. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +70 -0
  46. package/dist/components/molecules/HeaderItem/index.js +42 -0
  47. package/dist/components/molecules/HeaderItem/styles.js +30 -0
  48. package/dist/components/molecules/HeaderTop/index.js +68 -11
  49. package/dist/components/molecules/RowItem/ColumnItem.js +23 -0
  50. package/dist/components/molecules/RowItem/RowItem.stories.js +5242 -0
  51. package/dist/components/molecules/RowItem/index.js +58 -0
  52. package/dist/components/molecules/RowItem/styles.js +30 -0
  53. package/dist/components/molecules/SignInLogin/index.js +36 -28
  54. package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
  55. package/dist/components/organisms/Chat/Chat.stories.js +27 -8
  56. package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
  57. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  58. package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
  59. package/dist/components/organisms/Chat/Footer/index.js +48 -39
  60. package/dist/components/organisms/Chat/index.js +49 -4
  61. package/dist/components/organisms/Chat/styles.js +1 -1
  62. package/dist/components/organisms/DashboardMetric/index.js +12 -6
  63. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  64. package/dist/components/organisms/GridProducts/GridProducts.stories.js +5097 -0
  65. package/dist/components/organisms/GridProducts/index.js +63 -0
  66. package/dist/components/organisms/GridProducts/styles.js +18 -0
  67. package/dist/components/organisms/GridProducts/utils.js +149 -0
  68. package/dist/components/organisms/InputGroup/index.js +1 -10
  69. package/dist/components/organisms/Modal/styles.js +1 -1
  70. package/dist/components/organisms/VersionSelector/index.js +1 -1
  71. package/dist/components/pages/Dashboard/Dashboard.stories.js +33 -36
  72. package/dist/components/pages/Dashboard/index.js +37 -9
  73. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -3
  74. package/dist/components/pages/ProviderProductEdition/index.js +120 -144
  75. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  76. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +7 -3
  77. package/dist/components/pages/RetailerProductEdition/index.js +279 -274
  78. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  79. package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
  80. package/dist/global-files/data.js +11 -3
  81. package/dist/global-files/variables.js +5 -1
  82. package/dist/index.js +201 -58
  83. package/package.json +2 -3
  84. package/src/components/atoms/Avatar/index.js +8 -2
  85. package/src/components/atoms/CheckBox/styles.js +2 -0
  86. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
  87. package/src/components/atoms/ImageCarousel/index.js +103 -0
  88. package/src/components/atoms/ImageCarousel/styles.js +79 -0
  89. package/src/components/atoms/InputFormatter/styles.js +2 -1
  90. package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
  91. package/src/components/atoms/PercentTag/index.js +9 -0
  92. package/src/components/atoms/PercentTag/styles.js +69 -0
  93. package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
  94. package/src/components/atoms/RatingStars/index.js +31 -0
  95. package/src/components/atoms/RatingStars/styles.js +28 -0
  96. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
  97. package/src/components/atoms/RetailerCatalog/index.js +49 -0
  98. package/src/components/atoms/RetailerCatalog/styles.js +30 -0
  99. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
  100. package/src/components/atoms/RetailerOption/index.js +53 -0
  101. package/src/components/atoms/RetailerOption/styles.js +41 -0
  102. package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
  103. package/src/components/atoms/RetailersList/index.js +20 -0
  104. package/src/components/atoms/RetailersList/styles.js +19 -0
  105. package/src/components/atoms/SliderToolTip/styles.js +1 -1
  106. package/src/components/atoms/TabSection/styles.js +1 -1
  107. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
  108. package/src/components/atoms/UserCatalog/index.js +100 -0
  109. package/src/components/atoms/UserCatalog/styles.js +24 -0
  110. package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
  111. package/src/components/atoms/UserOption/index.js +95 -0
  112. package/src/components/atoms/UserOption/styles.js +61 -0
  113. package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
  114. package/src/components/atoms/UserSelector/index.js +86 -0
  115. package/src/components/atoms/UserSelector/styles.js +55 -0
  116. package/src/components/molecules/BoxAttribute/index.js +32 -25
  117. package/src/components/molecules/BoxAttribute/styles.js +1 -1
  118. package/src/components/molecules/BoxButtons/index.js +23 -22
  119. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  120. package/src/components/molecules/GalleryElement/index.js +14 -8
  121. package/src/components/molecules/GalleryElement/styles.js +7 -0
  122. package/src/components/molecules/GalleryHeader/index.js +1 -0
  123. package/src/components/molecules/GalleryHeader/styles.js +4 -0
  124. package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
  125. package/src/components/molecules/GridItem/index.js +105 -0
  126. package/src/components/molecules/GridItem/styles.js +104 -0
  127. package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
  128. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
  129. package/src/components/molecules/HeaderItem/index.js +26 -0
  130. package/src/components/molecules/HeaderItem/styles.js +27 -0
  131. package/src/components/molecules/HeaderTop/index.js +52 -6
  132. package/src/components/molecules/RowItem/ColumnItem.js +9 -0
  133. package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
  134. package/src/components/molecules/RowItem/index.js +45 -0
  135. package/src/components/molecules/RowItem/styles.js +40 -0
  136. package/src/components/molecules/SignInLogin/index.js +11 -11
  137. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
  138. package/src/components/molecules/TagAndInput/index.js +6 -5
  139. package/src/components/organisms/Chat/Chat.stories.js +27 -7
  140. package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
  141. package/src/components/organisms/Chat/ContainerItems/styles.js +14 -2
  142. package/src/components/organisms/Chat/ContentChat/index.js +88 -12
  143. package/src/components/organisms/Chat/Footer/index.js +11 -0
  144. package/src/components/organisms/Chat/index.js +46 -4
  145. package/src/components/organisms/Chat/styles.js +4 -0
  146. package/src/components/organisms/DashboardMetric/index.js +6 -3
  147. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  148. package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
  149. package/src/components/organisms/GridProducts/index.js +50 -0
  150. package/src/components/organisms/GridProducts/styles.js +14 -0
  151. package/src/components/organisms/GridProducts/utils.js +111 -0
  152. package/src/components/organisms/InputGroup/index.js +131 -119
  153. package/src/components/organisms/Modal/styles.js +4 -1
  154. package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
  155. package/src/components/organisms/VersionSelector/index.js +1 -1
  156. package/src/components/pages/Dashboard/Dashboard.stories.js +33 -38
  157. package/src/components/pages/Dashboard/index.js +36 -7
  158. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +100 -83
  159. package/src/components/pages/ProviderProductEdition/index.js +100 -131
  160. package/src/components/pages/ProviderProductEdition/styles.js +5 -1
  161. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -2
  162. package/src/components/pages/RetailerProductEdition/index.js +107 -137
  163. package/src/components/pages/RetailerProductEdition/styles.js +4 -0
  164. package/src/components/pages/RetailerProductEdition/utils.js +37 -0
  165. package/src/global-files/data.js +7 -13
  166. package/src/global-files/variables.js +4 -0
  167. package/src/index.js +11 -0
@@ -16,7 +16,7 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI0OTMyY2JhZC1lYzcyLTRjYWItODgyNS0wMzY2M2RkNmE2ODIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY5Mjc1MDY0NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY5Mjc1NDI0NywiaWF0IjoxNjkyNzUwNjQ3LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.eqOY-gcS-W99WcEC632Ewckcg3WJzKoV9fIGcn1AkEE44_odGTcEk8fhVs-6_evIJkfShQOP0RFX0d2Dn31F-xFh5Lez6LvbT9F41_rAmMb3ELyRvdcz42V4eMw2IBH-FGrpGhSsJOHKV2T3WuUyZxPJu-C04ZAadfFSoNBBWnxX6SFk_eefcp9KghNmnELSSnWDh6DD1XDrWqEaLOVlQ5H7q4ARJqBo07KcXHIQo056anVud-inUMiX9KDTaorXdBCD0doWgv8NkYWSEpUS_Ctj-NG6vAled9g-6oLnC6DLR_ay6PRnAKGVNCv8bRZJL0GqF8ZnWk02svDHfUPJ0Q",
19
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
20
20
  productSelected: {
21
21
  services: {
22
22
  datasheets: 1,
@@ -73,7 +73,11 @@ RetailerProductEditionDefault.args = {
73
73
  upc: "7543453453",
74
74
  },
75
75
  location: {
76
- product: { articleId: 39290, versionId: 7 },
76
+ product: { articleId: 354, versionId: 3 },
77
+ state: {
78
+ withChat: true,
79
+ chatType: "product_status",
80
+ },
77
81
  },
78
82
  user: {
79
83
  id_user: 37,
@@ -24,15 +24,20 @@ import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.s
24
24
  import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
25
25
  import { TagAndInput } from "../../molecules/TagAndInput/index";
26
26
  import { Button } from "../../atoms/GeneralButton";
27
- import { Commentary } from "../../atoms/Commentary";
28
27
  import { GenericModal } from "../../atoms/GenericModal";
29
28
  import { ScreenHeader } from "../../atoms/ScreenHeader";
30
29
  import { Loading } from "../../atoms/Loading";
31
30
  import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
32
- import errorModal from "../../../assets/images/genericModal/errorModal.svg";
33
31
  import { VersionSelector } from "../../organisms/VersionSelector";
34
32
  import { useCloseModal } from "../../../global-files/customHooks";
35
- import { getAuditVersion, getInputsData } from "./utils";
33
+ import {
34
+ getAuditVersion,
35
+ getInputsData,
36
+ createMessage,
37
+ sendMessage,
38
+ } from "./utils";
39
+ import { Modal } from "../../organisms/Modal";
40
+ import { ButtonV2 } from "../../atoms/ButtonV2";
36
41
 
37
42
  const reducerImages = (state, action) => {
38
43
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -132,6 +137,7 @@ export const RetailerProductEdition = ({
132
137
  const [datasheets, setDatasheets] = useState([]);
133
138
  const [images, setImages] = useReducer(reducerImages, {});
134
139
  const [showModal, setShowModal] = useState(false);
140
+ const [showRejectModal, setShowRejectModal] = useState(false);
135
141
  const { getRootProps, getInputProps } = useDropzone({
136
142
  accept: "image/*",
137
143
  noKeyboard: true,
@@ -218,6 +224,11 @@ export const RetailerProductEdition = ({
218
224
  const [auditDescriptions, setAuditDescriptions] = useState([]);
219
225
  const [auditImages, setAuditImages] = useState([]);
220
226
  const [compare, setCompare] = useState(false);
227
+ const [valRejAll, setValRejAll] = useState(false);
228
+
229
+ const [desc, setDesc] = useState([]);
230
+ const [fich, setFich] = useState([]);
231
+ const [imag, setImag] = useState([]);
221
232
 
222
233
  useEffect(async () => {
223
234
  const { id_article } = product?.article || {};
@@ -452,7 +463,7 @@ export const RetailerProductEdition = ({
452
463
  return images?.values?.map((image, index) => (
453
464
  <GalleryElement
454
465
  setCheckAll={setCheckAll}
455
- key={index + "-" + imageType.name}
466
+ key={index + "-" + image.name}
456
467
  image={image}
457
468
  gridLayout={imageLayout}
458
469
  id={"gallery-element-" + index}
@@ -563,6 +574,7 @@ export const RetailerProductEdition = ({
563
574
  active: images?.values?.some((value) => value?.image_id === e?.id),
564
575
  }));
565
576
  setSocketType(imageInputs);
577
+ console.log(images);
566
578
  }, [images]);
567
579
 
568
580
  const updateImages = useCallback(async () => {
@@ -937,6 +949,25 @@ export const RetailerProductEdition = ({
937
949
  const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
938
950
  res.data.body
939
951
  );
952
+ const messageToChat = createMessage(
953
+ product.retailers,
954
+ activeRetailer.id,
955
+ evalStatus,
956
+ newStatus,
957
+ activeTab
958
+ );
959
+
960
+ const data = {
961
+ paramsBody: {
962
+ id: product.article.id_article,
963
+ version: version,
964
+ items: [{ type: "status", value: messageToChat }],
965
+ retailerId: activeRetailer.id,
966
+ status: product.status,
967
+ },
968
+ paramsHeader: { Authorization: token },
969
+ };
970
+ await sendMessage(data);
940
971
  if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
941
972
  productTemp[`${concept}_status`] = newStatus;
942
973
  await loadData();
@@ -979,35 +1010,19 @@ export const RetailerProductEdition = ({
979
1010
  return product?.article[`id_auditor`] === user.id_user;
980
1011
  };
981
1012
 
982
- const createComment = async (e, body, tab) => {
983
- let concept = "";
984
- switch (activeTab) {
985
- case "Ficha técnica":
986
- concept = "datasheet";
987
- break;
988
- case "Imágenes":
989
- concept = "images";
990
- break;
991
-
992
- default:
993
- concept = "description";
994
- break;
995
- }
1013
+ const createComment = async (messages = [], retailerId) => {
996
1014
  const data = {
997
- articleId: product?.article?.id_article,
998
- orderId: product?.orderId,
999
- message: body?.replace(/<.*?\/?>/gm, ""),
1000
- concept: concept,
1001
- version: version,
1002
- };
1003
- await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
1004
- headers: {
1005
- Authorization: token,
1015
+ paramsBody: {
1016
+ id: product.article.id_article,
1017
+ version: version,
1018
+ items: messages,
1019
+ retailerId: retailerId,
1020
+ status: product.status,
1006
1021
  },
1007
- });
1008
- await getComments(tab);
1022
+ paramsHeader: { Authorization: token },
1023
+ };
1009
1024
  setMessage("");
1010
- setComponentsArray([]);
1025
+ return sendMessage(data);
1011
1026
  };
1012
1027
 
1013
1028
  const getRequired = (services) => {
@@ -1259,6 +1274,7 @@ export const RetailerProductEdition = ({
1259
1274
  };
1260
1275
 
1261
1276
  useEffect(() => {
1277
+ console.log(servicesData, "servicesData");
1262
1278
  let status = getRetailerStatus(servicesData, activeTab);
1263
1279
  setRetailerStatus(status);
1264
1280
  }, [activeTab, servicesData, activeRetailer]);
@@ -1336,7 +1352,6 @@ export const RetailerProductEdition = ({
1336
1352
  // };
1337
1353
 
1338
1354
  const validateAll = async (result) => {
1339
-
1340
1355
  try {
1341
1356
  setLoading(true);
1342
1357
  const evaluationArray = [];
@@ -1354,6 +1369,8 @@ export const RetailerProductEdition = ({
1354
1369
  break;
1355
1370
  }
1356
1371
 
1372
+ const messages = [];
1373
+
1357
1374
  servicesData?.forEach((ret) => {
1358
1375
  if (conceptArray.includes(ret.service)) {
1359
1376
  let data = {
@@ -1373,19 +1390,19 @@ export const RetailerProductEdition = ({
1373
1390
  );
1374
1391
  }
1375
1392
  });
1376
-
1377
1393
  await Promise.all(evaluationArray);
1378
1394
 
1379
1395
  const productTemp = product;
1380
1396
  productTemp.status = `${result}A`;
1381
1397
  productTemp.datasheet_status =
1382
- productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
1398
+ productTemp.datasheet_status === "NS" ? "NS" : `${result}A`;
1383
1399
  productTemp.description_status =
1384
- productTemp.description_status === "NA" ? "NA" : `${result}A`;
1400
+ productTemp.description_status === "NS" ? "NS" : `${result}A`;
1385
1401
  productTemp.images_status =
1386
- productTemp.images_status === "NA" ? "NA" : `${result}A`;
1402
+ productTemp.images_status === "NS" ? "NS" : `${result}A`;
1387
1403
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1388
1404
  setProduct(productTemp);
1405
+ const messagesResponse = await Promise.all(messages);
1389
1406
 
1390
1407
  await loadData();
1391
1408
  } catch (error) {
@@ -1401,8 +1418,10 @@ export const RetailerProductEdition = ({
1401
1418
  setCompare={setCompare}
1402
1419
  isAuditor={[1, 6].includes(user.id_role)}
1403
1420
  withChat={location?.state?.withChat}
1404
- productSelected={productSelected}
1421
+ chatType={location?.state?.chatType}
1422
+ productSelected={product}
1405
1423
  token={token}
1424
+ activeRetailer={activeRetailer}
1406
1425
  />
1407
1426
  <div className="data-container">
1408
1427
  <div className="image-data-panel">
@@ -1442,36 +1461,7 @@ export const RetailerProductEdition = ({
1442
1461
  sendToFacilitator("A");
1443
1462
  }}
1444
1463
  reject={() => {
1445
- sendToFacilitator("R");
1446
- setMessage("Rechazado");
1447
- setComponentsArray([
1448
- <img src={errorModal} />,
1449
- <ScreenHeader
1450
- text={"Agrega tu comentarios para enviar el rechazo"}
1451
- headerType={"input-name-header"}
1452
- color={"white"}
1453
- />,
1454
- <TagAndInput
1455
- label={"Caja de Comentario"}
1456
- inputType={"textarea"}
1457
- inputId={"modal-commentary-box"}
1458
- index={0}
1459
- color={"white"}
1460
- />,
1461
- <Button
1462
- buttonType={"general-default-button"}
1463
- label={"Enviar comentario"}
1464
- onClick={(e) =>
1465
- createComment(
1466
- e,
1467
- document.querySelector(
1468
- "#modal-commentary-box .ql-container .ql-editor > p"
1469
- ).innerHTML,
1470
- activeTab
1471
- )
1472
- }
1473
- />,
1474
- ]);
1464
+ setShowRejectModal(true);
1475
1465
  }}
1476
1466
  showApproveRejectAll={
1477
1467
  approveRejectAllButtons() && (auditorAssigned() || userAssigned())
@@ -1481,36 +1471,8 @@ export const RetailerProductEdition = ({
1481
1471
  }
1482
1472
  approveAll={() => validateAll("A")}
1483
1473
  rejectAll={() => {
1484
- validateAll("R");
1485
- setMessage("Rechazado");
1486
- setComponentsArray([
1487
- <img src={errorModal} />,
1488
- <ScreenHeader
1489
- text={"Agrega tu comentarios para enviar el rechazo"}
1490
- headerType={"input-name-header"}
1491
- color={"white"}
1492
- />,
1493
- <TagAndInput
1494
- label={"Caja de Comentario"}
1495
- inputType={"textarea"}
1496
- inputId={"modal-commentary-box"}
1497
- index={0}
1498
- color={"white"}
1499
- />,
1500
- <Button
1501
- buttonType={"general-default-button"}
1502
- label={"Enviar comentario"}
1503
- onClick={(e) =>
1504
- createComment(
1505
- e,
1506
- document.querySelector(
1507
- "#modal-commentary-box .ql-container .ql-editor > p"
1508
- ).innerHTML,
1509
- activeTab
1510
- )
1511
- }
1512
- />,
1513
- ]);
1474
+ setShowRejectModal(true);
1475
+ setValRejAll(true);
1514
1476
  }}
1515
1477
  />
1516
1478
  <FullTabsMenu
@@ -1526,6 +1488,12 @@ export const RetailerProductEdition = ({
1526
1488
  isRetailer={isRetailer}
1527
1489
  showSaveButton={auditorAssigned() || userAssigned()}
1528
1490
  version={version}
1491
+ desc={desc}
1492
+ setDesc={setDesc}
1493
+ fich={fich}
1494
+ setFich={setFich}
1495
+ imag={imag}
1496
+ setImag={setImag}
1529
1497
  updatedDescriptions={updatedDescriptions}
1530
1498
  setUpdatedDescriptions={setUpdatedDescriptions}
1531
1499
  updatedDatasheets={updatedDatasheets}
@@ -1640,47 +1608,6 @@ export const RetailerProductEdition = ({
1640
1608
  {(userAssigned(activeTab) || auditorAssigned()) &&
1641
1609
  product[`${getConcept(activeTab)}_status`] !== "NS" && (
1642
1610
  <div className="commentary-box">
1643
- {!comment ? (
1644
- <div className="commentary">
1645
- <TagAndInput
1646
- label={"Caja de Comentario"}
1647
- inputType={"textarea"}
1648
- inputCols={80}
1649
- inputRows={4}
1650
- inputId={"commentary-box"}
1651
- index={0}
1652
- />
1653
- <div className="buttons-box">
1654
- <Button
1655
- buttonType={"general-transparent-button"}
1656
- label={"Enviar comentario"}
1657
- onClick={(e) =>
1658
- createComment(
1659
- e,
1660
- document.querySelector(
1661
- "#commentary-box .ql-container .ql-editor > p"
1662
- ).innerHTML,
1663
- activeTab
1664
- )
1665
- }
1666
- />
1667
- </div>
1668
- </div>
1669
- ) : (
1670
- <div className="feedback-box">
1671
- <Commentary
1672
- comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
1673
- reviewed={crossComment}
1674
- />
1675
- <Button
1676
- buttonType={"circular-button accept-button"}
1677
- onClick={async () => {
1678
- setCrossComment(true);
1679
- commentRevised();
1680
- }}
1681
- />
1682
- </div>
1683
- )}
1684
1611
  {[7, 8].includes(user.id_role) && (
1685
1612
  <Button
1686
1613
  buttonType={
@@ -1738,6 +1665,49 @@ export const RetailerProductEdition = ({
1738
1665
  jwt={token}
1739
1666
  />
1740
1667
  )}
1668
+ {showRejectModal && (
1669
+ <Modal
1670
+ title={`Agregar mensaje de rechazo para ${activeTab?.toLowerCase()}`}
1671
+ show={showRejectModal}
1672
+ customComponent={
1673
+ <TagAndInput
1674
+ inputType={"textarea"}
1675
+ inputId={"modal-message-box"}
1676
+ index={0}
1677
+ color={"white"}
1678
+ />
1679
+ }
1680
+ buttons={[
1681
+ <ButtonV2
1682
+ key={"btn-Cancelar"}
1683
+ type={"white"}
1684
+ label={"Cancelar"}
1685
+ size={12}
1686
+ onClick={() => {
1687
+ setShowRejectModal(false);
1688
+ }}
1689
+ />,
1690
+ <ButtonV2
1691
+ key={"btn-Aceptar"}
1692
+ type={"pink"}
1693
+ label={"Aceptar"}
1694
+ size={12}
1695
+ onClick={async () => {
1696
+ const body = document.querySelector(
1697
+ "#modal-message-box .ql-container .ql-editor > p"
1698
+ ).innerHTML;
1699
+ const messages = [
1700
+ { type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
1701
+ ];
1702
+ await createComment(messages, activeRetailer.id);
1703
+ valRejAll ? validateAll("R") : sendToFacilitator("R");
1704
+ setMessage("Rechazado");
1705
+ setShowRejectModal(false);
1706
+ }}
1707
+ />,
1708
+ ]}
1709
+ />
1710
+ )}
1741
1711
  </Container>
1742
1712
  );
1743
1713
  };
@@ -89,6 +89,10 @@ export const Container = styled.div`
89
89
  }
90
90
  }
91
91
  }
92
+ #modal-message-box {
93
+ width: 400px;
94
+ height: 100px;
95
+ }
92
96
  .container {
93
97
  width: 100%;
94
98
  height: 100%;
@@ -1,4 +1,5 @@
1
1
  import axios from "axios";
2
+ import { fetchPOST } from "../../../global-files/handle_http";
2
3
 
3
4
  export const getAuditVersion = async (articleId, setState, token) => {
4
5
  const auditResponse = await axios.get(
@@ -32,3 +33,39 @@ export const getInputsData = (
32
33
  setDescriptionState(descriptions);
33
34
  }
34
35
  };
36
+
37
+ export const translateService = (tab) => {
38
+ switch (tab) {
39
+ case "description":
40
+ case "Descripción":
41
+ return "Descripciones";
42
+ case "datasheet":
43
+ case "Ficha técnica":
44
+ return "Fichas técnicas";
45
+ case "images":
46
+ case "Imágenes":
47
+ return "Imágenes";
48
+ }
49
+ };
50
+
51
+ export const createMessage = (
52
+ retailers,
53
+ idRetailer,
54
+ oldStatus,
55
+ newStatus,
56
+ service
57
+ ) => {
58
+ const [retailer] = retailers?.filter((ret) => ret.id === idRetailer) || [];
59
+ return `${translateService(service)} de ${
60
+ retailer.name
61
+ } |${oldStatus}| a |${newStatus}`;
62
+ };
63
+
64
+ export const sendMessage = async (data) => {
65
+ const { paramsBody, paramsHeader } = data;
66
+ return fetchPOST(
67
+ process.env.REACT_APP_CREATE_MESSAGES,
68
+ paramsBody,
69
+ paramsHeader
70
+ );
71
+ };
@@ -7,29 +7,23 @@ export const getRetailerServices = async (
7
7
  category,
8
8
  categoryId,
9
9
  version,
10
- token
10
+ Authorization
11
11
  ) => {
12
12
  try {
13
13
  const responseArray = await Promise.all([
14
14
  axios.post(
15
15
  `${process.env.REACT_APP_ARTICLE_DATA_DATASHEET_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`,
16
- {
17
-
18
- },
19
- {
20
- headers: {
21
- Authorization: token,
22
- },
23
- }
16
+ {},
17
+ { headers: { Authorization } }
24
18
  ),
25
19
  axios.get(
26
- `${process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`
20
+ `${process.env.REACT_APP_ARTICLE_DATA_DESCRIPTION_ENDPOINT}?idCategory=${categoryId}&articleId=${articleId}&version=${version}`,
21
+ { headers: { Authorization } }
27
22
  ),
28
23
  axios.post(
29
24
  `${process.env.REACT_APP_ARTICLE_DATA_IMAGES_ENDPOINT}?articleId=${articleId}&version=${version}`,
30
- {
31
- category,
32
- }
25
+ { category },
26
+ { headers: { Authorization } }
33
27
  ),
34
28
  ]);
35
29
 
@@ -15,6 +15,10 @@ export const GlobalColors = {
15
15
  finished: "#18A0FB",
16
16
  exported: "#71DE56",
17
17
  white: "#FFFFFF",
18
+ gray_light: "#F0F0F0",
19
+ gray:"#707070",
20
+ blue_light:"#F7F7FC",
21
+ purple:"#8A6CAA",
18
22
  };
19
23
 
20
24
  export const FontFamily = {
package/src/index.js CHANGED
@@ -33,6 +33,13 @@ export * from "./components/atoms/ImagePreview/index";
33
33
  export * from "./components/atoms/InputText/index";
34
34
  export * from "./components/atoms/NotFound/index";
35
35
  export * from "./components/atoms/Tooltip/index";
36
+ export * from "./components/atoms/UserOption/index";
37
+ export * from "./components/atoms/UserCatalog/index";
38
+ export * from "./components/atoms/UserSelector/index";
39
+ export * from "./components/atoms/ImageCarousel/index";
40
+ export * from "./components/atoms/RetailersList/index";
41
+ export * from "./components/atoms/RetailerOption/index";
42
+ export * from "./components/atoms/RetailerCatalog/index";
36
43
 
37
44
  //molecules
38
45
  export * from "./components/molecules/AvatarAndValidation/index";
@@ -65,6 +72,9 @@ export * from "./components/molecules/SelectV2/index";
65
72
  export * from "./components/molecules/Dropdown/index";
66
73
  export * from "./components/molecules/StripeCardForm/index";
67
74
  export * from "./components/molecules/StripeCardSelector/index";
75
+ export * from "./components/molecules/GridItem/index";
76
+ export * from "./components/molecules/HeaderItem/index";
77
+ export * from "./components/molecules/RowItem/index";
68
78
 
69
79
  //organisms
70
80
  export * from "./components/organisms/ChangePassword/index";
@@ -82,6 +92,7 @@ export * from "./components/organisms/OrderDetail/index";
82
92
  export * from "./components/organisms/RangeCalendar";
83
93
  export * from "./components/organisms/TableResizable";
84
94
  export * from "./components/organisms/SideModal/index";
95
+ export * from "./components/organisms/GridProducts/index";
85
96
  export * from "./components/organisms/PanelLayout";
86
97
 
87
98
  //pages