Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 12047 Rev 12081
Línea 3... Línea 3...
3
import { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
4
import { useDispatch } from 'react-redux'
4
import { useDispatch } from 'react-redux'
5
import { addNotification } from '../../../redux/notification/notification.actions'
5
import { addNotification } from '../../../redux/notification/notification.actions'
6
import DescriptionInput from '../../../shared/DescriptionInput'
6
import DescriptionInput from '../../../shared/DescriptionInput'
Línea -... Línea 7...
-
 
7
 
-
 
8
const levelOptions = {
-
 
9
	'1': 'Uno',
-
 
10
	'2': 'Dos',
-
 
11
	'3': 'Tres',
-
 
12
	'4': 'Cuatro',
-
 
13
	'5': 'Cinco'
-
 
14
}
7
 
15
 
Línea 8... Línea 16...
8
const EditView = ({ actionLink }) => {
16
const EditView = ({ actionLink }) => {
9
 
17
 
10
	const { register, handleSubmit, setValue, watch } = useForm()
18
	const { register, handleSubmit, setValue, watch } = useForm()
-
 
19
	const [currentJobDescription, setCurretJobDescription] = useState('')
-
 
20
	const [jobDescriptionOptions, setJobDescriptionOptions] = useState([])
11
	const [currentJobDescription, setCurretJobDescription] = useState('')
21
	const [competencyTypes, setCompetencyTypes] = useState([])
12
	const [jobDescriptionOptions, setJobDescriptionOptions] = useState([])
22
	const [competenciesSelected, setCompetenciesSelected] = useState([])
Línea 13... Línea 23...
13
	const [status, setStatus] = useState('a')
23
	const [status, setStatus] = useState('a')
14
	const dispatch = useDispatch()
24
	const dispatch = useDispatch()
Línea 43... Línea 53...
43
						msg: 'Ha ocurrido un error'
53
						msg: 'Ha ocurrido un error'
44
					}))
54
					}))
45
				}
55
				}
Línea 46... Línea 56...
46
 
56
 
-
 
57
				setJobDescriptionOptions([...data.data.jobs_description, { job_description_id: data.data.uuid, name: data.data.name }])
-
 
58
				setCompetenciesSelected(data.data.competencies_selected)
47
				setJobDescriptionOptions([...data.data.jobs_description, { job_description_id: data.data.uuid, name: data.data.name }])
59
				setCompetencyTypes(data.data.competency_types)
48
			})
60
			})
Línea 49... Línea 61...
49
	}, [currentJobDescription])
61
	}, [currentJobDescription])
50
 
62
 
