contentoh-components-library 21.3.55 → 21.3.57
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/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/Status/styles.js +1 -1
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +18 -23
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +27 -0
- package/dist/components/organisms/GlobalModal/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/styles.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/pages/Dashboard/Dashboard.stories.js +35 -54
- package/dist/components/pages/Dashboard/index.js +8 -4
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +98 -26
- package/dist/components/pages/ProviderProductEdition/index.js +623 -386
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +103 -153
- package/dist/components/pages/RetailerProductEdition/index.js +33 -35
- package/dist/index.js +13 -0
- package/package.json +7 -6
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +4 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +18 -22
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +3 -4
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +18 -1
- package/src/components/organisms/GlobalModal/styles.js +10 -0
- package/src/components/organisms/OrderDetail/styles.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +0 -1
- package/src/components/organisms/TableResizable/TableResizable.stories.js +17 -0
- package/src/components/organisms/TableResizable/index.js +119 -0
- package/src/components/organisms/TableResizable/styles.js +133 -0
- package/src/components/organisms/TableResizable/utils.js +46 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +35 -59
- package/src/components/pages/Dashboard/index.js +4 -3
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +110 -31
- package/src/components/pages/ProviderProductEdition/index.js +244 -131
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +93 -145
- package/src/components/pages/RetailerProductEdition/index.js +24 -22
- package/src/index.js +1 -0
|
@@ -19,9 +19,6 @@ import { useDropzone } from "react-dropzone";
|
|
|
19
19
|
import axios from "axios";
|
|
20
20
|
import { v4 as uuidv4 } from "uuid";
|
|
21
21
|
import AWS from "aws-sdk";
|
|
22
|
-
import attributesSent from "../../../assets/images/modalsSVGs/attributesSent.svg";
|
|
23
|
-
import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.svg";
|
|
24
|
-
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
22
|
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
23
|
import { Button } from "../../atoms/GeneralButton";
|
|
27
24
|
import { Commentary } from "../../atoms/Commentary";
|
|
@@ -42,7 +39,6 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
|
|
|
42
39
|
import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
|
|
43
40
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
44
41
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
45
|
-
import { number } from "prop-types";
|
|
46
42
|
|
|
47
43
|
const reducerImages = (state, action) => {
|
|
48
44
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -134,6 +130,7 @@ export const ProviderProductEdition = ({
|
|
|
134
130
|
setShowContentohRequestModal,
|
|
135
131
|
showSurvey,
|
|
136
132
|
company,
|
|
133
|
+
addToCart,
|
|
137
134
|
}) => {
|
|
138
135
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
139
136
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -205,7 +202,6 @@ export const ProviderProductEdition = ({
|
|
|
205
202
|
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
206
203
|
: productToEdit
|
|
207
204
|
);
|
|
208
|
-
const [icon, setIcon] = useState(null);
|
|
209
205
|
const [version, setVersion] = useState(product?.version);
|
|
210
206
|
const [comments] = useState({});
|
|
211
207
|
const [comment, setComment] = useState("");
|
|
@@ -226,9 +222,6 @@ export const ProviderProductEdition = ({
|
|
|
226
222
|
Imágenes: originProp,
|
|
227
223
|
});
|
|
228
224
|
const [inCart, setInCart] = useState(false);
|
|
229
|
-
const [modalSent, setModalSent] = useState(false);
|
|
230
|
-
const [modalViewError, setModalViewError] = useState(false);
|
|
231
|
-
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
232
225
|
const [dataGenericModal, setDataGenericModal] = useState({
|
|
233
226
|
message: "¿Estás seguro de continuar?",
|
|
234
227
|
detail: ` ${
|
|
@@ -238,7 +231,7 @@ export const ProviderProductEdition = ({
|
|
|
238
231
|
}`,
|
|
239
232
|
button1: {
|
|
240
233
|
name: "Cerrar",
|
|
241
|
-
action:
|
|
234
|
+
action: closeGlobalModal,
|
|
242
235
|
},
|
|
243
236
|
button2: {
|
|
244
237
|
name: "Continuar",
|
|
@@ -246,7 +239,6 @@ export const ProviderProductEdition = ({
|
|
|
246
239
|
},
|
|
247
240
|
img: face,
|
|
248
241
|
});
|
|
249
|
-
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
250
242
|
const [socketType, setSocketType] = useState(null);
|
|
251
243
|
const [saving, setSaving] = useState(loading);
|
|
252
244
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
@@ -254,6 +246,227 @@ export const ProviderProductEdition = ({
|
|
|
254
246
|
);
|
|
255
247
|
const [showVersionSelector, setShowVersionSelector] =
|
|
256
248
|
useCloseModal("version-selector");
|
|
249
|
+
const [globalModal, setGlobalModal] = useState();
|
|
250
|
+
|
|
251
|
+
const updateAuditStatus = async (status) => {
|
|
252
|
+
const productTemp = product;
|
|
253
|
+
productTemp.article_status = status;
|
|
254
|
+
productTemp.datasheet_status = status;
|
|
255
|
+
productTemp.description_status = status;
|
|
256
|
+
productTemp.images_status = status;
|
|
257
|
+
|
|
258
|
+
const retailerStatusCopy = { ...retailerStatus };
|
|
259
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
260
|
+
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
261
|
+
conceptArray.forEach((concept) => {
|
|
262
|
+
if (retailerStatusCopy[key][concept]) {
|
|
263
|
+
retailerStatusCopy[key][concept] = status;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
setRetailerStatus(retailerStatusCopy);
|
|
268
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
269
|
+
setProduct(productTemp);
|
|
270
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
271
|
+
setProductEdit({
|
|
272
|
+
ArticleId: productTemp.id_article,
|
|
273
|
+
idCategory: productTemp.article.id_category,
|
|
274
|
+
product: productTemp,
|
|
275
|
+
});
|
|
276
|
+
sessionStorage.setItem(
|
|
277
|
+
"productEdit",
|
|
278
|
+
JSON.stringify({
|
|
279
|
+
ArticleId: productTemp.id_article,
|
|
280
|
+
idCategory: productTemp.article.id_category,
|
|
281
|
+
product: productTemp,
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
await loadData();
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const addCart = async (retailers) => {
|
|
288
|
+
const { article, version } = product;
|
|
289
|
+
const articleToOrder = [
|
|
290
|
+
{
|
|
291
|
+
articleId: article.id_article,
|
|
292
|
+
version,
|
|
293
|
+
userId: user.id_user,
|
|
294
|
+
discount: 0,
|
|
295
|
+
subtotal: 0,
|
|
296
|
+
companyId: user.id_company,
|
|
297
|
+
datasheet: retailers,
|
|
298
|
+
description: retailers,
|
|
299
|
+
image: retailers,
|
|
300
|
+
attributeTranslations: false,
|
|
301
|
+
descriptionTranslations: false,
|
|
302
|
+
build: "[]",
|
|
303
|
+
manual: "[]",
|
|
304
|
+
userCreated: user.id_user,
|
|
305
|
+
},
|
|
306
|
+
];
|
|
307
|
+
let modatlType = "addedToCartError";
|
|
308
|
+
if (addToCart) {
|
|
309
|
+
const resCart = await addToCart({ data: articleToOrder });
|
|
310
|
+
if (resCart.data.statusCode === 200) {
|
|
311
|
+
modatlType = "addedToCart";
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
showGlobalModal(modatlType);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const closeGlobalModal = () => setGlobalModal();
|
|
318
|
+
|
|
319
|
+
const seenByProvider = async () => {
|
|
320
|
+
const productTemp = product;
|
|
321
|
+
const articleId = productTemp.id_article;
|
|
322
|
+
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
323
|
+
const promises = [];
|
|
324
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
325
|
+
conceptArray.forEach((concept) => {
|
|
326
|
+
const sectionStatusKey = `${concept}_status`;
|
|
327
|
+
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
328
|
+
const data = { articleId, orderId, concept, evalStatus };
|
|
329
|
+
promises.push(
|
|
330
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
331
|
+
headers: {
|
|
332
|
+
Authorization: token,
|
|
333
|
+
},
|
|
334
|
+
})
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
await Promise.all(promises);
|
|
338
|
+
closeGlobalModal();
|
|
339
|
+
await updateAuditStatus("FAP");
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const showGlobalModal = useCallback(
|
|
343
|
+
(type) => {
|
|
344
|
+
const formatter = new Intl.ListFormat("es", { type: "conjunction" });
|
|
345
|
+
switch (type) {
|
|
346
|
+
case "error":
|
|
347
|
+
setGlobalModal({
|
|
348
|
+
message: `${activeTab} rechazada`,
|
|
349
|
+
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
350
|
+
img: errorModal,
|
|
351
|
+
textArea: true,
|
|
352
|
+
button1: {
|
|
353
|
+
name: "Enviar",
|
|
354
|
+
action: (e) => {
|
|
355
|
+
const textArea = document.querySelector("#area");
|
|
356
|
+
if (textArea.value) {
|
|
357
|
+
textArea.style.border = "none";
|
|
358
|
+
createComment(e, textArea.value);
|
|
359
|
+
showGlobalModal("commentsSent");
|
|
360
|
+
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
361
|
+
} else {
|
|
362
|
+
textArea.style.border = "2px solid red";
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
break;
|
|
368
|
+
case "generic":
|
|
369
|
+
setGlobalModal(dataGenericModal);
|
|
370
|
+
break;
|
|
371
|
+
case "commentsSent":
|
|
372
|
+
setGlobalModal({
|
|
373
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
374
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
375
|
+
button1: {
|
|
376
|
+
name: "Cerrar",
|
|
377
|
+
action: closeGlobalModal,
|
|
378
|
+
},
|
|
379
|
+
img: face,
|
|
380
|
+
textArea: false,
|
|
381
|
+
});
|
|
382
|
+
break;
|
|
383
|
+
case "RAC":
|
|
384
|
+
const servicesRejected = [];
|
|
385
|
+
const translateServices = {
|
|
386
|
+
datasheet: "ficha técnica",
|
|
387
|
+
description: "descripción",
|
|
388
|
+
images: "imágenes",
|
|
389
|
+
};
|
|
390
|
+
Object.keys(translateServices).forEach((service) => {
|
|
391
|
+
if (product[`${service}_status`] === "RAC") {
|
|
392
|
+
servicesRejected.push(translateServices[service]);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
const plural = ["Los servicios", "cumplen"];
|
|
396
|
+
const singular = ["El servicio", "cumple"];
|
|
397
|
+
const grammar = servicesRejected.length > 1 ? plural : singular;
|
|
398
|
+
const formatted = formatter.format(servicesRejected);
|
|
399
|
+
const text1 = `${grammar[0]} de ${formatted} no ${grammar[1]} con lo que la cadena necesita.`;
|
|
400
|
+
const text2 = `¡Solicita el servicio de Content-oh! para completarlo!`;
|
|
401
|
+
const retailers = product.retailersWithService.map((retailer) =>
|
|
402
|
+
Number(retailer)
|
|
403
|
+
);
|
|
404
|
+
setGlobalModal({
|
|
405
|
+
message:
|
|
406
|
+
"Tu producto no cumple con los requerimientos de la cadena",
|
|
407
|
+
customComponent: (
|
|
408
|
+
<>
|
|
409
|
+
<p className="generic-text">
|
|
410
|
+
{text1}
|
|
411
|
+
<br />
|
|
412
|
+
<br />
|
|
413
|
+
{text2}
|
|
414
|
+
</p>
|
|
415
|
+
</>
|
|
416
|
+
),
|
|
417
|
+
button1: {
|
|
418
|
+
name: "Continuar",
|
|
419
|
+
action: async () => await seenByProvider(),
|
|
420
|
+
},
|
|
421
|
+
button2: {
|
|
422
|
+
name: "Solicitar a Content-oh!",
|
|
423
|
+
action: async () => {
|
|
424
|
+
await addCart(retailers);
|
|
425
|
+
await seenByProvider();
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
img: errorModal,
|
|
429
|
+
});
|
|
430
|
+
break;
|
|
431
|
+
case "AAC":
|
|
432
|
+
setGlobalModal({
|
|
433
|
+
message: "Felicidades",
|
|
434
|
+
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
435
|
+
button1: {
|
|
436
|
+
name: "Continuar",
|
|
437
|
+
action: async () => await seenByProvider(),
|
|
438
|
+
},
|
|
439
|
+
img: face,
|
|
440
|
+
});
|
|
441
|
+
break;
|
|
442
|
+
case "addedToCartError":
|
|
443
|
+
setGlobalModal({
|
|
444
|
+
detail:
|
|
445
|
+
"Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
446
|
+
button1: {
|
|
447
|
+
name: "Continuar",
|
|
448
|
+
action: closeGlobalModal,
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
break;
|
|
452
|
+
case "addedToCart":
|
|
453
|
+
setGlobalModal({
|
|
454
|
+
message: "Producto añadido",
|
|
455
|
+
detail: "Tu producto se añadió al carrito de compras.",
|
|
456
|
+
button1: {
|
|
457
|
+
name: "Continuar",
|
|
458
|
+
action: closeGlobalModal,
|
|
459
|
+
},
|
|
460
|
+
img: face,
|
|
461
|
+
});
|
|
462
|
+
break;
|
|
463
|
+
default:
|
|
464
|
+
closeGlobalModal();
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
[activeTab, dataGenericModal, product]
|
|
469
|
+
);
|
|
257
470
|
|
|
258
471
|
useEffect(() => {
|
|
259
472
|
checkAll && setSelectedImages(images.values);
|
|
@@ -352,6 +565,8 @@ export const ProviderProductEdition = ({
|
|
|
352
565
|
getCart();
|
|
353
566
|
fetchUsers(token).then((res) => setUserGroups(res));
|
|
354
567
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
568
|
+
if (["RAC", "AAC"].includes(product.article_status))
|
|
569
|
+
showGlobalModal(product.article_status);
|
|
355
570
|
}, [product, version]);
|
|
356
571
|
|
|
357
572
|
useEffect(() => {
|
|
@@ -618,22 +833,6 @@ export const ProviderProductEdition = ({
|
|
|
618
833
|
}
|
|
619
834
|
};
|
|
620
835
|
|
|
621
|
-
const getSectionIcon = () => {
|
|
622
|
-
switch (activeTab) {
|
|
623
|
-
case "Ficha técnica":
|
|
624
|
-
setIcon(attributesSent);
|
|
625
|
-
break;
|
|
626
|
-
case "Descripción":
|
|
627
|
-
setIcon(descriptionSent);
|
|
628
|
-
break;
|
|
629
|
-
case "Imágenes0,,":
|
|
630
|
-
setIcon(imagesSent);
|
|
631
|
-
break;
|
|
632
|
-
default:
|
|
633
|
-
break;
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
|
|
637
836
|
const createComment = async (e, body, tab) => {
|
|
638
837
|
let concept = "";
|
|
639
838
|
switch (activeTab) {
|
|
@@ -716,21 +915,6 @@ export const ProviderProductEdition = ({
|
|
|
716
915
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
717
916
|
};
|
|
718
917
|
|
|
719
|
-
const evaluationComplete = (tab) => {
|
|
720
|
-
const concept = getConcept(tab);
|
|
721
|
-
let serv = servicesData.filter((item) => item.service === concept);
|
|
722
|
-
if (
|
|
723
|
-
["RequestWithContentoh", "RequestWithoutContentoh"].includes(origin[tab])
|
|
724
|
-
) {
|
|
725
|
-
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
726
|
-
}
|
|
727
|
-
const statusArray =
|
|
728
|
-
user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
|
|
729
|
-
return (
|
|
730
|
-
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
731
|
-
);
|
|
732
|
-
};
|
|
733
|
-
|
|
734
918
|
const downloadImages = () => {
|
|
735
919
|
selectedImages.length > 0
|
|
736
920
|
? selectedImages.forEach((e) => {
|
|
@@ -824,21 +1008,6 @@ export const ProviderProductEdition = ({
|
|
|
824
1008
|
}
|
|
825
1009
|
};
|
|
826
1010
|
|
|
827
|
-
const confirmStatusComplete = () => {
|
|
828
|
-
const { datasheet_status, description_status, images_status } = product;
|
|
829
|
-
const completionStates =
|
|
830
|
-
user.is_retailer === 1
|
|
831
|
-
? ["ACA", "Evaluated", "NS"]
|
|
832
|
-
: ["AP", "Evaluated", "NS"];
|
|
833
|
-
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
834
|
-
const descsEvaluated = completionStates.includes(description_status);
|
|
835
|
-
const imgsEvaluated = completionStates.includes(images_status);
|
|
836
|
-
|
|
837
|
-
const AllEvaluated = dsEvaluated && descsEvaluated && imgsEvaluated;
|
|
838
|
-
|
|
839
|
-
return AllEvaluated;
|
|
840
|
-
};
|
|
841
|
-
|
|
842
1011
|
const sendEvaluation = async (result) => {
|
|
843
1012
|
setLoading(true);
|
|
844
1013
|
const concept = getConcept(activeTab);
|
|
@@ -937,23 +1106,24 @@ export const ProviderProductEdition = ({
|
|
|
937
1106
|
})
|
|
938
1107
|
);
|
|
939
1108
|
});
|
|
940
|
-
|
|
1109
|
+
await Promise.all(evaluationArray);
|
|
941
1110
|
const userType = user.is_retailer === 1 ? "CA" : "P";
|
|
942
1111
|
|
|
943
1112
|
const productTemp = product;
|
|
944
|
-
|
|
1113
|
+
const status = `${result}${userType}`;
|
|
1114
|
+
productTemp.article_status = status;
|
|
945
1115
|
productTemp.datasheet_status =
|
|
946
|
-
productTemp.datasheet_status === "NA" ? "NA" :
|
|
1116
|
+
productTemp.datasheet_status === "NA" ? "NA" : status;
|
|
947
1117
|
productTemp.description_status =
|
|
948
|
-
productTemp.description_status === "NA" ? "NA" :
|
|
1118
|
+
productTemp.description_status === "NA" ? "NA" : status;
|
|
949
1119
|
productTemp.images_status =
|
|
950
|
-
productTemp.images_status === "NA" ? "NA" :
|
|
1120
|
+
productTemp.images_status === "NA" ? "NA" : status;
|
|
951
1121
|
|
|
952
1122
|
const retailerStatusCopy = { ...retailerStatus };
|
|
953
1123
|
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
954
1124
|
conceptArray.forEach((concept) => {
|
|
955
1125
|
if (retailerStatusCopy[key][concept]) {
|
|
956
|
-
retailerStatusCopy[key][concept] =
|
|
1126
|
+
retailerStatusCopy[key][concept] = status;
|
|
957
1127
|
}
|
|
958
1128
|
});
|
|
959
1129
|
});
|
|
@@ -1004,7 +1174,7 @@ export const ProviderProductEdition = ({
|
|
|
1004
1174
|
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1005
1175
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1006
1176
|
setProduct(prod);
|
|
1007
|
-
|
|
1177
|
+
showGlobalModal("generic");
|
|
1008
1178
|
await loadData();
|
|
1009
1179
|
};
|
|
1010
1180
|
|
|
@@ -1075,7 +1245,7 @@ export const ProviderProductEdition = ({
|
|
|
1075
1245
|
action: () => evaluationToRetailer("A"),
|
|
1076
1246
|
},
|
|
1077
1247
|
}));
|
|
1078
|
-
|
|
1248
|
+
showGlobalModal("generic");
|
|
1079
1249
|
} else if (user.is_retailer) {
|
|
1080
1250
|
if (product.id_order || product.orderId) {
|
|
1081
1251
|
sendEvaluation("A");
|
|
@@ -1087,7 +1257,7 @@ export const ProviderProductEdition = ({
|
|
|
1087
1257
|
action: () => evaluationToRetailer("A"),
|
|
1088
1258
|
},
|
|
1089
1259
|
}));
|
|
1090
|
-
|
|
1260
|
+
showGlobalModal("generic");
|
|
1091
1261
|
}
|
|
1092
1262
|
} else {
|
|
1093
1263
|
sendEvaluation("A");
|
|
@@ -1102,7 +1272,7 @@ export const ProviderProductEdition = ({
|
|
|
1102
1272
|
} else if (user.is_retailer) {
|
|
1103
1273
|
if (product.id_order || product.orderId) {
|
|
1104
1274
|
setValidatedAll(true);
|
|
1105
|
-
|
|
1275
|
+
showGlobalModal("error");
|
|
1106
1276
|
} else {
|
|
1107
1277
|
setDataGenericModal((prev) => ({
|
|
1108
1278
|
...prev,
|
|
@@ -1111,11 +1281,11 @@ export const ProviderProductEdition = ({
|
|
|
1111
1281
|
action: () => evaluationToRetailer("R"),
|
|
1112
1282
|
},
|
|
1113
1283
|
}));
|
|
1114
|
-
|
|
1284
|
+
showGlobalModal("generic");
|
|
1115
1285
|
}
|
|
1116
1286
|
} else {
|
|
1117
1287
|
setValidatedAll(true);
|
|
1118
|
-
|
|
1288
|
+
showGlobalModal("error");
|
|
1119
1289
|
}
|
|
1120
1290
|
}
|
|
1121
1291
|
};
|
|
@@ -1174,7 +1344,7 @@ export const ProviderProductEdition = ({
|
|
|
1174
1344
|
action: () => evaluationToRetailer("A"),
|
|
1175
1345
|
},
|
|
1176
1346
|
}));
|
|
1177
|
-
|
|
1347
|
+
showGlobalModal("generic");
|
|
1178
1348
|
} else if (user.is_retailer) {
|
|
1179
1349
|
if (product.id_order || product.orderId) {
|
|
1180
1350
|
validateAll("A");
|
|
@@ -1186,7 +1356,7 @@ export const ProviderProductEdition = ({
|
|
|
1186
1356
|
action: () => evaluationToRetailer("A"),
|
|
1187
1357
|
},
|
|
1188
1358
|
}));
|
|
1189
|
-
|
|
1359
|
+
showGlobalModal("generic");
|
|
1190
1360
|
}
|
|
1191
1361
|
} else {
|
|
1192
1362
|
validateAll("A");
|
|
@@ -1202,7 +1372,7 @@ export const ProviderProductEdition = ({
|
|
|
1202
1372
|
} else if (user.is_retailer) {
|
|
1203
1373
|
if (product.id_order || product.orderId) {
|
|
1204
1374
|
setValidatedAll(true);
|
|
1205
|
-
|
|
1375
|
+
showGlobalModal("error");
|
|
1206
1376
|
} else {
|
|
1207
1377
|
setDataGenericModal((prev) => ({
|
|
1208
1378
|
...prev,
|
|
@@ -1211,11 +1381,11 @@ export const ProviderProductEdition = ({
|
|
|
1211
1381
|
action: () => evaluationToRetailer("R"),
|
|
1212
1382
|
},
|
|
1213
1383
|
}));
|
|
1214
|
-
|
|
1384
|
+
showGlobalModal("generic");
|
|
1215
1385
|
}
|
|
1216
1386
|
} else {
|
|
1217
1387
|
setValidatedAll(true);
|
|
1218
|
-
|
|
1388
|
+
showGlobalModal("error");
|
|
1219
1389
|
}
|
|
1220
1390
|
}}
|
|
1221
1391
|
approve={() => sendToEvaluation("A")}
|
|
@@ -1442,64 +1612,7 @@ export const ProviderProductEdition = ({
|
|
|
1442
1612
|
onClick={() => setMessage("")}
|
|
1443
1613
|
/>
|
|
1444
1614
|
)}
|
|
1445
|
-
{
|
|
1446
|
-
<GlobalModal
|
|
1447
|
-
close={() => setModalSent(false)}
|
|
1448
|
-
message={message}
|
|
1449
|
-
detail={""}
|
|
1450
|
-
bold={!evaluationComplete(activeTab) && "Aprueba / Rechaza"}
|
|
1451
|
-
widthImg={!evaluationComplete(activeTab) ? "160px" : "354px"}
|
|
1452
|
-
heightImg={!evaluationComplete(activeTab) ? "84px" : "354px"}
|
|
1453
|
-
img={getSectionIcon()}
|
|
1454
|
-
/>
|
|
1455
|
-
)}
|
|
1456
|
-
{modalViewError && (
|
|
1457
|
-
<GlobalModal
|
|
1458
|
-
close={() => setModalViewError(false)}
|
|
1459
|
-
message={`${activeTab} rechazada`}
|
|
1460
|
-
detail={"Agrega tu comentarios para enviar el rechazo"}
|
|
1461
|
-
button1={{
|
|
1462
|
-
name: "Enviar",
|
|
1463
|
-
action: (e) => {
|
|
1464
|
-
const textArea = document.querySelector("#area");
|
|
1465
|
-
if (textArea.value) {
|
|
1466
|
-
textArea.style.border = "none";
|
|
1467
|
-
createComment(e, textArea.value);
|
|
1468
|
-
setModalViewError(false);
|
|
1469
|
-
setModalViewTextArea(true);
|
|
1470
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
1471
|
-
} else {
|
|
1472
|
-
textArea.style.border = "2px solid red";
|
|
1473
|
-
}
|
|
1474
|
-
},
|
|
1475
|
-
}}
|
|
1476
|
-
img={errorModal}
|
|
1477
|
-
textArea={true}
|
|
1478
|
-
/>
|
|
1479
|
-
)}
|
|
1480
|
-
{showGenericModal && (
|
|
1481
|
-
<GlobalModal
|
|
1482
|
-
close={() => setShowGenericModal(false)}
|
|
1483
|
-
message={dataGenericModal.message}
|
|
1484
|
-
detail={dataGenericModal.detail}
|
|
1485
|
-
button1={dataGenericModal.button1}
|
|
1486
|
-
button2={dataGenericModal.button2}
|
|
1487
|
-
img={dataGenericModal.img}
|
|
1488
|
-
/>
|
|
1489
|
-
)}
|
|
1490
|
-
{modalViewTextArea && (
|
|
1491
|
-
<GlobalModal
|
|
1492
|
-
close={() => setModalViewTextArea(false)}
|
|
1493
|
-
message={`Gracias, tus comentarios fueron entregados.`}
|
|
1494
|
-
detail={"Trabajaremos en conjunto para resolverlo."}
|
|
1495
|
-
button1={{
|
|
1496
|
-
name: "Cerrar",
|
|
1497
|
-
action: () => setModalViewTextArea(false),
|
|
1498
|
-
}}
|
|
1499
|
-
img={face}
|
|
1500
|
-
textArea={false}
|
|
1501
|
-
/>
|
|
1502
|
-
)}
|
|
1615
|
+
{globalModal && <GlobalModal close={closeGlobalModal} {...globalModal} />}
|
|
1503
1616
|
{showVersionSelector && (
|
|
1504
1617
|
<VersionSelector
|
|
1505
1618
|
modalId={"version-selector"}
|