contentoh-components-library 11.0.0 → 12.0.0
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.
- package/.env.development +12 -10
- package/.env.production +2 -0
- package/dist/components/atoms/AsignationOption/index.js +1 -1
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/Commentary/index.js +3 -1
- package/dist/components/atoms/Commentary/styles.js +4 -1
- package/dist/components/atoms/GeneralInput/index.js +2 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +21 -10
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +6 -2
- package/dist/components/organisms/FullTabsMenu/index.js +7 -4
- package/dist/components/organisms/ImageDataTable/index.js +6 -2
- package/dist/components/organisms/ProductImageModal/index.js +0 -3
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +1 -0
- package/dist/components/pages/RetailerProductEdition/index.js +421 -146
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +51 -4
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +1 -1
- package/src/components/atoms/AsignationOption/styles.js +6 -0
- package/src/components/atoms/Commentary/index.js +2 -2
- package/src/components/atoms/Commentary/styles.js +1 -0
- package/src/components/atoms/GeneralInput/index.js +12 -6
- package/src/components/molecules/StatusAsignationInfo/index.js +38 -24
- package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
- package/src/components/molecules/TableHeader/index.js +9 -1
- package/src/components/organisms/FullTabsMenu/index.js +6 -3
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/organisms/ProductImageModal/index.js +0 -4
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -0
- package/src/components/pages/RetailerProductEdition/index.js +194 -54
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/global-files/data.js +29 -2
|
@@ -7,7 +7,11 @@ import { FullTabsMenu } from "../../organisms/FullTabsMenu";
|
|
|
7
7
|
import { InputGroup } from "../../organisms/InputGroup";
|
|
8
8
|
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
9
9
|
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getRetailerServices,
|
|
12
|
+
getPercentage,
|
|
13
|
+
fetchUsers,
|
|
14
|
+
} from "../../../global-files/data";
|
|
11
15
|
import { GalleryHeader } from "../../molecules/GalleryHeader";
|
|
12
16
|
import { ProductImageModal } from "../../organisms/ProductImageModal";
|
|
13
17
|
import { useDropzone } from "react-dropzone";
|
|
@@ -59,6 +63,7 @@ export const RetailerProductEdition = ({
|
|
|
59
63
|
articleId,
|
|
60
64
|
productSelected = {},
|
|
61
65
|
user = {},
|
|
66
|
+
token,
|
|
62
67
|
}) => {
|
|
63
68
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
64
69
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -121,7 +126,12 @@ export const RetailerProductEdition = ({
|
|
|
121
126
|
const [icon, setIcon] = useState(null);
|
|
122
127
|
const [version, setVersion] = useState(productSelected?.version);
|
|
123
128
|
const [comments, setComments] = useState({});
|
|
129
|
+
const [comment, setComment] = useState("");
|
|
124
130
|
const [requiredNull, setRequiredNull] = useState(0);
|
|
131
|
+
const [crossComment, setCrossComment] = useState(false);
|
|
132
|
+
const [userGroups, setUserGroups] = useState([]);
|
|
133
|
+
const [assig, setAssig] = useState({});
|
|
134
|
+
const isRetailer = user?.is_retailer;
|
|
125
135
|
|
|
126
136
|
const loadData = async () => {
|
|
127
137
|
const services = await getRetailerServices(
|
|
@@ -129,7 +139,7 @@ export const RetailerProductEdition = ({
|
|
|
129
139
|
parseInt(productSelected.article.id_category),
|
|
130
140
|
productSelected.version
|
|
131
141
|
);
|
|
132
|
-
|
|
142
|
+
|
|
133
143
|
//Converts the data inside the datasheets object to array
|
|
134
144
|
setServices(services);
|
|
135
145
|
setActiveRetailer(productSelected?.retailers[0]);
|
|
@@ -166,7 +176,7 @@ export const RetailerProductEdition = ({
|
|
|
166
176
|
const translateConcept = (concept) => {
|
|
167
177
|
let translation = "";
|
|
168
178
|
if (concept === "datasheet") {
|
|
169
|
-
translation = "Ficha
|
|
179
|
+
translation = "Ficha técnica";
|
|
170
180
|
} else if (concept === "description") {
|
|
171
181
|
translation = "Descripción";
|
|
172
182
|
} else if (concept === "images") {
|
|
@@ -175,7 +185,7 @@ export const RetailerProductEdition = ({
|
|
|
175
185
|
return translation;
|
|
176
186
|
};
|
|
177
187
|
|
|
178
|
-
const getComments = async (tab) => {
|
|
188
|
+
const getComments = async (tab = "Descripción") => {
|
|
179
189
|
const commentsResponse = await Promise.all([
|
|
180
190
|
axios.get(
|
|
181
191
|
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${productSelected?.article?.id_article}&concept=description&orderIdColab=${productSelected?.orderId}&version=${version}`
|
|
@@ -189,27 +199,84 @@ export const RetailerProductEdition = ({
|
|
|
189
199
|
]);
|
|
190
200
|
|
|
191
201
|
let comments = {};
|
|
192
|
-
commentsResponse.
|
|
202
|
+
commentsResponse.forEach(
|
|
193
203
|
(comment) =>
|
|
194
204
|
JSON.parse(comment.data.body).data[0] &&
|
|
195
205
|
(comments[
|
|
196
206
|
translateConcept(JSON.parse(comment.data.body).data[0]?.concept)
|
|
197
207
|
] = JSON.parse(comment.data.body).data[0])
|
|
198
208
|
);
|
|
209
|
+
setComment(comments[tab]);
|
|
199
210
|
setComments(comments);
|
|
200
|
-
//const comment = JSON.parse(commentsResponse.data.body).data;
|
|
201
|
-
//setComment(comment[0]);
|
|
202
211
|
};
|
|
203
212
|
|
|
204
|
-
useEffect(() => {
|
|
213
|
+
useEffect(async () => {
|
|
205
214
|
loadData();
|
|
206
215
|
getPercentage({ data: [productSelected] }).then((res) =>
|
|
207
216
|
setPercentages(res)
|
|
208
217
|
);
|
|
209
218
|
getServices();
|
|
210
219
|
getComments();
|
|
220
|
+
setUserGroups(await fetchUsers(token));
|
|
211
221
|
}, []);
|
|
212
222
|
|
|
223
|
+
const loadAssignations = (currentProduct) => {
|
|
224
|
+
setAssig({
|
|
225
|
+
Descripción: {
|
|
226
|
+
assignations: [
|
|
227
|
+
{
|
|
228
|
+
collaboratorType: "especialist",
|
|
229
|
+
id: currentProduct?.article?.id_description_especialist,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
collaboratorType: "facilitator",
|
|
233
|
+
id: currentProduct?.article?.id_description_facilitator,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
collaborators: {
|
|
237
|
+
especialist: userGroups[0] || [],
|
|
238
|
+
facilitator: userGroups[2] || [],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
"Ficha técnica": {
|
|
242
|
+
assignations: [
|
|
243
|
+
{
|
|
244
|
+
collaboratorType: "especialist",
|
|
245
|
+
id: currentProduct?.article?.id_datasheet_especialist,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
collaboratorType: "facilitator",
|
|
249
|
+
id: currentProduct?.article?.id_datasheet_facilitator,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
collaborators: {
|
|
253
|
+
especialist: userGroups[0] || [],
|
|
254
|
+
facilitator: userGroups[2] || [],
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
Imágenes: {
|
|
258
|
+
assignations: [
|
|
259
|
+
{
|
|
260
|
+
collaboratorType: "especialist",
|
|
261
|
+
id: currentProduct?.article?.id_images_especialist,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
collaboratorType: "facilitator",
|
|
265
|
+
id: currentProduct?.article?.id_images_facilitator,
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
collaborators: {
|
|
269
|
+
especialist: userGroups[1] || [],
|
|
270
|
+
facilitator: userGroups[3] || [],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
loadAssignations(productSelected);
|
|
278
|
+
}, [userGroups]);
|
|
279
|
+
|
|
213
280
|
useEffect(() => {
|
|
214
281
|
productSelected.retailers.forEach((retailer) => {
|
|
215
282
|
retailer["percentage"] = percentages.filter(
|
|
@@ -271,8 +338,7 @@ export const RetailerProductEdition = ({
|
|
|
271
338
|
dataObject,
|
|
272
339
|
{
|
|
273
340
|
headers: {
|
|
274
|
-
Authorization:
|
|
275
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
341
|
+
Authorization: token,
|
|
276
342
|
},
|
|
277
343
|
}
|
|
278
344
|
);
|
|
@@ -292,8 +358,7 @@ export const RetailerProductEdition = ({
|
|
|
292
358
|
dataObject,
|
|
293
359
|
{
|
|
294
360
|
headers: {
|
|
295
|
-
Authorization:
|
|
296
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
361
|
+
Authorization: token,
|
|
297
362
|
},
|
|
298
363
|
}
|
|
299
364
|
);
|
|
@@ -406,8 +471,7 @@ export const RetailerProductEdition = ({
|
|
|
406
471
|
dataImages,
|
|
407
472
|
{
|
|
408
473
|
headers: {
|
|
409
|
-
Authorization:
|
|
410
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
474
|
+
Authorization: token,
|
|
411
475
|
},
|
|
412
476
|
}
|
|
413
477
|
);
|
|
@@ -521,12 +585,10 @@ export const RetailerProductEdition = ({
|
|
|
521
585
|
}
|
|
522
586
|
}
|
|
523
587
|
}
|
|
524
|
-
//console.log(serv, "serv");
|
|
525
588
|
setServicesData(serv);
|
|
526
589
|
};
|
|
527
590
|
|
|
528
591
|
const sendToFacilitator = async (result) => {
|
|
529
|
-
console.log("exce");
|
|
530
592
|
let concept = "";
|
|
531
593
|
switch (activeTab) {
|
|
532
594
|
case "Descripción":
|
|
@@ -579,8 +641,7 @@ export const RetailerProductEdition = ({
|
|
|
579
641
|
};
|
|
580
642
|
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
581
643
|
headers: {
|
|
582
|
-
Authorization:
|
|
583
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
644
|
+
Authorization: token,
|
|
584
645
|
},
|
|
585
646
|
});
|
|
586
647
|
} else {
|
|
@@ -610,8 +671,7 @@ export const RetailerProductEdition = ({
|
|
|
610
671
|
|
|
611
672
|
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
612
673
|
headers: {
|
|
613
|
-
Authorization:
|
|
614
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
674
|
+
Authorization: token,
|
|
615
675
|
},
|
|
616
676
|
});
|
|
617
677
|
setProduct(productTemp);
|
|
@@ -673,22 +733,91 @@ export const RetailerProductEdition = ({
|
|
|
673
733
|
return productSelected?.version === version;
|
|
674
734
|
}
|
|
675
735
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
736
|
+
const createComment = async (e, body, tab) => {
|
|
737
|
+
let concept = "";
|
|
738
|
+
switch (activeTab) {
|
|
739
|
+
case "Ficha técnica":
|
|
740
|
+
concept = "datasheet";
|
|
741
|
+
break;
|
|
742
|
+
case "Imágenes":
|
|
743
|
+
concept = "images";
|
|
744
|
+
break;
|
|
745
|
+
|
|
746
|
+
default:
|
|
747
|
+
concept = "description";
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
const data = {
|
|
751
|
+
articleId: product?.article?.id_article,
|
|
752
|
+
orderId: product?.orderId,
|
|
753
|
+
message: body,
|
|
754
|
+
concept: concept,
|
|
755
|
+
version: version,
|
|
756
|
+
};
|
|
757
|
+
e.preventDefault();
|
|
758
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
759
|
+
headers: {
|
|
760
|
+
Authorization: token,
|
|
761
|
+
},
|
|
762
|
+
});
|
|
763
|
+
await getComments(tab);
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
useEffect(async () => {
|
|
767
|
+
setComment(comments[activeTab]);
|
|
690
768
|
}, [activeTab]);
|
|
691
769
|
|
|
770
|
+
const commentRevised = async () => {
|
|
771
|
+
const data = {
|
|
772
|
+
commentId: comment.id,
|
|
773
|
+
};
|
|
774
|
+
await axios.put(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
775
|
+
headers: {
|
|
776
|
+
Authorization: sessionStorage.getItem("jwt"),
|
|
777
|
+
},
|
|
778
|
+
});
|
|
779
|
+
setCrossComment(false);
|
|
780
|
+
await getComments();
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const setAssignation = async (assignationType, assignationId) => {
|
|
784
|
+
let concept = "";
|
|
785
|
+
switch (activeTab) {
|
|
786
|
+
case "Ficha técnica":
|
|
787
|
+
concept = "datasheet";
|
|
788
|
+
break;
|
|
789
|
+
case "Imágenes":
|
|
790
|
+
concept = "images";
|
|
791
|
+
break;
|
|
792
|
+
|
|
793
|
+
default:
|
|
794
|
+
concept = "description";
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
const productTemp = productSelected;
|
|
798
|
+
productTemp.article[`id_${concept}_${assignationType}`] = assignationId;
|
|
799
|
+
const data = {
|
|
800
|
+
articleList: [
|
|
801
|
+
{
|
|
802
|
+
orderId: product.orderId,
|
|
803
|
+
articleId: product?.article?.id_article,
|
|
804
|
+
},
|
|
805
|
+
],
|
|
806
|
+
concept: concept,
|
|
807
|
+
[`${assignationType}Id`]: assignationId,
|
|
808
|
+
};
|
|
809
|
+
axios({
|
|
810
|
+
method: "post",
|
|
811
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
812
|
+
data: data,
|
|
813
|
+
headers: {
|
|
814
|
+
Authorization: token,
|
|
815
|
+
},
|
|
816
|
+
});
|
|
817
|
+
loadAssignations(productTemp);
|
|
818
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
819
|
+
};
|
|
820
|
+
|
|
692
821
|
return (
|
|
693
822
|
<Container headerTop={headerTop}>
|
|
694
823
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -705,11 +834,10 @@ export const RetailerProductEdition = ({
|
|
|
705
834
|
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
706
835
|
retailerSelected={activeRetailer.id}
|
|
707
836
|
setImages={setImages}
|
|
708
|
-
assignationsImages={[
|
|
709
|
-
productSelected.article.id_images_especialist,
|
|
710
|
-
productSelected.article.id_images_facilitator,
|
|
711
|
-
]}
|
|
837
|
+
assignationsImages={assig["Imágenes"]}
|
|
712
838
|
imagesStatus={productSelected?.images_status}
|
|
839
|
+
setAssignation={setAssignation}
|
|
840
|
+
isRetailer={isRetailer}
|
|
713
841
|
/>
|
|
714
842
|
</div>
|
|
715
843
|
<div className="product-information">
|
|
@@ -745,20 +873,9 @@ export const RetailerProductEdition = ({
|
|
|
745
873
|
saveDescriptions={saveDescriptions}
|
|
746
874
|
saveDatasheets={saveDatasheets}
|
|
747
875
|
updateImages={updateImages}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
productSelected.article.id_description_facilitator,
|
|
752
|
-
],
|
|
753
|
-
"Ficha técnica": [
|
|
754
|
-
productSelected.article.id_datasheet_especialist,
|
|
755
|
-
productSelected.article.id_datasheet_facilitator,
|
|
756
|
-
],
|
|
757
|
-
Imágenes: [
|
|
758
|
-
productSelected.article.id_images_especialist,
|
|
759
|
-
productSelected.article.id_images_facilitator,
|
|
760
|
-
],
|
|
761
|
-
}}
|
|
876
|
+
assig={assig[activeTab]}
|
|
877
|
+
setAssignation={setAssignation}
|
|
878
|
+
isRetailer={isRetailer}
|
|
762
879
|
/>
|
|
763
880
|
<div
|
|
764
881
|
className={
|
|
@@ -814,18 +931,29 @@ export const RetailerProductEdition = ({
|
|
|
814
931
|
{(userAssigned(activeTab, "especialist" || "facilitator") ||
|
|
815
932
|
auditorAssigned()) && (
|
|
816
933
|
<div className="commentary-box">
|
|
817
|
-
{!
|
|
934
|
+
{!comment ? (
|
|
818
935
|
<div className="commentary">
|
|
819
936
|
<TagAndInput
|
|
820
937
|
label={"Caja de Comentario"}
|
|
821
938
|
inputType={"textarea"}
|
|
822
939
|
inputCols={80}
|
|
823
940
|
inputRows={4}
|
|
941
|
+
inputId={"commentary-box"}
|
|
942
|
+
index={0}
|
|
824
943
|
/>
|
|
825
944
|
<div className="buttons-box">
|
|
826
945
|
<Button
|
|
827
946
|
buttonType={"general-transparent-button"}
|
|
828
947
|
label={"Enviar comentario"}
|
|
948
|
+
onClick={(e) =>
|
|
949
|
+
createComment(
|
|
950
|
+
e,
|
|
951
|
+
document.getElementById(
|
|
952
|
+
"description-commentary-box-0"
|
|
953
|
+
).value,
|
|
954
|
+
activeTab
|
|
955
|
+
)
|
|
956
|
+
}
|
|
829
957
|
/>
|
|
830
958
|
<Button
|
|
831
959
|
buttonType={
|
|
@@ -841,7 +969,19 @@ export const RetailerProductEdition = ({
|
|
|
841
969
|
</div>
|
|
842
970
|
</div>
|
|
843
971
|
) : (
|
|
844
|
-
<
|
|
972
|
+
<div className="feedback-box">
|
|
973
|
+
<Commentary
|
|
974
|
+
comment={comment.message}
|
|
975
|
+
reviewed={crossComment}
|
|
976
|
+
/>
|
|
977
|
+
<Button
|
|
978
|
+
buttonType={"circular-button accept-button"}
|
|
979
|
+
onClick={async () => {
|
|
980
|
+
setCrossComment(true);
|
|
981
|
+
commentRevised();
|
|
982
|
+
}}
|
|
983
|
+
/>
|
|
984
|
+
</div>
|
|
845
985
|
)}
|
|
846
986
|
</div>
|
|
847
987
|
)}
|
package/src/global-files/data.js
CHANGED
|
@@ -15,8 +15,6 @@ export const getRetailerServices = async (articleId, category, version) => {
|
|
|
15
15
|
),
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
|
-
console.log(JSON.parse(responseArray[0].data.body).data);
|
|
19
|
-
|
|
20
18
|
const datasheets = JSON.parse(responseArray[0].data.body).data;
|
|
21
19
|
const descriptions = JSON.parse(responseArray[1].data.body).data;
|
|
22
20
|
const images = JSON.parse(responseArray[2].data.body).data;
|
|
@@ -150,3 +148,32 @@ export const getProfilePicture = (userId, width, height) => {
|
|
|
150
148
|
return defaultUpdate;
|
|
151
149
|
}
|
|
152
150
|
};
|
|
151
|
+
|
|
152
|
+
export const fetchUsers = async (auth) => {
|
|
153
|
+
const usersPromises = [];
|
|
154
|
+
let usersGroups = [];
|
|
155
|
+
const header = {
|
|
156
|
+
headers: {
|
|
157
|
+
Authorization: auth,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* 7 will fetch all text specialists
|
|
162
|
+
* 8 will fetch all img specialists
|
|
163
|
+
* 4 will fetch all text facilitators
|
|
164
|
+
* 5 will fetch all img facilitators
|
|
165
|
+
* 6 will fetch all auditors
|
|
166
|
+
*/
|
|
167
|
+
usersPromises.push(
|
|
168
|
+
axios.get(`${process.env.REACT_APP_USER_ENDPOINT}?fetchRole=7`, header),
|
|
169
|
+
axios.get(`${process.env.REACT_APP_USER_ENDPOINT}?fetchRole=8`, header),
|
|
170
|
+
axios.get(`${process.env.REACT_APP_USER_ENDPOINT}?fetchRole=4`, header),
|
|
171
|
+
axios.get(`${process.env.REACT_APP_USER_ENDPOINT}?fetchRole=5`, header),
|
|
172
|
+
axios.get(`${process.env.REACT_APP_USER_ENDPOINT}?fetchRole=6`, header)
|
|
173
|
+
);
|
|
174
|
+
const usersResponse = await Promise.all(usersPromises);
|
|
175
|
+
usersResponse.forEach((item, i) => {
|
|
176
|
+
usersGroups.push(item.data.data);
|
|
177
|
+
});
|
|
178
|
+
return usersGroups;
|
|
179
|
+
};
|