Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 10450 Rev 10513
Línea -... Línea 1...
-
 
1
import axios from 'axios'
1
import React from 'react'
2
import React from 'react'
2
import { useEffect } from 'react'
3
import { useEffect } from 'react'
-
 
4
import { useForm } from 'react-hook-form'
-
 
5
import { useDispatch } from 'react-redux'
3
import { useHistory, useParams } from 'react-router-dom'
6
import { useHistory, useParams } from 'react-router-dom'
-
 
7
import { addNotification } from '../../../redux/notification/notification.actions'
Línea 4... Línea 8...
4
 
8
 
-
 
9
const pointsOptions = [
-
 
10
	{ label: 'Evaluación', value: 0 },
-
 
11
	{ label: 'Sugerir otro cargo', value: 0 },
-
 
12
	{ label: '25%', value: 1 },
-
 
13
	{ label: '50%', value: 2 },
-
 
14
	{ label: '75%', value: 3 },
-
 
15
	{ label: '100%', value: 4 }
Línea -... Línea 16...
-
 
16
]
-
 
17
 
-
 
18
const statusOptions = [
-
 
19
	{ label: 'Estatus', value: '' },
-
 
20
	{ label: 'Aceptado', value: 'a' },
-
 
21
	{ label: 'Rechazado', value: 'r' }
-
 
22
]
-
 
23
 
-
 
