Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 14257 Rev 14261
Línea 7... Línea 7...
7
import { useDispatch } from 'react-redux'
7
import { useDispatch } from 'react-redux'
8
import { useHistory, useParams } from 'react-router-dom'
8
import { useHistory, useParams } from 'react-router-dom'
9
import { addNotification } from '../../redux/notification/notification.actions'
9
import { addNotification } from '../../redux/notification/notification.actions'
10
import { config } from '../../shared/helpers/ckeditor_config'
10
import { config } from '../../shared/helpers/ckeditor_config'
11
import ToggleComponent from '../../shared/ToggleComponent'
11
import ToggleComponent from '../../shared/ToggleComponent'
-
 
12
import ConductModal from '../component/ConductModal'
Línea 12... Línea 13...
12
 
13
 
13
const CONDUCTS_OPTIONS = {
14
const CONDUCTS_OPTIONS = {
14
	0: 'No aplica',
15
	0: 'No aplica',
15
	1: 'Uno',
16
	1: 'Uno',
Línea 41... Línea 42...
41
	const [competencyOptions, setCompetencyOptions] = useState([])
42
	const [competencyOptions, setCompetencyOptions] = useState([])
42
	const [competenciesSelected, setCompetenciesSelected] = useState([])
43
	const [competenciesSelected, setCompetenciesSelected] = useState([])
43
	const [competencyTypeOptions, setCompetencyTypeOptions] = useState([])
44
	const [competencyTypeOptions, setCompetencyTypeOptions] = useState([])
44
	const [jobsDescription, setJobsDescription] = useState([])
45
	const [jobsDescription, setJobsDescription] = useState([])
45
	const [subordinatesSelected, setSubordinatesSelected] = useState([])
46
	const [subordinatesSelected, setSubordinatesSelected] = useState([])
-
 
47
	const [selectBehavior, setSelectBehavior] = useState({})
-
 
48
	const [isShowModal, setIsShowModal] = useState(false)
Línea 46... Línea 49...
46
 
49
 
Línea 47... Línea 50...
47
	const onSubmit = (data) => {
50
	const onSubmit = (data) => {
48
 
51
 
Línea 94... Línea 97...
94
 
97
 
95
	const deleteSubordinate = (id) => {
98
	const deleteSubordinate = (id) => {
96
		setSubordinatesSelected(prev => prev.filter(subordinate => subordinate.job_description_id !== id))
99
		setSubordinatesSelected(prev => prev.filter(subordinate => subordinate.job_description_id !== id))
Línea -... Línea 100...
-
 
100
	}
-
 
101
 
-
 
102
	const editLevel = (val) => {
-
 
103
		const newCompetencies = competenciesSelected.map(competency => {
-
 
104
			if (competency.competency_id === selectBehavior.competency_id) {
-
 
105
				competency.behaviors.map(behavior => {
-
 
106
					if (behavior.behavior_id === selectBehavior.behavior_id) {
-
 
107
						return { ...behavior, level: val }
-
 
108
					}
-
 
109
 
-
 
110
					return behavior
-
 
111
				})
-
 
112
			}
-
 
113
 
-
 
114
			return competency
-
 
115
		})
-
 
116
 
-
 
117
		setCompetenciesSelected(newCompetencies)
-
 
118
		setSelectBehavior({})
-
 
119
	}
-
 
120
 
-
 
121
	const displayModal = (behavior) => {
-
 
122
		setSelectBehavior(behavior)
-
 
123
		setIsShowModal(true)
97
	}
124
	}
98
 
125
 
99
	useEffect(() => {
126
	useEffect(() => {
100
		register('status')
127
		register('status')
101
		register('objectives')
128
		register('objectives')
Línea 328... Línea 355...
328
																					<td>{CONDUCTS_OPTIONS[behavior.level]}</td>
355
																					<td>{CONDUCTS_OPTIONS[behavior.level]}</td>
329
																					<td>
356
																					<td>
330
																						<button
357
																						<button
331
																							type='button'
358
																							type='button'
332
																							className='btn btn-primary'
359
																							className='btn btn-primary'
333
																							onClick={() => deleteSubordinate(competency_selected.competency_id)}
360
																							onClick={() => displayModal(behavior)}
334
																						>
361
																						>
335
																							<i className='fa fa-edit mr-1' />
362
																							<i className='fa fa-edit mr-1' />
336
																							Editar Perfil
363
																							Editar Perfil
337
																						</button>
364
																						</button>
338
																					</td>
365
																					</td>
Línea 344... Línea 371...
344
															</div>
371
															</div>
345
														)
372
														)
346
													})
373
													})
347
												}
374
												}
348
											</div>
375
											</div>
-
 
376
											<ConductModal
-
 
377
												isShow={isShowModal}
-
 
378
												onSubmit={(val) => editLevel(val)}
-
 
379
												closeModal={() => setIsShowModal(false)}
-
 
380
											/>
349
										</div>
381
										</div>
350
										<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
382
										<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
351
											<div className="card p-2">
383
											<div className="card p-2">
352
												<div className="d-flex justify-content-around">
384
												<div className="d-flex justify-content-around">
353
													<div className="col-9">
385
													<div className="col-9">