Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4113 | Rev 4405 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4113 Rev 4115
Línea -... Línea 1...
-
 
1
/* eslint-disable react/prop-types */
-
 
2
/* eslint-disable no-mixed-spaces-and-tabs */
1
import React, { useEffect, useState } from "react";
3
import React, { useEffect, useState } from "react";
2
import PhoneInput from "react-phone-input-2";
4
import PhoneInput from "react-phone-input-2";
3
import "react-phone-input-2/lib/style.css";
5
import "react-phone-input-2/lib/style.css";
4
import { useForm } from "react-hook-form";
6
import { useForm } from "react-hook-form";
5
import { axios } from '../../../utils';
7
import { axios } from '../../../utils';
Línea 20... Línea 22...
20
  justify-content: center;
22
  justify-content: center;
21
  align-items: center;
23
  align-items: center;
22
  z-index: 300;
24
  z-index: 300;
23
`;
25
`;
Línea 24... Línea 26...
24
 
26
 
25
const BasicSettings = (props) => {
-
 
26
  // redux destructuring
27
const BasicSettings = ({
27
  const { addNotification } = props;
-
 
28
  
28
  addNotification = function () { }, // Redux action
-
 
29
  timezones = {}
Línea 29... Línea -...
29
  const {  timezones } = props;
-
 
30
 
30
}) => {
Línea 31... Línea 31...
31
  // states
31
 
32
  const [loading, setLoading] = useState(false);
-
 
33
 
32
  const [loading, setLoading] = useState(false);
34
  const { register, handleSubmit, setValue, watch, setError, errors } = useForm(
33
 
35
    {
34
  const { register, handleSubmit, setValue, watch, setError, errors } = useForm({
36
      defaultValues: {
-
 
37
        phone: "",
35
    defaultValues: {
38
        timezone: "",
36
      phone: "",
Línea 39... Línea 37...
39
      },
37
      timezone: "",
40
    }
38
    },
41
  );
39
  })
42
 
40
 
Línea 135... Línea 133...
135
                name="email"
133
                name="email"
136
                id="email"
134
                id="email"
137
                ref={register({
135
                ref={register({
138
                  required: "Por favor ingrese su apellido",
136
                  required: "Por favor ingrese su apellido",
139
                  pattern: {
137
                  pattern: {
140
                    value: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,
138
                    value: /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/i,
141
                    message: "Por favor ingrese un correo válido",
139
                    message: "Por favor ingrese un correo válido",
142
                  },
140
                  },
143
                })}
141
                })}
144
              />
142
              />
145
              {<FormErrorFeedback>{errors?.email?.message}</FormErrorFeedback>}
143
              {<FormErrorFeedback>{errors?.email?.message}</FormErrorFeedback>}
Línea 172... Línea 170...
172
                <option value="m">Masculino</option>
170
                <option value="m">Masculino</option>
173
                <option value="f">Femenino</option>
171
                <option value="f">Femenino</option>
174
              </select>
172
              </select>
175
              {<FormErrorFeedback>{errors?.gender?.message}</FormErrorFeedback>}
173
              {<FormErrorFeedback>{errors?.gender?.message}</FormErrorFeedback>}
176
            </div>
174
            </div>
177
           </div>  
175
          </div>
178
           <div className="d-flex flex-wrap" style={{ gap: '1rem' }}>
176
          <div className="d-flex flex-wrap" style={{ gap: '1rem' }}>
179
            <div className="cp-field">
177
            <div className="cp-field">
180
            	<label htmlFor="timezone">Zona horaria</label>
178
              <label htmlFor="timezone">Zona horaria</label>
181
	            <select
179
              <select
182
	                name="timezone"
180
                name="timezone"
183
	                id="timezone"
181
                id="timezone"
184
	                defaultValue=""
182
                defaultValue=""
185
	                ref={register({
183
                ref={register({
186
	                  required: "Por favor elige una Zona horaria",
184
                  required: "Por favor elige una Zona horaria",
187
	                })}
185
                })}
188
	              >
186
              >
189
	                <option value="" hidden>
187
                <option value="" hidden>
190
	                  Zona horaria
188
                  Zona horaria
191
	                </option>
189
                </option>
192
	                {Object.entries(self.timezones).map(([key, value]) => (
190
                {Object.entries(timezones).map(([key, value]) => (
193
	                  <option value={key} key={key}>
191
                  <option value={key} key={key}>
194
	                    {value}
192
                    {value}
195
	                  </option>
193
                  </option>
196
	                ))}
194
                ))}
197
	              </select>
195
              </select>
198
              	  {<FormErrorFeedback>{errors?.timezone?.message}</FormErrorFeedback>}
196
              {<FormErrorFeedback>{errors?.timezone?.message}</FormErrorFeedback>}
199
            </div>
197
            </div>
200
            <div className="col-6 mx-auto d-flex align-items-center justify-content-center">
198
            <div className="col-6 mx-auto d-flex align-items-center justify-content-center">
201
              <button type="submit" className="btn btn-secondary mt-4">
199
              <button type="submit" className="btn btn-secondary mt-4">
202
                Guardar
200
                Guardar
203
              </button>
201
              </button>