Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15090 Rev 15126
Línea 1... Línea 1...
1
/* eslint-disable no-mixed-spaces-and-tabs */
1
/* eslint-disable no-mixed-spaces-and-tabs */
2
import axios from 'axios'
-
 
3
import React, { useState, useEffect } from 'react'
2
import React, { useState, useEffect } from 'react'
-
 
3
import axios from 'axios'
-
 
4
import parse from 'html-react-parser'
4
import { useForm } from 'react-hook-form'
5
import { useForm } from 'react-hook-form'
5
import { useDispatch } from 'react-redux'
6
import { useDispatch } from 'react-redux'
6
import { useHistory, useParams } from 'react-router-dom'
-
 
7
import { addNotification } from '../../../redux/notification/notification.actions'
7
import { addNotification } from '../../../redux/notification/notification.actions'
Línea -... Línea 8...
-
 
8
 
-
 
9
const FormView = ({
-
 
10
	actionLink,
-
 
11
	type_link,
-
 
12
	vacancy_link,
-
 
13
	vacancies,
-
 
14
	add_link,
-
 
15
	setActionLink,
-
 
16
	action,
8
 
17
	setAction
9
 
-
 
Línea 10... Línea 18...
10
const FormView = ({ actionLink, type_link, vacancy_link, vacancies, add_link, setActionLink }) => {
18
}) => {
11
 
19
 
12
	// States
20
	// States
13
	const [vacancyOptions, setVacancyOptions] = useState(vacancies)
21
	const [vacancyOptions, setVacancyOptions] = useState(vacancies)
Línea 50... Línea 58...
50
		{ label: 'Rechazado', value: 'r' }
58
		{ label: 'Rechazado', value: 'r' }
51
	])
59
	])
Línea 52... Línea 60...
52
 
60
 
53
	// Hooks
61
	// Hooks
54
	const { setValue, register, watch, handleSubmit } = useForm()
-
 
55
	const history = useHistory()
62
	const { setValue, register, watch, handleSubmit } = useForm()
56
	const dispatch = useDispatch()
-
 
Línea 57... Línea 63...
57
	const { action } = useParams()
63
	const dispatch = useDispatch()
58
 
-
 
