contentoh-components-library 21.0.3 → 21.0.6

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.
Files changed (86) hide show
  1. package/dist/components/atoms/CharCounter/CharCounter.stories.js +31 -0
  2. package/dist/components/atoms/CharCounter/index.js +22 -0
  3. package/dist/components/atoms/CharCounter/styles.js +20 -0
  4. package/dist/components/atoms/GeneralInput/index.js +69 -48
  5. package/dist/components/atoms/GradientPanel/styles.js +2 -2
  6. package/dist/components/atoms/InputFormatter/index.js +128 -67
  7. package/dist/components/atoms/InputFormatter/styles.js +2 -2
  8. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  9. package/dist/components/atoms/Select/index.js +4 -2
  10. package/dist/components/atoms/Select/style.js +1 -1
  11. package/dist/components/atoms/StatusTag/styles.js +1 -1
  12. package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
  13. package/dist/components/molecules/CarouselImagesLogin/index.js +94 -0
  14. package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
  15. package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
  16. package/dist/components/molecules/LoginPasswordStrength/index.js +131 -0
  17. package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
  18. package/dist/components/molecules/TagAndInput/index.js +4 -2
  19. package/dist/components/organisms/InputGroup/index.js +10 -8
  20. package/dist/components/organisms/ProductImageModal/index.js +0 -1
  21. package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
  22. package/dist/components/pages/ChangePasswordLogin/index.js +131 -0
  23. package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
  24. package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
  25. package/dist/components/pages/EmailResetPassword/index.js +130 -0
  26. package/dist/components/pages/EmailResetPassword/styles.js +20 -0
  27. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  28. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  29. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  30. package/dist/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
  31. package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
  32. package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
  33. package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
  34. package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
  35. package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
  36. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -16
  37. package/dist/components/pages/RetailerProductEdition/index.js +102 -66
  38. package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
  39. package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
  40. package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
  41. package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
  42. package/package.json +2 -2
  43. package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
  44. package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
  45. package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
  46. package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
  47. package/src/components/atoms/CharCounter/index.js +13 -0
  48. package/src/components/atoms/CharCounter/styles.js +10 -0
  49. package/src/components/atoms/GeneralInput/index.js +58 -49
  50. package/src/components/atoms/GradientPanel/styles.js +7 -1
  51. package/src/components/atoms/InputFormatter/index.js +104 -47
  52. package/src/components/atoms/InputFormatter/styles.js +6 -0
  53. package/src/components/atoms/ProgressBar/styles.js +2 -1
  54. package/src/components/atoms/Select/index.js +3 -1
  55. package/src/components/atoms/Select/style.js +1 -1
  56. package/src/components/atoms/StatusTag/styles.js +2 -1
  57. package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
  58. package/src/components/molecules/CarouselImagesLogin/index.js +68 -0
  59. package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
  60. package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
  61. package/src/components/molecules/LoginPasswordStrength/index.js +89 -0
  62. package/src/components/molecules/LoginPasswordStrength/styles.js +87 -0
  63. package/src/components/molecules/TagAndInput/index.js +2 -0
  64. package/src/components/organisms/InputGroup/index.js +18 -7
  65. package/src/components/organisms/ProductImageModal/index.js +0 -2
  66. package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
  67. package/src/components/pages/ChangePasswordLogin/index.js +78 -0
  68. package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
  69. package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
  70. package/src/components/pages/EmailResetPassword/index.js +77 -0
  71. package/src/components/pages/EmailResetPassword/styles.js +27 -0
  72. package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
  73. package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
  74. package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
  75. package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
  76. package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
  77. package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
  78. package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
  79. package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
  80. package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
  81. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -16
  82. package/src/components/pages/RetailerProductEdition/index.js +73 -18
  83. package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
  84. package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
  85. package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
  86. package/src/components/pages/VerificationCodeResetPassword/utils.js +56 -0
