contentoh-components-library 21.3.30 → 21.3.32

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 (128) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +5 -2
  3. package/dist/assets/images/generalButton/closeIcon.svg +2 -2
  4. package/dist/components/atoms/ProgressBar/index.js +36 -6
  5. package/dist/components/atoms/ProgressBar/styles.js +11 -3
  6. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  7. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  8. package/dist/components/molecules/GalleryElement/index.js +1 -1
  9. package/dist/components/molecules/HeaderTop/index.js +15 -1
  10. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  11. package/dist/components/molecules/ProductNameHeader/index.js +6 -4
  12. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
  13. package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
  14. package/dist/components/organisms/ProductImageModal/index.js +10 -3
  15. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +214 -30
  16. package/dist/components/pages/ProviderProductEdition/index.js +86 -65
  17. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +88 -52
  18. package/dist/components/pages/RetailerProductEdition/index.js +27 -18
  19. package/dist/components/pages/RetailerProductEdition/utils.js +1 -1
  20. package/dist/global-files/data.js +18 -23
  21. package/dist/global-files/fonts.css +6 -0
  22. package/dist/global-files/variables.js +2 -0
  23. package/dist/index.js +267 -46
  24. package/package.json +14 -1
  25. package/src/assets/images/customSelect/starIcon.svg +14 -0
  26. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  27. package/src/assets/images/defaultImages/notFound.svg +124 -0
  28. package/src/assets/images/generalButton/closeIcon.svg +2 -2
  29. package/src/assets/sounds/newMessage.mp3 +0 -0
  30. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  31. package/src/components/atoms/ButtonFileChooser/index.js +68 -0
  32. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  33. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
  34. package/src/components/atoms/ButtonV2/index.js +85 -0
  35. package/src/components/atoms/ButtonV2/styles.js +217 -0
  36. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  37. package/src/components/atoms/CustomIcon/index.js +41 -0
  38. package/src/components/atoms/CustomIcon/styles.js +85 -0
  39. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  40. package/src/components/atoms/IconFile/index.js +119 -0
  41. package/src/components/atoms/IconFile/styles.js +67 -0
  42. package/src/components/atoms/Image/Image.stories.js +51 -0
  43. package/src/components/atoms/Image/index.js +55 -0
  44. package/src/components/atoms/Image/styles.js +34 -0
  45. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  46. package/src/components/atoms/ImageLink/index.js +57 -0
  47. package/src/components/atoms/ImageLink/styles.js +30 -0
  48. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  49. package/src/components/atoms/ImagePreview/index.js +178 -0
  50. package/src/components/atoms/ImagePreview/styles.js +77 -0
  51. package/src/components/atoms/InputText/InputText.stories.js +39 -0
  52. package/src/components/atoms/InputText/index.js +61 -0
  53. package/src/components/atoms/InputText/styles.js +89 -0
  54. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  55. package/src/components/atoms/NotFound/index.js +52 -0
  56. package/src/components/atoms/NotFound/styles.js +55 -0
  57. package/src/components/atoms/ProgressBar/index.js +40 -5
  58. package/src/components/atoms/ProgressBar/styles.js +24 -0
  59. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
  60. package/src/components/atoms/SelectItemV2/index.js +61 -0
  61. package/src/components/atoms/SelectItemV2/styles.js +90 -0
  62. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  63. package/src/components/atoms/Tooltip/index.js +59 -0
  64. package/src/components/atoms/Tooltip/styles.js +42 -0
  65. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  66. package/src/components/molecules/ButtonDownloadFile/index.js +109 -0
  67. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  68. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  69. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  70. package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
  71. package/src/components/molecules/Dropdown/index.js +150 -0
  72. package/src/components/molecules/Dropdown/styles.js +75 -0
  73. package/src/components/molecules/GalleryElement/index.js +1 -1
  74. package/src/components/molecules/HeaderTop/index.js +17 -0
  75. package/src/components/molecules/HeaderTop/styles.js +5 -2
  76. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
  77. package/src/components/molecules/ImageTooltip/index.js +63 -0
  78. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  79. package/src/components/molecules/ProductNameHeader/index.js +7 -2
  80. package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
  81. package/src/components/molecules/SelectV2/index.js +357 -0
  82. package/src/components/molecules/SelectV2/styles.js +105 -0
  83. package/src/components/molecules/SelectV2/test.js +60 -0
  84. package/src/components/molecules/SelectV2/test.stories.js +10 -0
  85. package/src/components/molecules/StatusAsignationInfo/index.js +11 -9
  86. package/src/components/organisms/Chat/Chat.stories.js +149 -0
  87. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  88. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  89. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  90. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  91. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  92. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  93. package/src/components/organisms/Chat/ContainerItems/index.js +522 -0
  94. package/src/components/organisms/Chat/ContainerItems/styles.js +348 -0
  95. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  96. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  97. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  98. package/src/components/organisms/Chat/ContentChat/index.js +922 -0
  99. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  100. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  101. package/src/components/organisms/Chat/Footer/index.js +661 -0
  102. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  103. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  104. package/src/components/organisms/Chat/Header/index.js +93 -0
  105. package/src/components/organisms/Chat/Header/styles.js +49 -0
  106. package/src/components/organisms/Chat/index.js +238 -0
  107. package/src/components/organisms/Chat/styles.js +42 -0
  108. package/src/components/organisms/FullProductNameHeader/index.js +1 -0
  109. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  110. package/src/components/organisms/Modal/index.js +97 -0
  111. package/src/components/organisms/Modal/styles.js +103 -0
  112. package/src/components/organisms/ProductImageModal/index.js +6 -3
  113. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
  114. package/src/components/organisms/RangeCalendar/index.js +121 -0
  115. package/src/components/organisms/RangeCalendar/styles.js +883 -0
  116. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +239 -32
  117. package/src/components/pages/ProviderProductEdition/index.js +87 -67
  118. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +93 -52
  119. package/src/components/pages/RetailerProductEdition/index.js +23 -21
  120. package/src/components/pages/RetailerProductEdition/utils.js +2 -1
  121. package/src/global-files/data.js +18 -23
  122. package/src/global-files/fonts.css +6 -0
  123. package/src/global-files/handle_http.js +225 -0
  124. package/src/global-files/handle_userTech.js +7 -0
  125. package/src/global-files/utils.js +330 -0
  126. package/src/global-files/variables.js +2 -0
  127. package/src/index.js +17 -0
  128. package/src/assets/fonts/roboto/LICENSE.txt +0 -202