59
	const onSubmit = () => {
64
 
60
 
65
	const onSubmit = () => {
61
		const content = []
66
		const content = []
62
		competencies.forEach(competency => competency.behaviors.forEach(behavior => {
67
		competencies.forEach(competency => competency.behaviors.forEach(behavior => {
63
			content.push({
68
			content.push({
Línea 93... Línea 98...
93
							)
98
							)
94
						)
99
						)
95
					return
100
					return
96
				}
101
				}
Línea 97... Línea 102...
97
 
102
 
98
				history.goBack()
103
				setAction('')
99
				dispatch(addNotification({
104
				dispatch(addNotification({
100
					style: 'success',
105
					style: 'success',
101
					msg: `Registro ${action === 'edit' ? 'actualizado' : 'añadido'}`
106
					msg: `Registro ${action === 'edit' ? 'actualizado' : 'añadido'}`
102
				}))
107
				}))
Línea 240... Línea 245...
240
												</div>
245
												</div>
241
											</div>
246
											</div>
242
											<h5>{typeOptions.value}</h5>
247
											<h5>{typeOptions.value}</h5>
243
											<div className="card">
248
											<div className="card">
244
												<div className="card-body">
249
												<div className="card-body">
245
													<h5>{generalOptions.name}</h5>
250
													<h5 className='mb-3'>{generalOptions.name}</h5>
246
													<p>{generalOptions.description}</p>
251
													<p>{parse(generalOptions.description)}</p>
247
													<h6>Funciones</h6>
252
													<h6>Funciones</h6>
248
													<p>{generalOptions.functions}</p>
253
													<p>{parse(generalOptions.functions)}</p>
249
													<h6>Objetivos</h6>
254
													<h6>Objetivos</h6>
250
													<p>{generalOptions.objectives}</p>
255
													<p>{parse(generalOptions.objectives)}</p>
251
												</div>
256
												</div>
252
											</div>
257
											</div>
253
										</div>
258
										</div>
254
										<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
259
										<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
255
											{
-
 
256
												competencies.map((competency) => (
260
											{competencies.map((competency) => (
257
													<div className="card" key={competency.competency_uuid}>
261
												<div className="card" key={competency.competency_uuid}>
258
														<div className="card-header">
262
													<div className="card-header">
259
															<h5>{competency.competency_name} - {competency.competency_type_name}</h5>
263
														<h5>{competency.competency_name} - {competency.competency_type_name}</h5>
260
														</div>
264
													</div>
261
														<div className="card-body">
265
													<div className="card-body">
262
															<div className="table-responsive">
266
														<div className="table-responsive">
263
																{
267
															{
264
																	competency.behaviors
268
																competency.behaviors
265
																	&&
269
																&&
266
																	competency.behaviors.map((behavior) => (
270
																competency.behaviors.map((behavior) => (
267
																		<table key={behavior.uuid} className="table table-hover">
271
																	<table key={behavior.uuid} className="table table-hover">
268
																			<thead>
272
																		<thead>
269
																				<tr>
273
																			<tr>
270
																					<th style={{ width: '20%' }}>Conducta Observable</th>
274
																				<th style={{ width: '20%' }}>Conducta Observable</th>
271
																					<th style={{ width: '60%' }}>Comentario</th>
275
																				<th style={{ width: '60%' }}>Comentario</th>
272
																					<th style={{ width: '20%' }}>Evaluación</th>
276
																				<th style={{ width: '20%' }}>Evaluación</th>
273
																				</tr>
277
																			</tr>
274
																			</thead>
278
																		</thead>
275
																			<tbody>
279
																		<tbody>
276
																				<tr>
280
																			<tr>
277
																					<td style={{ width: '20%' }}>{behavior.description}</td>
281
																				<td style={{ width: '20%' }}>{behavior.description}</td>
278
																					<td style={{ width: '60%' }}>
282
																				<td style={{ width: '60%' }}>
279
																						<input
283
																					<input
280
																							type="text"
284
																						type="text"
281
																							name={`${behavior.competency_uuid}-${behavior.uuid}-comment`}
285
																						name={`${behavior.competency_uuid}-${behavior.uuid}-comment`}
282
																							maxlength="80"
286
																						maxLength="80"
283
																							ref={register}
287
																						ref={register}
284
																							className='form-control w100'
288
																						className='form-control w100'
285
																						/>
289
																					/>
286
																					</td>
290
																				</td>
287
																					<td style={{ width: '20%' }}>
291
																				<td style={{ width: '20%' }}>
288
																						<select className='form-control' name={`select-${behavior.competency_uuid}-${behavior.uuid}`} ref={register}>
292
																					<select className='form-control' name={`select-${behavior.competency_uuid}-${behavior.uuid}`} ref={register}>
289
																							{
293
																						{
290
																								pointsOptions.map(({ label, value }) => {
294
																							pointsOptions.map(({ label, value }) => {
291
																									return <option selected={watch(`select-${behavior.competency_uuid}-${behavior.uuid}`) === value} key={value} value={value}>{label}</option>
295
																								return <option selected={watch(`select-${behavior.competency_uuid}-${behavior.uuid}`) === value} key={value} value={value}>{label}</option>
292
																								})
296
																							})
293
																							}
297
																						}
294
																						</select>
298
																					</select>
295
																					</td>
299
																				</td>
296
																				</tr>
300
																			</tr>
297
																			</tbody>
301
																		</tbody>
298
																		</table>
302
																	</table>
299
																	))
303
																))
300
																}
304
															}
301
															</div>
-
 
302
														</div>
305
														</div>
303
													</div>
306
													</div>
-
 
307
												</div>
304
												))
308
											))
305
											}
309
											}
306
										</div>
310
										</div>
307
										<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
311
										<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
308
											<div className="form-group">
312
											<div className="form-group">
309
												<label>Comentario</label>
313
												<label>Comentario</label>
Línea 336... Línea 340...
336
											Guardar
340
											Guardar
337
										</button>
341
										</button>
338
										<button
342
										<button
339
											type="button"
343
											type="button"
340
											className="btn btn-secondary btn-edit-cancel"
344
											className="btn btn-secondary btn-edit-cancel"
341
											onClick={() => history.goBack()}
345
											onClick={() => setAction('')}
342
										>
346
										>
343
											Cancelar
347
											Cancelar
344
										</button>
348
										</button>
345
									</div>
349
									</div>
346
								</div>
350
								</div>