@@ -0,0 +1,17 @@
1
+ import { RegistrationLoginThirdStep } 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/RegistrationLoginThirdStep",
8
+ component: RegistrationLoginThirdStep,
9
+ };
10
+ const Template = (args) => <RegistrationLoginThirdStep {...args} />;
11
+
12
+ export const RegistrationLoginThirdStepDefault = Template.bind({});
13
+
14
+ RegistrationLoginThirdStepDefault.args = {
15
+ imageArrayCarousel: [LoginImage, Login2, Login3],
16
+ textCarousel: "Elige la plataforma que conecta proovedores y retailers",
17
+ };
@@ -0,0 +1,106 @@
1
+ import { Container } from "./styles";
2
+ import { GradientPanel } from "../../atoms/GradientPanel";
3
+ import { CarouselImagesLogin } from "../../molecules/CarouselImagesLogin";
4
+ import { 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 { TagAndInput } from "../../molecules/TagAndInput";
9
+ import { Button } from "../../atoms/GeneralButton";
10
+
11
+ export const RegistrationLoginThirdStep = ({
12
+ imageArrayCarousel = [],
13
+ textCarousel,
14
+ backogroundColorCarousel,
15
+ }) => {
16
+ const [emptyCommercialName, setEmptyCommercialName] = useState(false);
17
+ const [emptyBussinesName, setEmptyBussinesName] = useState(false);
18
+ const [emptyRFC, setEmptyRFC] = useState(false);
19
+ const [emptyFiscalAddress, setEmptyFiscalAddress] = useState(false);
20
+ const validate = async (e) => {
21
+ e.preventDefault();
22
+ const commercialName = document.querySelector("#commercialNameInput").value;
23
+ const bussinesName = document.querySelector("#bussinesNameInput").value;
24
+ const RFC = document.querySelector("#rfcInput").value;
25
+ const FiscalAddress = document.querySelector("#fiscalAddressInput").value;
26
+ commercialName === "" ? setEmptyCommercialName(true) : setEmptyCommercialName(false);
27
+ bussinesName === "" ? setEmptyBussinesName(true) : setEmptyBussinesName(false);
28
+ RFC === "" ? setEmptyRFC(true) : setEmptyRFC(false);
29
+ FiscalAddress === "" ? setEmptyFiscalAddress(true) : setEmptyFiscalAddress(false);
30
+ };
31
+ const loginRight = [
32
+ <LogoImage key="1" />,
33
+ <div className="credenciales" key={"2"}>
34
+ <ScreenHeader
35
+ fontFamily={FontFamily.AvenirNext}
36
+ color={GlobalColors.s5}
37
+ text={"Ingresa tus credenciales"}
38
+ />
39
+ </div>,
40
+ <div className="user" key="3">
41
+ <TagAndInput
42
+ inputType={"text"}
43
+ inputId={"commercialNameInput"}
44
+ label={"Nombre comercial"}
45
+ inputPlaceHolder={"Nombre comercial"}
46
+ />
47
+ {emptyCommercialName && <label>Ingrese el nombre comercial de la empresa</label>}
48
+ <TagAndInput
49
+ inputType={"text"}
50
+ inputId={"bussinesNameInput"}
51
+ label={"Razón social"}
52
+ inputPlaceHolder={"Razón social"}
53
+ />
54
+ {emptyBussinesName && <label>Ingrese la razón social de la empresa</label>}
55
+ <TagAndInput
56
+ inputType={"text"}
57
+ inputId={"rfcInput"}
58
+ label={"RFC"}
59
+ inputPlaceHolder={"RFC"}
60
+ />
61
+ {emptyRFC && <label>El RFC es requerido</label>}
62
+ <TagAndInput
63
+ inputType={"text"}
64
+ inputId={"fiscalAddressInput"}
65
+ label={"Direccion fiscal"}
66
+ inputPlaceHolder={"Dirección fiscal"}
67
+ />
68
+ {emptyFiscalAddress && <label>Ingrese la direccion fiscal de la empresa</label>}
69
+ </div>,
70
+ <div className="button-end" key="4">
71
+ <Button
72
+ buttonType={"general-default-button"}
73
+ label={"Enviar"}
74
+ onClick={(e) => validate(e)}
75
+ />
76
+ </div>,
77
+ <div className="progress-bar" key="5">
78
+ <div className="progress-bar-step-check"></div>
79
+ <div className="progress-bar-registration"></div>
80
+ </div>,
81
+ <ScreenHeader text={"Paso 3"} headerType={"date-header"} color={GlobalColors.s4} key="6"/>,
82
+ <div className="new-login" key="7">
83
+ <p className="pre-registro">
84
+ ¿Ya tienes una cuenta?<span> Inicia Sesión</span>
85
+ </p>
86
+ </div>,
87
+ ];
88
+ return (
89
+ <Container>
90
+ <div className="home-retailer">
91
+ <CarouselImagesLogin
92
+ panelImg={imageArrayCarousel}
93
+ panelText={textCarousel}
94
+ panelColor={backogroundColorCarousel}
95
+ />
96
+ </div>
97
+ <div className="home-login-retailer">
98
+ <GradientPanel
99
+ componentsArray={loginRight}
100
+ panelType={"home-login"}
101
+ panelColor={GlobalColors.white}
102
+ />
103
+ </div>
104
+ </Container>
105
+ );
106
+ };
@@ -0,0 +1,48 @@
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
+ .user {
9
+ .input-name-header {
10
+ margin-top: 10px;
11
+ }
12
+ }
13
+ .button-end {
14
+ text-align: end;
15
+ .general-default-button {
16
+ width: 160px;
17
+ }
18
+ & + * {
19
+ margin-top: 10px;
20
+ }
21
+ }
22
+ .home-login-retailer,
23
+ .home-retailer {
24
+ width: 50%;
25
+ }
26
+ .progress-bar {
27
+ width: 100%;
28
+ height: 8px;
29
+ display: flex;
30
+ justify-content: space-between;
31
+ .progress-bar-step-check {
32
+ width: 66.66%;
33
+ background-color: ${GlobalColors.exported};
34
+ }
35
+ .progress-bar-registration {
36
+ background-color: rgb(196, 196, 196);
37
+ width: 33.33%;
38
+ }
39
+ }
40
+ .date-header {
41
+ margin-left: 66.66%;
42
+ .new-login {
43
+ & + * {
44
+ margin-top: 20px;
45
+ }
46
+ }
47
+ }
48
+ `;
@@ -55,12 +55,12 @@ RetailerProductEditionDefault.args = {
55
55
  images: 1,
56
56
  },
57
57
  orderId: 101,
58
- status: "RP",
59
- datasheet_status: "AP",
58
+ status: "AF",
59
+ datasheet_status: "AF",
60
60
  prio: "none",
61
61
  version: 2,
62
- description_status: "RP",
63
- images_status: "AP",
62
+ description_status: "AF",
63
+ images_status: "AF",
64
64
  article: {
65
65
  id_article: 292,
66
66
  id_category: "697",
@@ -105,17 +105,7 @@ RetailerProductEditionDefault.args = {
105
105
  },
106
106
  ],
107
107
  country: "Colombia",
108
- modal: false,
109
- modalCadenas: false,
110
- totalCadenas: false,
111
- modalAsig1: false,
112
- modalFD: false,
113
- modalAsig2: false,
114
- modalAsig3: false,
115
- modalAsig4: false,
116
- modalAsig5: false,
117
- modalFI: false,
118
- modalQA: false,
108
+ upc: "7491989462",
119
109
  },
120
110
  user: {
121
111
  id_user: 30,
@@ -147,6 +137,6 @@ RetailerProductEditionDefault.args = {
147
137
  products_limit: "3",
148
138
  type: "PyMES",
149
139
  },
150
- src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1649434410216",
140
+ src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1649896700986",
151
141
  },
152
142
  };
@@ -120,7 +120,9 @@ 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("");
@@ -129,7 +131,11 @@ export const RetailerProductEdition = ({
129
131
  const [version, setVersion] = useState(productSelected?.version);
130
132
  const [comments, setComments] = useState({});
131
133
  const [comment, setComment] = useState("");
132
- const [requiredNull, setRequiredNull] = useState(0);
134
+ const [requiredNull, setRequiredNull] = useState({
135
+ "Ficha técnica": 0,
136
+ Descripción: 0,
137
+ Imágenes: 0,
138
+ });
133
139
  const [crossComment, setCrossComment] = useState(false);
134
140
  const [userGroups, setUserGroups] = useState([]);
135
141
  const [assig, setAssig] = useState({});
@@ -151,13 +157,17 @@ export const RetailerProductEdition = ({
151
157
 
152
158
  //Converts the data inside the datasheets object to array
153
159
  setServices(services);
154
- setActiveRetailer(productSelected?.retailers[0]);
160
+ getRequired(services);
161
+ //setActiveRetailer(productSelected?.retailers[0]);
155
162
  setImages({
156
163
  action: "init",
157
164
  init: services[2],
158
165
  });
159
166
  if (services[2]?.values?.length > 0) setActiveImage(0);
160
167
  setProduct(productSelected);
168
+ getPercentage({ data: [productSelected] }).then((res) =>
169
+ setPercentages(res)
170
+ );
161
171
  setLoading(false);
162
172
  };
163
173
 
@@ -221,9 +231,9 @@ export const RetailerProductEdition = ({
221
231
 
222
232
  useEffect(async () => {
223
233
  loadData();
224
- getPercentage({ data: [productSelected] }).then((res) =>
225
- setPercentages(res)
226
- );
234
+ // getPercentage({ data: [productSelected] }).then((res) =>
235
+ // setPercentages(res)
236
+ // );
227
237
  getServices();
228
238
  getComments();
229
239
  setUserGroups(await fetchUsers(token));
@@ -296,7 +306,6 @@ export const RetailerProductEdition = ({
296
306
  }, [percentages]);
297
307
 
298
308
  useEffect(() => {
299
- const required = {};
300
309
  if (services.length > 0) {
301
310
  if (services[0][activeRetailer.id])
302
311
  services[0][activeRetailer.id].data = Object.values(
@@ -308,7 +317,6 @@ export const RetailerProductEdition = ({
308
317
  const descriptions = services[1]?.filter(
309
318
  (service) => service?.id === activeRetailer?.id
310
319
  );
311
- setRequiredNull(required);
312
320
  setDatasheets([datagroups, inputs]);
313
321
  setDescriptions(descriptions);
314
322
  }
@@ -318,6 +326,7 @@ export const RetailerProductEdition = ({
318
326
  const imageInputs = images?.inputs?.map((e) => ({
319
327
  value: e?.id,
320
328
  name: e?.name,
329
+ required: e?.required,
321
330
  }));
322
331
  const imageType = images?.imageType?.map((e) => ({
323
332
  value: e?.id,
@@ -522,11 +531,11 @@ export const RetailerProductEdition = ({
522
531
  concept = action ? action : concept;
523
532
  return (
524
533
  (productSelected[`${concept}_status`] === "QF" &&
525
- (user?.id_role === 1 || user?.id_role === 4 || user?.id_role === 5)) ||
534
+ (user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
526
535
  (productSelected[`${concept}_status`] === "AF" &&
527
- (user?.id_role === 1 || user?.id_role === 6)) ||
536
+ (user.id_role === 1 || user.id_role === 6)) ||
528
537
  (productSelected[`${concept}_status`] === "RP" &&
529
- (user?.id_role === 1 || user?.id_role === 6))
538
+ (user.id_role === 1 || user.id_role === 6))
530
539
  );
531
540
  };
532
541
 
@@ -626,7 +635,7 @@ export const RetailerProductEdition = ({
626
635
  break;
627
636
  }
628
637
  let evalStatus = "";
629
- let productTemp = { ...productSelected };
638
+ let productTemp = productSelected;
630
639
  evalStatus = productSelected[`${concept}_status`];
631
640
  const specialistDone =
632
641
  evalStatus === "RF" ||
@@ -637,18 +646,22 @@ export const RetailerProductEdition = ({
637
646
  setMessage(`${activeTab} enviada a facilitador`);
638
647
  getSectionIcon();
639
648
  productTemp[`${concept}_status`] = "QF";
649
+ evalStatus = "QF";
640
650
  } else if (evalStatus === "QF") {
641
651
  setMessage("Evaluación enviada");
642
652
  getSectionIcon();
643
653
  productTemp[`${concept}_status`] = "AF";
654
+ evalStatus = "AF";
644
655
  } else if (evalStatus === "AF") {
645
656
  setMessage("Evaluación enviada");
646
657
  getSectionIcon();
647
658
  productTemp[`${concept}_status`] = "AA";
659
+ evalStatus = "AA";
648
660
  } else if (evalStatus === "RP") {
649
661
  setMessage("Evaluación enviada");
650
662
  getSectionIcon();
651
663
  productTemp[`${concept}_status`] = "AA";
664
+ evalStatus = "AA";
652
665
  }
653
666
  let data = {};
654
667
  if (result) {
@@ -697,7 +710,7 @@ export const RetailerProductEdition = ({
697
710
  },
698
711
  });
699
712
  setProduct(productTemp);
700
- setModalSent(true);
713
+ //setModalSent(true);
701
714
  }
702
715
  };
703
716
 
@@ -759,7 +772,49 @@ export const RetailerProductEdition = ({
759
772
  await getComments(tab);
760
773
  };
761
774
 
762
- useEffect(async () => {
775
+ const getRequired = (services) => {
776
+ const objetcTemp = requiredNull;
777
+ const datasheetServicesArray = Object.values(services[0]);
778
+ const dsInputs = datasheetServicesArray.pop();
779
+ const descriptionsServicesArray = services[1];
780
+
781
+ let dsInputsRequired = [];
782
+ let desInputsRequired = 0;
783
+ datasheetServicesArray.forEach((datasheet) =>
784
+ Object.values(datasheet?.data).forEach((dataGroup) =>
785
+ dsInputsRequired.push(
786
+ ...dataGroup.inputs.filter(
787
+ (input) => dsInputs[input].required && !dsInputs[input].value
788
+ )
789
+ )
790
+ )
791
+ );
792
+ objetcTemp["Ficha técnica"] = dsInputsRequired.length;
793
+
794
+ descriptionsServicesArray.forEach((description) =>
795
+ description.inputs.forEach(
796
+ (input) =>
797
+ input.required &&
798
+ (!input.value ||
799
+ input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") ===
800
+ "") &&
801
+ desInputsRequired++
802
+ )
803
+ );
804
+
805
+ objetcTemp["Descripción"] = desInputsRequired;
806
+ const requiredImages = services[2]?.inputs?.filter((e) => e.required);
807
+ let requiredCounter = 0;
808
+ requiredImages.forEach(
809
+ (req) =>
810
+ services[2].values.filter((img) => img.image_id === req.id).length ===
811
+ 0 && requiredCounter++
812
+ );
813
+ objetcTemp["Imágenes"] = requiredCounter;
814
+ setRequiredNull(objetcTemp);
815
+ };
816
+
817
+ useEffect(() => {
763
818
  setComment(comments[activeTab]);
764
819
  }, [activeTab]);
765
820
 
@@ -974,7 +1029,7 @@ export const RetailerProductEdition = ({
974
1029
  approveRejectButtons={approveRejectButtons}
975
1030
  sendToFacilitator={sendToFacilitator}
976
1031
  auditorAssigned={auditorAssigned}
977
- userAssigned={userAssigned(activeTab, "facilitator")}
1032
+ userAssigned={() => userAssigned(activeTab, "facilitator")}
978
1033
  />
979
1034
  <FullTabsMenu
980
1035
  tabsSections={tabsSections}
@@ -1128,8 +1183,8 @@ export const RetailerProductEdition = ({
1128
1183
  )}
1129
1184
  <Button
1130
1185
  buttonType={
1131
- !requiredNull[activeTab] === 0 ||
1132
1186
  !approveRejectButtons() ||
1187
+ requiredNull[activeTab] !== 0 ||
1133
1188
  !evaluationComplete(activeTab)
1134
1189
  ? "general-button-disabled"
1135
1190
  : "general-green-button"
@@ -1156,9 +1211,9 @@ export const RetailerProductEdition = ({
1156
1211
  componentsArray.length > 0
1157
1212
  ? componentsArray
1158
1213
  : [
1159
- <img src={succes} alt="success icon" />,
1214
+ <img key="1" src={succes} alt="success icon" />,
1160
1215
  <ScreenHeader
1161
- key="1"
1216
+ key="2"
1162
1217
  headerType={"retailer-name-header"}
1163
1218
  text={message}
1164
1219
  color={"white"}
@@ -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
+ };