contentoh-components-library 21.0.5 → 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 (84) 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 -66
  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 +9 -7
  20. package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
  21. package/dist/components/pages/ChangePasswordLogin/index.js +131 -0
  22. package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
  23. package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
  24. package/dist/components/pages/EmailResetPassword/index.js +130 -0
  25. package/dist/components/pages/EmailResetPassword/styles.js +20 -0
  26. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  27. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  28. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  29. package/dist/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
  30. package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
  31. package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
  32. package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
  33. package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
  34. package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
  35. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +14 -36
  36. package/dist/components/pages/RetailerProductEdition/index.js +89 -56
  37. package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
  38. package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
  39. package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
  40. package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
  41. package/package.json +2 -2
  42. package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
  43. package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
  44. package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
  45. package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
  46. package/src/components/atoms/CharCounter/index.js +13 -0
  47. package/src/components/atoms/CharCounter/styles.js +10 -0
  48. package/src/components/atoms/GeneralInput/index.js +58 -49
  49. package/src/components/atoms/GradientPanel/styles.js +7 -1
  50. package/src/components/atoms/InputFormatter/index.js +103 -46
  51. package/src/components/atoms/InputFormatter/styles.js +6 -0
  52. package/src/components/atoms/ProgressBar/styles.js +2 -1
  53. package/src/components/atoms/Select/index.js +3 -1
  54. package/src/components/atoms/Select/style.js +1 -1
  55. package/src/components/atoms/StatusTag/styles.js +2 -1
  56. package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
  57. package/src/components/molecules/CarouselImagesLogin/index.js +68 -0
  58. package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
  59. package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
  60. package/src/components/molecules/LoginPasswordStrength/index.js +89 -0
  61. package/src/components/molecules/LoginPasswordStrength/styles.js +87 -0
  62. package/src/components/molecules/TagAndInput/index.js +2 -0
  63. package/src/components/organisms/InputGroup/index.js +12 -3
  64. package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
  65. package/src/components/pages/ChangePasswordLogin/index.js +78 -0
  66. package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
  67. package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
  68. package/src/components/pages/EmailResetPassword/index.js +77 -0
  69. package/src/components/pages/EmailResetPassword/styles.js +27 -0
  70. package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
  71. package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
  72. package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
  73. package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
  74. package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
  75. package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
  76. package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
  77. package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
  78. package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
  79. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +15 -38
  80. package/src/components/pages/RetailerProductEdition/index.js +67 -15
  81. package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
  82. package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
  83. package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
  84. 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
