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