51
	return (
63
	return (
52
		<section className="content">
64
		<section className="content">
53
			<div className="row" style={{ padding: 16 }}>
65
			<div className="row" style={{ padding: 16 }}>
54
				<div className="col-xs-12 col-md-12">
66
				<div className="col-xs-12 col-md-12">
55
					<form onSubmit={handleSubmit}>
67
					<form onSubmit={handleSubmit}>
56
						<div className="form-group">
68
						<div className="form-group">
57
							<label htmlFor="form-name">Nombre</label>
69
							<label>Nombre</label>
58
							<input type="text" name="name" ref={register({ required: true, maxLength: 50 })} />
70
							<input type="text" name="name" className='form-control' ref={register({ required: true, maxLength: 50 })} />
59
						</div>
71
						</div>
60
						<div className="form-group">
72
						<div className="form-group">
61
							<label>Cargo a evaluar</label>
73
							<label>Cargo a evaluar</label>
62
							<select name="job_description_id" ref={register({ required: true })} className="form-control select2-hidden-accessible">
74
							<select name="job_description_id" ref={register({ required: true })} className="form-control">
63
								{
75
								{
64
									jobDescriptionOptions.map(({ name, job_description_id }) => (
76
									jobDescriptionOptions.map(({ name, job_description_id }) => (
65
										<option selected={job_description_id === currentJobDescription} key={job_description_id} value={job_description_id}>{name}</option>
77
										<option selected={job_description_id === currentJobDescription} key={job_description_id} value={job_description_id}>{name}</option>
Línea 92... Línea 104...
92
							<div className="row">
104
							<div className="row">
93
								<div className="col-xs-12 col-md-12">
105
								<div className="col-xs-12 col-md-12">
94
									<hr />
106
									<hr />
95
									<h4 style={{ fontSize: 18, fontWeight: 'bold' }}>Competencias asociadas al cargo:</h4>
107
									<h4 style={{ fontSize: 18, fontWeight: 'bold' }}>Competencias asociadas al cargo:</h4>
96
									<br />
108
									<br />
97
									<div className="panel-group" id="rows-job-competencies">
109
									<div className="panel-group" id="rows-job-competencies" >
-
 
110
										{
-
 
111
											competenciesSelected.map(({ competency_id, competency_type_id, behaviors, name }) => {
-
 
112
												const type = competencyTypes.find((type) => type.competency_type_id === competency_type_id)
-
 
113
												return (
98
										<div className="panel panel-default" id="panel-46d0f805-03ad-4c06-93c2-2a4ec87f6b97">
114
													<div className="panel panel-default" key={competency_id} id={`panel-${competency_id}`}>
99
											<div className="panel-heading">
115
														<div className="panel-heading">
100
												<h4 className="panel-title" style={{ fontSize: 18 }}>
116
															<h4 className="panel-title" style={{ fontSize: 18 }}>
101
													<a className="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-46d0f805-03ad-4c06-93c2-2a4ec87f6b97" href="#collapse-46d0f805-03ad-4c06-93c2-2a4ec87f6b97">
117
																<a className="accordion-toggle" data-toggle="collapse" aria-expanded="true" href={`collapse-${competency_id}`}>
102
														<span className="competency-name46d0f805-03ad-4c06-93c2-2a4ec87f6b97">
118
																	<span className={`competency-name-${competency_id}`}>
103
															Competencias Transversales - Servicio
119
																		{`${type.name} - ${name}`}
104
														</span>
120
																	</span>
105
													</a>
121
																</a>
106
												</h4>
122
															</h4>
107
											</div>
123
														</div>
108
											<div id="collapse-46d0f805-03ad-4c06-93c2-2a4ec87f6b97" className="panel-collapse in collapse show">
124
														<div id="collapse-46d0f805-03ad-4c06-93c2-2a4ec87f6b97" className="panel-collapse in collapse show">
109
												<div className="panel-body">
125
															<div className="panel-body">
110
													<div className="table-responsive">
126
																<div className="table-responsive">
111
														<table className="table table-bordered">
127
																	<table className="table table-bordered">
112
															<thead>
128
																		<thead>
113
																<tr>
129
																			<tr>
114
																	<th style={{ width: '80%' }}>Conducta Observable</th>
130
																				<th style={{ width: '80%' }}>Conducta Observable</th>
115
																	<th style={{ width: '20%' }}>Nivel</th>
131
																				<th style={{ width: '20%' }}>Nivel</th>
116
																</tr>
132
																			</tr>
117
															</thead>
133
																		</thead>
118
															<tbody>
134
																		<tbody>
119
																<tr>
135
																			{
-
 
136
																				behaviors?.map(({ behavior_id, description, level }) => (
-
 
137
																					<tr key={behavior_id}>
120
																	<td className="text-left">
138
																						<td className="text-left">
-
 
139
																							{description}
-
 
140
																						</td>
-
 
141
																						<td>
121
																		Enfocar sus acciones al logro de los resultados planteados.
142
																							{levelOptions[level]}
122
																	</td>
143
																						</td>
-
 
144
																					</tr>
123
																	<td>
145
																				))
124
																		Uno
146
																			}
125
																	</td>
147
																		</tbody>
-
 
148
																	</table>
126
																</tr>
149
																</div>
127
															</tbody>
150
															</div>
128
														</table>
151
														</div>
129
													</div>
152
													</div>
130
												</div>
153
												)
131
											</div>
154
											})
132
										</div>
155
										}
133
									</div>
156
									</div>
134
								</div>
157
								</div>
135
							</div>
158
							</div>
136
						</div>
159
						</div>
137
						<div className="form-group">
160
						<div className="form-group">
Línea 139... Línea 162...
139
							<button type="button" className="btn btn-primary">Guardar & Cerrar</button>
162
							<button type="button" className="btn btn-primary">Guardar & Cerrar</button>
140
							<button type="button" className="btn btn-secondary">Cancelar</button>
163
							<button type="button" className="btn btn-secondary">Cancelar</button>
141
						</div>
164
						</div>
142
					</form>
165
					</form>
143
				</div>
166
				</div>
144
			</div>
167
			</div >
145
		</section>
168
		</section >
Línea 146... Línea 169...
146
 
169
 
147
	)
170
	)
Línea 148... Línea 171...
148
}
171
}
149
 
172