+ `;
@@ -54,26 +54,26 @@ RetailerProductEditionDefault.args = {
54
54
  descriptions: 1,
55
55
  images: 1,
56
56
  },
57
- orderId: 113,
58
- status: "IN_PROGRESS",
59
- datasheet_status: "IN_PROGRESS",
57
+ orderId: 101,
58
+ status: "AF",
59
+ datasheet_status: "AF",
60
60
  prio: "none",
61
61
  version: 2,
62
- description_status: "IN_PROGRESS",
63
- images_status: "IN_PROGRESS",
62
+ description_status: "AF",
63
+ images_status: "AF",
64
64
  article: {
65
- id_article: 324,
66
- id_category: "684",
67
- name: "Crema dental ",
68
- upc: "154161",
69
- timestamp: "2022-04-12T14:46:42.000Z",
65
+ id_article: 292,
66
+ id_category: "697",
67
+ name: "SHAMPOO ANTIFRIZ",
68
+ upc: "7491989462",
69
+ timestamp: "2022-03-09T19:35:51.000Z",
70
70
  id_user: 28,
71
71
  status: "NULL",
72
72
  active: 1,
73
73
  company_id: 1,
74
74
  company_name: "COMPANY DEV",
75
75
  country: "Colombia",
76
- id_order: 113,
76
+ id_order: 101,
77
77
  id_datasheet_especialist: 36,
78
78
  id_datasheet_facilitator: 52,
79
79
  id_description_especialist: 36,
@@ -82,7 +82,8 @@ RetailerProductEditionDefault.args = {
82
82
  id_images_facilitator: 53,
83
83
  id_auditor: 30,
84
84
  id_recepcionist: null,
85
- category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
85
+ category:
86
+ "SALUD Y BELLEZA|CUIDADO DEL CABELLO|SHAMPOOS Y ACONDICIONADORES",
86
87
  missingAttributes: null,
87
88
  missingDescriptions: null,
88
89
  missingImages: null,
@@ -95,13 +96,6 @@ RetailerProductEditionDefault.args = {
95
96
  id_region: 1,
96
97
  active: 1,
97
98
  },
98
- {
99
- id: 5,
100
- name: "Chedraui",
101
- country: "México",
102
- id_region: 1,
103
- active: 1,
104
- },
105
99
  {
106
100
  id: 6,
107
101
  name: "HEB",
@@ -109,26 +103,9 @@ RetailerProductEditionDefault.args = {
109
103
  id_region: 1,
110
104
  active: 1,
111
105
  },
112
- {
113
- id: 12,
114
- name: "La Comer",
115
- country: "México",
116
- id_region: 1,
117
- active: 1,
118
- },
119
106
  ],
120
107
  country: "Colombia",
121
- modal: false,
122
- modalCadenas: false,
123
- totalCadenas: false,
124
- modalAsig1: false,
125
- modalFD: false,
126
- modalAsig2: false,
127
- modalAsig3: false,
128
- modalAsig4: false,
129
- modalAsig5: false,
130
- modalFI: false,
131
- modalQA: false,
108
+ upc: "7491989462",
132
109
  },
133
110
  user: {
134
111
  id_user: 30,
@@ -160,6 +137,6 @@ RetailerProductEditionDefault.args = {
160
137
  products_limit: "3",
161
138
  type: "PyMES",
162
139
  },
163
- 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",
164
141
  },
165
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,7 +157,8 @@ 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],
@@ -299,7 +306,6 @@ export const RetailerProductEdition = ({
299
306
  }, [percentages]);
300
307
 
301
308
  useEffect(() => {
302
- const required = {};
303
309
  if (services.length > 0) {
304
310
  if (services[0][activeRetailer.id])
305
311
  services[0][activeRetailer.id].data = Object.values(
@@ -311,7 +317,6 @@ export const RetailerProductEdition = ({
311
317
  const descriptions = services[1]?.filter(
312
318
  (service) => service?.id === activeRetailer?.id
313
319
  );
314
- setRequiredNull(required);
315
320
  setDatasheets([datagroups, inputs]);
316
321
  setDescriptions(descriptions);
317
322
  }
@@ -321,6 +326,7 @@ export const RetailerProductEdition = ({
321
326
  const imageInputs = images?.inputs?.map((e) => ({
322
327
  value: e?.id,
323
328
  name: e?.name,
329
+ required: e?.required,
324
330
  }));
325
331
  const imageType = images?.imageType?.map((e) => ({
326
332
  value: e?.id,
@@ -525,11 +531,11 @@ export const RetailerProductEdition = ({
525
531
  concept = action ? action : concept;
526
532
  return (
527
533
  (productSelected[`${concept}_status`] === "QF" &&
528
- (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)) ||
529
535
  (productSelected[`${concept}_status`] === "AF" &&
530
- (user?.id_role === 1 || user?.id_role === 6)) ||
536
+ (user.id_role === 1 || user.id_role === 6)) ||
531
537
  (productSelected[`${concept}_status`] === "RP" &&
532
- (user?.id_role === 1 || user?.id_role === 6))
538
+ (user.id_role === 1 || user.id_role === 6))
533
539
  );
534
540
  };
535
541
 
@@ -629,7 +635,7 @@ export const RetailerProductEdition = ({
629
635
  break;
630
636
  }
631
637
  let evalStatus = "";
632
- let productTemp = { ...productSelected };
638
+ let productTemp = productSelected;
633
639
  evalStatus = productSelected[`${concept}_status`];
634
640
  const specialistDone =
635
641
  evalStatus === "RF" ||
@@ -640,18 +646,22 @@ export const RetailerProductEdition = ({
640
646
  setMessage(`${activeTab} enviada a facilitador`);
641
647
  getSectionIcon();
642
648
  productTemp[`${concept}_status`] = "QF";
649
+ evalStatus = "QF";
643
650
  } else if (evalStatus === "QF") {
644
651
  setMessage("Evaluación enviada");
645
652
  getSectionIcon();
646
653
  productTemp[`${concept}_status`] = "AF";
654
+ evalStatus = "AF";
647
655
  } else if (evalStatus === "AF") {
648
656
  setMessage("Evaluación enviada");
649
657
  getSectionIcon();
650
658
  productTemp[`${concept}_status`] = "AA";
659
+ evalStatus = "AA";
651
660
  } else if (evalStatus === "RP") {
652
661
  setMessage("Evaluación enviada");
653
662
  getSectionIcon();
654
663
  productTemp[`${concept}_status`] = "AA";
664
+ evalStatus = "AA";
655
665
  }
656
666
  let data = {};
657
667
  if (result) {
@@ -700,7 +710,7 @@ export const RetailerProductEdition = ({
700
710
  },
701
711
  });
702
712
  setProduct(productTemp);
703
- setModalSent(true);
713
+ //setModalSent(true);
704
714
  }
705
715
  };
706
716
 
@@ -762,7 +772,49 @@ export const RetailerProductEdition = ({
762
772
  await getComments(tab);
763
773
  };
764
774
 
765
- 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(() => {
766
818
  setComment(comments[activeTab]);
767
819
  }, [activeTab]);
768
820
 
@@ -977,7 +1029,7 @@ export const RetailerProductEdition = ({
977
1029
  approveRejectButtons={approveRejectButtons}
978
1030
  sendToFacilitator={sendToFacilitator}
979
1031
  auditorAssigned={auditorAssigned}
980
- userAssigned={userAssigned(activeTab, "facilitator")}
1032
+ userAssigned={() => userAssigned(activeTab, "facilitator")}
981
1033
  />
982
1034
  <FullTabsMenu
983
1035
  tabsSections={tabsSections}
@@ -1131,8 +1183,8 @@ export const RetailerProductEdition = ({
1131
1183
  )}
1132
1184
  <Button
1133
1185
  buttonType={
1134
- !requiredNull[activeTab] === 0 ||
1135
1186
  !approveRejectButtons() ||
1187
+ requiredNull[activeTab] !== 0 ||
1136
1188
  !evaluationComplete(activeTab)
1137
1189
  ? "general-button-disabled"
1138
1190
  : "general-green-button"
@@ -1159,9 +1211,9 @@ export const RetailerProductEdition = ({
1159
1211
  componentsArray.length > 0
1160
1212
  ? componentsArray
1161
1213
  : [
1162
- <img src={succes} alt="success icon" />,
1214
+ <img key="1" src={succes} alt="success icon" />,
1163
1215
  <ScreenHeader
1164
- key="1"
1216
+ key="2"
1165
1217
  headerType={"retailer-name-header"}
1166
1218
  text={message}
1167
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
+ };