| Línea 5... |
Línea 5... |
| 5 |
import { useDispatch } from 'react-redux'
|
5 |
import { useDispatch } from 'react-redux'
|
| 6 |
import { useHistory, useParams } from 'react-router-dom'
|
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 8... |
Línea 8... |
| 8 |
|
8 |
|
| Línea 9... |
Línea 9... |
| 9 |
|
9 |
|
| - |
|
10 |
const FormView = ({ actionLink, type_link, vacancy_link, vacancies }) => {
|
| 10 |
const FormView = ({ actionLink, type_link }) => {
|
11 |
|
| 11 |
|
12 |
// States
|
| 12 |
// States
|
13 |
const [vacancyUrl, setVacancyUrl] = useState(vacancy_link)
|
| 13 |
const [typeOptions, setTypeOptions] = useState({
|
14 |
const [typeOptions, setTypeOptions] = useState({
|
| 14 |
url: type_link,
|
15 |
url: type_link,
|
| Línea 20... |
Línea 21... |
| 20 |
description: '',
|
21 |
description: '',
|
| 21 |
functions: '',
|
22 |
functions: '',
|
| 22 |
objectives: ''
|
23 |
objectives: ''
|
| 23 |
})
|
24 |
})
|
| 24 |
const [pointsOptions, setPointsOptions] = useState([
|
25 |
const [pointsOptions, setPointsOptions] = useState([
|
| 25 |
{ label: 'Evaluación', value: 0 },
|
26 |
{ label: 'Evaluación', value: null },
|
| 26 |
{ label: 'Sugerir otro cargo', value: 0 },
|
27 |
{ label: 'Sugerir otro cargo', value: 0 },
|
| 27 |
{ label: '25%', value: 1 },
|
28 |
{ label: '25%', value: 1 },
|
| 28 |
{ label: '50%', value: 2 },
|
29 |
{ label: '50%', value: 2 },
|
| 29 |
{ label: '75%', value: 3 },
|
30 |
{ label: '75%', value: 3 },
|
| 30 |
{ label: '100%', value: 4 }
|
31 |
{ label: '100%', value: 4 }
|
| Línea 32... |
Línea 33... |
| 32 |
const [statusOptions, setStatusOptions] = useState([
|
33 |
const [statusOptions, setStatusOptions] = useState([
|
| 33 |
{ label: 'Estatus', value: '' },
|
34 |
{ label: 'Estatus', value: '' },
|
| 34 |
{ label: 'Aceptado', value: 'a' },
|
35 |
{ label: 'Aceptado', value: 'a' },
|
| 35 |
{ label: 'Rechazado', value: 'r' }
|
36 |
{ label: 'Rechazado', value: 'r' }
|
| 36 |
])
|
37 |
])
|
| 37 |
const [vacancyOptions, setVacancyOptions] = useState([
|
38 |
const [vacancyOptions, setVacancyOptions] = useState(vacancies)
|
| 38 |
{ label: 'Estatus', value: '' },
|
- |
|
| 39 |
{ label: 'Aceptado', value: 'a' },
|
- |
|
| 40 |
{ label: 'Rechazado', value: 'r' }
|
- |
|
| 41 |
])
|
- |
|
| 42 |
const [candidatesOptions, setCandidatesOptions] = useState([
|
39 |
const [candidatesOptions, setCandidatesOptions] = useState([
|
| 43 |
{ label: 'Estatus', value: '' },
|
40 |
{ label: 'Estatus', value: '' },
|
| 44 |
{ label: 'Aceptado', value: 'a' },
|
41 |
{ label: 'Aceptado', value: 'a' },
|
| 45 |
{ label: 'Rechazado', value: 'r' }
|
42 |
{ label: 'Rechazado', value: 'r' }
|
| 46 |
])
|
43 |
])
|
| Línea 69... |
Línea 66... |
| 69 |
setValue('points', resData.interview.points)
|
66 |
setValue('points', resData.interview.points)
|
| 70 |
setValue('status', resData.interview.status)
|
67 |
setValue('status', resData.interview.status)
|
| 71 |
setCompetencies(resData.job_description.competencies)
|
68 |
setCompetencies(resData.job_description.competencies)
|
| 72 |
setCandidatesOptions([{ label: `${resData.candidate.first_name} ${resData.candidate.last_name}`, value: resData.candidate.uuid }])
|
69 |
setCandidatesOptions([{ label: `${resData.candidate.first_name} ${resData.candidate.last_name}`, value: resData.candidate.uuid }])
|
| 73 |
setVacancyOptions([{ label: resData.vacancy.name, value: resData.vacancy.uuid }])
|
70 |
setVacancyOptions([{ label: resData.vacancy.name, value: resData.vacancy.uuid }])
|
| 74 |
setTypeOptions({ ...typeOptions, value: resData.interview.type })
|
71 |
setTypeOptions({ ...typeOptions, value: resData.interview.type === 'r' ? 'Entrevista por Recursos Humanos' : 'Entrevista por Potencial superior' })
|
| 75 |
setGeneralOptions({
|
72 |
setGeneralOptions({
|
| 76 |
...generalOptions,
|
73 |
...generalOptions,
|
| 77 |
name: resData.vacancy.name,
|
74 |
name: resData.vacancy.name,
|
| 78 |
uuid: resData.vacancy.uuid,
|
75 |
uuid: resData.vacancy.uuid,
|
| 79 |
description: resData.vacancy.description,
|
76 |
description: resData.vacancy.description,
|
| Línea 93... |
Línea 90... |
| 93 |
style: 'error',
|
90 |
style: 'error',
|
| 94 |
msg: 'Ha ocurrido un error'
|
91 |
msg: 'Ha ocurrido un error'
|
| 95 |
}))
|
92 |
}))
|
| 96 |
}
|
93 |
}
|
| Línea 97... |
Línea 94... |
| 97 |
|
94 |
|
| 98 |
console.log(data.data)
|
95 |
setTypeOptions({ ...typeOptions, value: data.data })
|
| Línea 99... |
Línea 96... |
| 99 |
})
|
96 |
})
|
| Línea -... |
Línea 97... |
| - |
|
97 |
|
| - |
|
98 |
}, [typeOptions.url])
|
| - |
|
99 |
|
| - |
|
100 |
useEffect(() => {
|
| - |
|
101 |
axios.get(vacancyUrl)
|
| - |
|
102 |
.then(({ data }) => {
|
| - |
|
103 |
const resData = data.data
|
| - |
|
104 |
|
| - |
|
105 |
if (!data.success) {
|
| - |
|
106 |
dispatch(addNotification({
|
| - |
|
107 |
style: 'error',
|
| - |
|
108 |
msg: 'Ha ocurrido un error'
|
| - |
|
109 |
}))
|
| - |
|
110 |
}
|
| - |
|
111 |
|
| - |
|
112 |
setCandidatesOptions(resData.candidates)
|
| - |
|
113 |
setValue('comment', resData.interview.comment)
|
| - |
|
114 |
setValue('points', resData.interview.points)
|
| - |
|
115 |
setValue('status', resData.interview.status)
|
| - |
|
116 |
setCompetencies(resData.job_description.competencies)
|
| - |
|
117 |
setTypeOptions({ ...typeOptions, value: resData.interview.type === 'r' ? 'Entrevista por Recursos Humanos' : 'Entrevista por Potencial superior' })
|
| - |
|
118 |
setGeneralOptions({
|
| - |
|
119 |
...generalOptions,
|
| - |
|
120 |
name: resData.vacancy.name,
|
| - |
|
121 |
uuid: resData.vacancy.uuid,
|
| - |
|
122 |
description: resData.vacancy.description,
|
| - |
|
123 |
functions: resData.job_description.functions,
|
| - |
|
124 |
objectives: resData.job_description.objectives
|
| - |
|
125 |
})
|
| - |
|
126 |
})
|
| 100 |
|
127 |
|
| 101 |
}, [typeOptions.url])
|
128 |
}, [vacancyUrl])
|
| 102 |
|
129 |
|
| 103 |
return (
|
130 |
return (
|
| 104 |
<section className="content">
|
131 |
<section className="content">
|
| Línea 124... |
Línea 151... |
| 124 |
<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
151 |
<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
| 125 |
<div className="row p-3 justify-content-between">
|
152 |
<div className="row p-3 justify-content-between">
|
| 126 |
<div className="col-6">
|
153 |
<div className="col-6">
|
| 127 |
<div className="form-group">
|
154 |
<div className="form-group">
|
| 128 |
<label>Vacantes</label>
|
155 |
<label>Vacantes</label>
|
| 129 |
<select className='form-control' name='points' ref={register} disabled={action === 'edit'}>
|
156 |
<select className='form-control' name='points' ref={register} disabled={action === 'edit'} onChange={(e) => setVacancyUrl(vacancy_link.replace('UUID_PLACEHOLDER', e.target.value))}>
|
| 130 |
{
|
157 |
{
|
| 131 |
vacancyOptions.map(({ label, value }) => (
|
158 |
vacancyOptions.map(({ label, value }) => (
|
| 132 |
<option selected={generalOptions.name === label} key={value} value={value}>{label}</option>
|
159 |
<option selected={generalOptions.name === label} key={value} value={value}>{label}</option>
|
| 133 |
))
|
160 |
))
|
| 134 |
}
|
161 |
}
|
| Línea 216... |
Línea 243... |
| 216 |
<label>Comentario</label>
|
243 |
<label>Comentario</label>
|
| 217 |
<input type="text" name="comment" className="form-control" ref={register} />
|
244 |
<input type="text" name="comment" className="form-control" ref={register} />
|
| 218 |
</div>
|
245 |
</div>
|
| 219 |
<div className="form-group">
|
246 |
<div className="form-group">
|
| 220 |
<label>Evaluación</label>
|
247 |
<label>Evaluación</label>
|
| 221 |
<select className='form-control' name='points' ref={register}>
|
248 |
<select className='form-control' name='points' ref={register} defaultValue={pointsOptions[0].value}>
|
| 222 |
{
|
249 |
{
|
| 223 |
pointsOptions.map(({ label, value }) => (
|
250 |
pointsOptions.map(({ label, value }) => (
|
| 224 |
<option selected={watch('points') === value} key={value} value={value}>{label}</option>
|
251 |
<option selected={watch('points') === value} key={value} value={value}>{label}</option>
|
| 225 |
))
|
252 |
))
|
| 226 |
}
|
253 |
}
|
| 227 |
</select>
|
254 |
</select>
|
| 228 |
</div>
|
255 |
</div>
|
| 229 |
<div className="form-group">
|
256 |
<div className="form-group">
|
| 230 |
<label>Estatus</label>
|
257 |
<label>Estatus</label>
|
| 231 |
<select className='form-control' name='status' ref={register}>
|
258 |
<select className='form-control' name='status' ref={register} defaultValue={statusOptions[0].value}>
|
| 232 |
{
|
259 |
{
|
| 233 |
statusOptions.map(({ label, value }) => (
|
260 |
statusOptions.map(({ label, value }) => (
|
| 234 |
<option selected={watch('status') === value} key={value} value={value}>{label}</option>
|
261 |
<option selected={watch('status') === value} key={value} value={value}>{label}</option>
|
| 235 |
))
|
262 |
))
|
| 236 |
}
|
263 |
}
|