@@ -12,101 +12,142 @@ export const RetailerProductEditionDefault = Template.bind({});
12
12
  RetailerProductEditionDefault.args = {
13
13
  tabsSections: {
14
14
  Descripción: true,
15
- "Ficha técnica": false,
16
- Imágenes: false,
15
+ "Ficha técnica": true,
16
+ Imágenes: true,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjllNTRjMDc0LWFjNzktNGEwNC1iOGEzLWNhOWU2ZmQxNDE3ZiIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjc3NTQ1NzA2LCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjc3NTQ5MzA2LCJpYXQiOjE2Nzc1NDU3MDYsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.CS5zthG2PFlQIn5yCV64aadrBvh0ccEMlm8osN_BHTqqYARTiGJMnGUzD-FqmCB9JNeLn036eNHQ7TppqlvhBEe66-F7Aq3fSCMR2X31dWkASsg1E9kSmYS2V6NeG1G5WkfaIBOh7d7VH5Dnu6i5phne_BAu_fDbnBgsQUxQQMh-LMfv2heQ_MInJ6O2MrIzbYYMZYK7ioO5C7FvBnOCpDuk3DcgVFwuqBdVJAGkm-VYJbbnR6NYmYMnZfzrFJ8DjNE3O-L3ugVDOIfZOjuVBt2ZsfIB0-I7h_TBuIzwVE309f68AoDAujacOKvPORoN4ympPrAUSa7ZrM6ye2564g",
19
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhY2FmNjhiOC00MmU1LTQ1NzAtYThiMC04YWY4NmY3MGU5YTEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3ODQ5NDYzNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY3ODQ5ODIzNiwiaWF0IjoxNjc4NDk0NjM2LCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.WoO3h0tAsF_Z4f_6BLIOXaL__TzHUxZyQlDAULQ2cT1HkUs0EmTZXRzRZ4oce7rV5osco9gCWfhc03rQ-C12jmU-Yt7jq3vuuoHUz4JqkLpelZPS8jHSsCAUWu_ekOIgDzvNegiyKk2R4qnd7IRPzWOAx1houg-KKT7kxCxjkTyJJGtzb7pYDLSJSV871nS8MeXGf5VZG5rQ3Smfl8ANqypLUEQQ6gSOr30Ztt1lZaHRmhF8WKo_GWwY3jNScmX_o9QGOSvKVl8hTqz4gA9xbiNJ3zpoh_5PzY-N4Sl8pE3gt_9Zw_o5ItLNHpnXuav_0NENvhXDu7p7VTLEpG8DTA",
20
20
  productSelected: {
21
21
  services: {
22
22
  datasheets: 1,
23
23
  descriptions: 1,
24
24
  images: 1,
25
25
  },
26
- orderId: 130,
27
- status: "PA",
28
- datasheet_status: "PA",
26
+ orderId: 14606,
27
+ status: "AS",
28
+ datasheet_status: "CA",
29
29
  prio: "none",
30
- version: 17,
31
- description_status: "PA",
32
- images_status: "PA",
30
+ version: 3,
31
+ description_status: "CA",
32
+ images_status: "AS",
33
33
  statusByRetailer: {
34
- 58: {
35
- datasheet: "PA",
36
- description: "PA",
37
- images: "PA",
34
+ 4: {
35
+ datasheet: "AC",
36
+ description: "CA",
37
+ images: "AS",
38
+ },
39
+ 5: {
40
+ datasheet: "CA",
41
+ description: "CA",
42
+ images: "AS",
43
+ },
44
+ 6: {
45
+ description: "CA",
46
+ images: "AS",
47
+ datasheet: "CA",
48
+ },
49
+ 12: {
50
+ datasheet: "CA",
51
+ description: "CA",
52
+ images: "AS",
53
+ },
54
+ 17: {
55
+ datasheet: "CA",
56
+ description: "AC",
57
+ images: "AS",
38
58
  },
39
59
  },
40
60
  article: {
41
- id_article: 3,
42
- id_category: "2032",
43
- name: "CORTINA BLACKOUT DE POLIÉSTER CAFÉ 2.13 X 1.06 M",
44
- upc: "161157",
45
- timestamp: "2022-11-14T16:02:47.000Z",
61
+ id_article: 37317,
62
+ id_category: "157",
63
+ name: "Detergente lavatrastres líquido Axion Complete tricloro 1.1 l",
64
+ upc: "7509546078915",
65
+ timestamp: "2023-03-10T20:19:15.000Z",
46
66
  id_user: 28,
47
67
  status: "NULL",
48
68
  active: 1,
49
- company_id: 1,
50
- company_name: "GRUPO BRAHMA",
69
+ company_id: 1005,
70
+ SKU: null,
71
+ Descripcion: null,
72
+ Proveedor: null,
73
+ id_proveedor: 0,
74
+ company_name: "CRS Transformaciones",
51
75
  country: "México",
52
- id_order: 130,
53
- id_datasheet_especialist: null,
54
- id_datasheet_facilitator: null,
55
- id_description_especialist: null,
56
- id_description_facilitator: null,
57
- id_images_especialist: null,
58
- id_images_facilitator: null,
59
- id_auditor: null,
76
+ id_order: 14606,
77
+ id_datasheet_especialist: 54,
78
+ id_datasheet_facilitator: 52,
79
+ id_description_especialist: 54,
80
+ id_description_facilitator: 52,
81
+ id_images_especialist: 55,
82
+ id_images_facilitator: 53,
83
+ id_auditor: 37,
60
84
  id_recepcionist: null,
61
- category: "Decoración|Cortinas y Persianas|Cortinas",
85
+ category:
86
+ "Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
62
87
  missingAttributes: 0,
63
88
  missingDescriptions: 0,
64
89
  missingImages: 0,
65
90
  },
66
91
  retailers: [
67
92
  {
68
- id: 58,
69
- name: "The Home Depot Golden",
93
+ id: 4,
94
+ name: "Walmart Super y Superama",
95
+ },
96
+ {
97
+ id: 5,
98
+ name: "Chedraui",
99
+ },
100
+ {
101
+ id: 6,
102
+ name: "HEB",
103
+ },
104
+ {
105
+ id: 12,
106
+ name: "La Comer",
107
+ },
108
+ {
109
+ id: 17,
110
+ name: "Genérico",
70
111
  },
71
112
  ],
72
113
  country: "México",
73
- upc: "161157",
114
+ upc: "7509546078915",
74
115
  },
75
116
  location: {
76
- product: { articleId: 109485, versionId: 3 },
117
+ product: { articleId: 354, versionId: 3 },
77
118
  },
78
119
  user: {
79
- id_user: 30,
80
- name: "Admin",
81
- last_name: "Ulises",
82
- email: "salmeron.5@hotmail.com",
83
- position: "Admin",
120
+ id_user: 51,
121
+ name: "ADMIN PRUEBA",
122
+ last_name: "",
123
+ email: "etc@contentoh.com",
124
+ position: "",
84
125
  telephone: "",
85
- country: "México",
126
+ country: "",
86
127
  id_company: 2,
87
- id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
128
+ id_cognito: "a6c4d3d6-24a4-41d4-ad0f-d087438ab5b6",
88
129
  birth_Date: null,
89
130
  about_me: "",
90
131
  zip_code: "",
91
132
  address: "",
92
133
  job: "",
93
134
  id_stripe: "",
94
- id_role: 6,
135
+ id_role: 1,
95
136
  active: 1,
96
137
  is_retailer: 0,
97
138
  email_notify: 1,
98
- is_user_tech: "ADMIN-AS",
139
+ is_user_tech: null,
99
140
  membership: {
100
- id: 2,
101
- start_date: "2021-11-05T02:35:12.000Z",
102
- end_date: "2022-11-05T02:34:49.000Z",
103
- planID: 1,
104
- plan: "prod_KtkvuFFLpOdP6e",
105
- name: "Plan Free",
106
- user_limit: "1",
107
- products_limit: "3",
108
- type: "PyMES",
141
+ id: 750,
142
+ start_date: "2022-01-07T21:32:54.000Z",
143
+ end_date: "2023-01-07T21:32:54.000Z",
144
+ planID: 6,
145
+ plan: "prod_KvGd6YSTJyR3AP",
146
+ name: "Plan Small",
147
+ user_limit: "10",
148
+ products_limit: "1000",
149
+ type: "Enterprise",
109
150
  },
110
- src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1676494961913",
151
+ src: "https://content-management-profile.s3.amazonaws.com/id-51/51.png?1678494637588",
111
152
  },
112
153
  };
@@ -122,6 +122,7 @@ export const RetailerProductEdition = ({
122
122
  productSelected = {},
123
123
  user = {},
124
124
  token,
125
+ location,
125
126
  }) => {
126
127
  const [activeTab, setActiveTab] = useState("Descripción");
127
128
  const [activeImage, setActiveImage] = useState();
@@ -176,6 +177,7 @@ export const RetailerProductEdition = ({
176
177
  const [percentages, setPercentages] = useState(
177
178
  new Array(product?.retailers?.length).fill({ percentage: 0 })
178
179
  );
180
+ // const [percentages, setPercentages] = useState([{ retailers: {} }]);
179
181
  const [activePercentage, setActivePercentage] = useState(0);
180
182
  const [activeRetailer, setActiveRetailer] = useState({});
181
183
  const [services, setServices] = useState([]);
@@ -243,7 +245,9 @@ export const RetailerProductEdition = ({
243
245
  };
244
246
 
245
247
  useEffect(() => {
246
- loadAuditableData();
248
+ if (auditableVersion) {
249
+ loadAuditableData();
250
+ }
247
251
  }, [auditableVersion]);
248
252
 
249
253
  useEffect(() => {
@@ -264,12 +268,9 @@ export const RetailerProductEdition = ({
264
268
  //Converts the data inside the datasheets object to array
265
269
  setServices(services);
266
270
  getServices();
267
-
268
- // setActiveRetailer(product?.retailers[0]);
269
271
  setImages({ action: "init", init: services[2] });
270
272
  if (services[2]?.values?.length > 0) setActiveImage(0);
271
-
272
- getPercentage({ data: [product] }).then((res) => setPercentages(res));
273
+ getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
273
274
  setLoading(false);
274
275
  } catch (error) {
275
276
  console.log(error);
@@ -410,25 +411,23 @@ export const RetailerProductEdition = ({
410
411
  }, [userGroups]);
411
412
 
412
413
  useEffect(() => {
413
- product?.retailers?.forEach((retailer) => {
414
- retailer["percentage"] = percentages.length
415
- ? percentages?.filter(
416
- (percent) => retailer?.id === percent?.id_retailer
417
- )[0]?.percentage
418
- : 0;
419
- });
420
- setActivePercentage(product?.retailers[0]?.percentage);
414
+ const retailers = product?.retailersAvailable || product?.retailers;
415
+ if (
416
+ Object.keys(percentages[product.article.id_article] ?? {})?.length > 0
417
+ ) {
418
+ retailers?.forEach((retailer, index) => {
419
+ retailer["percentage"] = Number(
420
+ percentages[product.article.id_article][retailer.id]
421
+ ?.percentageRequired
422
+ );
423
+ });
424
+ }
425
+ setActivePercentage(retailers[0]?.percentage);
421
426
  }, [percentages]);
422
427
 
423
428
  useEffect(() => {
424
429
  getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
425
- auditableVersion &&
426
- getInputsData(
427
- auditServices,
428
- activeRetailer,
429
- setAuditDatasheets,
430
- setAuditDescriptions
431
- );
430
+ auditableVersion && loadAuditableData();
432
431
  setActivePercentage(Math.round(activeRetailer?.percentage, 0));
433
432
  activeRetailer?.id &&
434
433
  setImages({ action: "orderImages", retailerId: activeRetailer.id });
@@ -1271,6 +1270,9 @@ export const RetailerProductEdition = ({
1271
1270
  auditableVersion={auditableVersion}
1272
1271
  setCompare={setCompare}
1273
1272
  isAuditor={[1, 6].includes(user.id_role)}
1273
+ withChat={location?.state?.withChat}
1274
+ productSelected={productSelected}
1275
+ token={token}
1274
1276
  />
1275
1277
  <div className="data-container">
1276
1278
  <div className="image-data-panel">
@@ -1564,7 +1566,7 @@ export const RetailerProductEdition = ({
1564
1566
  images={images}
1565
1567
  setShowModal={setShowModal}
1566
1568
  sendToFacilitator={sendToFacilitator}
1567
- approveRejectButtons={approveRejectButtons}
1569
+ approveRejectButtons={approveRejectButtons()}
1568
1570
  />
1569
1571
  )}
1570
1572
  {message.length > 0 && (
@@ -5,8 +5,9 @@ export const getAuditVersion = async (articleId, setState, token) => {
5
5
  `${process.env.REACT_APP_GET_AUDIT}?articleId=${articleId}`,
6
6
  { headers: { Authorization: token } }
7
7
  );
8
+
8
9
  if (auditResponse.status === 200) {
9
- setState(JSON.parse(auditResponse.data.body).data);
10
+ setState(JSON.parse(auditResponse.data.body).data || "{}");
10
11
  }
11
12
  };
12
13
 
@@ -86,32 +86,27 @@ export const getImage = (imageGeneral, width = 250, height = 250) => {
86
86
  export const getPercentage = async (params = {}) => {
87
87
  const func = async () => {
88
88
  const dataToSend = [];
89
+ const arrayRetailers = [];
89
90
  let retailers =
90
91
  params.data[0].retailers || params.data[0].retailersAvailable;
91
- params.data.forEach((product) => {
92
+ params.data.forEach((product, i) => {
93
+ dataToSend.push(
94
+ product.article
95
+ ? {
96
+ id_article: product.article.id_article,
97
+ id_category: product.article.id_category,
98
+ version: product.version,
99
+ }
100
+ : {
101
+ id_article: product.id_article,
102
+ id_category: product.id_category,
103
+ version: product.version,
104
+ }
105
+ );
92
106
  retailers.forEach((retailer) => {
93
- dataToSend.push(
94
- product.article
95
- ? {
96
- id_article: product.article.id_article,
97
- id_category: product.article.id_category,
98
- id_retailer: retailer.id,
99
- version: product.version,
100
- upc: product.article.upc,
101
- name: product.article.name,
102
- retailerName: retailer.name,
103
- }
104
- : {
105
- id_article: product.id_article,
106
- id_category: product.id_category,
107
- id_retailer: retailer.id,
108
- version: product.version,
109
- upc: product.upc,
110
- name: product.name,
111
- retailerName: retailer.name,
112
- }
113
- );
107
+ arrayRetailers.push(retailer.id);
114
108
  });
109
+ dataToSend[i].id_retailer_array = arrayRetailers;
115
110
  });
116
111
 
117
112
  return await axios
@@ -125,7 +120,7 @@ export const getPercentage = async (params = {}) => {
125
120
  }
126
121
  )
127
122
  .then((response) => {
128
- return response.data;
123
+ return [response.data];
129
124
  })
130
125
  .catch((err) => console.log(err, "Errror"));
131
126
  };
@@ -61,3 +61,9 @@
61
61
  src: url("../assets/fonts/roboto/Roboto-Regular.ttf");
62
62
  font-weight: 400;
63
63
  }
64
+
65
+ .prueba {
66
+ color: #9e3e26;
67
+ color: #b42983;
68
+ color: #e7e7e7;
69
+ }
@@ -0,0 +1,225 @@
1
+ import axios from "axios";
2
+
3
+ //============================================================
4
+ /**
5
+ * funcion que realiza un axios GET
6
+ *
7
+ * Si <body> es undefined significa que hubo error
8
+
9
+ * @returns { Promise<{
10
+ * body: {} | undefined ,
11
+ * message: string,
12
+ * errorDetail: string
13
+ * }> }
14
+ *
15
+ */
16
+ //============================================================
17
+ export const fetchGET = (
18
+ endpoint = "",
19
+ paramsQuery = {},
20
+ paramsHeaders = {}
21
+ ) => {
22
+ return new Promise(async (response) => {
23
+ try {
24
+ let URL = endpoint;
25
+ const keysParamsQuery = Object.keys(paramsQuery);
26
+ // agregar cada param query a la URL
27
+ keysParamsQuery.forEach((key, index) => {
28
+ if (index == 0) {
29
+ URL += `?${key}=${paramsQuery[key]}`;
30
+ } else {
31
+ URL += `&${key}=${paramsQuery[key]}`;
32
+ }
33
+ });
34
+ const respHTTPjson = await axios.get(URL, { headers: paramsHeaders });
35
+ // verificar si existe un error en la peticion realizada
36
+ if (respHTTPjson.status !== 200) {
37
+ return response({
38
+ message: "No fue posible llevar a cabo la operación",
39
+ errorDetail: respHTTPjson.statusText,
40
+ });
41
+ }
42
+ // obtener body backend
43
+ const body = JSON.parse(respHTTPjson.data.body);
44
+
45
+ // verificar si existe error desde el backend
46
+ if (respHTTPjson.data.statusCode !== 200) {
47
+ return response({
48
+ message: body.message ?? "",
49
+ errorDetail: body.errorDetail ?? "",
50
+ });
51
+ }
52
+ // success
53
+ return response({ body });
54
+ } catch (err) {
55
+ return response({
56
+ message: "Error al obtener los datos",
57
+ errorDetail: err.message,
58
+ });
59
+ }
60
+ });
61
+ };
62
+
63
+ //============================================================
64
+ /**
65
+ * funcion que realiza un axios POST
66
+ *
67
+ * Si <body> es undefined significa que hubo error
68
+
69
+ * @returns { Promise<{
70
+ * body: {} | undefined ,
71
+ * message: string,
72
+ * errorDetail: string
73
+ * }> }
74
+ *
75
+ */
76
+ //============================================================
77
+ export const fetchPOST = (
78
+ endpoint = "",
79
+ paramsBody = {},
80
+ paramsHeaders = {}
81
+ ) => {
82
+ return new Promise(async (response) => {
83
+ try {
84
+ const respHTTPjson = await axios.post(endpoint, paramsBody, {
85
+ headers: paramsHeaders,
86
+ });
87
+
88
+ // verificar si existe un error en la peticion realizada
89
+ if (respHTTPjson.status !== 200) {
90
+ return response({
91
+ message: "No fue posible llevar a cabo la operación",
92
+ errorDetail: respHTTPjson.statusText,
93
+ });
94
+ }
95
+ // obtener body backend
96
+ const body = JSON.parse(respHTTPjson.data.body);
97
+
98
+ // verificar si existe error desde el backend
99
+ if (respHTTPjson.data.statusCode !== 200) {
100
+ return response({
101
+ message: body.message ?? "",
102
+ errorDetail: body.errorDetail ?? "",
103
+ });
104
+ }
105
+ // success
106
+ return response({ body });
107
+ } catch (err) {
108
+ return response({
109
+ message: "Error al guardar los datos",
110
+ errorDetail: err.message,
111
+ });
112
+ }
113
+ });
114
+ };
115
+
116
+ //============================================================
117
+ /**
118
+ * funcion que realiza un axios GET
119
+ *
120
+ * Si <body> es undefined significa que hubo error
121
+
122
+ * @returns { Promise<{
123
+ * body: {} | undefined ,
124
+ * message: string,
125
+ * errorDetail: string
126
+ * }> }
127
+ *
128
+ */
129
+ //============================================================
130
+ export const fetchPUT = (
131
+ endpoint = "",
132
+ paramsBody = {},
133
+ paramsHeaders = {}
134
+ ) => {
135
+ return new Promise(async (response) => {
136
+ try {
137
+ const respHTTPjson = await axios.put(endpoint, paramsBody, {
138
+ headers: paramsHeaders,
139
+ });
140
+
141
+ // verificar si existe un error en la peticion realizada
142
+ if (respHTTPjson.status !== 200) {
143
+ return response({
144
+ message: "No fue posible llevar a cabo la operación",
145
+ errorDetail: respHTTPjson.statusText,
146
+ });
147
+ }
148
+
149
+ // obtener body backend
150
+ const body = JSON.parse(respHTTPjson.data.body);
151
+
152
+ // verificar si existe error desde el backend
153
+ if (respHTTPjson.data.statusCode !== 200) {
154
+ return response({
155
+ message: body.message ?? "",
156
+ errorDetail: body.errorDetail ?? "",
157
+ });
158
+ }
159
+
160
+ // success
161
+ return response({ body });
162
+ } catch (err) {
163
+ return response({
164
+ message: "Error al actualizar los datos",
165
+ errorDetail: err.message,
166
+ });
167
+ }
168
+ });
169
+ };
170
+
171
+ //============================================================
172
+ /**
173
+ * funcion que realiza un axios GET
174
+ *
175
+ * Si <body> es undefined significa que hubo error
176
+
177
+ * @returns { Promise<{
178
+ * body: {} | undefined ,
179
+ * message: string,
180
+ * errorDetail: string
181
+ * }> }
182
+ *
183
+ */
184
+ //============================================================
185
+ export const fetchDELETE = (
186
+ endpoint = "",
187
+ paramsBody = {},
188
+ paramsHeaders = {}
189
+ ) => {
190
+ return new Promise(async (response) => {
191
+ try {
192
+ const respHTTPjson = await axios.delete(endpoint, {
193
+ data: paramsBody,
194
+ headers: paramsHeaders,
195
+ });
196
+
197
+ // verificar si existe un error en la peticion realizada
198
+ if (respHTTPjson.status !== 200) {
199
+ return response({
200
+ message: "No fue posible llevar a cabo la operación",
201
+ errorDetail: respHTTPjson.statusText,
202
+ });
203
+ }
204
+
205
+ // obtener body backend
206
+ const body = JSON.parse(respHTTPjson.data.body);
207
+
208
+ // verificar si existe error desde el backend
209
+ if (respHTTPjson.data.statusCode !== 200) {
210
+ return response({
211
+ message: body.message ?? "",
212
+ errorDetail: body.errorDetail ?? "",
213
+ });
214
+ }
215
+
216
+ // success
217
+ return response({ body });
218
+ } catch (err) {
219
+ return response({
220
+ message: "Error al actualizar los datos",
221
+ errorDetail: err.message,
222
+ });
223
+ }
224
+ });
225
+ };
@@ -0,0 +1,7 @@
1
+ export const isUserTech = (value = "") => {
2
+ return ["AS", "ADMIN-AS", "ADMIN"].includes(value);
3
+ };
4
+
5
+ export const isUserAdminTech = (value = "") => {
6
+ return ["ADMIN-AS", "ADMIN"].includes(value);
7
+ };