contentoh-components-library 21.0.5 → 21.0.8
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/CharCounter/CharCounter.stories.js +31 -0
- package/dist/components/atoms/CharCounter/index.js +22 -0
- package/dist/components/atoms/CharCounter/styles.js +20 -0
- package/dist/components/atoms/GeneralInput/index.js +78 -49
- package/dist/components/atoms/GeneralInput/styles.js +4 -1
- package/dist/components/atoms/GradientPanel/styles.js +2 -2
- package/dist/components/atoms/InputFormatter/index.js +132 -66
- package/dist/components/atoms/InputFormatter/styles.js +2 -2
- package/dist/components/atoms/ProgressBar/styles.js +1 -1
- package/dist/components/atoms/Select/index.js +4 -2
- package/dist/components/atoms/Select/style.js +1 -1
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +94 -0
- package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
- package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
- package/dist/components/molecules/LoginPasswordStrength/index.js +131 -0
- package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
- package/dist/components/molecules/TagAndInput/index.js +4 -2
- package/dist/components/organisms/InputGroup/index.js +12 -10
- package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
- package/dist/components/pages/ChangePasswordLogin/index.js +131 -0
- package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
- package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
- package/dist/components/pages/EmailResetPassword/index.js +130 -0
- package/dist/components/pages/EmailResetPassword/styles.js +20 -0
- 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/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
- package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
- package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
- package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
- package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +15 -37
- package/dist/components/pages/RetailerProductEdition/index.js +92 -56
- package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
- package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
- package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
- package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
- package/package.json +2 -2
- package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
- package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
- package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
- package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
- package/src/components/atoms/CharCounter/index.js +13 -0
- package/src/components/atoms/CharCounter/styles.js +10 -0
- package/src/components/atoms/GeneralInput/index.js +74 -50
- package/src/components/atoms/GeneralInput/styles.js +9 -0
- package/src/components/atoms/GradientPanel/styles.js +7 -1
- package/src/components/atoms/InputFormatter/index.js +109 -46
- package/src/components/atoms/InputFormatter/styles.js +6 -0
- package/src/components/atoms/ProgressBar/styles.js +2 -1
- package/src/components/atoms/Select/index.js +3 -1
- package/src/components/atoms/Select/style.js +1 -2
- package/src/components/atoms/StatusTag/styles.js +2 -1
- package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +68 -0
- package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
- package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
- package/src/components/molecules/LoginPasswordStrength/index.js +89 -0
- package/src/components/molecules/LoginPasswordStrength/styles.js +87 -0
- package/src/components/molecules/TagAndInput/index.js +2 -0
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +19 -4
- package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
- package/src/components/pages/ChangePasswordLogin/index.js +78 -0
- package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
- package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
- package/src/components/pages/EmailResetPassword/index.js +77 -0
- package/src/components/pages/EmailResetPassword/styles.js +27 -0
- package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
- package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
- package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
- package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
- package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
- package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
- package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
- package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
- package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +27 -51
- package/src/components/pages/RetailerProductEdition/index.js +172 -52
- package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
- package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
- package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
- package/src/components/pages/VerificationCodeResetPassword/utils.js +56 -0
|
@@ -120,16 +120,26 @@ export const RetailerProductEdition = ({
|
|
|
120
120
|
new Array(productSelected?.retailers?.length).fill({ percentage: 0 })
|
|
121
121
|
);
|
|
122
122
|
const [activePercentage, setActivePercentage] = useState(0);
|
|
123
|
-
const [activeRetailer, setActiveRetailer] = useState(
|
|
123
|
+
const [activeRetailer, setActiveRetailer] = useState(
|
|
124
|
+
productSelected?.retailers[0]
|
|
125
|
+
);
|
|
124
126
|
const [services, setServices] = useState([]);
|
|
125
127
|
const [servicesData, setServicesData] = useState([]);
|
|
126
128
|
const [message, setMessage] = useState("");
|
|
127
|
-
const [product, setProduct] = useState(
|
|
129
|
+
const [product, setProduct] = useState(
|
|
130
|
+
JSON.parse(sessionStorage.getItem("productSelected"))
|
|
131
|
+
? JSON.parse(sessionStorage.getItem("productSelected"))
|
|
132
|
+
: productSelected
|
|
133
|
+
);
|
|
128
134
|
const [icon, setIcon] = useState(null);
|
|
129
135
|
const [version, setVersion] = useState(productSelected?.version);
|
|
130
136
|
const [comments, setComments] = useState({});
|
|
131
137
|
const [comment, setComment] = useState("");
|
|
132
|
-
const [requiredNull, setRequiredNull] = useState(
|
|
138
|
+
const [requiredNull, setRequiredNull] = useState({
|
|
139
|
+
"Ficha técnica": 0,
|
|
140
|
+
Descripción: 0,
|
|
141
|
+
Imágenes: 0,
|
|
142
|
+
});
|
|
133
143
|
const [crossComment, setCrossComment] = useState(false);
|
|
134
144
|
const [userGroups, setUserGroups] = useState([]);
|
|
135
145
|
const [assig, setAssig] = useState({});
|
|
@@ -151,13 +161,14 @@ export const RetailerProductEdition = ({
|
|
|
151
161
|
|
|
152
162
|
//Converts the data inside the datasheets object to array
|
|
153
163
|
setServices(services);
|
|
154
|
-
|
|
164
|
+
getRequired(services);
|
|
165
|
+
//setActiveRetailer(productSelected?.retailers[0]);
|
|
155
166
|
setImages({
|
|
156
167
|
action: "init",
|
|
157
168
|
init: services[2],
|
|
158
169
|
});
|
|
159
170
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
160
|
-
|
|
171
|
+
|
|
161
172
|
getPercentage({ data: [productSelected] }).then((res) =>
|
|
162
173
|
setPercentages(res)
|
|
163
174
|
);
|
|
@@ -179,7 +190,7 @@ export const RetailerProductEdition = ({
|
|
|
179
190
|
}
|
|
180
191
|
const selected = productSelected;
|
|
181
192
|
const servicesResponse = await axios.get(
|
|
182
|
-
`${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${
|
|
193
|
+
`${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${product?.article?.id_article}&orderId=${product?.article?.id_order}&end=true`
|
|
183
194
|
);
|
|
184
195
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
185
196
|
setServicesData(parsedResponse);
|
|
@@ -299,7 +310,6 @@ export const RetailerProductEdition = ({
|
|
|
299
310
|
}, [percentages]);
|
|
300
311
|
|
|
301
312
|
useEffect(() => {
|
|
302
|
-
const required = {};
|
|
303
313
|
if (services.length > 0) {
|
|
304
314
|
if (services[0][activeRetailer.id])
|
|
305
315
|
services[0][activeRetailer.id].data = Object.values(
|
|
@@ -311,7 +321,6 @@ export const RetailerProductEdition = ({
|
|
|
311
321
|
const descriptions = services[1]?.filter(
|
|
312
322
|
(service) => service?.id === activeRetailer?.id
|
|
313
323
|
);
|
|
314
|
-
setRequiredNull(required);
|
|
315
324
|
setDatasheets([datagroups, inputs]);
|
|
316
325
|
setDescriptions(descriptions);
|
|
317
326
|
}
|
|
@@ -321,6 +330,7 @@ export const RetailerProductEdition = ({
|
|
|
321
330
|
const imageInputs = images?.inputs?.map((e) => ({
|
|
322
331
|
value: e?.id,
|
|
323
332
|
name: e?.name,
|
|
333
|
+
required: e?.required,
|
|
324
334
|
}));
|
|
325
335
|
const imageType = images?.imageType?.map((e) => ({
|
|
326
336
|
value: e?.id,
|
|
@@ -524,12 +534,14 @@ export const RetailerProductEdition = ({
|
|
|
524
534
|
}
|
|
525
535
|
concept = action ? action : concept;
|
|
526
536
|
return (
|
|
527
|
-
(
|
|
528
|
-
(user
|
|
529
|
-
(
|
|
530
|
-
(user
|
|
531
|
-
(
|
|
532
|
-
(user
|
|
537
|
+
(product[`${concept}_status`] === "QF" &&
|
|
538
|
+
(user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
539
|
+
(product[`${concept}_status`] === "AF" && //sessionStorage productSelected
|
|
540
|
+
(user.id_role === 1 || user.id_role === 6)) ||
|
|
541
|
+
(product[`${concept}_status`] === "RP" &&
|
|
542
|
+
(user.id_role === 1 || user.id_role === 6)) ||
|
|
543
|
+
(product[`${concept}_status`] === "RC" &&
|
|
544
|
+
(user.id_role === 1 || user.id_role === 6))
|
|
533
545
|
);
|
|
534
546
|
};
|
|
535
547
|
|
|
@@ -551,7 +563,7 @@ export const RetailerProductEdition = ({
|
|
|
551
563
|
|
|
552
564
|
const updateCompaniesList = (status, result, retailerId, concept) => {
|
|
553
565
|
let serv = servicesData.slice();
|
|
554
|
-
let item = serv
|
|
566
|
+
let item = serv.find(
|
|
555
567
|
(item) => item.id_retailer === retailerId && item.service === concept
|
|
556
568
|
);
|
|
557
569
|
let index = serv.indexOf(item);
|
|
@@ -625,12 +637,9 @@ export const RetailerProductEdition = ({
|
|
|
625
637
|
case "Imágenes":
|
|
626
638
|
concept = "images";
|
|
627
639
|
break;
|
|
628
|
-
default:
|
|
629
|
-
break;
|
|
630
640
|
}
|
|
631
|
-
let
|
|
632
|
-
let
|
|
633
|
-
evalStatus = productSelected[`${concept}_status`];
|
|
641
|
+
let productTemp = { ...product };
|
|
642
|
+
let evalStatus = product[`${concept}_status`];
|
|
634
643
|
const specialistDone =
|
|
635
644
|
evalStatus === "RF" ||
|
|
636
645
|
evalStatus === "RA" ||
|
|
@@ -652,30 +661,39 @@ export const RetailerProductEdition = ({
|
|
|
652
661
|
setMessage("Evaluación enviada");
|
|
653
662
|
getSectionIcon();
|
|
654
663
|
productTemp[`${concept}_status`] = "AA";
|
|
664
|
+
} else if (evalStatus === "RC") {
|
|
665
|
+
setMessage("Evaluación enviada");
|
|
666
|
+
getSectionIcon();
|
|
667
|
+
productTemp[`${concept}_status`] = "AP";
|
|
655
668
|
}
|
|
669
|
+
|
|
656
670
|
let data = {};
|
|
657
671
|
if (result) {
|
|
658
672
|
updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
659
673
|
data = {
|
|
660
|
-
articleId:
|
|
661
|
-
orderId:
|
|
674
|
+
articleId: product.article.id_article,
|
|
675
|
+
orderId: product.orderId,
|
|
662
676
|
concept: concept,
|
|
663
677
|
result: result,
|
|
664
678
|
evalStatus: evalStatus,
|
|
665
679
|
retailerId: activeRetailer.id,
|
|
666
680
|
};
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
681
|
+
try {
|
|
682
|
+
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
683
|
+
headers: {
|
|
684
|
+
Authorization: token,
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
} catch (error) {
|
|
688
|
+
console.log(error);
|
|
689
|
+
}
|
|
672
690
|
} else {
|
|
673
691
|
if (specialistDone) {
|
|
674
|
-
updateCompaniesList(evalStatus, result, activeRetailer.id);
|
|
692
|
+
updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
675
693
|
}
|
|
676
694
|
data = {
|
|
677
|
-
articleId:
|
|
678
|
-
orderId:
|
|
695
|
+
articleId: product.article.id_article,
|
|
696
|
+
orderId: product.orderId,
|
|
679
697
|
concept: concept,
|
|
680
698
|
evalStatus: evalStatus,
|
|
681
699
|
retailerId: activeRetailer.id,
|
|
@@ -694,13 +712,16 @@ export const RetailerProductEdition = ({
|
|
|
694
712
|
break;
|
|
695
713
|
}
|
|
696
714
|
|
|
715
|
+
console.log(data);
|
|
716
|
+
|
|
697
717
|
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
698
718
|
headers: {
|
|
699
719
|
Authorization: token,
|
|
700
720
|
},
|
|
701
721
|
});
|
|
722
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
702
723
|
setProduct(productTemp);
|
|
703
|
-
setModalSent(true);
|
|
724
|
+
//setModalSent(true);
|
|
704
725
|
}
|
|
705
726
|
};
|
|
706
727
|
|
|
@@ -720,9 +741,21 @@ export const RetailerProductEdition = ({
|
|
|
720
741
|
}
|
|
721
742
|
|
|
722
743
|
const allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
723
|
-
|
|
724
744
|
const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
|
|
725
745
|
|
|
746
|
+
if (!rol) {
|
|
747
|
+
switch (user.id_role) {
|
|
748
|
+
case 4:
|
|
749
|
+
case 5:
|
|
750
|
+
rol = "facilitator";
|
|
751
|
+
break;
|
|
752
|
+
case 7:
|
|
753
|
+
case 8:
|
|
754
|
+
rol = "especialist";
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
726
759
|
return (
|
|
727
760
|
productSelected.article[`id_${concept}_${rol}`] === user.id_user &&
|
|
728
761
|
validUser
|
|
@@ -762,7 +795,52 @@ export const RetailerProductEdition = ({
|
|
|
762
795
|
await getComments(tab);
|
|
763
796
|
};
|
|
764
797
|
|
|
765
|
-
|
|
798
|
+
const getRequired = (services) => {
|
|
799
|
+
const objetcTemp = {};
|
|
800
|
+
const datasheetServicesArray = Object.values(services[0]);
|
|
801
|
+
const dsInputs = datasheetServicesArray.pop();
|
|
802
|
+
const descriptionsServicesArray = services[1];
|
|
803
|
+
|
|
804
|
+
let dsInputsRequired = [];
|
|
805
|
+
let desInputsRequired = 0;
|
|
806
|
+
datasheetServicesArray.forEach((datasheet) =>
|
|
807
|
+
Object.values(datasheet?.data).forEach((dataGroup) =>
|
|
808
|
+
dsInputsRequired.push(
|
|
809
|
+
...dataGroup.inputs.filter(
|
|
810
|
+
(input) =>
|
|
811
|
+
dsInputs[input].required &&
|
|
812
|
+
(dsInputs[input].value === undefined || !dsInputs[input].value)
|
|
813
|
+
)
|
|
814
|
+
)
|
|
815
|
+
)
|
|
816
|
+
);
|
|
817
|
+
|
|
818
|
+
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
819
|
+
|
|
820
|
+
descriptionsServicesArray.forEach((description) =>
|
|
821
|
+
description.inputs.forEach(
|
|
822
|
+
(input) =>
|
|
823
|
+
input.required &&
|
|
824
|
+
(!input.value ||
|
|
825
|
+
input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") ===
|
|
826
|
+
"") &&
|
|
827
|
+
desInputsRequired++
|
|
828
|
+
)
|
|
829
|
+
);
|
|
830
|
+
|
|
831
|
+
objetcTemp["Descripción"] = desInputsRequired;
|
|
832
|
+
const requiredImages = services[2]?.inputs?.filter((e) => e.required);
|
|
833
|
+
let requiredCounter = 0;
|
|
834
|
+
requiredImages.forEach(
|
|
835
|
+
(req) =>
|
|
836
|
+
services[2].values.filter((img) => img.image_id === req.id).length ===
|
|
837
|
+
0 && requiredCounter++
|
|
838
|
+
);
|
|
839
|
+
objetcTemp["Imágenes"] = requiredCounter;
|
|
840
|
+
setRequiredNull(objetcTemp);
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
useEffect(() => {
|
|
766
844
|
setComment(comments[activeTab]);
|
|
767
845
|
}, [activeTab]);
|
|
768
846
|
|
|
@@ -817,20 +895,20 @@ export const RetailerProductEdition = ({
|
|
|
817
895
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
818
896
|
};
|
|
819
897
|
|
|
820
|
-
const evaluationComplete = (
|
|
898
|
+
const evaluationComplete = () => {
|
|
821
899
|
let concept = "";
|
|
822
|
-
switch (
|
|
900
|
+
switch (activeTab) {
|
|
823
901
|
case "Ficha técnica":
|
|
824
902
|
concept = "datasheet";
|
|
825
903
|
break;
|
|
826
904
|
case "Imágenes":
|
|
827
905
|
concept = "images";
|
|
828
906
|
break;
|
|
829
|
-
|
|
830
|
-
default:
|
|
907
|
+
case "Descripción":
|
|
831
908
|
concept = "description";
|
|
832
909
|
break;
|
|
833
910
|
}
|
|
911
|
+
|
|
834
912
|
let serv = servicesData.filter((item) => item.service === concept);
|
|
835
913
|
let approved = "";
|
|
836
914
|
let rejected = "";
|
|
@@ -943,6 +1021,26 @@ export const RetailerProductEdition = ({
|
|
|
943
1021
|
}
|
|
944
1022
|
};
|
|
945
1023
|
|
|
1024
|
+
const specialistValid = (tab) => {
|
|
1025
|
+
let concept = "";
|
|
1026
|
+
switch (tab) {
|
|
1027
|
+
case "Ficha técnica":
|
|
1028
|
+
concept = "datasheet";
|
|
1029
|
+
break;
|
|
1030
|
+
case "Imágenes":
|
|
1031
|
+
concept = "images";
|
|
1032
|
+
break;
|
|
1033
|
+
case "Descripción":
|
|
1034
|
+
concept = "description";
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
return (
|
|
1038
|
+
product[`${concept}_status`] === "IN_PROGRESS" ||
|
|
1039
|
+
product[`${concept}_status`] === "RF" ||
|
|
1040
|
+
product[`${concept}_status`] === "RA"
|
|
1041
|
+
);
|
|
1042
|
+
};
|
|
1043
|
+
|
|
946
1044
|
return (
|
|
947
1045
|
<Container headerTop={headerTop}>
|
|
948
1046
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -977,15 +1075,38 @@ export const RetailerProductEdition = ({
|
|
|
977
1075
|
approveRejectButtons={approveRejectButtons}
|
|
978
1076
|
sendToFacilitator={sendToFacilitator}
|
|
979
1077
|
auditorAssigned={auditorAssigned}
|
|
980
|
-
userAssigned={userAssigned(activeTab
|
|
1078
|
+
userAssigned={() => userAssigned(activeTab)}
|
|
981
1079
|
/>
|
|
982
1080
|
<FullTabsMenu
|
|
983
1081
|
tabsSections={tabsSections}
|
|
984
|
-
status={
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1082
|
+
status={
|
|
1083
|
+
// {
|
|
1084
|
+
// Descripción: product?.description_status,
|
|
1085
|
+
// "Ficha técnica": product?.datasheet_status,
|
|
1086
|
+
// Imágenes: product?.images_status,
|
|
1087
|
+
// }
|
|
1088
|
+
() => {
|
|
1089
|
+
let concept = "";
|
|
1090
|
+
switch (activeTab) {
|
|
1091
|
+
case "Ficha técnica":
|
|
1092
|
+
concept = "datasheet";
|
|
1093
|
+
break;
|
|
1094
|
+
case "Imágenes":
|
|
1095
|
+
concept = "images";
|
|
1096
|
+
break;
|
|
1097
|
+
case "Descripción":
|
|
1098
|
+
concept = "description";
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
let retailerService = {};
|
|
1102
|
+
[retailerService] = servicesData.filter(
|
|
1103
|
+
(service) =>
|
|
1104
|
+
service.id_retailer === activeRetailer.id &&
|
|
1105
|
+
service.service === concept
|
|
1106
|
+
);
|
|
1107
|
+
return retailerService?.status;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
989
1110
|
activeTab={activeTab}
|
|
990
1111
|
setActiveTab={setActiveTab}
|
|
991
1112
|
setImageLayout={setImageLayout}
|
|
@@ -1085,8 +1206,7 @@ export const RetailerProductEdition = ({
|
|
|
1085
1206
|
</>
|
|
1086
1207
|
)}
|
|
1087
1208
|
</div>
|
|
1088
|
-
{(userAssigned(activeTab
|
|
1089
|
-
auditorAssigned()) && (
|
|
1209
|
+
{(userAssigned(activeTab) || auditorAssigned()) && (
|
|
1090
1210
|
<div className="commentary-box">
|
|
1091
1211
|
{!comment ? (
|
|
1092
1212
|
<div className="commentary">
|
|
@@ -1131,11 +1251,11 @@ export const RetailerProductEdition = ({
|
|
|
1131
1251
|
)}
|
|
1132
1252
|
<Button
|
|
1133
1253
|
buttonType={
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
? "general-button
|
|
1138
|
-
: "general-
|
|
1254
|
+
evaluationComplete() &&
|
|
1255
|
+
requiredNull[activeTab] === 0 &&
|
|
1256
|
+
approveRejectButtons()
|
|
1257
|
+
? "general-green-button"
|
|
1258
|
+
: "general-button-disabled"
|
|
1139
1259
|
}
|
|
1140
1260
|
label={"Enviar evaluación"}
|
|
1141
1261
|
onClick={() => sendToFacilitator()}
|
|
@@ -1159,9 +1279,9 @@ export const RetailerProductEdition = ({
|
|
|
1159
1279
|
componentsArray.length > 0
|
|
1160
1280
|
? componentsArray
|
|
1161
1281
|
: [
|
|
1162
|
-
<img src={succes} alt="success icon" />,
|
|
1282
|
+
<img key="1" src={succes} alt="success icon" />,
|
|
1163
1283
|
<ScreenHeader
|
|
1164
|
-
key="
|
|
1284
|
+
key="2"
|
|
1165
1285
|
headerType={"retailer-name-header"}
|
|
1166
1286
|
text={message}
|
|
1167
1287
|
color={"white"}
|
package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VerificationCodeResetPassword } from "./index";
|
|
2
|
+
import LoginImage from "../../../assets/images/carouselImagesLogin/loginImage.svg";
|
|
3
|
+
import Login2 from "../../../assets/images/carouselImagesLogin/login2.svg";
|
|
4
|
+
import Login3 from "../../../assets/images/carouselImagesLogin/login3.svg";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/pages/VerificationCodeResetPassword",
|
|
8
|
+
component: VerificationCodeResetPassword,
|
|
9
|
+
};
|
|
10
|
+
const Template = (args) => <VerificationCodeResetPassword {...args} />;
|
|
11
|
+
|
|
12
|
+
export const VerificationCodeResetPasswordDefault = Template.bind({});
|
|
13
|
+
|
|
14
|
+
VerificationCodeResetPasswordDefault.args = {
|
|
15
|
+
imageArrayCarousel: [LoginImage, Login2, Login3],
|
|
16
|
+
textCarousel: "Elige la plataforma que conecta proovedores y retailers",
|
|
17
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { GradientPanel } from "../../atoms/GradientPanel";
|
|
3
|
+
import { CarouselImagesLogin } from "../../molecules/CarouselImagesLogin";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { LogoImage } from "../../atoms/LogoImage";
|
|
6
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
7
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
8
|
+
import { GeneralInput } from "../../atoms/GeneralInput";
|
|
9
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
10
|
+
import { validateInput, validate } from "./utils";
|
|
11
|
+
|
|
12
|
+
export const VerificationCodeResetPassword = ({
|
|
13
|
+
imageArrayCarousel = [],
|
|
14
|
+
textCarousel,
|
|
15
|
+
backogroundColorCarousel,
|
|
16
|
+
}) => {
|
|
17
|
+
const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
|
|
18
|
+
const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState();
|
|
19
|
+
const inputPositions = [1, 2, 3, 4, 5, 6];
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setInputCodeVerificationAll(
|
|
23
|
+
document.querySelectorAll("[id^='verificationCodeInput']")
|
|
24
|
+
);
|
|
25
|
+
}, []);
|
|
26
|
+
|
|
27
|
+
const loginRight = [
|
|
28
|
+
<LogoImage key="1" />,
|
|
29
|
+
<div className="credenciales" key={"2"}>
|
|
30
|
+
<ScreenHeader
|
|
31
|
+
fontFamily={FontFamily.AvenirNext}
|
|
32
|
+
color={GlobalColors.s5}
|
|
33
|
+
text={"Ingresa tus credenciales"}
|
|
34
|
+
/>
|
|
35
|
+
</div>,
|
|
36
|
+
<div className="user" key="3">
|
|
37
|
+
<ScreenHeader
|
|
38
|
+
text={"Ingresa el código de verificación enviado a:"}
|
|
39
|
+
headerType={"input-name-header"}
|
|
40
|
+
/>
|
|
41
|
+
<div className="verification-code">
|
|
42
|
+
{inputPositions.map((position) => (
|
|
43
|
+
<GeneralInput
|
|
44
|
+
inputId={`verificationCodeInput${position}`}
|
|
45
|
+
inputType={"text"}
|
|
46
|
+
inputPlaceholder={"X"}
|
|
47
|
+
validateInput={validateInput}
|
|
48
|
+
inputsArray={inputCodeVerificationAll}
|
|
49
|
+
position={position}
|
|
50
|
+
maxLength="1"
|
|
51
|
+
/>
|
|
52
|
+
))}
|
|
53
|
+
</div>
|
|
54
|
+
{emptyVerificationCode && (
|
|
55
|
+
<label>Ingrese su código de verificación</label>
|
|
56
|
+
)}
|
|
57
|
+
</div>,
|
|
58
|
+
<div className="resend-code" key="4">
|
|
59
|
+
<p>Reenviar código de verificación</p>
|
|
60
|
+
</div>,
|
|
61
|
+
<div className="button-center" key="5">
|
|
62
|
+
<Button
|
|
63
|
+
buttonType={"general-default-button"}
|
|
64
|
+
label={"Enviar"}
|
|
65
|
+
onClick={(e) =>
|
|
66
|
+
validate(inputCodeVerificationAll, setEmptyVerificationCode)
|
|
67
|
+
}
|
|
68
|
+
/>
|
|
69
|
+
</div>,
|
|
70
|
+
<div className="reset-password" key="6">
|
|
71
|
+
<p>Regresar...</p>
|
|
72
|
+
</div>,
|
|
73
|
+
];
|
|
74
|
+
return (
|
|
75
|
+
<Container>
|
|
76
|
+
<div className="home-retailer">
|
|
77
|
+
<CarouselImagesLogin
|
|
78
|
+
panelImg={imageArrayCarousel}
|
|
79
|
+
panelText={textCarousel}
|
|
80
|
+
panelColor={backogroundColorCarousel}
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
<div className="home-login-retailer">
|
|
84
|
+
<GradientPanel
|
|
85
|
+
componentsArray={loginRight}
|
|
86
|
+
panelType={"home-login"}
|
|
87
|
+
panelColor={GlobalColors.white}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</Container>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily, GlobalColors } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100vh;
|
|
8
|
+
.button-center {
|
|
9
|
+
text-align: center;
|
|
10
|
+
.general-default-button {
|
|
11
|
+
width: 160px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
.reset-password {
|
|
15
|
+
text-align: center;
|
|
16
|
+
margin: 15px !important;
|
|
17
|
+
color: ${GlobalColors.secondary_magenta};
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
font-family: ${FontFamily.Raleway};
|
|
21
|
+
font-size: 13px;
|
|
22
|
+
}
|
|
23
|
+
.resend-code {
|
|
24
|
+
margin-top: 8px !important;
|
|
25
|
+
color: ${GlobalColors.magenta_s2};
|
|
26
|
+
font-family: ${FontFamily.AvenirNext};
|
|
27
|
+
font-size: 11px;
|
|
28
|
+
text-decoration: underline rgb(228, 81, 172);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
& + * {
|
|
31
|
+
margin-top: 30px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.verification-code {
|
|
35
|
+
display: flex;
|
|
36
|
+
text-align: center;
|
|
37
|
+
margin: auto;
|
|
38
|
+
margin-top: 10px;
|
|
39
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
40
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
41
|
+
-webkit-appearance: none;
|
|
42
|
+
margin: 0;
|
|
43
|
+
}
|
|
44
|
+
input {
|
|
45
|
+
|
|
46
|
+
width: 70%;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.home-login-retailer,
|
|
51
|
+
.home-retailer {
|
|
52
|
+
width: 50%;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {event} e event received triggered by verification code input
|
|
4
|
+
* @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
|
|
5
|
+
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
|
|
6
|
+
*/
|
|
7
|
+
export const validateInput = (e, index, inputsArray) => {
|
|
8
|
+
let isValid = false;
|
|
9
|
+
const inputNotEmpty = e.target.value.length > 0;
|
|
10
|
+
if (inputNotEmpty) {
|
|
11
|
+
if (validateInputNumber(e) !== null) {
|
|
12
|
+
isValid = true;
|
|
13
|
+
nextInputFocus(inputsArray, index++);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return isValid ? e.target.value : "";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {event} e event received triggered by verification code input
|
|
22
|
+
* @returns {boolean} if digit is a number
|
|
23
|
+
*/
|
|
24
|
+
const validateInputNumber = (e) => {
|
|
25
|
+
return (e.target.value || String.fromCharCode(e.keyCode)).match(/[0-9]{1}/);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
|
|
31
|
+
* @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
|
|
32
|
+
* changes focus to next input if digit typed is a number and there wasn't any before
|
|
33
|
+
*/
|
|
34
|
+
const nextInputFocus = (inputsArray, index) => {
|
|
35
|
+
const button = document.getElementsByClassName("general-default-button");
|
|
36
|
+
|
|
37
|
+
inputsArray?.length && index === inputsArray?.length
|
|
38
|
+
? button[0].focus()
|
|
39
|
+
: inputsArray[index]?.focus();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {array<html nodes>} inputsArray array which contains every VC digit input (used to check if there's any empty)
|
|
45
|
+
* @param {function} setEmptyVerificationCode function to update flag which handles if there's an empty char
|
|
46
|
+
* updates emptyVerificationFlag from father component
|
|
47
|
+
*/
|
|
48
|
+
export const validate = (inputsArray, setEmptyVerificationCode) => {
|
|
49
|
+
let contInputEmpty = 0;
|
|
50
|
+
inputsArray.forEach((element) => {
|
|
51
|
+
element.value === "" ? 0 : contInputEmpty++;
|
|
52
|
+
});
|
|
53
|
+
contInputEmpty === inputsArray.length
|
|
54
|
+
? setEmptyVerificationCode(false)
|
|
55
|
+
: setEmptyVerificationCode(true);
|
|
56
|
+
};
|