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.
- package/.env.development +0 -2
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- 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/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/organisms/Chat/Chat.stories.js +1 -21
- package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +3 -48
- package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +0 -27
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- 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 +81 -198
- package/dist/components/pages/ProviderProductEdition/index.js +429 -725
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +139 -86
- package/dist/components/pages/RetailerProductEdition/index.js +279 -268
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- 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/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/organisms/Chat/Chat.stories.js +0 -21
- package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
- package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
- package/src/components/organisms/Chat/ContentChat/index.js +6 -81
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +3 -47
- package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +1 -18
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- 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 +88 -214
- package/src/components/pages/ProviderProductEdition/index.js +160 -323
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +146 -89
- package/src/components/pages/RetailerProductEdition/index.js +138 -112
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
- package/src/index.js +0 -1
- 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,9 +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";
|
|
42
|
-
import {
|
|
43
|
-
import { Modal } from "../../organisms/Modal";
|
|
44
|
-
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
45
|
+
import { number } from "prop-types";
|
|
45
46
|
|
|
46
47
|
const reducerImages = (state, action) => {
|
|
47
48
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -133,7 +134,6 @@ export const ProviderProductEdition = ({
|
|
|
133
134
|
setShowContentohRequestModal,
|
|
134
135
|
showSurvey,
|
|
135
136
|
company,
|
|
136
|
-
addToCart,
|
|
137
137
|
}) => {
|
|
138
138
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
139
139
|
const [activeImage, setActiveImage] = useState();
|
|
@@ -205,6 +205,7 @@ export const ProviderProductEdition = ({
|
|
|
205
205
|
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
206
206
|
: productToEdit
|
|
207
207
|
);
|
|
208
|
+
const [icon, setIcon] = useState(null);
|
|
208
209
|
const [version, setVersion] = useState(product?.version);
|
|
209
210
|
const [comments] = useState({});
|
|
210
211
|
const [comment, setComment] = useState("");
|
|
@@ -217,7 +218,6 @@ export const ProviderProductEdition = ({
|
|
|
217
218
|
const isRetailer = user?.is_retailer;
|
|
218
219
|
const [loading, setLoading] = useState(true);
|
|
219
220
|
const [validatedAll, setValidatedAll] = useState(false);
|
|
220
|
-
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
221
221
|
|
|
222
222
|
const originProp = location?.state?.origin;
|
|
223
223
|
const [origin, setOrigin] = useState({
|
|
@@ -226,6 +226,9 @@ export const ProviderProductEdition = ({
|
|
|
226
226
|
Imágenes: originProp,
|
|
227
227
|
});
|
|
228
228
|
const [inCart, setInCart] = useState(false);
|
|
229
|
+
const [modalSent, setModalSent] = useState(false);
|
|
230
|
+
const [modalViewError, setModalViewError] = useState(false);
|
|
231
|
+
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
229
232
|
const [dataGenericModal, setDataGenericModal] = useState({
|
|
230
233
|
message: "¿Estás seguro de continuar?",
|
|
231
234
|
detail: ` ${
|
|
@@ -235,7 +238,7 @@ export const ProviderProductEdition = ({
|
|
|
235
238
|
}`,
|
|
236
239
|
button1: {
|
|
237
240
|
name: "Cerrar",
|
|
238
|
-
action:
|
|
241
|
+
action: () => setModalViewTextArea(false),
|
|
239
242
|
},
|
|
240
243
|
button2: {
|
|
241
244
|
name: "Continuar",
|
|
@@ -243,6 +246,7 @@ export const ProviderProductEdition = ({
|
|
|
243
246
|
},
|
|
244
247
|
img: face,
|
|
245
248
|
});
|
|
249
|
+
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
246
250
|
const [socketType, setSocketType] = useState(null);
|
|
247
251
|
const [saving, setSaving] = useState(loading);
|
|
248
252
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
@@ -250,205 +254,6 @@ export const ProviderProductEdition = ({
|
|
|
250
254
|
);
|
|
251
255
|
const [showVersionSelector, setShowVersionSelector] =
|
|
252
256
|
useCloseModal("version-selector");
|
|
253
|
-
const [globalModal, setGlobalModal] = useState();
|
|
254
|
-
|
|
255
|
-
const updateAuditStatus = async (status) => {
|
|
256
|
-
const productTemp = product;
|
|
257
|
-
productTemp.article_status = status;
|
|
258
|
-
productTemp.datasheet_status = status;
|
|
259
|
-
productTemp.description_status = status;
|
|
260
|
-
productTemp.images_status = status;
|
|
261
|
-
|
|
262
|
-
const retailerStatusCopy = { ...retailerStatus };
|
|
263
|
-
const conceptArray = ["description", "datasheet", "images"];
|
|
264
|
-
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
265
|
-
conceptArray.forEach((concept) => {
|
|
266
|
-
if (retailerStatusCopy[key][concept]) {
|
|
267
|
-
retailerStatusCopy[key][concept] = status;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
setRetailerStatus(retailerStatusCopy);
|
|
272
|
-
productTemp.statusByRetailer = retailerStatusCopy;
|
|
273
|
-
setProduct(productTemp);
|
|
274
|
-
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
275
|
-
setProductEdit({
|
|
276
|
-
ArticleId: productTemp.id_article,
|
|
277
|
-
idCategory: productTemp.article.id_category,
|
|
278
|
-
product: productTemp,
|
|
279
|
-
});
|
|
280
|
-
sessionStorage.setItem(
|
|
281
|
-
"productEdit",
|
|
282
|
-
JSON.stringify({
|
|
283
|
-
ArticleId: productTemp.id_article,
|
|
284
|
-
idCategory: productTemp.article.id_category,
|
|
285
|
-
product: productTemp,
|
|
286
|
-
})
|
|
287
|
-
);
|
|
288
|
-
await loadData();
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const addCart = async (retailers) => {
|
|
292
|
-
const { article, version } = product;
|
|
293
|
-
const articleToOrder = [
|
|
294
|
-
{
|
|
295
|
-
articleId: article.id_article,
|
|
296
|
-
version,
|
|
297
|
-
userId: user.id_user,
|
|
298
|
-
discount: 0,
|
|
299
|
-
subtotal: 0,
|
|
300
|
-
companyId: user.id_company,
|
|
301
|
-
datasheet: retailers,
|
|
302
|
-
description: retailers,
|
|
303
|
-
image: retailers,
|
|
304
|
-
attributeTranslations: false,
|
|
305
|
-
descriptionTranslations: false,
|
|
306
|
-
build: "[]",
|
|
307
|
-
manual: "[]",
|
|
308
|
-
userCreated: user.id_user,
|
|
309
|
-
},
|
|
310
|
-
];
|
|
311
|
-
let modatlType = "addedToCartError";
|
|
312
|
-
if (addToCart) {
|
|
313
|
-
const resCart = await addToCart({ data: articleToOrder });
|
|
314
|
-
if (resCart.data.statusCode === 200) {
|
|
315
|
-
modatlType = "addedToCart";
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
showGlobalModal(modatlType);
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const closeGlobalModal = () => setGlobalModal();
|
|
322
|
-
|
|
323
|
-
const seenByProvider = async () => {
|
|
324
|
-
const productTemp = product;
|
|
325
|
-
const articleId = productTemp.id_article;
|
|
326
|
-
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
327
|
-
const promises = [];
|
|
328
|
-
const conceptArray = ["description", "datasheet", "images"];
|
|
329
|
-
conceptArray.forEach((concept) => {
|
|
330
|
-
const sectionStatusKey = `${concept}_status`;
|
|
331
|
-
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
332
|
-
const data = { articleId, orderId, concept, evalStatus };
|
|
333
|
-
promises.push(
|
|
334
|
-
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
335
|
-
headers: {
|
|
336
|
-
Authorization: token,
|
|
337
|
-
},
|
|
338
|
-
})
|
|
339
|
-
);
|
|
340
|
-
});
|
|
341
|
-
await Promise.all(promises);
|
|
342
|
-
closeGlobalModal();
|
|
343
|
-
await updateAuditStatus("FAP");
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
const showGlobalModal = useCallback(
|
|
347
|
-
(type) => {
|
|
348
|
-
const formatter = new Intl.ListFormat("es", { type: "conjunction" });
|
|
349
|
-
switch (type) {
|
|
350
|
-
case "generic":
|
|
351
|
-
setGlobalModal(dataGenericModal);
|
|
352
|
-
break;
|
|
353
|
-
case "commentsSent":
|
|
354
|
-
setGlobalModal({
|
|
355
|
-
message: "Gracias, tus comentarios fueron entregados.",
|
|
356
|
-
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
357
|
-
button1: {
|
|
358
|
-
name: "Cerrar",
|
|
359
|
-
action: closeGlobalModal,
|
|
360
|
-
},
|
|
361
|
-
img: face,
|
|
362
|
-
textArea: false,
|
|
363
|
-
});
|
|
364
|
-
break;
|
|
365
|
-
case "RAC":
|
|
366
|
-
const servicesRejected = [];
|
|
367
|
-
const translateServices = {
|
|
368
|
-
datasheet: "ficha técnica",
|
|
369
|
-
description: "descripción",
|
|
370
|
-
images: "imágenes",
|
|
371
|
-
};
|
|
372
|
-
Object.keys(translateServices).forEach((service) => {
|
|
373
|
-
if (product[`${service}_status`] === "RAC") {
|
|
374
|
-
servicesRejected.push(translateServices[service]);
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
const plural = ["Los servicios", "cumplen"];
|
|
378
|
-
const singular = ["El servicio", "cumple"];
|
|
379
|
-
const grammar = servicesRejected.length > 1 ? plural : singular;
|
|
380
|
-
const formatted = formatter.format(servicesRejected);
|
|
381
|
-
const text1 = `${grammar[0]} de ${formatted} no ${grammar[1]} con lo que la cadena necesita.`;
|
|
382
|
-
const text2 = `¡Solicita el servicio de Content-oh! para completarlo!`;
|
|
383
|
-
const retailers = product.retailersWithService.map((retailer) =>
|
|
384
|
-
Number(retailer)
|
|
385
|
-
);
|
|
386
|
-
setGlobalModal({
|
|
387
|
-
message:
|
|
388
|
-
"Tu producto no cumple con los requerimientos de la cadena",
|
|
389
|
-
customComponent: (
|
|
390
|
-
<>
|
|
391
|
-
<p className="generic-text">
|
|
392
|
-
{text1}
|
|
393
|
-
<br />
|
|
394
|
-
<br />
|
|
395
|
-
{text2}
|
|
396
|
-
</p>
|
|
397
|
-
</>
|
|
398
|
-
),
|
|
399
|
-
button1: {
|
|
400
|
-
name: "Continuar",
|
|
401
|
-
action: async () => await seenByProvider(),
|
|
402
|
-
},
|
|
403
|
-
button2: {
|
|
404
|
-
name: "Solicitar a Content-oh!",
|
|
405
|
-
action: async () => {
|
|
406
|
-
await addCart(retailers);
|
|
407
|
-
await seenByProvider();
|
|
408
|
-
},
|
|
409
|
-
},
|
|
410
|
-
img: errorModal,
|
|
411
|
-
});
|
|
412
|
-
break;
|
|
413
|
-
case "AAC":
|
|
414
|
-
setGlobalModal({
|
|
415
|
-
message: "Felicidades",
|
|
416
|
-
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
417
|
-
button1: {
|
|
418
|
-
name: "Continuar",
|
|
419
|
-
action: async () => await seenByProvider(),
|
|
420
|
-
},
|
|
421
|
-
img: face,
|
|
422
|
-
});
|
|
423
|
-
break;
|
|
424
|
-
case "addedToCartError":
|
|
425
|
-
setGlobalModal({
|
|
426
|
-
detail:
|
|
427
|
-
"Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
428
|
-
button1: {
|
|
429
|
-
name: "Continuar",
|
|
430
|
-
action: closeGlobalModal,
|
|
431
|
-
},
|
|
432
|
-
});
|
|
433
|
-
break;
|
|
434
|
-
case "addedToCart":
|
|
435
|
-
setGlobalModal({
|
|
436
|
-
message: "Producto añadido",
|
|
437
|
-
detail: "Tu producto se añadió al carrito de compras.",
|
|
438
|
-
button1: {
|
|
439
|
-
name: "Continuar",
|
|
440
|
-
action: closeGlobalModal,
|
|
441
|
-
},
|
|
442
|
-
img: face,
|
|
443
|
-
});
|
|
444
|
-
break;
|
|
445
|
-
default:
|
|
446
|
-
closeGlobalModal();
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
[activeTab, dataGenericModal, product]
|
|
451
|
-
);
|
|
452
257
|
|
|
453
258
|
useEffect(() => {
|
|
454
259
|
checkAll && setSelectedImages(images.values);
|
|
@@ -498,9 +303,7 @@ export const ProviderProductEdition = ({
|
|
|
498
303
|
);
|
|
499
304
|
setServicesData(parsedResponse);
|
|
500
305
|
}
|
|
501
|
-
|
|
502
|
-
!activeRetailer.id &&
|
|
503
|
-
setActiveRetailer(active ? active : retailers[0]);
|
|
306
|
+
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
504
307
|
};
|
|
505
308
|
|
|
506
309
|
const isRevision = () => {
|
|
@@ -549,8 +352,6 @@ export const ProviderProductEdition = ({
|
|
|
549
352
|
getCart();
|
|
550
353
|
fetchUsers(token).then((res) => setUserGroups(res));
|
|
551
354
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
552
|
-
if (["RAC", "AAC"].includes(product.article_status))
|
|
553
|
-
showGlobalModal(product.article_status);
|
|
554
355
|
}, [product, version]);
|
|
555
356
|
|
|
556
357
|
useEffect(() => {
|
|
@@ -576,7 +377,7 @@ export const ProviderProductEdition = ({
|
|
|
576
377
|
});
|
|
577
378
|
}
|
|
578
379
|
setProduct(productTemp);
|
|
579
|
-
|
|
380
|
+
setActivePercentage(retailers[0]?.percentage);
|
|
580
381
|
}, [percentages]);
|
|
581
382
|
|
|
582
383
|
const loadInputs = () => {
|
|
@@ -817,19 +618,48 @@ export const ProviderProductEdition = ({
|
|
|
817
618
|
}
|
|
818
619
|
};
|
|
819
620
|
|
|
820
|
-
const
|
|
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
|
+
const createComment = async (e, body, tab) => {
|
|
638
|
+
let concept = "";
|
|
639
|
+
switch (activeTab) {
|
|
640
|
+
case "Ficha técnica":
|
|
641
|
+
concept = "datasheet";
|
|
642
|
+
break;
|
|
643
|
+
case "Imágenes":
|
|
644
|
+
concept = "images";
|
|
645
|
+
break;
|
|
646
|
+
|
|
647
|
+
default:
|
|
648
|
+
concept = "description";
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
821
651
|
const data = {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
status: product.status || productEdit.product.status,
|
|
828
|
-
},
|
|
829
|
-
paramsHeader: { Authorization: token },
|
|
652
|
+
articleId: product?.id_article,
|
|
653
|
+
orderId: product?.orderId,
|
|
654
|
+
message: body,
|
|
655
|
+
concept: concept,
|
|
656
|
+
version: version,
|
|
830
657
|
};
|
|
831
|
-
|
|
832
|
-
|
|
658
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
659
|
+
headers: {
|
|
660
|
+
Authorization: token,
|
|
661
|
+
},
|
|
662
|
+
});
|
|
833
663
|
};
|
|
834
664
|
|
|
835
665
|
useEffect(() => {
|
|
@@ -886,6 +716,21 @@ export const ProviderProductEdition = ({
|
|
|
886
716
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
887
717
|
};
|
|
888
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
|
+
|
|
889
734
|
const downloadImages = () => {
|
|
890
735
|
selectedImages.length > 0
|
|
891
736
|
? selectedImages.forEach((e) => {
|
|
@@ -979,6 +824,21 @@ export const ProviderProductEdition = ({
|
|
|
979
824
|
}
|
|
980
825
|
};
|
|
981
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
|
+
|
|
982
842
|
const sendEvaluation = async (result) => {
|
|
983
843
|
setLoading(true);
|
|
984
844
|
const concept = getConcept(activeTab);
|
|
@@ -1029,27 +889,6 @@ export const ProviderProductEdition = ({
|
|
|
1029
889
|
const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
|
|
1030
890
|
res.data.body
|
|
1031
891
|
);
|
|
1032
|
-
|
|
1033
|
-
const message = createMessage(
|
|
1034
|
-
product.retailers || product.retailersAvailable,
|
|
1035
|
-
activeRetailer.id,
|
|
1036
|
-
product[sectionStatusKey],
|
|
1037
|
-
newStatus,
|
|
1038
|
-
activeTab
|
|
1039
|
-
);
|
|
1040
|
-
|
|
1041
|
-
const messageData = {
|
|
1042
|
-
paramsBody: {
|
|
1043
|
-
id: product.article.id_article || productEdit.ArticleId,
|
|
1044
|
-
version: version,
|
|
1045
|
-
items: [{ type: "status", value: message }],
|
|
1046
|
-
retailerId: activeRetailer.id,
|
|
1047
|
-
status: product.status || productEdit.product.status,
|
|
1048
|
-
},
|
|
1049
|
-
paramsHeader: { Authorization: token },
|
|
1050
|
-
};
|
|
1051
|
-
await sendMessage(messageData);
|
|
1052
|
-
|
|
1053
892
|
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
1054
893
|
const retailerStatusCopy = { ...retailerStatus };
|
|
1055
894
|
retailerStatusCopy[activeRetailer.id][concept] = newStatus;
|
|
@@ -1081,7 +920,6 @@ export const ProviderProductEdition = ({
|
|
|
1081
920
|
result,
|
|
1082
921
|
isAproved: result === "A",
|
|
1083
922
|
};
|
|
1084
|
-
const messages = [];
|
|
1085
923
|
servicesData?.forEach((ret) => {
|
|
1086
924
|
const { service, id_retailer } = ret;
|
|
1087
925
|
let data = {};
|
|
@@ -1098,37 +936,24 @@ export const ProviderProductEdition = ({
|
|
|
1098
936
|
},
|
|
1099
937
|
})
|
|
1100
938
|
);
|
|
1101
|
-
if (product[`${ret.service}_status`] !== "NS") {
|
|
1102
|
-
const message = createMessage(
|
|
1103
|
-
product.retailers,
|
|
1104
|
-
ret.id_retailer,
|
|
1105
|
-
product[`${ret.service}_status`],
|
|
1106
|
-
`${result}A`,
|
|
1107
|
-
ret.service
|
|
1108
|
-
);
|
|
1109
|
-
messages.push(
|
|
1110
|
-
createComment([{ type: "status", value: message }], ret.id_retailer)
|
|
1111
|
-
);
|
|
1112
|
-
}
|
|
1113
939
|
});
|
|
1114
|
-
await Promise.all(evaluationArray);
|
|
940
|
+
const evalResponse = await Promise.all(evaluationArray);
|
|
1115
941
|
const userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1116
942
|
|
|
1117
943
|
const productTemp = product;
|
|
1118
|
-
|
|
1119
|
-
productTemp.article_status = status;
|
|
944
|
+
productTemp.article_status = `${result}${userType}`;
|
|
1120
945
|
productTemp.datasheet_status =
|
|
1121
|
-
productTemp.datasheet_status === "NA" ? "NA" :
|
|
946
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1122
947
|
productTemp.description_status =
|
|
1123
|
-
productTemp.description_status === "NA" ? "NA" :
|
|
948
|
+
productTemp.description_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1124
949
|
productTemp.images_status =
|
|
1125
|
-
productTemp.images_status === "NA" ? "NA" :
|
|
950
|
+
productTemp.images_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1126
951
|
|
|
1127
952
|
const retailerStatusCopy = { ...retailerStatus };
|
|
1128
953
|
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
1129
954
|
conceptArray.forEach((concept) => {
|
|
1130
955
|
if (retailerStatusCopy[key][concept]) {
|
|
1131
|
-
retailerStatusCopy[key][concept] =
|
|
956
|
+
retailerStatusCopy[key][concept] = `${result}${userType}`;
|
|
1132
957
|
}
|
|
1133
958
|
});
|
|
1134
959
|
});
|
|
@@ -1149,7 +974,6 @@ export const ProviderProductEdition = ({
|
|
|
1149
974
|
product: productTemp,
|
|
1150
975
|
})
|
|
1151
976
|
);
|
|
1152
|
-
await Promise.all(messages);
|
|
1153
977
|
|
|
1154
978
|
await loadData();
|
|
1155
979
|
} catch (error) {
|
|
@@ -1180,7 +1004,7 @@ export const ProviderProductEdition = ({
|
|
|
1180
1004
|
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1181
1005
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1182
1006
|
setProduct(prod);
|
|
1183
|
-
|
|
1007
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1184
1008
|
await loadData();
|
|
1185
1009
|
};
|
|
1186
1010
|
|
|
@@ -1251,7 +1075,7 @@ export const ProviderProductEdition = ({
|
|
|
1251
1075
|
action: () => evaluationToRetailer("A"),
|
|
1252
1076
|
},
|
|
1253
1077
|
}));
|
|
1254
|
-
|
|
1078
|
+
setShowGenericModal(true);
|
|
1255
1079
|
} else if (user.is_retailer) {
|
|
1256
1080
|
if (product.id_order || product.orderId) {
|
|
1257
1081
|
sendEvaluation("A");
|
|
@@ -1263,7 +1087,7 @@ export const ProviderProductEdition = ({
|
|
|
1263
1087
|
action: () => evaluationToRetailer("A"),
|
|
1264
1088
|
},
|
|
1265
1089
|
}));
|
|
1266
|
-
|
|
1090
|
+
setShowGenericModal(true);
|
|
1267
1091
|
}
|
|
1268
1092
|
} else {
|
|
1269
1093
|
sendEvaluation("A");
|
|
@@ -1277,7 +1101,8 @@ export const ProviderProductEdition = ({
|
|
|
1277
1101
|
return;
|
|
1278
1102
|
} else if (user.is_retailer) {
|
|
1279
1103
|
if (product.id_order || product.orderId) {
|
|
1280
|
-
|
|
1104
|
+
setValidatedAll(true);
|
|
1105
|
+
setModalViewError(true);
|
|
1281
1106
|
} else {
|
|
1282
1107
|
setDataGenericModal((prev) => ({
|
|
1283
1108
|
...prev,
|
|
@@ -1286,10 +1111,11 @@ export const ProviderProductEdition = ({
|
|
|
1286
1111
|
action: () => evaluationToRetailer("R"),
|
|
1287
1112
|
},
|
|
1288
1113
|
}));
|
|
1289
|
-
|
|
1114
|
+
setShowGenericModal(true);
|
|
1290
1115
|
}
|
|
1291
1116
|
} else {
|
|
1292
|
-
|
|
1117
|
+
setValidatedAll(true);
|
|
1118
|
+
setModalViewError(true);
|
|
1293
1119
|
}
|
|
1294
1120
|
}
|
|
1295
1121
|
};
|
|
@@ -1298,7 +1124,6 @@ export const ProviderProductEdition = ({
|
|
|
1298
1124
|
<HeaderTop
|
|
1299
1125
|
setHeaderTop={setHeaderTop}
|
|
1300
1126
|
withChat={location?.state?.withChat}
|
|
1301
|
-
chatType={location?.state?.chatType}
|
|
1302
1127
|
productSelected={productSelected}
|
|
1303
1128
|
token={token}
|
|
1304
1129
|
activeRetailer={activeRetailer}
|
|
@@ -1349,7 +1174,7 @@ export const ProviderProductEdition = ({
|
|
|
1349
1174
|
action: () => evaluationToRetailer("A"),
|
|
1350
1175
|
},
|
|
1351
1176
|
}));
|
|
1352
|
-
|
|
1177
|
+
setShowGenericModal(true);
|
|
1353
1178
|
} else if (user.is_retailer) {
|
|
1354
1179
|
if (product.id_order || product.orderId) {
|
|
1355
1180
|
validateAll("A");
|
|
@@ -1361,7 +1186,7 @@ export const ProviderProductEdition = ({
|
|
|
1361
1186
|
action: () => evaluationToRetailer("A"),
|
|
1362
1187
|
},
|
|
1363
1188
|
}));
|
|
1364
|
-
|
|
1189
|
+
setShowGenericModal(true);
|
|
1365
1190
|
}
|
|
1366
1191
|
} else {
|
|
1367
1192
|
validateAll("A");
|
|
@@ -1377,7 +1202,7 @@ export const ProviderProductEdition = ({
|
|
|
1377
1202
|
} else if (user.is_retailer) {
|
|
1378
1203
|
if (product.id_order || product.orderId) {
|
|
1379
1204
|
setValidatedAll(true);
|
|
1380
|
-
|
|
1205
|
+
setModalViewError(true);
|
|
1381
1206
|
} else {
|
|
1382
1207
|
setDataGenericModal((prev) => ({
|
|
1383
1208
|
...prev,
|
|
@@ -1386,17 +1211,15 @@ export const ProviderProductEdition = ({
|
|
|
1386
1211
|
action: () => evaluationToRetailer("R"),
|
|
1387
1212
|
},
|
|
1388
1213
|
}));
|
|
1389
|
-
|
|
1214
|
+
setShowGenericModal(true);
|
|
1390
1215
|
}
|
|
1391
1216
|
} else {
|
|
1392
|
-
setShowRejectModal(true);
|
|
1393
1217
|
setValidatedAll(true);
|
|
1218
|
+
setModalViewError(true);
|
|
1394
1219
|
}
|
|
1395
1220
|
}}
|
|
1396
1221
|
approve={() => sendToEvaluation("A")}
|
|
1397
|
-
reject={() =>
|
|
1398
|
-
setShowRejectModal(true);
|
|
1399
|
-
}}
|
|
1222
|
+
reject={() => sendToEvaluation("R")}
|
|
1400
1223
|
/>
|
|
1401
1224
|
<FullTabsMenu
|
|
1402
1225
|
tabsSections={tabsSections}
|
|
@@ -1619,7 +1442,64 @@ export const ProviderProductEdition = ({
|
|
|
1619
1442
|
onClick={() => setMessage("")}
|
|
1620
1443
|
/>
|
|
1621
1444
|
)}
|
|
1622
|
-
{
|
|
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
|
+
)}
|
|
1623
1503
|
{showVersionSelector && (
|
|
1624
1504
|
<VersionSelector
|
|
1625
1505
|
modalId={"version-selector"}
|
|
@@ -1631,49 +1511,6 @@ export const ProviderProductEdition = ({
|
|
|
1631
1511
|
jwt={token}
|
|
1632
1512
|
/>
|
|
1633
1513
|
)}
|
|
1634
|
-
{showRejectModal && (
|
|
1635
|
-
<Modal
|
|
1636
|
-
title={"Agregar mensaje de rechazo"}
|
|
1637
|
-
show={showRejectModal}
|
|
1638
|
-
customComponent={
|
|
1639
|
-
<TagAndInput
|
|
1640
|
-
label={"Caja de Comentario"}
|
|
1641
|
-
inputType={"textarea"}
|
|
1642
|
-
inputId={"modal-message-box"}
|
|
1643
|
-
index={0}
|
|
1644
|
-
color={"white"}
|
|
1645
|
-
/>
|
|
1646
|
-
}
|
|
1647
|
-
buttons={[
|
|
1648
|
-
<ButtonV2
|
|
1649
|
-
key={"btn-Cancelar"}
|
|
1650
|
-
type={"white"}
|
|
1651
|
-
label={"Cancelar"}
|
|
1652
|
-
size={12}
|
|
1653
|
-
onClick={() => {
|
|
1654
|
-
setShowRejectModal(false);
|
|
1655
|
-
}}
|
|
1656
|
-
/>,
|
|
1657
|
-
<ButtonV2
|
|
1658
|
-
key={"btn-Aceptar"}
|
|
1659
|
-
type={"pink"}
|
|
1660
|
-
label={"Aceptar"}
|
|
1661
|
-
size={12}
|
|
1662
|
-
onClick={async () => {
|
|
1663
|
-
const body = document.querySelector(
|
|
1664
|
-
"#modal-message-box .ql-container .ql-editor > p"
|
|
1665
|
-
).innerHTML;
|
|
1666
|
-
const messages = [
|
|
1667
|
-
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1668
|
-
];
|
|
1669
|
-
await createComment(messages, activeRetailer.id);
|
|
1670
|
-
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
1671
|
-
setShowRejectModal(false);
|
|
1672
|
-
}}
|
|
1673
|
-
/>,
|
|
1674
|
-
]}
|
|
1675
|
-
/>
|
|
1676
|
-
)}
|
|
1677
1514
|
</Container>
|
|
1678
1515
|
);
|
|
1679
1516
|
};
|