Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6952 Rev 6954
Línea 9... Línea 9...
9
import useFetchHelper from '../../hooks/useFetchHelper'
9
import useFetchHelper from '../../hooks/useFetchHelper'
Línea 10... Línea 10...
10
 
10
 
11
const ConferenceModal = ({
11
const ConferenceModal = ({
12
  show = false,
12
  show = false,
13
  zoomUrl = '',
13
  zoomUrl = '',
14
  onCreate = () => null,
14
  onClose = () => null,
15
}) => {
15
}) => {
16
  const dt = new Date()
16
  const dt = new Date()
17
  const [date, setDate] = useState({
17
  const [date, setDate] = useState({
18
    year: dt.toLocaleString('default', { year: 'numeric' }),
18
    year: dt.toLocaleString('default', { year: 'numeric' }),
Línea 76... Línea 76...
76
        })
76
        })
77
        return
77
        return
78
      }
78
      }
Línea 79... Línea 79...
79
 
79
 
80
      dispatch(addNotification({ msg: response.data, style: 'success' }))
80
      dispatch(addNotification({ msg: response.data, style: 'success' }))
81
      onCreate()
81
      onClose()
82
      reset()
82
      reset()
83
    } catch (error) {
83
    } catch (error) {
84
      console.log(`Error: ${error}`)
84
      console.log(`Error: ${error}`)
85
      dispatch(
85
      dispatch(
Línea 88... Línea 88...
88
      throw new Error(error)
88
      throw new Error(error)
89
    }
89
    }
90
  })
90
  })
Línea 91... Línea 91...
91
 
91
 