24
const FormView = ({ actionLink }) => {
5
const FormView = () => {
25
 
-
 
26
	const { register, setValue } = useForm()
6
 
27
	const history = useHistory()
Línea 7... Línea 28...
7
	const history = useHistory()
28
	const dispatch = useDispatch()
-
 
29
	const { action } = useParams()
-
 
30
 
-
 
31
	useEffect(() => {
-
 
32
		axios.get(actionLink)
-
 
33
			.then(({ data }) => {
-
 
34
				const resData = data.data
-
 
35
 
-
 
36
				if (!data.success) {
-
 
37
					dispatch(addNotification({
-
 
38
						style: 'error',
-
 
39
						msg: 'Ha ocurrido un error'
-
 
40
					}))
-
 
41
				}
-
 
42
 
-
 
43
				setValue('status', resData.interview.status)
-
 
44
				setValue('points', resData.interview.points)
-
 
45
				setValue('comment', resData.interview.comment)
-
 
46
			})
-
 
47
	}, [])
-
 
48
 
-
 
49
	const dataExaple = {
-
 
50
		'candidate': {
-
 
51
			'uuid': 'afc67cd3-60cd-4b14-81d8-6d8a014bbdd6',
-
 
52
			'first_name': 'Eleazar',
-
 
53
			'last_name': 'Oroño',
-
 
54
			'email': 'eorono@gmail.com'
-
 
55
		},
-
 
56
		'job_description': {
-
 
57
			'uuid': '8ff86a9a-651c-4dd0-86c1-b9c0716d09e0',
-
 
58
			'name': 'Programador Junior',
-
 
59
			'functions': '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tempus urna et pharetra pharetra massa massa ultricies mi. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum. Tortor posuere ac ut consequat semper viverra nam. Ultricies leo integer malesuada nunc.</p>',
-
 
60
			'objectives': '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tempus urna et pharetra pharetra massa massa ultricies mi. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum. Tortor posuere ac ut consequat semper viverra nam. Ultricies leo integer malesuada nunc.</p>',
-
 
61
			'competencies': [
-
 
62
				{
-
 
63
					'competency_uuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b',
-
 
64
					'competency_name': 'Flexibilidad',
-
 
65
					'competency_type_uuid': 'ae45b2e5-73a9-4a0b-ad04-29a07524ccd6',
-
 
66
					'competency_type_name': 'Competencias Horizontales',
-
 
67
					'behaviors': [
-
 
68
						{
-
 
69
							'uuid': '4cee9594-051d-4a52-82f0-58d4accc5583',
-
 
70
							'description': 'Enfocar sus acciones al logro de los resultados planteados.',
-
 
71
							'points': 0,
-
 
72
							'comment': '',
-
 
73
							'competency_uuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b'
-
 
74
						}
-
 
75
					]
-
 
76
				}
-
 
77
			]
-
 
78
		},
-
 
79
		'interview': {
-
 
80
			'id': 'd1cb9f3d-a6d0-43c1-a698-645b0156d99d',
-
 
81
			'status': 'a',
-
 
82
			'content': [
-
 
83
				{
-
 
84
					'competencyUuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b',
-
 
85
					'behaviorUuid': '4cee9594-051d-4a52-82f0-58d4accc5583',
-
 
86
					'comment': '',
-
 
87
					'evaluation': '0'
-
 
88
				}
-
 
89
			],
-
 
90
			'type': 'b',
-
 
91
			'points': '3',
-
 
92
			'comment': null
-
 
93
		},
-
 
94
		'vacancy': {
-
 
95
			'id': '26',
-
 
96
			'uuid': '7693a385-cde2-4e35-adef-1adc1ca63eac',
-
 
97
			'company_id': '1',
-
 
98
			'name': 'Programador PHP',
-
 
99
			'job_description_id': '3',
-
 
100
			'job_category_id': '11',
-
 
101
			'description': '<p>Test</p>',
-
 
102
			'location_id': '136',
-
 
103
			'industry_id': '12',
-
 
104
			'last_date': '0000-00-00',
-
 
105
			'status': 'a',
-
 
106
			'added_on': '2022-08-10 18:24:56',
-
 
107
			'updated_on': '2022-08-17 20:47:29'
-
 
108
		}
8
	const { action } = useParams()
109
	}
9
 
110
 
Línea 10... Línea 111...
10
	useEffect(() => {
111
	useEffect(() => {
11
		console.log(action)
112
		console.log(action)
Línea 34... Línea 135...
34
								<div className="tab-content" id="myTabContent">
135
								<div className="tab-content" id="myTabContent">
35
									<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"></div>
136
									<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab"></div>
36
									<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab"></div>
137
									<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab"></div>
37
									<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
138
									<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
38
										<div className="form-group">
139
										<div className="form-group">
39
											<label>Nombre</label>
140
											<label>Comentario</label>
-
 
141
											<input type="text" name="comment" className="form-control" />
40
											<input
142
										</div>
-
 
143
										<div className="form-group">
-
 
144
											<label>Evaluación</label>
-
 
145
											<select name='points' ref={register}>
-
 
146
												{
-
 
147
													pointsOptions.map(({ label, value }) => {
-
 
148
														<option key={value} value={value}>{label}</option>
-
 
149
													})
-
 
150
												}
41
												type="text"
151
											</select>
42
												name="name"
152
										</div>
43
												className="form-control"
153
										<div className="form-group">
-
 
154
											<label>Estatus</label>
-
 
155
											<select name='status' ref={register}>
-
 
156
												{
-
 
157
													statusOptions.map(({ label, value }) => {
-
 
158
														<option key={value} value={value}>{label}</option>
-
 
159
													})
44
											/>
160
												}
-
 
161
											</select>
45
										</div>
162
										</div>
46
									</div>
163
									</div>
47
								</div>
164
								</div>
48
								<div className="form-group">
165
								<div className="form-group">
49
									<button
-
 
50
										type="submit"
-
 
51
										className="btn btn-primary btn-form-save-close mr-2"
166
									<button type="submit" className="btn btn-primary btn-form-save-close mr-2">
52
									>
-
 
53
                                        Guardar
167
                                        Guardar
54
									</button>
168
									</button>
55
									<button
169
									<button
56
										type="button"
170
										type="button"
57
										className="btn btn-secondary btn-edit-cancel"
171
										className="btn btn-secondary btn-edit-cancel"