Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16267 | Rev 16272 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
16255 stevensc 1
import React, { useState, useEffect } from "react";
16253 stevensc 2
import { axios } from "../../../../utils";
3
import { useDispatch } from "react-redux";
16254 stevensc 4
import { useForm } from "react-hook-form";
16256 stevensc 5
import { Modal } from "@mui/material";
6
import Datetime from "react-datetime";
16253 stevensc 7
 
16256 stevensc 8
import FormErrorFeedback from "../../../../shared/form-error-feedback/FormErrorFeedback";
9
 
16253 stevensc 10
const ConferenceModal = ({
16266 stevensc 11
  isShow = false,
16253 stevensc 12
  timezones = {},
13
  zoomUrl = "",
16266 stevensc 14
  onClose = () => null,
16253 stevensc 15
  onCreate = () => null,
16
}) => {
16267 stevensc 17
  const { handleSubmit, register, errors } = useForm();
16253 stevensc 18
 
19
  return (
16266 stevensc 20
    <Modal show={isShow} onHide={onClose}>
16253 stevensc 21
      <Modal.Header closeButton>
22
        <Modal.Title>Crear Conferencia</Modal.Title>
23
      </Modal.Header>
16264 stevensc 24
      <Modal.Body>
16269 stevensc 25
        <form onSubmit={handleSubmit} autoComplete="new-password">
16264 stevensc 26
          <div className="form-group">
27
            <label htmlFor="first_name">Título</label>
28
            <input
29
              type="text"
30
              name="title"
31
              className="form-control"
32
              maxLength={128}
33
              ref={register({ required: "Por favor ingrese un título" })}
34
            />
35
            {errors.title && (
36
              <FormErrorFeedback>{errors.title.message}</FormErrorFeedback>
37
            )}
38
          </div>
39
          <div className="form-group">
40
            <label htmlFor="first_name">Descripción</label>
41
            <input
42
              type="text"
43
              name="description"
44
              className="form-control"
45
              ref={register({ required: "Por favor ingrese una descripción" })}
46
            />
47
            {errors.description && (
48
              <FormErrorFeedback>
49
                {errors.description.message}
50
              </FormErrorFeedback>
51
            )}
52
          </div>
53
          <div className="form-group">
54
            <label htmlFor="timezone">Tipo de conferencia</label>
16266 stevensc 55
            <select name="type" className="form-control" ref={register}>
16264 stevensc 56
              <option value="i">Inmediata</option>
57
              <option value="s">Programada</option>
58
            </select>
59
          </div>
60
          <div className="form-group">
61
            <label htmlFor="timezone">Zona horaria</label>
62
            <select
63
              className="form-control"
64
              name="timezone"
65
              ref={register({ required: "Por favor elige una Zona horaria" })}
66
            >
67
              <option value="" hidden>
68
                Zona horaria
69
              </option>
70
              {Object.entries(timezones).map(([key, value]) => (
71
                <option value={key} key={key}>
72
                  {value}
73
                </option>
74
              ))}
75
            </select>
76
            {errors.timezone && (
77
              <FormErrorFeedback>{errors.timezone.message}</FormErrorFeedback>
78
            )}
79
          </div>
80
          <div className="form-group">
81
            <label htmlFor="timezone">Duración</label>
82
            <select className="form-control" name="duration" ref={register}>
83
              <option value={5}>5-min</option>
84
              <option value={10}>10-min</option>
85
              <option value={15}>15-min</option>
86
              <option value={20}>20-min</option>
87
              <option value={25}>25-min</option>
88
              <option value={30}>30-min</option>
89
              <option value={35}>35-min</option>
90
              <option value={40}>40-min</option>
91
              <option value={45}>45-min</option>
92
            </select>
93
          </div>
94
          <div className="form-group">
95
            <label htmlFor="first_name">Contraseña de ingreso</label>
96
            <input
97
              type="password"
98
              name="password"
99
              className="form-control"
100
              ref={register({
101
                required: "Por favor ingrese una contraseña",
102
                maxLength: {
103
                  value: 6,
104
                  message: "La contraseña debe tener al menos 6 digitos",
105
                },
106
              })}
107
            />
108
            {errors.password && (
109
              <FormErrorFeedback>{errors.password.message}</FormErrorFeedback>
110
            )}
111
          </div>
112
          <button className="btn btn-primary" type="submit">
113
            Crear
114
          </button>
115
        </form>
116
      </Modal.Body>
16253 stevensc 117
    </Modal>
118
  );
119
};
120
 
121
export default ConferenceModal;