92
  return (
92
  return (
93
    <Modal show={show}>
93
    <Modal show={show} onHide={onClose}>
94
      <Modal.Header>
94
      <Modal.Header closeButton>
95
        <Modal.Title>{labels.create_conference}</Modal.Title>
95
        <Modal.Title>{labels.create_conference}</Modal.Title>
-
 
96
      </Modal.Header>
96
      </Modal.Header>
97
      <Modal.Body>
97
      <form onSubmit={onSubmit} autoComplete="new-password">
98
        <form onSubmit={onSubmit} autoComplete="new-password">
98
        <div className="form-group">
99
          <div className="form-group">
99
          <label htmlFor="first_name">Título</label>
100
            <label htmlFor="first_name">Título</label>
100
          <input
101
            <input
101
            type="text"
102
              type="text"
102
            name="title"
103
              name="title"
103
            className="form-control"
104
              className="form-control"
104
            maxLength={128}
105
              maxLength={128}
105
            ref={register({ required: 'Por favor ingrese un título' })}
-
 
106
          />
-
 
107
          {errors.title && (
-
 
108
            <FormErrorFeedback>{errors.title.message}</FormErrorFeedback>
-
 
109
          )}
-
 
110
        </div>
-
 
111
        <div className="form-group">
-
 
112
          <label htmlFor="first_name">Descripción</label>
-
 
113
          <input
-
 
114
            type="text"
-
 
115
            name="description"
-
 
116
            className="form-control"
-
 
117
            ref={register({ required: 'Por favor ingrese una descripción' })}
-
 
118
          />
-
 
119
          {errors.description && (
-
 
120
            <FormErrorFeedback>{errors.description.message}</FormErrorFeedback>
-
 
121
          )}
-
 
122
        </div>
-
 
123
        <div className="form-group">
-
 
124
          <label htmlFor="timezone">Tipo de conferencia</label>
-
 
125
          <select name="type" className="form-control" ref={register}>
-
 
126
            <option value="i">Inmediata</option>
-
 
127
            <option value="s">Programada</option>
-
 
128
          </select>
-
 
129
        </div>
-
 
130
        {getValues('type') === 's' && (
-
 
131
          <div className="form-group">
-
 
132
            <label htmlFor="timezone">Horario</label>
-
 
133
            <Datetime
-
 
134
              dateFormat="DD-MM-YYYY"
-
 
135
              onChange={(e) => {
-
 
136
                if (e.toDate) {
-
 
137
                  handleDateTime(e.toDate())
-
 
138
                }
-
 
139
              }}
-
 
140
              inputProps={{ className: 'form-control' }}
-
 
141
              initialValue={Date.parse(new Date())}
-
 
142
              closeOnSelect
106
              ref={register({ required: 'Por favor ingrese un título' })}
-
 
107
            />
-
 
108
            {errors.title && (
-
 
109
              <FormErrorFeedback>{errors.title.message}</FormErrorFeedback>
143
            />
110
            )}
144
          </div>
-
 
145
        )}
111
          </div>
146
        <div className="form-group">
112
          <div className="form-group">
147
          <label htmlFor="timezone">Zona horaria</label>
113
            <label htmlFor="first_name">Descripción</label>
148
          <select
114
            <input
149
            className="form-control"
115
              type="text"
-
 
116
              name="description"
150
            name="timezone"
117
              className="form-control"
151
            ref={register({ required: 'Por favor elige una Zona horaria' })}
118
              ref={register({ required: 'Por favor ingrese una descripción' })}
152
          >
119
            />
153
            <option value="" hidden>
120
            {errors.description && (
154
              Zona horaria
-
 
155
            </option>
-
 
156
            {Object.entries(timezones).map(([key, value]) => (
121
              <FormErrorFeedback>
157
              <option value={key} key={key}>
-
 
158
                {value}
122
                {errors.description.message}
159
              </option>
123
              </FormErrorFeedback>
160
            ))}
-
 
161
          </select>
-
 
162
          {errors.timezone && (
-
 
163
            <FormErrorFeedback>{errors.timezone.message}</FormErrorFeedback>
-
 
164
          )}
124
            )}
165
        </div>
125
          </div>
166
        <div className="form-group">
126
          <div className="form-group">
167
          <label htmlFor="timezone">Duración</label>
127
            <label htmlFor="timezone">Tipo de conferencia</label>
168
          <select className="form-control" name="duration" ref={register}>
128
            <select name="type" className="form-control" ref={register}>
169
            <option value={5}>5-min</option>
129
              <option value="i">Inmediata</option>
170
            <option value={10}>10-min</option>
-
 
171
            <option value={15}>15-min</option>
-
 
172
            <option value={20}>20-min</option>
-
 
173
            <option value={25}>25-min</option>
-
 
174
            <option value={30}>30-min</option>
-
 
175
            <option value={35}>35-min</option>
-
 
176
            <option value={40}>40-min</option>
-
 
177
            <option value={45}>45-min</option>
130
              <option value="s">Programada</option>
178
          </select>
131
            </select>
-
 
132
          </div>
179
        </div>
133
          {getValues('type') === 's' && (
180
        <div className="form-group">
134
            <div className="form-group">
181
          <label htmlFor="first_name">Contraseña de ingreso</label>
135
              <label htmlFor="timezone">Horario</label>
182
          <input
136
              <Datetime
183
            type="password"
137
                dateFormat="DD-MM-YYYY"
184
            name="password"
-
 
185
            className="form-control"
138
                onChange={(e) => {
186
            ref={register({
139
                  if (e.toDate) {
187
              required: 'Por favor ingrese una contraseña',
140
                    handleDateTime(e.toDate())
188
              maxLength: {
141
                  }
189
                value: 6,
142
                }}
190
                message: 'La contraseña debe tener al menos 6 digitos',
143
                inputProps={{ className: 'form-control' }}
191
              },
144
                initialValue={Date.parse(new Date())}
192
            })}
145
                closeOnSelect
193
          />
146
              />
194
          {errors.password && (
-
 
195
            <FormErrorFeedback>{errors.password.message}</FormErrorFeedback>
147
            </div>
-
 
148
          )}
-
 
149
          <div className="form-group">
-
 
150
            <label htmlFor="timezone">Zona horaria</label>
-
 
151
            <select
-
 
152
              className="form-control"
-
 
153
              name="timezone"
-
 
154
              ref={register({ required: 'Por favor elige una Zona horaria' })}
-
 
155
            >
-
 
156
              <option value="" hidden>
-
 
157
                Zona horaria
-
 
158
              </option>
-
 
159
              {Object.entries(timezones).map(([key, value]) => (
-
 
160
                <option value={key} key={key}>
-
 
161
                  {value}
-
 
162
                </option>
-
 
163
              ))}
-
 
164
            </select>
-
 
165
            {errors.timezone && (
-
 
166
              <FormErrorFeedback>{errors.timezone.message}</FormErrorFeedback>
-
 
167
            )}
-
 
168
          </div>
-
 
169
          <div className="form-group">
-
 
170
            <label htmlFor="timezone">Duración</label>
-
 
171
            <select className="form-control" name="duration" ref={register}>
-
 
172
              <option value={5}>5-min</option>
-
 
173
              <option value={10}>10-min</option>
-
 
174
              <option value={15}>15-min</option>
-
 
175
              <option value={20}>20-min</option>
-
 
176
              <option value={25}>25-min</option>
-
 
177
              <option value={30}>30-min</option>
-
 
178
              <option value={35}>35-min</option>
-
 
179
              <option value={40}>40-min</option>
-
 
180
              <option value={45}>45-min</option>
-
 
181
            </select>
-
 
182
          </div>
-
 
183
          <div className="form-group">
-
 
184
            <label htmlFor="first_name">Contraseña de ingreso</label>
-
 
185
            <input
-
 
186
              type="password"
-
 
187
              name="password"
-
 
188
              className="form-control"
-
 
189
              ref={register({
-
 
190
                required: 'Por favor ingrese una contraseña',
-
 
191
                maxLength: {
-
 
192
                  value: 6,
-
 
193
                  message: 'La contraseña debe tener al menos 6 digitos',
-
 
194
                },
-
 
195
              })}
-
 
196
            />
-
 
197
            {errors.password && (
-
 
198
              <FormErrorFeedback>{errors.password.message}</FormErrorFeedback>
196
          )}
199
            )}
197
        </div>
200
          </div>
198
        <button className="btn btn-primary" type="submit">
201
          <button className="btn btn-primary" type="submit">
199
          Crear
202
            Crear
200
        </button>
203
          </button>
-
 
204
        </form>
201
      </form>
205
      </Modal.Body>
202
    </Modal>
206
    </Modal>
203
  )
207
  )
Línea 204... Línea 208...
204
}
208
}