contentoh-components-library 21.3.52 → 21.3.53
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 +23 -18
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +4 -4
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +0 -27
- 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 +50 -31
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +89 -127
- package/dist/components/pages/ProviderProductEdition/index.js +392 -647
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -61
- package/dist/components/pages/RetailerProductEdition/index.js +1 -1
- package/dist/index.js +0 -13
- package/package.json +6 -7
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/Status/styles.js +0 -4
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +22 -18
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +4 -3
- package/src/components/molecules/AvatarAndValidation/index.js +1 -1
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -18
- package/src/components/organisms/GlobalModal/styles.js +0 -10
- package/src/components/organisms/OrderDetail/index.js +0 -1
- package/src/components/organisms/OrderDetail/styles.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +1 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +55 -31
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +96 -135
- package/src/components/pages/ProviderProductEdition/index.js +135 -264
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +111 -61
- package/src/components/pages/RetailerProductEdition/index.js +1 -1
- package/src/index.js +0 -1
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
- package/src/components/organisms/TableResizable/TableResizable.stories.js +0 -17
- package/src/components/organisms/TableResizable/index.js +0 -119
- package/src/components/organisms/TableResizable/styles.js +0 -133
- package/src/components/organisms/TableResizable/utils.js +0 -46
|
@@ -19,6 +19,9 @@ 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";
|
|
22
25
|
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
23
26
|
import { Button } from "../../atoms/GeneralButton";
|
|
24
27
|
import { Commentary } from "../../atoms/Commentary";
|
|
@@ -39,6 +42,7 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
|
|
|
39
42
|
import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
|
|
40
43
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
41
44
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
45
|
+
import { number } from "prop-types";
|
|
42
46
|
|
|
43
47
|
const reducerImages = (state, action) => {
|
|
44
48
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -130,7 +134,6 @@ export const ProviderProductEdition = ({
|
|
|
130
134
|
setShowContentohRequestModal,
|
|
131
135
|
showSurvey,
|
|
132
136
|
company,
|
|
133
|
-
addToCart,
|
|
134
137
|
}) => {
|
|
135
138
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
136
139
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -202,6 +205,7 @@ export const ProviderProductEdition = ({
|
|
|
202
205
|
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
203
206
|
: productToEdit
|
|
204
207
|
);
|
|
208
|
+
const [icon, setIcon] = useState(null);
|
|
205
209
|
const [version, setVersion] = useState(product?.version);
|
|
206
210
|
const [comments] = useState({});
|
|
207
211
|
const [comment, setComment] = useState("");
|
|
@@ -215,12 +219,16 @@ export const ProviderProductEdition = ({
|
|
|
215
219
|
const [loading, setLoading] = useState(true);
|
|
216
220
|
const [validatedAll, setValidatedAll] = useState(false);
|
|
217
221
|
|
|
222
|
+
const originProp = location?.state?.origin;
|
|
218
223
|
const [origin, setOrigin] = useState({
|
|
219
|
-
"Ficha técnica":
|
|
220
|
-
Descripción:
|
|
221
|
-
Imágenes:
|
|
224
|
+
"Ficha técnica": originProp,
|
|
225
|
+
Descripción: originProp,
|
|
226
|
+
Imágenes: originProp,
|
|
222
227
|
});
|
|
223
228
|
const [inCart, setInCart] = useState(false);
|
|
229
|
+
const [modalSent, setModalSent] = useState(false);
|
|
230
|
+
const [modalViewError, setModalViewError] = useState(false);
|
|
231
|
+
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
224
232
|
const [dataGenericModal, setDataGenericModal] = useState({
|
|
225
233
|
message: "¿Estás seguro de continuar?",
|
|
226
234
|
detail: ` ${
|
|
@@ -230,7 +238,7 @@ export const ProviderProductEdition = ({
|
|
|
230
238
|
}`,
|
|
231
239
|
button1: {
|
|
232
240
|
name: "Cerrar",
|
|
233
|
-
action:
|
|
241
|
+
action: () => setModalViewTextArea(false),
|
|
234
242
|
},
|
|
235
243
|
button2: {
|
|
236
244
|
name: "Continuar",
|
|
@@ -238,6 +246,7 @@ export const ProviderProductEdition = ({
|
|
|
238
246
|
},
|
|
239
247
|
img: face,
|
|
240
248
|
});
|
|
249
|
+
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
241
250
|
const [socketType, setSocketType] = useState(null);
|
|
242
251
|
const [saving, setSaving] = useState(loading);
|
|
243
252
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
@@ -245,227 +254,6 @@ export const ProviderProductEdition = ({
|
|
|
245
254
|
);
|
|
246
255
|
const [showVersionSelector, setShowVersionSelector] =
|
|
247
256
|
useCloseModal("version-selector");
|
|
248
|
-
const [globalModal, setGlobalModal] = useState();
|
|
249
|
-
|
|
250
|
-
const updateAuditStatus = async (status) => {
|
|
251
|
-
const productTemp = product;
|
|
252
|
-
productTemp.article_status = status;
|
|
253
|
-
productTemp.datasheet_status = status;
|
|
254
|
-
productTemp.description_status = status;
|
|
255
|
-
productTemp.images_status = status;
|
|
256
|
-
|
|
257
|
-
const retailerStatusCopy = { ...retailerStatus };
|
|
258
|
-
const conceptArray = ["description", "datasheet", "images"];
|
|
259
|
-
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
260
|
-
conceptArray.forEach((concept) => {
|
|
261
|
-
if (retailerStatusCopy[key][concept]) {
|
|
262
|
-
retailerStatusCopy[key][concept] = status;
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
setRetailerStatus(retailerStatusCopy);
|
|
267
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
268
|
-
setProduct(productTemp);
|
|
269
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
270
|
-
setProductEdit({
|
|
271
|
-
ArticleId: productTemp.id_article,
|
|
272
|
-
idCategory: productTemp.article.id_category,
|
|
273
|
-
product: productTemp,
|
|
274
|
-
});
|
|
275
|
-
sessionStorage.setItem(
|
|
276
|
-
"productEdit",
|
|
277
|
-
JSON.stringify({
|
|
278
|
-
ArticleId: productTemp.id_article,
|
|
279
|
-
idCategory: productTemp.article.id_category,
|
|
280
|
-
product: productTemp,
|
|
281
|
-
})
|
|
282
|
-
);
|
|
283
|
-
await loadData();
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const addCart = async (retailers) => {
|
|
287
|
-
const { article, version } = product;
|
|
288
|
-
const articleToOrder = [
|
|
289
|
-
{
|
|
290
|
-
articleId: article.id_article,
|
|
291
|
-
version,
|
|
292
|
-
userId: user.id_user,
|
|
293
|
-
discount: 0,
|
|
294
|
-
subtotal: 0,
|
|
295
|
-
companyId: user.id_company,
|
|
296
|
-
datasheet: retailers,
|
|
297
|
-
description: retailers,
|
|
298
|
-
image: retailers,
|
|
299
|
-
attributeTranslations: false,
|
|
300
|
-
descriptionTranslations: false,
|
|
301
|
-
build: "[]",
|
|
302
|
-
manual: "[]",
|
|
303
|
-
userCreated: user.id_user,
|
|
304
|
-
},
|
|
305
|
-
];
|
|
306
|
-
let modatlType = "addedToCartError";
|
|
307
|
-
if (addToCart) {
|
|
308
|
-
const resCart = await addToCart({ data: articleToOrder });
|
|
309
|
-
if (resCart.data.statusCode === 200) {
|
|
310
|
-
modatlType = "addedToCart";
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
showGlobalModal(modatlType);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
const closeGlobalModal = () => setGlobalModal();
|
|
317
|
-
|
|
318
|
-
const seenByProvider = async () => {
|
|
319
|
-
const productTemp = product;
|
|
320
|
-
const articleId = productTemp.id_article;
|
|
321
|
-
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
322
|
-
const promises = [];
|
|
323
|
-
const conceptArray = ["description", "datasheet", "images"];
|
|
324
|
-
conceptArray.forEach((concept) => {
|
|
325
|
-
const sectionStatusKey = `${concept}_status`;
|
|
326
|
-
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
327
|
-
const data = { articleId, orderId, concept, evalStatus };
|
|
328
|
-
promises.push(
|
|
329
|
-
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
330
|
-
headers: {
|
|
331
|
-
Authorization: token,
|
|
332
|
-
},
|
|
333
|
-
})
|
|
334
|
-
);
|
|
335
|
-
});
|
|
336
|
-
await Promise.all(promises);
|
|
337
|
-
closeGlobalModal();
|
|
338
|
-
await updateAuditStatus("FAP");
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
const showGlobalModal = useCallback(
|
|
342
|
-
(type) => {
|
|
343
|
-
const formatter = new Intl.ListFormat("es", { type: "conjunction" });
|
|
344
|
-
switch (type) {
|
|
345
|
-
case "error":
|
|
346
|
-
setGlobalModal({
|
|
347
|
-
message: `${activeTab} rechazada`,
|
|
348
|
-
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
349
|
-
img: errorModal,
|
|
350
|
-
textArea: true,
|
|
351
|
-
button1: {
|
|
352
|
-
name: "Enviar",
|
|
353
|
-
action: (e) => {
|
|
354
|
-
const textArea = document.querySelector("#area");
|
|
355
|
-
if (textArea.value) {
|
|
356
|
-
textArea.style.border = "none";
|
|
357
|
-
createComment(e, textArea.value);
|
|
358
|
-
showGlobalModal("commentsSent");
|
|
359
|
-
validatedAll ? validateAll("R") : sendEvaluation("R");
|
|
360
|
-
} else {
|
|
361
|
-
textArea.style.border = "2px solid red";
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
});
|
|
366
|
-
break;
|
|
367
|
-
case "generic":
|
|
368
|
-
setGlobalModal(dataGenericModal);
|
|
369
|
-
break;
|
|
370
|
-
case "commentsSent":
|
|
371
|
-
setGlobalModal({
|
|
372
|
-
message: "Gracias, tus comentarios fueron entregados.",
|
|
373
|
-
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
374
|
-
button1: {
|
|
375
|
-
name: "Cerrar",
|
|
376
|
-
action: closeGlobalModal,
|
|
377
|
-
},
|
|
378
|
-
img: face,
|
|
379
|
-
textArea: false,
|
|
380
|
-
});
|
|
381
|
-
break;
|
|
382
|
-
case "RAC":
|
|
383
|
-
const servicesRejected = [];
|
|
384
|
-
const translateServices = {
|
|
385
|
-
datasheet: "ficha técnica",
|
|
386
|
-
description: "descripción",
|
|
387
|
-
images: "imágenes",
|
|
388
|
-
};
|
|
389
|
-
Object.keys(translateServices).forEach((service) => {
|
|
390
|
-
if (product[`${service}_status`] === "RAC") {
|
|
391
|
-
servicesRejected.push(translateServices[service]);
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
const plural = ["Los servicios", "cumplen"];
|
|
395
|
-
const singular = ["El servicio", "cumple"];
|
|
396
|
-
const grammar = servicesRejected.length > 1 ? plural : singular;
|
|
397
|
-
const formatted = formatter.format(servicesRejected);
|
|
398
|
-
const text1 = `${grammar[0]} de ${formatted} no ${grammar[1]} con lo que la cadena necesita.`;
|
|
399
|
-
const text2 = `¡Solicita el servicio de Content-oh! para completarlo!`;
|
|
400
|
-
const retailers = product.retailersWithService.map((retailer) =>
|
|
401
|
-
Number(retailer)
|
|
402
|
-
);
|
|
403
|
-
setGlobalModal({
|
|
404
|
-
message:
|
|
405
|
-
"Tu producto no cumple con los requerimientos de la cadena",
|
|
406
|
-
customComponent: (
|
|
407
|
-
<>
|
|
408
|
-
<p className="generic-text">
|
|
409
|
-
{text1}
|
|
410
|
-
<br />
|
|
411
|
-
<br />
|
|
412
|
-
{text2}
|
|
413
|
-
</p>
|
|
414
|
-
</>
|
|
415
|
-
),
|
|
416
|
-
button1: {
|
|
417
|
-
name: "Continuar",
|
|
418
|
-
action: async () => await seenByProvider(),
|
|
419
|
-
},
|
|
420
|
-
button2: {
|
|
421
|
-
name: "Solicitar a Content-oh!",
|
|
422
|
-
action: async () => {
|
|
423
|
-
await addCart(retailers);
|
|
424
|
-
await seenByProvider();
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
img: errorModal,
|
|
428
|
-
});
|
|
429
|
-
break;
|
|
430
|
-
case "AAC":
|
|
431
|
-
setGlobalModal({
|
|
432
|
-
message: "Felicidades",
|
|
433
|
-
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
434
|
-
button1: {
|
|
435
|
-
name: "Continuar",
|
|
436
|
-
action: async () => await seenByProvider(),
|
|
437
|
-
},
|
|
438
|
-
img: face,
|
|
439
|
-
});
|
|
440
|
-
break;
|
|
441
|
-
case "addedToCartError":
|
|
442
|
-
setGlobalModal({
|
|
443
|
-
detail:
|
|
444
|
-
"Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
445
|
-
button1: {
|
|
446
|
-
name: "Continuar",
|
|
447
|
-
action: closeGlobalModal,
|
|
448
|
-
},
|
|
449
|
-
});
|
|
450
|
-
break;
|
|
451
|
-
case "addedToCart":
|
|
452
|
-
setGlobalModal({
|
|
453
|
-
message: "Producto añadido",
|
|
454
|
-
detail: "Tu producto se añadió al carrito de compras.",
|
|
455
|
-
button1: {
|
|
456
|
-
name: "Continuar",
|
|
457
|
-
action: closeGlobalModal,
|
|
458
|
-
},
|
|
459
|
-
img: face,
|
|
460
|
-
});
|
|
461
|
-
break;
|
|
462
|
-
default:
|
|
463
|
-
closeGlobalModal();
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
[activeTab, dataGenericModal, product]
|
|
468
|
-
);
|
|
469
257
|
|
|
470
258
|
useEffect(() => {
|
|
471
259
|
checkAll && setSelectedImages(images.values);
|
|
@@ -477,15 +265,6 @@ export const ProviderProductEdition = ({
|
|
|
477
265
|
}
|
|
478
266
|
}, [showModal]);
|
|
479
267
|
|
|
480
|
-
useEffect(() => {
|
|
481
|
-
console.log({ location });
|
|
482
|
-
setOrigin({
|
|
483
|
-
"Ficha técnica": location?.state?.origin,
|
|
484
|
-
Descripción: location?.state?.origin,
|
|
485
|
-
Imágenes: location?.state?.origin,
|
|
486
|
-
});
|
|
487
|
-
}, [location?.state?.origin]);
|
|
488
|
-
|
|
489
268
|
const loadData = async () => {
|
|
490
269
|
const services = await getRetailerServices(
|
|
491
270
|
product?.id_article || product?.article?.id_article,
|
|
@@ -539,13 +318,6 @@ export const ProviderProductEdition = ({
|
|
|
539
318
|
"Contentoh",
|
|
540
319
|
].includes(orgn);
|
|
541
320
|
if (isRetailer) {
|
|
542
|
-
console.log({
|
|
543
|
-
origin: origin[activeTab],
|
|
544
|
-
concept,
|
|
545
|
-
orgn,
|
|
546
|
-
revision,
|
|
547
|
-
currentService,
|
|
548
|
-
});
|
|
549
321
|
if (revision && currentService === "AP") return true;
|
|
550
322
|
} else {
|
|
551
323
|
const { product } = productEdit;
|
|
@@ -580,8 +352,6 @@ export const ProviderProductEdition = ({
|
|
|
580
352
|
getCart();
|
|
581
353
|
fetchUsers(token).then((res) => setUserGroups(res));
|
|
582
354
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
583
|
-
if (["RAC", "AAC"].includes(product.article_status))
|
|
584
|
-
showGlobalModal(product.article_status);
|
|
585
355
|
}, [product, version]);
|
|
586
356
|
|
|
587
357
|
useEffect(() => {
|
|
@@ -848,6 +618,22 @@ export const ProviderProductEdition = ({
|
|
|
848
618
|
}
|
|
849
619
|
};
|
|
850
620
|
|
|
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
|
+
|
|
851
637
|
const createComment = async (e, body, tab) => {
|
|
852
638
|
let concept = "";
|
|
853
639
|
switch (activeTab) {
|
|
@@ -930,6 +716,21 @@ export const ProviderProductEdition = ({
|
|
|
930
716
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
931
717
|
};
|
|
932
718
|
|
|
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
|
+
|
|
933
734
|
const downloadImages = () => {
|
|
934
735
|
selectedImages.length > 0
|
|
935
736
|
? selectedImages.forEach((e) => {
|
|
@@ -1023,6 +824,21 @@ export const ProviderProductEdition = ({
|
|
|
1023
824
|
}
|
|
1024
825
|
};
|
|
1025
826
|
|
|
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
|
+
|
|
1026
842
|
const sendEvaluation = async (result) => {
|
|
1027
843
|
setLoading(true);
|
|
1028
844
|
const concept = getConcept(activeTab);
|
|
@@ -1121,24 +937,23 @@ export const ProviderProductEdition = ({
|
|
|
1121
937
|
})
|
|
1122
938
|
);
|
|
1123
939
|
});
|
|
1124
|
-
await Promise.all(evaluationArray);
|
|
940
|
+
const evalResponse = await Promise.all(evaluationArray);
|
|
1125
941
|
const userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1126
942
|
|
|
1127
943
|
const productTemp = product;
|
|
1128
|
-
|
|
1129
|
-
productTemp.article_status = status;
|
|
944
|
+
productTemp.article_status = `${result}${userType}`;
|
|
1130
945
|
productTemp.datasheet_status =
|
|
1131
|
-
productTemp.datasheet_status === "NA" ? "NA" :
|
|
946
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1132
947
|
productTemp.description_status =
|
|
1133
|
-
productTemp.description_status === "NA" ? "NA" :
|
|
948
|
+
productTemp.description_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1134
949
|
productTemp.images_status =
|
|
1135
|
-
productTemp.images_status === "NA" ? "NA" :
|
|
950
|
+
productTemp.images_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1136
951
|
|
|
1137
952
|
const retailerStatusCopy = { ...retailerStatus };
|
|
1138
953
|
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
1139
954
|
conceptArray.forEach((concept) => {
|
|
1140
955
|
if (retailerStatusCopy[key][concept]) {
|
|
1141
|
-
retailerStatusCopy[key][concept] =
|
|
956
|
+
retailerStatusCopy[key][concept] = `${result}${userType}`;
|
|
1142
957
|
}
|
|
1143
958
|
});
|
|
1144
959
|
});
|
|
@@ -1189,13 +1004,12 @@ export const ProviderProductEdition = ({
|
|
|
1189
1004
|
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1190
1005
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1191
1006
|
setProduct(prod);
|
|
1192
|
-
|
|
1007
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1193
1008
|
await loadData();
|
|
1194
1009
|
};
|
|
1195
1010
|
|
|
1196
1011
|
const getSectionStatus = () => {
|
|
1197
1012
|
const concept = getConcept(activeTab);
|
|
1198
|
-
console.log("getSectionStatus", productEdit.product[`${concept}_status`]);
|
|
1199
1013
|
return ["AA", "AP", "R", "CA", "RCA"].includes(
|
|
1200
1014
|
productEdit.product[`${concept}_status`]
|
|
1201
1015
|
);
|
|
@@ -1261,7 +1075,7 @@ export const ProviderProductEdition = ({
|
|
|
1261
1075
|
action: () => evaluationToRetailer("A"),
|
|
1262
1076
|
},
|
|
1263
1077
|
}));
|
|
1264
|
-
|
|
1078
|
+
setShowGenericModal(true);
|
|
1265
1079
|
} else if (user.is_retailer) {
|
|
1266
1080
|
if (product.id_order || product.orderId) {
|
|
1267
1081
|
sendEvaluation("A");
|
|
@@ -1273,7 +1087,7 @@ export const ProviderProductEdition = ({
|
|
|
1273
1087
|
action: () => evaluationToRetailer("A"),
|
|
1274
1088
|
},
|
|
1275
1089
|
}));
|
|
1276
|
-
|
|
1090
|
+
setShowGenericModal(true);
|
|
1277
1091
|
}
|
|
1278
1092
|
} else {
|
|
1279
1093
|
sendEvaluation("A");
|
|
@@ -1288,7 +1102,7 @@ export const ProviderProductEdition = ({
|
|
|
1288
1102
|
} else if (user.is_retailer) {
|
|
1289
1103
|
if (product.id_order || product.orderId) {
|
|
1290
1104
|
setValidatedAll(true);
|
|
1291
|
-
|
|
1105
|
+
setModalViewError(true);
|
|
1292
1106
|
} else {
|
|
1293
1107
|
setDataGenericModal((prev) => ({
|
|
1294
1108
|
...prev,
|
|
@@ -1297,11 +1111,11 @@ export const ProviderProductEdition = ({
|
|
|
1297
1111
|
action: () => evaluationToRetailer("R"),
|
|
1298
1112
|
},
|
|
1299
1113
|
}));
|
|
1300
|
-
|
|
1114
|
+
setShowGenericModal(true);
|
|
1301
1115
|
}
|
|
1302
1116
|
} else {
|
|
1303
1117
|
setValidatedAll(true);
|
|
1304
|
-
|
|
1118
|
+
setModalViewError(true);
|
|
1305
1119
|
}
|
|
1306
1120
|
}
|
|
1307
1121
|
};
|
|
@@ -1360,7 +1174,7 @@ export const ProviderProductEdition = ({
|
|
|
1360
1174
|
action: () => evaluationToRetailer("A"),
|
|
1361
1175
|
},
|
|
1362
1176
|
}));
|
|
1363
|
-
|
|
1177
|
+
setShowGenericModal(true);
|
|
1364
1178
|
} else if (user.is_retailer) {
|
|
1365
1179
|
if (product.id_order || product.orderId) {
|
|
1366
1180
|
validateAll("A");
|
|
@@ -1372,7 +1186,7 @@ export const ProviderProductEdition = ({
|
|
|
1372
1186
|
action: () => evaluationToRetailer("A"),
|
|
1373
1187
|
},
|
|
1374
1188
|
}));
|
|
1375
|
-
|
|
1189
|
+
setShowGenericModal(true);
|
|
1376
1190
|
}
|
|
1377
1191
|
} else {
|
|
1378
1192
|
validateAll("A");
|
|
@@ -1388,7 +1202,7 @@ export const ProviderProductEdition = ({
|
|
|
1388
1202
|
} else if (user.is_retailer) {
|
|
1389
1203
|
if (product.id_order || product.orderId) {
|
|
1390
1204
|
setValidatedAll(true);
|
|
1391
|
-
|
|
1205
|
+
setModalViewError(true);
|
|
1392
1206
|
} else {
|
|
1393
1207
|
setDataGenericModal((prev) => ({
|
|
1394
1208
|
...prev,
|
|
@@ -1397,11 +1211,11 @@ export const ProviderProductEdition = ({
|
|
|
1397
1211
|
action: () => evaluationToRetailer("R"),
|
|
1398
1212
|
},
|
|
1399
1213
|
}));
|
|
1400
|
-
|
|
1214
|
+
setShowGenericModal(true);
|
|
1401
1215
|
}
|
|
1402
1216
|
} else {
|
|
1403
1217
|
setValidatedAll(true);
|
|
1404
|
-
|
|
1218
|
+
setModalViewError(true);
|
|
1405
1219
|
}
|
|
1406
1220
|
}}
|
|
1407
1221
|
approve={() => sendToEvaluation("A")}
|
|
@@ -1628,7 +1442,64 @@ export const ProviderProductEdition = ({
|
|
|
1628
1442
|
onClick={() => setMessage("")}
|
|
1629
1443
|
/>
|
|
1630
1444
|
)}
|
|
1631
|
-
{
|
|
1445
|
+
{modalSent && (
|
|
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
|
+
)}
|
|
1632
1503
|
{showVersionSelector && (
|
|
1633
1504
|
<VersionSelector
|
|
1634
1505
|
modalId={"version-selector"}
|