contentoh-components-library 21.3.54 → 21.3.55

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 (60) hide show
  1. package/.env.development +0 -2
  2. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  3. package/dist/components/atoms/ButtonV2/styles.js +1 -1
  4. package/dist/components/atoms/Status/styles.js +1 -1
  5. package/dist/components/atoms/VerticalSideMenuMainPage/index.js +23 -18
  6. package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
  7. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  8. package/dist/components/molecules/HeaderTop/index.js +11 -68
  9. package/dist/components/organisms/Chat/Chat.stories.js +1 -21
  10. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  11. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  12. package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
  13. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  14. package/dist/components/organisms/Chat/index.js +3 -48
  15. package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +0 -27
  16. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  17. package/dist/components/organisms/GlobalModal/styles.js +1 -1
  18. package/dist/components/organisms/OrderDetail/styles.js +1 -1
  19. package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
  20. package/dist/components/pages/Dashboard/Dashboard.stories.js +50 -31
  21. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +81 -198
  22. package/dist/components/pages/ProviderProductEdition/index.js +429 -725
  23. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  24. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +139 -86
  25. package/dist/components/pages/RetailerProductEdition/index.js +279 -268
  26. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  27. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  28. package/dist/index.js +0 -13
  29. package/package.json +6 -7
  30. package/src/components/atoms/ButtonV2/styles.js +1 -1
  31. package/src/components/atoms/Status/styles.js +0 -4
  32. package/src/components/atoms/VerticalSideMenuMainPage/index.js +22 -18
  33. package/src/components/atoms/VerticalSideMenuMainPage/styles.js +4 -3
  34. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  35. package/src/components/molecules/HeaderTop/index.js +6 -52
  36. package/src/components/organisms/Chat/Chat.stories.js +0 -21
  37. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  38. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
  39. package/src/components/organisms/Chat/ContentChat/index.js +6 -81
  40. package/src/components/organisms/Chat/Footer/index.js +0 -11
  41. package/src/components/organisms/Chat/index.js +3 -47
  42. package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -18
  43. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  44. package/src/components/organisms/GlobalModal/styles.js +0 -10
  45. package/src/components/organisms/OrderDetail/index.js +0 -1
  46. package/src/components/organisms/OrderDetail/styles.js +1 -1
  47. package/src/components/organisms/OrderDetail/utils/Table/styles.js +1 -0
  48. package/src/components/pages/Dashboard/Dashboard.stories.js +55 -31
  49. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +88 -214
  50. package/src/components/pages/ProviderProductEdition/index.js +160 -323
  51. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  52. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +146 -89
  53. package/src/components/pages/RetailerProductEdition/index.js +138 -112
  54. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  55. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  56. package/src/index.js +0 -1
  57. package/src/components/organisms/TableResizable/TableResizable.stories.js +0 -17
  58. package/src/components/organisms/TableResizable/index.js +0 -119
  59. package/src/components/organisms/TableResizable/styles.js +0 -133
  60. package/src/components/organisms/TableResizable/utils.js +0 -46
@@ -107,10 +107,6 @@ export const Container = styled.div`
107
107
  }
108
108
  }
109
109
  }
110
- #modal-message-box {
111
- width: 400px;
112
- height: 100px;
113
- }
114
110
  .container {
115
111
  width: 100%;
116
112
  height: 100%;
@@ -119,4 +115,4 @@ export const Container = styled.div`
119
115
  width: 100%;
120
116
  }
121
117
  }
