Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11063 Rev 11065
Línea -... Línea 1...
-
 
1
import React, { useState, useEffect } from 'react'
1
import { Button, Modal } from 'react-bootstrap'
2
import { Button, Modal } from 'react-bootstrap'
2
import axios from 'axios'
3
import axios from 'axios'
3
import React from 'react'
-
 
4
import { useState } from 'react'
-
 
5
import { useForm } from 'react-hook-form'
4
import { useForm } from 'react-hook-form'
6
import { useDispatch } from 'react-redux'
5
import { useDispatch } from 'react-redux'
7
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { addNotification } from '../../../redux/notification/notification.actions'
8
import DescriptionInput from '../../../shared/DescriptionInput'
7
import DescriptionInput from '../../../shared/DescriptionInput'
9
import { useEffect } from 'react'
-
 
Línea 10... Línea 8...
10
 
8
 
Línea 11... Línea 9...
11
const EditModal = ({ closeModal, email_link, isOpen, edit_link }) => {
9
const EditModal = ({ closeModal, isOpen, edit_link }) => {
12
 
10
 
-
 
11
	//Hooks
13
	//Hooks
12
	const { register, handleSubmit, watch, errors, setValue, clearErrors } = useForm()
Línea 14... Línea 13...
14
	const { register, handleSubmit, watch, errors, setValue, clearErrors } = useForm()
13
	const [fileUrl, setFileUrl] = useState('')
15
	const dispatch = useDispatch()
14
	const dispatch = useDispatch()
16
 
15
 
17
	//States
16
	//States
18
	const [pointsOptions] = useState([
17
	const [pointsOptions] = useState([
19
		{ label: 'Evaluación', value: null },
18
		{ label: 'Evaluación', value: 0 },
20
		{ label: 'Sugerir otro cargo', value: 0 },
19
		{ label: 'Sugerir otro cargo', value: 0 },
21
		{ label: '25%', value: 1 },
20
		{ label: '25%', value: 1 },
Línea 64... Línea 63...
64
					}))
63
					}))
65
				}
64
				}
Línea 66... Línea 65...
66
 
65
 
67
				Object.keys(data.data).map((key) => register(key))
66
				Object.keys(data.data).map((key) => register(key))
-
 
67
				Object.entries(data.data).map(([key, value]) => setValue(key, value))
68
				Object.entries(data.data).map(([key, value]) => setValue(key, value))
68
				setFileUrl(data.data.fileUrl)
69
				clearErrors()
69
				clearErrors()
70
			})
70
			})
Línea 71... Línea 71...
71
	}
71
	}
Línea 95... Línea 95...
95
						{errors.email && <p>{errors.email.message}</p>}
95
						{errors.email && <p>{errors.email.message}</p>}
96
					</div>
96
					</div>
97
					<div className='form-group'>
97
					<div className='form-group'>
98
						<label className="form-label">Comentario</label>
98
						<label className="form-label">Comentario</label>
99
						<DescriptionInput
99
						<DescriptionInput
100
							name='comment'
100
							name='coment'
101
							setValue={setValue}
101
							setValue={setValue}
102
						/>
102
						/>
103
						{errors.comment && <p>{errors.comment.message}</p>}
103
						{errors.coment && <p>{errors.coment.message}</p>}
104
					</div>
104
					</div>
105
					<div className='form-group'>
105
					<div className='form-group'>
106
						<label className="form-label">Evaluación</label>
106
						<label className="form-label">Evaluación</label>
107
						<select className='form-control' name='evaluation' ref={register}>
107
						<select className='form-control' name='evaluation' ref={register}>
108
							{
108
							{
109
								pointsOptions.map(({ label, value }) => {
109
								pointsOptions.map(({ label, value }) => {
110
									return <option selected={watch('evaluation')} key={value} value={value}>{label}</option>
110
									return <option selected={watch('evaluation') === value} key={value} value={value}>{label}</option>
111
								})
111
								})
112
							}
112
							}
113
						</select>
113
						</select>
114
					</div>
114
					</div>
115
					<div className='form-group'>
115
					<div className='form-group'>
Línea 121... Línea 121...
121
							accept='pdf/docx'
121
							accept='pdf/docx'
122
							ref={register}
122
							ref={register}
123
							style={{ height: '2rem' }}
123
							style={{ height: '2rem' }}
124
						/>
124
						/>
125
					</div>
125
					</div>
126
					<a href={watch('file')} type="button" className="btn btn-primary">
126
					<a href={fileUrl} type="button" className="btn btn-primary">
127
                        Verificar Email
127
                        Verificar Email
128
					</a>
128
					</a>
129
					<div className='form-group'>
129
					<div className='form-group'>
130
						<label className="form-label">Estatus</label>
130
						<label className="form-label">Estatus</label>
131
						<select className='form-control' name='status' ref={register}>
131
						<select className='form-control' name='status' ref={register}>
132
							{
132
							{
133
								statusOptions.map(({ label, value }) => {
133
								statusOptions.map(({ label, value }) => {
134
									return <option selected={watch('status')} key={value} value={value}>{label}</option>
134
									return <option selected={watch('status') === value} key={value} value={value}>{label}</option>
135
								})
135
								})
136
							}
136
							}
137
						</select>
137
						</select>
138
					</div>
138
					</div>