contentoh-components-library 21.3.51 → 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 -639
- 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 -256
- 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,13 +219,16 @@ export const ProviderProductEdition = ({
|
|
|
215
219
|
const [loading, setLoading] = useState(true);
|
|
216
220
|
const [validatedAll, setValidatedAll] = useState(false);
|
|
217
221
|
|
|
218
|
-
|
|
222
|
+
const originProp = location?.state?.origin;
|
|
219
223
|
const [origin, setOrigin] = useState({
|
|
220
|
-
"Ficha técnica":
|
|
221
|
-
Descripción:
|
|
222
|
-
Imágenes:
|
|
224
|
+
"Ficha técnica": originProp,
|
|
225
|
+
Descripción: originProp,
|
|
226
|
+
Imágenes: originProp,
|
|
223
227
|
});
|
|
224
228
|
const [inCart, setInCart] = useState(false);
|
|
229
|
+
const [modalSent, setModalSent] = useState(false);
|
|
230
|
+
const [modalViewError, setModalViewError] = useState(false);
|
|
231
|
+
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
225
232
|
const [dataGenericModal, setDataGenericModal] = useState({
|
|
226
233
|
message: "¿Estás seguro de continuar?",
|
|
227
234
|
detail: ` ${
|
|
@@ -231,7 +238,7 @@ export const ProviderProductEdition = ({
|
|
|
231
238
|
}`,
|
|
232
239
|
button1: {
|
|
233
240
|
name: "Cerrar",
|
|
234
|
-
action:
|
|
241
|
+
action: () => setModalViewTextArea(false),
|
|
235
242
|
},
|
|
236
243
|
button2: {
|
|
237
244
|
name: "Continuar",
|
|
@@ -239,6 +246,7 @@ export const ProviderProductEdition = ({
|
|
|
239
246
|
},
|
|
240
247
|
img: face,
|
|
241
248
|
});
|
|
249
|
+
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
242
250
|
const [socketType, setSocketType] = useState(null);
|
|
243
251
|
const [saving, setSaving] = useState(loading);
|
|
244
252
|
const [retailerStatus, setRetailerStatus] = useState(
|
|
@@ -246,227 +254,6 @@ export const ProviderProductEdition = ({
|
|
|
246
254
|
);
|
|
247
255
|
const [showVersionSelector, setShowVersionSelector] =
|
|
248
256
|
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
|
-
);
|
|
470
257
|
|
|
471
258
|
useEffect(() => {
|
|
472
259
|
checkAll && setSelectedImages(images.values);
|
|
@@ -531,13 +318,6 @@ export const ProviderProductEdition = ({
|
|
|
531
318
|
"Contentoh",
|
|
532
319
|
].includes(orgn);
|
|
533
320
|
if (isRetailer) {
|
|
534
|
-
console.log({
|
|
535
|
-
origin: origin[activeTab],
|
|
536
|
-
concept,
|
|
537
|
-
orgn,
|
|
538
|
-
revision,
|
|
539
|
-
currentService,
|
|
540
|
-
});
|
|
541
321
|
if (revision && currentService === "AP") return true;
|
|
542
322
|
} else {
|
|
543
323
|
const { product } = productEdit;
|
|
@@ -572,8 +352,6 @@ export const ProviderProductEdition = ({
|
|
|
572
352
|
getCart();
|
|
573
353
|
fetchUsers(token).then((res) => setUserGroups(res));
|
|
574
354
|
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
575
|
-
if (["RAC", "AAC"].includes(product.article_status))
|
|
576
|
-
showGlobalModal(product.article_status);
|
|
577
355
|
}, [product, version]);
|
|
578
356
|
|
|
579
357
|
useEffect(() => {
|
|
@@ -840,6 +618,22 @@ export const ProviderProductEdition = ({
|
|
|
840
618
|
}
|
|
841
619
|
};
|
|
842
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
|
+
|
|
843
637
|
const createComment = async (e, body, tab) => {
|
|
844
638
|
let concept = "";
|
|
845
639
|
switch (activeTab) {
|
|
@@ -922,6 +716,21 @@ export const ProviderProductEdition = ({
|
|
|
922
716
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
923
717
|
};
|
|
924
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
|
+
|
|
925
734
|
const downloadImages = () => {
|
|
926
735
|
selectedImages.length > 0
|
|
927
736
|
? selectedImages.forEach((e) => {
|
|
@@ -1015,6 +824,21 @@ export const ProviderProductEdition = ({
|
|
|
1015
824
|
}
|
|
1016
825
|
};
|
|
1017
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
|
+
|
|
1018
842
|
const sendEvaluation = async (result) => {
|
|
1019
843
|
setLoading(true);
|
|
1020
844
|
const concept = getConcept(activeTab);
|
|
@@ -1113,24 +937,23 @@ export const ProviderProductEdition = ({
|
|
|
1113
937
|
})
|
|
1114
938
|
);
|
|
1115
939
|
});
|
|
1116
|
-
await Promise.all(evaluationArray);
|
|
940
|
+
const evalResponse = await Promise.all(evaluationArray);
|
|
1117
941
|
const userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1118
942
|
|
|
1119
943
|
const productTemp = product;
|
|
1120
|
-
|
|
1121
|
-
productTemp.article_status = status;
|
|
944
|
+
productTemp.article_status = `${result}${userType}`;
|
|
1122
945
|
productTemp.datasheet_status =
|
|
1123
|
-
productTemp.datasheet_status === "NA" ? "NA" :
|
|
946
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1124
947
|
productTemp.description_status =
|
|
1125
|
-
productTemp.description_status === "NA" ? "NA" :
|
|
948
|
+
productTemp.description_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1126
949
|
productTemp.images_status =
|
|
1127
|
-
productTemp.images_status === "NA" ? "NA" :
|
|
950
|
+
productTemp.images_status === "NA" ? "NA" : `${result}${userType}`;
|
|
1128
951
|
|
|
1129
952
|
const retailerStatusCopy = { ...retailerStatus };
|
|
1130
953
|
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
1131
954
|
conceptArray.forEach((concept) => {
|
|
1132
955
|
if (retailerStatusCopy[key][concept]) {
|
|
1133
|
-
retailerStatusCopy[key][concept] =
|
|
956
|
+
retailerStatusCopy[key][concept] = `${result}${userType}`;
|
|
1134
957
|
}
|
|
1135
958
|
});
|
|
1136
959
|
});
|
|
@@ -1181,13 +1004,12 @@ export const ProviderProductEdition = ({
|
|
|
1181
1004
|
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1182
1005
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1183
1006
|
setProduct(prod);
|
|
1184
|
-
|
|
1007
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1185
1008
|
await loadData();
|
|
1186
1009
|
};
|
|
1187
1010
|
|
|
1188
1011
|
const getSectionStatus = () => {
|
|
1189
1012
|
const concept = getConcept(activeTab);
|
|
1190
|
-
console.log("getSectionStatus", productEdit.product[`${concept}_status`]);
|
|
1191
1013
|
return ["AA", "AP", "R", "CA", "RCA"].includes(
|
|
1192
1014
|
productEdit.product[`${concept}_status`]
|
|
1193
1015
|
);
|
|
@@ -1253,7 +1075,7 @@ export const ProviderProductEdition = ({
|
|
|
1253
1075
|
action: () => evaluationToRetailer("A"),
|
|
1254
1076
|
},
|
|
1255
1077
|
}));
|
|
1256
|
-
|
|
1078
|
+
setShowGenericModal(true);
|
|
1257
1079
|
} else if (user.is_retailer) {
|
|
1258
1080
|
if (product.id_order || product.orderId) {
|
|
1259
1081
|
sendEvaluation("A");
|
|
@@ -1265,7 +1087,7 @@ export const ProviderProductEdition = ({
|
|
|
1265
1087
|
action: () => evaluationToRetailer("A"),
|
|
1266
1088
|
},
|
|
1267
1089
|
}));
|
|
1268
|
-
|
|
1090
|
+
setShowGenericModal(true);
|
|
1269
1091
|
}
|
|
1270
1092
|
} else {
|
|
1271
1093
|
sendEvaluation("A");
|
|
@@ -1280,7 +1102,7 @@ export const ProviderProductEdition = ({
|
|
|
1280
1102
|
} else if (user.is_retailer) {
|
|
1281
1103
|
if (product.id_order || product.orderId) {
|
|
1282
1104
|
setValidatedAll(true);
|
|
1283
|
-
|
|
1105
|
+
setModalViewError(true);
|
|
1284
1106
|
} else {
|
|
1285
1107
|
setDataGenericModal((prev) => ({
|
|
1286
1108
|
...prev,
|
|
@@ -1289,11 +1111,11 @@ export const ProviderProductEdition = ({
|
|
|
1289
1111
|
action: () => evaluationToRetailer("R"),
|
|
1290
1112
|
},
|
|
1291
1113
|
}));
|
|
1292
|
-
|
|
1114
|
+
setShowGenericModal(true);
|
|
1293
1115
|
}
|
|
1294
1116
|
} else {
|
|
1295
1117
|
setValidatedAll(true);
|
|
1296
|
-
|
|
1118
|
+
setModalViewError(true);
|
|
1297
1119
|
}
|
|
1298
1120
|
}
|
|
1299
1121
|
};
|
|
@@ -1352,7 +1174,7 @@ export const ProviderProductEdition = ({
|
|
|
1352
1174
|
action: () => evaluationToRetailer("A"),
|
|
1353
1175
|
},
|
|
1354
1176
|
}));
|
|
1355
|
-
|
|
1177
|
+
setShowGenericModal(true);
|
|
1356
1178
|
} else if (user.is_retailer) {
|
|
1357
1179
|
if (product.id_order || product.orderId) {
|
|
1358
1180
|
validateAll("A");
|
|
@@ -1364,7 +1186,7 @@ export const ProviderProductEdition = ({
|
|
|
1364
1186
|
action: () => evaluationToRetailer("A"),
|
|
1365
1187
|
},
|
|
1366
1188
|
}));
|
|
1367
|
-
|
|
1189
|
+
setShowGenericModal(true);
|
|
1368
1190
|
}
|
|
1369
1191
|
} else {
|
|
1370
1192
|
validateAll("A");
|
|
@@ -1380,7 +1202,7 @@ export const ProviderProductEdition = ({
|
|
|
1380
1202
|
} else if (user.is_retailer) {
|
|
1381
1203
|
if (product.id_order || product.orderId) {
|
|
1382
1204
|
setValidatedAll(true);
|
|
1383
|
-
|
|
1205
|
+
setModalViewError(true);
|
|
1384
1206
|
} else {
|
|
1385
1207
|
setDataGenericModal((prev) => ({
|
|
1386
1208
|
...prev,
|
|
@@ -1389,11 +1211,11 @@ export const ProviderProductEdition = ({
|
|
|
1389
1211
|
action: () => evaluationToRetailer("R"),
|
|
1390
1212
|
},
|
|
1391
1213
|
}));
|
|
1392
|
-
|
|
1214
|
+
setShowGenericModal(true);
|
|
1393
1215
|
}
|
|
1394
1216
|
} else {
|
|
1395
1217
|
setValidatedAll(true);
|
|
1396
|
-
|
|
1218
|
+
setModalViewError(true);
|
|
1397
1219
|
}
|
|
1398
1220
|
}}
|
|
1399
1221
|
approve={() => sendToEvaluation("A")}
|
|
@@ -1620,7 +1442,64 @@ export const ProviderProductEdition = ({
|
|
|
1620
1442
|
onClick={() => setMessage("")}
|
|
1621
1443
|
/>
|
|
1622
1444
|
)}
|
|
1623
|
-
{
|
|
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
|
+
)}
|
|
1624
1503
|
{showVersionSelector && (
|
|
1625
1504
|
<VersionSelector
|
|
1626
1505
|
modalId={"version-selector"}
|