122
- `;
118
+ `;
@@ -12,126 +12,183 @@ 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.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
19
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhY2FmNjhiOC00MmU1LTQ1NzAtYThiMC04YWY4NmY3MGU5YTEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3ODQ5NDYzNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY3ODQ5ODIzNiwiaWF0IjoxNjc4NDk0NjM2LCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.WoO3h0tAsF_Z4f_6BLIOXaL__TzHUxZyQlDAULQ2cT1HkUs0EmTZXRzRZ4oce7rV5osco9gCWfhc03rQ-C12jmU-Yt7jq3vuuoHUz4JqkLpelZPS8jHSsCAUWu_ekOIgDzvNegiyKk2R4qnd7IRPzWOAx1houg-KKT7kxCxjkTyJJGtzb7pYDLSJSV871nS8MeXGf5VZG5rQ3Smfl8ANqypLUEQQ6gSOr30Ztt1lZaHRmhF8WKo_GWwY3jNScmX_o9QGOSvKVl8hTqz4gA9xbiNJ3zpoh_5PzY-N4Sl8pE3gt_9Zw_o5ItLNHpnXuav_0NENvhXDu7p7VTLEpG8DTA",
20
20
  productSelected: {
21
- orderId: 15142,
22
- status: "CA",
23
- datasheet_status: "CA",
24
- prio: "none",
25
- version: 3,
26
- description_status: "AC",
27
- images_status: "CA",
28
- brand: "Garnier",
29
- retailerOrder: 0,
30
- missing: {
31
- datasheet: null,
32
- descriptions: null,
33
- images: null,
34
- },
35
21
  services: {
36
22
  datasheets: 1,
37
23
  descriptions: 1,
38
24
  images: 1,
39
25
  },
26
+ orderId: 4106,
27
+ status: "PA",
28
+ datasheet_status: "PA",
29
+ prio: "none",
30
+ version: 7,
31
+ description_status: "PA",
32
+ images_status: "CA",
33
+ statusByRetailer: {
34
+ 5: {
35
+ datasheet: "PA",
36
+ description: "PA",
37
+ images: "CA",
38
+ },
39
+ 16: {
40
+ datasheet: "PA",
41
+ description: "PA",
42
+ images: "AC",
43
+ },
44
+ },
40
45
  article: {
41
- category:
42
- "Salud y Belleza|Cuidado del Cabello|Shampoos y Acondicionadores",
43
- company_name: "GRUPO BRAHMA",
44
- country: "México",
45
- id_category: "697",
46
- id_datasheet_especialist: 54,
47
- id_datasheet_facilitator: 52,
48
- id_description_especialist: 54,
49
- id_description_facilitator: 52,
50
- id_images_especialist: 55,
51
- id_images_facilitator: 53,
52
- id_order: 15142,
53
- id_article: 39270,
54
- id_auditor: 37,
55
- name: "Acondicionador Garnier Fructis 650 ml",
56
- timestamp: "2023-03-27T18:37:48.000Z",
57
- upc: "750955287656712",
46
+ id_article: 18376,
47
+ id_category: "692",
48
+ name: "Jabón para Manos Palmolive Aquarium Series Líquido Rellena-Pack 800 ml",
49
+ upc: "7509546657097",
50
+ timestamp: "2021-10-09T16:33:17.000Z",
51
+ id_user: 203,
52
+ status: "RECEPTION",
53
+ active: 1,
54
+ company_id: 226,
55
+ verified_upc: 750954665709,
56
+ Descripcion: null,
57
+ Proveedor: null,
58
+ id_proveedor: 0,
59
+ company_name: "COLGATE PALMOLIVE S.A. DE C.V.",
60
+ country: "null",
61
+ id_order: 4106,
62
+ id_datasheet_especialist: null,
63
+ id_datasheet_facilitator: null,
64
+ id_description_especialist: null,
65
+ id_description_facilitator: null,
66
+ id_images_especialist: 1251,
67
+ id_images_facilitator: null,
68
+ id_auditor: null,
69
+ id_recepcionist: null,
70
+ category: "Salud y Belleza|Cuidado Corporal|Jabones de Tocador",
71
+ missingAttributes: null,
72
+ missingDescriptions: null,
73
+ missingImages: null,
58
74
  },
59
75
  retailers: [
76
+ {
77
+ id: 4,
78
+ name: "Walmart Super y Superama",
79
+ country: "México",
80
+ id_region: 1,
81
+ active: 1,
82
+ },
83
+ {
84
+ id: 5,
85
+ name: "Chedraui",
86
+ country: "México",
87
+ id_region: 1,
88
+ active: 1,
89
+ },
90
+ {
91
+ id: 6,
92
+ name: "HEB",
93
+ country: "México",
94
+ id_region: 1,
95
+ active: 1,
96
+ },
60
97
  {
61
98
  id: 12,
62
99
  name: "La Comer",
63
- image:
64
- "https://content-management-images.s3.amazonaws.com/retailers/12.png",
65
- services: ["CA", "CA", "AC", "NA", "NA", "NA", "NA", "NA", "NA"],
66
- percentage: 100,
100
+ country: "México",
101
+ id_region: 1,
102
+ active: 1,
67
103
  },
68
104
  {
69
- id: 29,
70
- name: "Farmacias del Ahorro",
71
- image:
72
- "https://content-management-images.s3.amazonaws.com/retailers/29.png",
73
- services: ["NA", "NA", "NA", "CA", "CA", "CA", "NA", "NA", "NA"],
74
- percentage: 100,
105
+ id: 13,
106
+ name: "Soriana",
107
+ country: "México",
108
+ id_region: 1,
109
+ active: 1,
75
110
  },
76
111
  {
77
- id: 63,
78
- name: "DAX",
79
- image:
80
- "https://content-management-images.s3.amazonaws.com/retailers/63.png",
81
- services: ["NA", "NA", "NA", "NA", "NA", "NA", "AC", "AC", "CA"],
82
- percentage: 83,
112
+ id: 16,
113
+ name: "Rappi",
114
+ country: "México",
115
+ id_region: 1,
116
+ active: 1,
83
117
  },
84
- ],
85
- statusByRetailer: {
86
- 12: {
87
- datasheet: "CA",
88
- description: "CA",
118
+ {
119
+ id: 17,
120
+ name: "Genérico",
121
+ country: "México",
122
+ id_region: 1,
123
+ active: 1,
89
124
  },
90
- 29: {
91
- datasheet: "CA",
92
- description: "CA",
125
+ {
126
+ id: 20,
127
+ name: "Cornershop",
128
+ country: "México",
129
+ id_region: 1,
130
+ active: 1,
93
131
  },
94
- },
132
+ {
133
+ id: 24,
134
+ name: "Alsuper",
135
+ country: "México",
136
+ id_region: 1,
137
+ active: 1,
138
+ },
139
+ {
140
+ id: 27,
141
+ name: "IMPIRA México",
142
+ country: "México",
143
+ id_region: 1,
144
+ active: 1,
145
+ },
146
+ {
147
+ id: 38,
148
+ name: "Del Sol",
149
+ country: "México",
150
+ id_region: 1,
151
+ active: 1,
152
+ },
153
+ ],
154
+ country: "null",
155
+ upc: "7509546657097",
95
156
  },
96
157
  location: {
97
158
  product: { articleId: 354, versionId: 3 },
98
- state: {
99
- withChat: true,
100
- chatType: "product_status",
101
- },
102
159
  },
103
160
  user: {
104
- id_user: 37,
105
- name: "José",
106
- last_name: "Castañeda",
107
- email: "ismael97lopez@gmail.com",
108
- position: "Auditor",
109
- telephone: "",
161
+ id_user: 1251,
162
+ name: "Ismael",
163
+ last_name: "López",
164
+ email: "ilopez@contentoh.com",
165
+ position: "Full Stack Developer",
166
+ telephone: null,
110
167
  country: "México",
111
- id_company: 2,
112
- id_cognito: "9a213128-6482-4c16-a4b6-6e64f225b1bd",
113
- birth_Date: null,
114
- about_me: "",
115
- zip_code: "",
116
- address: "",
117
- job: "",
118
- id_stripe: "",
119
- id_role: 6,
168
+ id_company: 254,
169
+ id_cognito: "9d0cc5c8-a89e-4bdd-9e2d-358a01cc9a62",
170
+ birth_Date: "1997-08-15T00:00:00.000Z",
171
+ about_me: null,
172
+ zip_code: null,
173
+ address: null,
174
+ job: null,
175
+ id_stripe: null,
176
+ id_role: 7,
120
177
  active: 1,
121
178
  is_retailer: 0,
122
179
  email_notify: 1,
123
- is_user_tech: null,
180
+ is_user_tech: "ADMIN-AS",
124
181
  membership: {
125
- id: 2,
126
- start_date: "2021-11-05T02:35:12.000Z",
127
- end_date: "2022-11-05T02:34:49.000Z",
128
- planID: 1,
129
- plan: "prod_KtkvuFFLpOdP6e",
130
- name: "Plan Free",
131
- user_limit: "1",
132
- products_limit: "3",
133
- type: "PyMES",
182
+ id: 750,
183
+ start_date: "2022-01-07T21:32:54.000Z",
184
+ end_date: "2023-01-07T21:32:54.000Z",
185
+ planID: 6,
186
+ plan: "prod_KvGd6YSTJyR3AP",
187
+ name: "Plan Small",
188
+ user_limit: "10",
189
+ products_limit: "1000",
190
+ type: "Enterprise",
134
191
  },
135
- src: "https://content-management-profile.s3.amazonaws.com/id-37/37.png?1683875228327",
192
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-460/460.png?1684511182259",
136
193
  },
137
194
  };
