contentoh-components-library 21.1.74 → 21.1.77
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/AsignationOption/index.js +2 -2
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
- package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
- package/dist/components/atoms/ProgressBar/styles.js +1 -1
- package/dist/components/atoms/Status/Status.stories.js +31 -0
- package/dist/components/atoms/Status/index.js +23 -0
- package/dist/components/atoms/Status/styles.js +20 -0
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
- package/dist/components/molecules/AssignedWork/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +2 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +3 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
- package/dist/components/organisms/VersionSelector/index.js +16 -8
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -6
- package/dist/components/pages/ProviderProductEdition/index.js +433 -433
- package/dist/components/pages/RetailerProductEdition/index.js +217 -200
- package/dist/global-files/customHooks.js +8 -14
- package/dist/global-files/data.js +8 -8
- package/dist/index.js +1 -14
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +2 -2
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +11 -12
- package/src/components/atoms/ProductPercentCard/styles.js +9 -9
- package/src/components/atoms/ProgressBar/styles.js +7 -8
- package/src/components/atoms/Status/Status.stories.js +14 -0
- package/src/components/atoms/Status/index.js +13 -0
- package/src/components/atoms/{StatusTag → Status}/styles.js +7 -10
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
- package/src/components/molecules/AssignedWork/styles.js +9 -10
- package/src/components/molecules/ProductNameHeader/index.js +2 -2
- package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
- package/src/components/organisms/FullProductNameHeader/index.js +2 -2
- package/src/components/organisms/VersionSelector/index.js +3 -8
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -3
- package/src/components/pages/ProviderProductEdition/index.js +233 -250
- package/src/components/pages/RetailerProductEdition/index.js +149 -173
- package/src/global-files/customHooks.js +13 -11
- package/src/global-files/data.js +8 -8
- package/src/index.js +1 -2
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +0 -48
- package/dist/components/atoms/StatusTag/index.js +0 -58
- package/dist/components/atoms/StatusTag/styles.js +0 -20
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
- package/src/components/atoms/StatusTag/index.js +0 -37
|
@@ -29,7 +29,6 @@ import { GenericModal } from "../../atoms/GenericModal";
|
|
|
29
29
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
30
|
import { Loading } from "../../atoms/Loading";
|
|
31
31
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
-
import { getNewStatus } from "../../../global-files/data";
|
|
33
32
|
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
34
33
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
35
34
|
import { closeModals } from "../../../global-files/customHooks";
|
|
@@ -188,11 +187,8 @@ export const RetailerProductEdition = ({
|
|
|
188
187
|
setServices(services);
|
|
189
188
|
getServices();
|
|
190
189
|
|
|
191
|
-
//setActiveRetailer(product?.retailers[0]);
|
|
192
|
-
setImages({
|
|
193
|
-
action: "init",
|
|
194
|
-
init: services[2],
|
|
195
|
-
});
|
|
190
|
+
// setActiveRetailer(product?.retailers[0]);
|
|
191
|
+
setImages({ action: "init", init: services[2] });
|
|
196
192
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
197
193
|
|
|
198
194
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
@@ -210,24 +206,22 @@ export const RetailerProductEdition = ({
|
|
|
210
206
|
);
|
|
211
207
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
212
208
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
209
|
+
const retailers = product.retailers || product.retailersAvailable;
|
|
210
|
+
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
211
|
+
const active = retailers?.find((retailer) =>
|
|
212
|
+
retailerResponse.includes(retailer.id)
|
|
213
|
+
);
|
|
217
214
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
218
215
|
setServicesData(parsedResponse);
|
|
219
216
|
};
|
|
220
217
|
|
|
221
218
|
const translateConcept = (concept) => {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
translation = "Imágenes";
|
|
229
|
-
}
|
|
230
|
-
return translation;
|
|
219
|
+
const translation = {
|
|
220
|
+
datasheet: "Ficha técnica",
|
|
221
|
+
description: "Descripción",
|
|
222
|
+
images: "Imágenes",
|
|
223
|
+
};
|
|
224
|
+
return translation[concept];
|
|
231
225
|
};
|
|
232
226
|
|
|
233
227
|
const getComments = async (tab = "Descripción") => {
|
|
@@ -264,14 +258,14 @@ export const RetailerProductEdition = ({
|
|
|
264
258
|
switch (user.id_role) {
|
|
265
259
|
case 7:
|
|
266
260
|
case 8:
|
|
267
|
-
arr = ["
|
|
261
|
+
arr = ["CA", "RC", "RA"];
|
|
268
262
|
break;
|
|
269
263
|
case 4:
|
|
270
264
|
case 5:
|
|
271
|
-
arr = ["
|
|
265
|
+
arr = ["RC", "AC", "AA", "AP", "ACA"];
|
|
272
266
|
break;
|
|
273
267
|
case 6:
|
|
274
|
-
arr = ["RP", "
|
|
268
|
+
arr = ["RP", "RCA", "AC", "RA"];
|
|
275
269
|
break;
|
|
276
270
|
default:
|
|
277
271
|
arr = [];
|
|
@@ -397,13 +391,14 @@ export const RetailerProductEdition = ({
|
|
|
397
391
|
const saveDescriptions = async () => {
|
|
398
392
|
setLoading(true);
|
|
399
393
|
const productTemp = product;
|
|
394
|
+
const articleId = product?.article?.id_article;
|
|
400
395
|
const dataObject = {
|
|
401
|
-
articleId
|
|
396
|
+
articleId,
|
|
402
397
|
articleData: updatedDescriptions,
|
|
403
398
|
};
|
|
404
399
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
405
400
|
try {
|
|
406
|
-
await axios.put(
|
|
401
|
+
const res = await axios.put(
|
|
407
402
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
408
403
|
dataObject,
|
|
409
404
|
{
|
|
@@ -412,14 +407,16 @@ export const RetailerProductEdition = ({
|
|
|
412
407
|
},
|
|
413
408
|
}
|
|
414
409
|
);
|
|
415
|
-
if (
|
|
416
|
-
|
|
410
|
+
if (res.data.statusCode === 200) {
|
|
411
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
412
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
413
|
+
if (newStatus) productTemp.description_status = newStatus;
|
|
417
414
|
setProduct(productTemp);
|
|
418
415
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
419
|
-
}
|
|
420
416
|
|
|
421
|
-
|
|
422
|
-
|
|
417
|
+
setMessage("Descripciones guardadas con éxito");
|
|
418
|
+
await loadData();
|
|
419
|
+
}
|
|
423
420
|
} catch (error) {
|
|
424
421
|
console.log(error);
|
|
425
422
|
}
|
|
@@ -428,13 +425,14 @@ export const RetailerProductEdition = ({
|
|
|
428
425
|
const saveDatasheets = async () => {
|
|
429
426
|
setLoading(true);
|
|
430
427
|
const productTemp = product;
|
|
428
|
+
const articleId = product?.article?.id_article;
|
|
431
429
|
const dataObject = {
|
|
432
|
-
articleId
|
|
430
|
+
articleId,
|
|
433
431
|
articleData: updatedDatasheets,
|
|
434
432
|
};
|
|
435
433
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
436
434
|
try {
|
|
437
|
-
await axios.put(
|
|
435
|
+
const res = await axios.put(
|
|
438
436
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
439
437
|
dataObject,
|
|
440
438
|
{
|
|
@@ -443,13 +441,16 @@ export const RetailerProductEdition = ({
|
|
|
443
441
|
},
|
|
444
442
|
}
|
|
445
443
|
);
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
productTemp.status =
|
|
444
|
+
if (res.data.statusCode === 200) {
|
|
445
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
446
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
447
|
+
if (newStatus) productTemp.datasheet_status = newStatus;
|
|
449
448
|
setProduct(productTemp);
|
|
450
449
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
450
|
+
|
|
451
|
+
setMessage("Fichas técnicas guardadas");
|
|
452
|
+
await loadData();
|
|
451
453
|
}
|
|
452
|
-
loadData();
|
|
453
454
|
} catch (error) {
|
|
454
455
|
console.log(error);
|
|
455
456
|
}
|
|
@@ -532,15 +533,6 @@ export const RetailerProductEdition = ({
|
|
|
532
533
|
} else {
|
|
533
534
|
setImagesUploaded(true);
|
|
534
535
|
}
|
|
535
|
-
let productTemp = product;
|
|
536
|
-
if (productTemp.status === "ASSIGNED") {
|
|
537
|
-
productTemp.status = "IN_PROGRESS";
|
|
538
|
-
setProduct(productTemp);
|
|
539
|
-
sessionStorage.setItem(
|
|
540
|
-
"productSelected",
|
|
541
|
-
JSON.stringify(productTemp)
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
536
|
} catch (err) {
|
|
545
537
|
console.log(err);
|
|
546
538
|
// setMainLoading(false);
|
|
@@ -565,7 +557,7 @@ export const RetailerProductEdition = ({
|
|
|
565
557
|
return e;
|
|
566
558
|
});
|
|
567
559
|
try {
|
|
568
|
-
await axios.put(
|
|
560
|
+
const res = await axios.put(
|
|
569
561
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
570
562
|
dataImages,
|
|
571
563
|
{
|
|
@@ -574,9 +566,21 @@ export const RetailerProductEdition = ({
|
|
|
574
566
|
},
|
|
575
567
|
}
|
|
576
568
|
);
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
569
|
+
if (res.data.statusCode === 200) {
|
|
570
|
+
let productTemp = product;
|
|
571
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
572
|
+
if (newArticleStatus)
|
|
573
|
+
productTemp.status = newArticleStatus[articleId];
|
|
574
|
+
if (newStatus) productTemp.images_status = newStatus;
|
|
575
|
+
setProduct(productTemp);
|
|
576
|
+
sessionStorage.setItem(
|
|
577
|
+
"productSelected",
|
|
578
|
+
JSON.stringify(productTemp)
|
|
579
|
+
);
|
|
580
|
+
setMessage("Imágenes guardadas con éxito");
|
|
581
|
+
sessionStorage.removeItem("imagesList");
|
|
582
|
+
await loadData();
|
|
583
|
+
}
|
|
580
584
|
} catch (error) {
|
|
581
585
|
console.log(error);
|
|
582
586
|
}
|
|
@@ -585,24 +589,23 @@ export const RetailerProductEdition = ({
|
|
|
585
589
|
|
|
586
590
|
const evaluationFinished = (userId, tab, statusArray) => {
|
|
587
591
|
const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
588
|
-
const
|
|
589
|
-
(serv) => serv.id_retailer === activeRetailer?.id
|
|
592
|
+
const srvActive = srv
|
|
593
|
+
.find((serv) => serv.id_retailer === activeRetailer?.id)
|
|
594
|
+
?.status?.replace(/.*\//, "");
|
|
595
|
+
const currStatus = product[`${getConcept(tab)}_status`]?.replace(
|
|
596
|
+
/.*\//,
|
|
597
|
+
""
|
|
590
598
|
);
|
|
591
|
-
const unvalidated =
|
|
592
|
-
product[`${getConcept(tab)}_status`] === "QF" ||
|
|
593
|
-
product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
599
|
+
const unvalidated = ["IE", "CA"].includes(currStatus);
|
|
594
600
|
|
|
595
|
-
const auditorUnvalidated = !["RA", "AA", "
|
|
596
|
-
product[`${getConcept(tab)}_status`]
|
|
597
|
-
);
|
|
601
|
+
const auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currStatus);
|
|
598
602
|
|
|
599
603
|
switch (userId) {
|
|
600
604
|
case 7:
|
|
601
605
|
case 8:
|
|
602
606
|
return (
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
(statusArray.includes(product.status) &&
|
|
607
|
+
statusArray.includes(srvActive) &&
|
|
608
|
+
(["RA", "RC"].includes(product?.status) ||
|
|
606
609
|
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
607
610
|
srv.length)
|
|
608
611
|
);
|
|
@@ -610,14 +613,16 @@ export const RetailerProductEdition = ({
|
|
|
610
613
|
case 5:
|
|
611
614
|
return (
|
|
612
615
|
unvalidated &&
|
|
613
|
-
["
|
|
616
|
+
["CA", "IE"].includes(product.status) && // "RC", "AC", "AA", "AP", "ACA"
|
|
614
617
|
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
615
618
|
srv.length
|
|
616
619
|
);
|
|
617
620
|
case 6:
|
|
618
621
|
return (
|
|
619
|
-
statusArray.includes(product.status) && //RP,
|
|
620
|
-
srv.every((serv) =>
|
|
622
|
+
statusArray.includes(product.status) && // RP, RCA, AC, RA true
|
|
623
|
+
srv.every((serv) =>
|
|
624
|
+
["RA", "AA", "AP", "ACA"].includes(serv.status)
|
|
625
|
+
) &&
|
|
621
626
|
auditorUnvalidated
|
|
622
627
|
);
|
|
623
628
|
default:
|
|
@@ -639,20 +644,20 @@ export const RetailerProductEdition = ({
|
|
|
639
644
|
const approveRejectButtons = (action) => {
|
|
640
645
|
let concept = getConcept(action || activeTab);
|
|
641
646
|
|
|
642
|
-
const
|
|
643
|
-
(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
647
|
+
const retailerStatus = servicesData
|
|
648
|
+
.find(
|
|
649
|
+
(srv) =>
|
|
650
|
+
srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
651
|
+
)
|
|
652
|
+
?.status?.replace(/.*\//, "");
|
|
653
|
+
|
|
654
|
+
//sessionStorage product
|
|
655
|
+
const adminFacilitatorCanEvaluate =
|
|
656
|
+
retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
|
|
657
|
+
const adminAuditorCanEvaluate =
|
|
658
|
+
["AC", "RP", "RCA"].includes(retailerStatus) &&
|
|
659
|
+
[1, 6].includes(user.id_role);
|
|
660
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
656
661
|
};
|
|
657
662
|
|
|
658
663
|
const getSectionIcon = () => {
|
|
@@ -676,92 +681,57 @@ export const RetailerProductEdition = ({
|
|
|
676
681
|
try {
|
|
677
682
|
let concept = getConcept(activeTab);
|
|
678
683
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
684
|
+
const productTemp = { ...product };
|
|
685
|
+
const evalStatus = retailerStatus;
|
|
686
|
+
const articleId = product.article.id_article;
|
|
687
|
+
const orderId = product.orderId;
|
|
688
|
+
|
|
689
|
+
let data = {
|
|
690
|
+
articleId,
|
|
691
|
+
orderId,
|
|
692
|
+
concept,
|
|
693
|
+
evalStatus,
|
|
694
|
+
retailerId: activeRetailer.id,
|
|
695
|
+
};
|
|
696
|
+
let res;
|
|
697
|
+
let message;
|
|
683
698
|
if (result) {
|
|
684
|
-
data =
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
headers: {
|
|
695
|
-
Authorization: token,
|
|
696
|
-
},
|
|
697
|
-
});
|
|
699
|
+
data.result = result;
|
|
700
|
+
res = await axios.put(
|
|
701
|
+
`${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
702
|
+
data,
|
|
703
|
+
{
|
|
704
|
+
headers: {
|
|
705
|
+
Authorization: token,
|
|
706
|
+
},
|
|
707
|
+
}
|
|
708
|
+
);
|
|
698
709
|
getServices();
|
|
699
710
|
} else {
|
|
700
|
-
const specialistDone =
|
|
701
|
-
evalStatus === "RF" ||
|
|
702
|
-
evalStatus === "RA" ||
|
|
703
|
-
evalStatus === "IN_PROGRESS";
|
|
711
|
+
const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
704
712
|
|
|
705
713
|
if (specialistDone) {
|
|
706
|
-
|
|
714
|
+
message = `${activeTab} enviada a facilitador`;
|
|
707
715
|
getSectionIcon();
|
|
708
|
-
} else if (
|
|
709
|
-
|
|
710
|
-
getSectionIcon();
|
|
711
|
-
} else if (evalStatus === "AF") {
|
|
712
|
-
setMessage("Evaluación enviada");
|
|
713
|
-
getSectionIcon();
|
|
714
|
-
} else if (evalStatus === "RP") {
|
|
715
|
-
setMessage("Evaluación enviada");
|
|
716
|
-
getSectionIcon();
|
|
717
|
-
} else if (evalStatus === "RC") {
|
|
718
|
-
setMessage("Evaluación enviada");
|
|
716
|
+
} else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
717
|
+
message = "Evaluación enviada";
|
|
719
718
|
getSectionIcon();
|
|
720
719
|
}
|
|
721
|
-
|
|
722
|
-
servicesData.forEach((srv) => {
|
|
723
|
-
srv.service === concept && statusArr.push(srv.status);
|
|
724
|
-
});
|
|
725
|
-
|
|
726
|
-
productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
727
|
-
|
|
728
|
-
let newStatus = getNewStatus([
|
|
729
|
-
productTemp.datasheet_status,
|
|
730
|
-
productTemp.description_status,
|
|
731
|
-
productTemp.images_status,
|
|
732
|
-
]);
|
|
733
|
-
|
|
734
|
-
productTemp.status = newStatus;
|
|
735
|
-
|
|
736
|
-
data = {
|
|
737
|
-
articleId: product.article.id_article,
|
|
738
|
-
orderId: product.orderId,
|
|
739
|
-
concept: concept,
|
|
740
|
-
evalStatus: evalStatus,
|
|
741
|
-
retailerId: activeRetailer.id,
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
switch (user.id_role) {
|
|
745
|
-
case 7:
|
|
746
|
-
case 8:
|
|
747
|
-
data.especialist = true;
|
|
748
|
-
break;
|
|
749
|
-
case 4:
|
|
750
|
-
case 5:
|
|
751
|
-
data.facilitator = true;
|
|
752
|
-
break;
|
|
753
|
-
default:
|
|
754
|
-
break;
|
|
755
|
-
}
|
|
756
|
-
await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
720
|
+
res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
757
721
|
headers: {
|
|
758
722
|
Authorization: token,
|
|
759
723
|
},
|
|
760
724
|
});
|
|
761
725
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
726
|
+
if (res.data.statusCode === 200) {
|
|
727
|
+
const { newStatus, newOrderStatus } = JSON.parse(res.data.body);
|
|
728
|
+
if (newOrderStatus) productTemp.status = newOrderStatus[orderId];
|
|
729
|
+
productTemp[`${concept}_status`] = newStatus;
|
|
730
|
+
await loadData();
|
|
731
|
+
if (message) setMessage(message);
|
|
732
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
733
|
+
setProduct(productTemp);
|
|
734
|
+
}
|
|
765
735
|
} catch (error) {
|
|
766
736
|
console.log(error);
|
|
767
737
|
}
|
|
@@ -859,21 +829,23 @@ export const RetailerProductEdition = ({
|
|
|
859
829
|
|
|
860
830
|
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
861
831
|
|
|
832
|
+
const regex = /(<\/?p>)|(<\/?strong>)|(<br>)/gm;
|
|
862
833
|
descriptionsServicesArray.forEach((description) => {
|
|
863
834
|
const [requested] = servicesData.filter(
|
|
864
835
|
(srv) =>
|
|
865
836
|
srv.id_retailer === description.id &&
|
|
866
837
|
srv.service === getConcept(activeTab)
|
|
867
838
|
);
|
|
868
|
-
requested
|
|
869
|
-
description.inputs.forEach(
|
|
870
|
-
(
|
|
839
|
+
if (requested) {
|
|
840
|
+
description.inputs.forEach((input) => {
|
|
841
|
+
if (
|
|
871
842
|
input.required &&
|
|
872
|
-
(!input.value ||
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
);
|
|
843
|
+
(!input.value || input.value?.replace(regex, "") === "")
|
|
844
|
+
) {
|
|
845
|
+
desInputsRequired++;
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
877
849
|
});
|
|
878
850
|
|
|
879
851
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
@@ -947,12 +919,12 @@ export const RetailerProductEdition = ({
|
|
|
947
919
|
},
|
|
948
920
|
],
|
|
949
921
|
concept: concept,
|
|
950
|
-
|
|
922
|
+
userId: assignationId,
|
|
951
923
|
};
|
|
952
|
-
axios({
|
|
924
|
+
await axios({
|
|
953
925
|
method: "post",
|
|
954
926
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
955
|
-
data
|
|
927
|
+
data,
|
|
956
928
|
headers: {
|
|
957
929
|
Authorization: token,
|
|
958
930
|
},
|
|
@@ -1141,7 +1113,7 @@ export const RetailerProductEdition = ({
|
|
|
1141
1113
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1142
1114
|
setProduct(productTemp);
|
|
1143
1115
|
|
|
1144
|
-
loadData();
|
|
1116
|
+
await loadData();
|
|
1145
1117
|
} catch (error) {
|
|
1146
1118
|
console.log(error);
|
|
1147
1119
|
}
|
|
@@ -1219,7 +1191,7 @@ export const RetailerProductEdition = ({
|
|
|
1219
1191
|
showApproveRejectAll={
|
|
1220
1192
|
isAuditor &&
|
|
1221
1193
|
servicesData.every((serv) =>
|
|
1222
|
-
["RA", "AA", "AP", "
|
|
1194
|
+
["RA", "AA", "AP", "ACA", "AC"].includes(serv.status)
|
|
1223
1195
|
) &&
|
|
1224
1196
|
approveRejectButtons() &&
|
|
1225
1197
|
(auditorAssigned() || userAssigned())
|
|
@@ -1262,7 +1234,6 @@ export const RetailerProductEdition = ({
|
|
|
1262
1234
|
}}
|
|
1263
1235
|
/>
|
|
1264
1236
|
<FullTabsMenu
|
|
1265
|
-
canAssign={![7, 8].includes(user.id_role)}
|
|
1266
1237
|
tabsSections={tabsSections}
|
|
1267
1238
|
status={retailerStatus}
|
|
1268
1239
|
activeTab={activeTab}
|
|
@@ -1415,16 +1386,21 @@ export const RetailerProductEdition = ({
|
|
|
1415
1386
|
/>
|
|
1416
1387
|
</div>
|
|
1417
1388
|
)}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1389
|
+
{[7, 8].includes(user.id_role) && (
|
|
1390
|
+
<Button
|
|
1391
|
+
buttonType={
|
|
1392
|
+
evaluationFinished(
|
|
1393
|
+
user.id_role,
|
|
1394
|
+
activeTab,
|
|
1395
|
+
statusArray
|
|
1396
|
+
) && requiredNull[activeTab] === 0
|
|
1397
|
+
? "general-green-button"
|
|
1398
|
+
: "general-button-disabled"
|
|
1399
|
+
}
|
|
1400
|
+
label={"Enviar evaluación"}
|
|
1401
|
+
onClick={() => sendToFacilitator()}
|
|
1402
|
+
/>
|
|
1403
|
+
)}
|
|
1428
1404
|
</div>
|
|
1429
1405
|
)}
|
|
1430
1406
|
</div>
|
|
@@ -4,20 +4,22 @@ import { useEffect } from "react";
|
|
|
4
4
|
export const closeModals = (id) => {
|
|
5
5
|
const [showModal, setShowModal] = useState(false);
|
|
6
6
|
|
|
7
|
-
const closeModal = (e) => {
|
|
8
|
-
e.stopPropagation();
|
|
9
|
-
if (!e.target.closest(`#${id}`) && showModal) {
|
|
10
|
-
document.removeEventListener("click", closeModal, false);
|
|
11
|
-
setShowModal(false);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
7
|
useEffect(() => {
|
|
8
|
+
const closeModal = (e) => {
|
|
9
|
+
if (
|
|
10
|
+
(!e.target.closest(`#${id}`) ||
|
|
11
|
+
e.target.closest("#close-button") ||
|
|
12
|
+
e.target.closest("#add-version")) &&
|
|
13
|
+
showModal
|
|
14
|
+
) {
|
|
15
|
+
document.removeEventListener("click", closeModal);
|
|
16
|
+
setShowModal(false);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
15
20
|
if (showModal) {
|
|
16
|
-
document.addEventListener("click", closeModal
|
|
21
|
+
document.addEventListener("click", closeModal);
|
|
17
22
|
}
|
|
18
|
-
return () => {
|
|
19
|
-
document.removeEventListener("click", closeModal, false);
|
|
20
|
-
};
|
|
21
23
|
}, [showModal]);
|
|
22
24
|
|
|
23
25
|
return [showModal, setShowModal];
|
package/src/global-files/data.js
CHANGED
|
@@ -195,18 +195,18 @@ export const fetchUsers = async (auth) => {
|
|
|
195
195
|
export const getNewStatus = (statusArray) => {
|
|
196
196
|
let lookupString = "";
|
|
197
197
|
statusArray.forEach((element) => (lookupString += element + "/"));
|
|
198
|
-
if (lookupString.includes("
|
|
198
|
+
if (lookupString.includes("RCA")) return "RCA";
|
|
199
|
+
if (lookupString.includes("RC")) return "RC";
|
|
199
200
|
if (lookupString.includes("RA")) return "RA";
|
|
200
201
|
if (lookupString.includes("RP")) return "RP";
|
|
201
|
-
if (lookupString.includes("
|
|
202
|
-
if (lookupString.includes("
|
|
203
|
-
if (lookupString.includes("
|
|
204
|
-
if (lookupString.includes("
|
|
205
|
-
if (lookupString.includes("
|
|
202
|
+
if (lookupString.includes("ACA")) return "ACA";
|
|
203
|
+
if (lookupString.includes("PA")) return "PA";
|
|
204
|
+
if (lookupString.includes("CA")) return "CA";
|
|
205
|
+
if (lookupString.includes("IE")) return "IE";
|
|
206
|
+
if (lookupString.includes("AC")) return "AC";
|
|
206
207
|
if (lookupString.includes("AA")) return "AA";
|
|
207
208
|
if (lookupString.includes("AP")) return "AP";
|
|
208
|
-
if (lookupString.includes("
|
|
209
|
-
if (lookupString.includes("RECEIVED")) return "RECEIVED";
|
|
209
|
+
if (lookupString.includes("R")) return "R";
|
|
210
210
|
if (lookupString.includes("NA")) return "NA";
|
|
211
211
|
return new Error("Status not found");
|
|
212
212
|
};
|
package/src/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export * from "./components/atoms/ProgressBar/index";
|
|
|
19
19
|
export * from "./components/atoms/ScreenHeader/index";
|
|
20
20
|
export * from "./components/atoms/SideMenuButton/index";
|
|
21
21
|
export * from "./components/atoms/SliderToolTip/index";
|
|
22
|
-
export * from "./components/atoms/
|
|
22
|
+
export * from "./components/atoms/Status/index";
|
|
23
23
|
export * from "./components/atoms/TabSection/index";
|
|
24
24
|
export * from "./components/atoms/ValidationPanel/index";
|
|
25
25
|
|
|
@@ -65,7 +65,6 @@ export * from "./components/pages/CustomerLogin";
|
|
|
65
65
|
export * from "./components/pages/CustomerType";
|
|
66
66
|
export * from "./components/pages/EmailResetPassword";
|
|
67
67
|
export * from "./components/pages/OnboardPlan";
|
|
68
|
-
export * from "./components/pages/RegistrationLoginFirstStep";
|
|
69
68
|
export * from "./components/pages/RegistrationLoginSecondStep";
|
|
70
69
|
export * from "./components/pages/RegistrationLoginThirdStep";
|
|
71
70
|
export * from "./components/pages/RetailerProductEdition";
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = exports.StatusTagDefault = void 0;
|
|
9
|
-
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
-
|
|
12
|
-
var _index = require("./index");
|
|
13
|
-
|
|
14
|
-
var _variables = require("../../../global-files/variables");
|
|
15
|
-
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
|
-
var status = _variables.GlobalStatus;
|
|
19
|
-
var _default = {
|
|
20
|
-
title: "Components/atoms/StatusTag",
|
|
21
|
-
component: _index.StatusTag,
|
|
22
|
-
argTypes: {
|
|
23
|
-
statusType: {
|
|
24
|
-
options: status,
|
|
25
|
-
control: {
|
|
26
|
-
type: "select"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
ovalForm: {
|
|
30
|
-
options: [true, false],
|
|
31
|
-
control: {
|
|
32
|
-
type: "boolean"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.default = _default;
|
|
38
|
-
|
|
39
|
-
var Template = function Template(args) {
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StatusTag, (0, _objectSpread2.default)({}, args));
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var StatusTagDefault = Template.bind({});
|
|
44
|
-
exports.StatusTagDefault = StatusTagDefault;
|
|
45
|
-
StatusTagDefault.args = {
|
|
46
|
-
statusType: "-",
|
|
47
|
-
ovalForm: false
|
|
48
|
-
};
|