@@ -24,20 +24,15 @@ 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";
27
28
  import { GenericModal } from "../../atoms/GenericModal";
28
29
  import { ScreenHeader } from "../../atoms/ScreenHeader";
29
30
  import { Loading } from "../../atoms/Loading";
30
31
  import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
32
+ import errorModal from "../../../assets/images/genericModal/errorModal.svg";
31
33
  import { VersionSelector } from "../../organisms/VersionSelector";
32
34
  import { useCloseModal } from "../../../global-files/customHooks";
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";
35
+ import { getAuditVersion, getInputsData } from "./utils";
41
36
 
42
37
  const reducerImages = (state, action) => {
43
38
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -137,7 +132,6 @@ export const RetailerProductEdition = ({
137
132
  const [datasheets, setDatasheets] = useState([]);
138
133
  const [images, setImages] = useReducer(reducerImages, {});
139
134
  const [showModal, setShowModal] = useState(false);
140
- const [showRejectModal, setShowRejectModal] = useState(false);
141
135
  const { getRootProps, getInputProps } = useDropzone({
142
136
  accept: "image/*",
143
137
  noKeyboard: true,
@@ -224,7 +218,6 @@ export const RetailerProductEdition = ({
224
218
  const [auditDescriptions, setAuditDescriptions] = useState([]);
225
219
  const [auditImages, setAuditImages] = useState([]);
226
220
  const [compare, setCompare] = useState(false);
227
- const [valRejAll, setValRejAll] = useState(false);
228
221
 
229
222
  useEffect(async () => {
230
223
  const { id_article } = product?.article || {};
@@ -344,7 +337,7 @@ export const RetailerProductEdition = ({
344
337
  switch (user.id_role) {
345
338
  case 7:
346
339
  case 8:
347
- arr = ["AS", "CA", "RC", "RA", "RP", "RCA"];
340
+ arr = ["PA", "AS", "CA", "RC", "RA", "RP", "RCA"];
348
341
  break;
349
342
  case 4:
350
343
  case 5:
@@ -759,7 +752,7 @@ export const RetailerProductEdition = ({
759
752
  const adminFacilitatorCanEvaluate =
760
753
  retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
761
754
  const adminAuditorCanEvaluate =
762
- ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) &&
755
+ ["AC", "RP", "RCA"].includes(retailerStatus) &&
763
756
  [1, 6].includes(user.id_role);
764
757
  return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
765
758
  };
@@ -862,25 +855,6 @@ export const RetailerProductEdition = ({
862
855
  const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
863
856
  res.data.body
864
857
  );
865
- const messageToChat = createMessage(
866
- product.retailers,
867
- activeRetailer.id,
868
- evalStatus,
869
- newStatus,
870
- activeTab
871
- );
872
-
873
- const data = {
874
- paramsBody: {
875
- id: product.article.id_article,
876
- version: version,
877
- items: [{ type: "status", value: messageToChat }],
878
- retailerId: activeRetailer.id,
879
- status: product.status,
880
- },
881
- paramsHeader: { Authorization: token },
882
- };
883
- await sendMessage(data);
884
858
  if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
885
859
  productTemp[`${concept}_status`] = newStatus;
886
860
  await loadData();
@@ -923,19 +897,35 @@ export const RetailerProductEdition = ({
923
897
  return product?.article[`id_auditor`] === user.id_user;
924
898
  };
925
899
 
926
- const createComment = async (messages = [], retailerId) => {
900
+ const createComment = async (e, body, tab) => {
901
+ let concept = "";
902
+ switch (activeTab) {
903
+ case "Ficha técnica":
904
+ concept = "datasheet";
905
+ break;
906
+ case "Imágenes":
907
+ concept = "images";
908
+ break;
909
+
910
+ default:
911
+ concept = "description";
912
+ break;
913
+ }
927
914
  const data = {
928
- paramsBody: {
929
- id: product.article.id_article,
930
- version: version,
931
- items: messages,
932
- retailerId: retailerId,
933
- status: product.status,
934
- },
935
- paramsHeader: { Authorization: token },
915
+ articleId: product?.article?.id_article,
916
+ orderId: product?.orderId,
917
+ message: body?.replace(/<.*?\/?>/gm, ""),
918
+ concept: concept,
919
+ version: version,
936
920
  };
921
+ await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
922
+ headers: {
923
+ Authorization: token,
924
+ },
925
+ });
926
+ await getComments(tab);
937
927
  setMessage("");
938
- return sendMessage(data);
928
+ setComponentsArray([]);
939
929
  };
940
930
 
941
931
  const getRequired = (services) => {
@@ -1218,8 +1208,6 @@ export const RetailerProductEdition = ({
1218
1208
  break;
1219
1209
  }
1220
1210
 
1221
- const messages = [];
1222
-
1223
1211
  servicesData?.forEach((ret) => {
1224
1212
  if (conceptArray.includes(ret.service)) {
1225
1213
  let data = {
@@ -1230,21 +1218,6 @@ export const RetailerProductEdition = ({
1230
1218
  evalStatus: product[`${ret.service}_status`],
1231
1219
  retailerId: ret.id_retailer,
1232
1220
  };
1233
- if (product[`${ret.service}_status`] !== "NS") {
1234
- const message = createMessage(
1235
- product.retailers,
1236
- ret.id_retailer,
1237
- product[`${ret.service}_status`],
1238
- `${result}A`,
1239
- ret.service
1240
- );
1241
- messages.push(
1242
- createComment(
1243
- [{ type: "status", value: message }],
1244
- ret.id_retailer
1245
- )
1246
- );
1247
- }
1248
1221
  evaluationArray.push(
1249
1222
  axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1250
1223
  headers: {
@@ -1255,6 +1228,8 @@ export const RetailerProductEdition = ({
1255
1228
  }
1256
1229
  });
1257
1230
 
1231
+ await Promise.all(evaluationArray);
1232
+
1258
1233
  conceptArray?.forEach((concept) => {
1259
1234
  let data = {
1260
1235
  articleId: product.article.id_article,
@@ -1274,14 +1249,13 @@ export const RetailerProductEdition = ({
1274
1249
  const productTemp = product;
1275
1250
  productTemp.status = `${result}A`;
1276
1251
  productTemp.datasheet_status =
1277
- productTemp.datasheet_status === "NS" ? "NS" : `${result}A`;
1252
+ productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
1278
1253
  productTemp.description_status =
1279
- productTemp.description_status === "NS" ? "NS" : `${result}A`;
1254
+ productTemp.description_status === "NA" ? "NA" : `${result}A`;
1280
1255
  productTemp.images_status =
1281
- productTemp.images_status === "NS" ? "NS" : `${result}A`;
1256
+ productTemp.images_status === "NA" ? "NA" : `${result}A`;
1282
1257
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1283
1258
  setProduct(productTemp);
1284
- const messagesResponse = await Promise.all(messages);
1285
1259
 
1286
1260
  await loadData();
1287
1261
  } catch (error) {
@@ -1297,10 +1271,8 @@ export const RetailerProductEdition = ({
1297
1271
  setCompare={setCompare}
1298
1272
  isAuditor={[1, 6].includes(user.id_role)}
1299
1273
  withChat={location?.state?.withChat}
1300
- chatType={location?.state?.chatType}
1301
- productSelected={product}
1274
+ productSelected={productSelected}
1302
1275
  token={token}
1303
- activeRetailer={activeRetailer}
1304
1276
  />
1305
1277
  <div className="data-container">
1306
1278
  <div className="image-data-panel">
@@ -1340,7 +1312,36 @@ export const RetailerProductEdition = ({
1340
1312
  sendToFacilitator("A");
1341
1313
  }}
1342
1314
  reject={() => {
1343
- setShowRejectModal(true);
1315
+ sendToFacilitator("R");
1316
+ setMessage("Rechazado");
1317
+ setComponentsArray([
1318
+ <img src={errorModal} />,
1319
+ <ScreenHeader
1320
+ text={"Agrega tu comentarios para enviar el rechazo"}
1321
+ headerType={"input-name-header"}
1322
+ color={"white"}
1323
+ />,
1324
+ <TagAndInput
1325
+ label={"Caja de Comentario"}
1326
+ inputType={"textarea"}
1327
+ inputId={"modal-commentary-box"}
1328
+ index={0}
1329
+ color={"white"}
1330
+ />,
1331
+ <Button
1332
+ buttonType={"general-default-button"}
1333
+ label={"Enviar comentario"}
1334
+ onClick={(e) =>
1335
+ createComment(
1336
+ e,
1337
+ document.querySelector(
1338
+ "#modal-commentary-box .ql-container .ql-editor > p"
1339
+ ).innerHTML,
1340
+ activeTab
1341
+ )
1342
+ }
1343
+ />,
1344
+ ]);
1344
1345
  }}
1345
1346
  showApproveRejectAll={
1346
1347
  approveRejectAllButtons() && (auditorAssigned() || userAssigned())
@@ -1350,8 +1351,36 @@ export const RetailerProductEdition = ({
1350
1351
  }
1351
1352
  approveAll={() => validateAll("A")}
1352
1353
  rejectAll={() => {
1353
- setShowRejectModal(true);
1354
- setValRejAll(true);
1354
+ validateAll("R");
1355
+ setMessage("Rechazado");
1356
+ setComponentsArray([
1357
+ <img src={errorModal} />,
1358
+ <ScreenHeader
1359
+ text={"Agrega tu comentarios para enviar el rechazo"}
1360
+ headerType={"input-name-header"}
1361
+ color={"white"}
1362
+ />,
1363
+ <TagAndInput
1364
+ label={"Caja de Comentario"}
1365
+ inputType={"textarea"}
1366
+ inputId={"modal-commentary-box"}
1367
+ index={0}
1368
+ color={"white"}
1369
+ />,
1370
+ <Button
1371
+ buttonType={"general-default-button"}
1372
+ label={"Enviar comentario"}
1373
+ onClick={(e) =>
1374
+ createComment(
1375
+ e,
1376
+ document.querySelector(
1377
+ "#modal-commentary-box .ql-container .ql-editor > p"
1378
+ ).innerHTML,
1379
+ activeTab
1380
+ )
1381
+ }
1382
+ />,
1383
+ ]);
1355
1384
  }}
1356
1385
  />
1357
1386
  <FullTabsMenu
@@ -1472,6 +1501,47 @@ export const RetailerProductEdition = ({
1472
1501
  {(userAssigned(activeTab) || auditorAssigned()) &&
1473
1502
  product[`${getConcept(activeTab)}_status`] !== "NS" && (
1474
1503
  <div className="commentary-box">
1504
+ {!comment ? (
1505
+ <div className="commentary">
1506
+ <TagAndInput
1507
+ label={"Caja de Comentario"}
1508
+ inputType={"textarea"}
1509
+ inputCols={80}
1510
+ inputRows={4}
1511
+ inputId={"commentary-box"}
1512
+ index={0}
1513
+ />
1514
+ <div className="buttons-box">
1515
+ <Button
1516
+ buttonType={"general-transparent-button"}
1517
+ label={"Enviar comentario"}
1518
+ onClick={(e) =>
1519
+ createComment(
1520
+ e,
1521
+ document.querySelector(
1522
+ "#commentary-box .ql-container .ql-editor > p"
1523
+ ).innerHTML,
1524
+ activeTab
1525
+ )
1526
+ }
1527
+ />
1528
+ </div>
1529
+ </div>
1530
+ ) : (
1531
+ <div className="feedback-box">
1532
+ <Commentary
1533
+ comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
1534
+ reviewed={crossComment}
1535
+ />
1536
+ <Button
1537
+ buttonType={"circular-button accept-button"}
1538
+ onClick={async () => {
1539
+ setCrossComment(true);
1540
+ commentRevised();
1541
+ }}
1542
+ />
1543
+ </div>
1544
+ )}
1475
1545
  {[7, 8].includes(user.id_role) && (
1476
1546
  <Button
1477
1547
  buttonType={
@@ -1529,50 +1599,6 @@ export const RetailerProductEdition = ({
1529
1599
  jwt={token}
1530
1600
  />
1531
1601
  )}
1532
- {showRejectModal && (
1533
- <Modal
1534
- title={"Agregar mensaje de rechazo"}
1535
- show={showRejectModal}
1536
- customComponent={
1537
- <TagAndInput
1538
- label={"Caja de Comentario"}
1539
- inputType={"textarea"}
1540
- inputId={"modal-message-box"}
1541
- index={0}
1542
- color={"white"}
1543
- />
1544
- }
1545
- buttons={[
1546
- <ButtonV2
1547
- key={"btn-Cancelar"}
1548
- type={"white"}
1549
- label={"Cancelar"}
1550
- size={12}
1551
- onClick={() => {
1552
- setShowRejectModal(false);
1553
- }}
1554
- />,
1555
- <ButtonV2
1556
- key={"btn-Aceptar"}
1557
- type={"pink"}
1558
- label={"Aceptar"}
1559
- size={12}
1560
- onClick={async () => {
1561
- const body = document.querySelector(
1562
- "#modal-message-box .ql-container .ql-editor > p"
1563
- ).innerHTML;
1564
- const messages = [
1565
- { type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
1566
- ];
1567
- await createComment(messages, activeRetailer.id);
1568
- valRejAll ? validateAll("R") : sendToFacilitator("R");
1569
- setMessage("Rechazado");
1570
- setShowRejectModal(false);
1571
- }}
1572
- />,
1573
- ]}
1574
- />
1575
- )}
1576
1602
  </Container>
1577
1603
  );
1578
1604
  };
@@ -89,10 +89,6 @@ export const Container = styled.div`
89
89
  }
90
90
  }
91
91
  }
92
- #modal-message-box {
93
- width: 400px;
94
- height: 100px;
95
- }
96
92
  .container {
97
93
  width: 100%;
98
94
  height: 100%;