Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 10569 Rev 10753
Línea 48... Línea 48...
48
	const dispatch = useDispatch()
48
	const dispatch = useDispatch()
49
	const { action } = useParams()
49
	const { action } = useParams()
Línea 50... Línea 50...
50
 
50
 
Línea 51... Línea -...
51
	useEffect(() => {
-
 
52
 
-
 
53
		// Get current item data
51
	useEffect(() => {
54
		if (action === 'edit') {
52
 
55
			axios.get(actionLink)
53
		axios.get(actionLink)
56
				.then(({ data }) => {
54
			.then(({ data }) => {
57
					const resData = data.data
55
				const resData = data.data
58
 
56
 
59
					if (!data.success) {
57
				if (!data.success) {
60
						dispatch(addNotification({
58
					dispatch(addNotification({
61
							style: 'error',
59
						style: 'error',
62
							msg: 'Ha ocurrido un error'
-
 
63
						}))
-
 
64
					}
-
 
65
 
-
 
66
					setValue('comment', resData.interview.comment)
-
 
67
					setValue('points', resData.interview.points)
-
 
68
					setValue('status', resData.interview.status)
-
 
69
					setCompetencies(resData.job_description.competencies)
-
 
70
					setGeneralOptions({
-
 
71
						...generalOptions,
-
 
72
						name: resData.vacancy.name,
-
 
73
						uuid: resData.vacancy.uuid,
-
 
74
						description: resData.vacancy.description,
-
 
75
						functions: dataExaple.job_description.functions,
-
 
76
						objectives: dataExaple.job_description.objectives
-
 
77
					})
-
 
78
				})
-
 
79
		}
-
 
80
	}, [action])
-
 
81
 
-
 
82
	const dataExaple = {
-
 
83
		'job_description': {
-
 
84
			'uuid': '8ff86a9a-651c-4dd0-86c1-b9c0716d09e0',
-
 
85
			'name': 'Programador Junior',
-
 
86
			'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>',
-
 
87
			'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>',
-
 
88
			'competencies': [
-
 
89
				{
-
 
90
					'competency_uuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b',
-
 
91
					'competency_name': 'Flexibilidad',
-
 
92
					'competency_type_uuid': 'ae45b2e5-73a9-4a0b-ad04-29a07524ccd6',
-
 
93
					'competency_type_name': 'Competencias Horizontales',
-
 
94
					'behaviors': [
-
 
95
						{
-
 
96
							'uuid': '4cee9594-051d-4a52-82f0-58d4accc5583',
-
 
97
							'description': 'Enfocar sus acciones al logro de los resultados planteados.',
-
 
98
							'points': 0,
-
 
99
							'comment': '',
-
 
100
							'competency_uuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b'
-
 
101
						}
60
						msg: 'Ha ocurrido un error'
102
					]
-
 
103
				}
-
 
104
			]
-
 
105
		},
-
 
106
		'interview': {
-
 
107
			'id': 'd1cb9f3d-a6d0-43c1-a698-645b0156d99d',
-
 
108
			'status': 'a',
-
 
109
			'content': [
-
 
110
				{
-
 
111
					'competencyUuid': '79b6ae02-f8e9-4f57-976d-d28b31fc824b',
-
 
112
					'behaviorUuid': '4cee9594-051d-4a52-82f0-58d4accc5583',
-
 
113
					'comment': '',
-
 
114
					'evaluation': '0'
-
 
115
				}
-
 
116
			],
-
 
117
			'type': 'b',
-
 
118
			'points': '3',
-
 
119
			'comment': null
-
 
Línea -... Línea 61...
-
 
61
					}))
-
 
62
				}
-
 
63
 
-
 
64
				setValue('comment', resData.interview.comment)
120
		}
65
				setValue('points', resData.interview.points)
121
	}
66
				setValue('status', resData.interview.status)
-
 
67
				setCompetencies(resData.job_description.competencies)
-
 
68
				setGeneralOptions({
-
 
69
					...generalOptions,
-
 
70
					name: resData.vacancy.name,
-
 
71
					uuid: resData.vacancy.uuid,
-
 
72
					description: resData.vacancy.description,
-
 
73
					functions: resData.job_description.functions,
-
 
74
					objectives: resData.job_description.objectives
122
 
75
				})
Línea 123... Línea 76...
123
	useEffect(() => {
76
			})
124
		console.log(action)
77
 
125
	}, [])
78
	}, [action])
126
 
79
 
Línea 148... Línea 101...
148
									<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
101
									<div className="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
149
										<div className="row p-3 justify-content-between">
102
										<div className="row p-3 justify-content-between">
150
											<div className="col-6">
103
											<div className="col-6">
151
												<div className="form-group">
104
												<div className="form-group">
152
													<label>Vacantes</label>
105
													<label>Vacantes</label>
153
													<select className='form-control' name='points' ref={register}>
106
													<select className='form-control' name='points' ref={register} disabled={action === 'edit'}>
154
														{
107
														{
155
															vacancyOptions.map(({ label, value }) => (
108
															vacancyOptions.map(({ label, value }) => (
156
																<option selected={generalOptions.name === label} key={value} value={value}>{label}</option>
109
																<option selected={generalOptions.name === label} key={value} value={value}>{label}</option>
157
															))
110
															))
158
														}
111
														}
Línea 160... Línea 113...
160
												</div>
113
												</div>
161
											</div>
114
											</div>
162
											<div className="col-6">
115
											<div className="col-6">
163
												<div className="form-group">
116
												<div className="form-group">
164
													<label>Candidatos</label>
117
													<label>Candidatos</label>
165
													<select className='form-control' name='points' ref={register}>
118
													<select className='form-control' name='points' ref={register} disabled={action === 'edit'}>
166
														{
119
														{
167
															candidatesOptions.map(({ label, value }) => (
120
															candidatesOptions.map(({ label, value }) => (
168
																<option selected={watch('candidate') === value} key={value} value={value}>{label}</option>
121
																<option selected={watch('candidate') === value} key={value} value={value}>{label}</option>
169
															))
122
															))
170
														}
123
														}
Línea 183... Línea 136...
183
											</div>
136
											</div>
184
										</div>
137
										</div>
185
									</div>
138
									</div>
186
									<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
139
									<div className="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
187
										{
140
										{
188
											competencies.length
141
											competencies.map((competency) => (
189
                                            &&
-
 
190
                                            competencies.map((competency) => (
-
 
191
                                            	<div className="card" key={competency.competency_uuid}>
142
												<div className="card" key={competency.competency_uuid}>
192
                                            		<div className="card-header">
143
													<div className="card-header">
193
                                            			<h5>{competency.competency_name} - {competency.competency_type_name}</h5>
144
														<h5>{competency.competency_name} - {competency.competency_type_name}</h5>
194
                                            		</div>
145
													</div>
195
                                            		<div className="card-body">
146
													<div className="card-body">
196
                                            			{
147
														{
197
                                            				competency.behaviors
148
															competency.behaviors
198
                                                            &&
149
															&&
199
                                                            competency.behaviors.map((behavior) => (
150
															competency.behaviors.map((behavior) => (
200
                                                            	<table key={behavior.uuid} className="table table-hover">
151
																<table key={behavior.uuid} className="table table-hover">
201
                                                            		<thead>
152
																	<thead>
202
                                                            			<tr>
153
																		<tr>
203
                                                            				<th style={{ width: '20%' }}>Conducta Observable</th>
154
																			<th style={{ width: '20%' }}>Conducta Observable</th>
204
                                                            				<th style={{ width: '60%' }}>Comentario</th>
155
																			<th style={{ width: '60%' }}>Comentario</th>
205
                                                            				<th style={{ width: '20%' }}>Evaluación</th>
156
																			<th style={{ width: '20%' }}>Evaluación</th>
206
                                                            			</tr>
157
																		</tr>
207
                                                            		</thead>
158
																	</thead>
208
                                                            		<tbody>
159
																	<tbody>
209
                                                            			<tr>
160
																		<tr>
210
                                                            				<td style={{ width: '20%' }}>{behavior.description}</td>
161
																			<td style={{ width: '20%' }}>{behavior.description}</td>
211
                                                            				<td style={{ width: '60%' }}>
162
																			<td style={{ width: '60%' }}>
212
                                                            					<textarea
163
																				<textarea
213
                                                            						name={`${behavior.competency_uuid}_${behavior.uuid}-name`}
164
																					name={`${behavior.competency_uuid}_${behavior.uuid}-name`}
214
                                                            						cols="30"
165
																					cols="30"
215
                                                            						rows="3"
166
																					rows="3"
216
                                                            						ref={register}
167
																					ref={register}
217
                                                            						className='form-control w100'
168
																					className='form-control w100'
218
                                                            					/>
169
																				/>
219
                                                            				</td>
170
																			</td>
220
                                                            				<td style={{ width: '20%' }}>
171
																			<td style={{ width: '20%' }}>
221
                                                            					<select className='form-control' name={`${behavior.competency_uuid}_${behavior.uuid}-points`} ref={register}>
172
																				<select className='form-control' name={`${behavior.competency_uuid}_${behavior.uuid}-points`} ref={register}>
222
                                                            						{
173
																					{
223
                                                            							pointsOptions.map(({ label, value }) => (
174
																						pointsOptions.map(({ label, value }) => (
224
                                                            								<option selected={behavior.points === value} key={value} value={value}>{label}</option>
175
																							<option selected={behavior.points === value} key={value} value={value}>{label}</option>
225
                                                            							))
176
																						))
226
                                                            						}
177
																					}
227
                                                            					</select>
178
																				</select>
228
                                                            				</td>
179
																			</td>
229
                                                            			</tr>
180
																		</tr>
230
                                                            		</tbody>
181
																	</tbody>
231
                                                            	</table>
182
																</table>
232
                                                            ))
183
															))
233
                                            			}
184
														}
234
                                            		</div>
185
													</div>
235
                                            	</div>
186
												</div>
236
                                            ))
187
											))
237
										}
188
										}
238
									</div>
189
									</div>
239
									<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
190
									<div className="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">
240
										<div className="form-group">
191
										<div className="form-group">
241
											<label>Comentario</label>
192
											<label>Comentario</label>
Línea 263... Línea 214...
263
										</div>
214
										</div>
264
									</div>
215
									</div>
265
								</div>
216
								</div>
266
								<div className="form-group">
217
								<div className="form-group">
267
									<button type="submit" className="btn btn-primary btn-form-save-close mr-2">
218
									<button type="submit" className="btn btn-primary btn-form-save-close mr-2">
268
                                        Guardar
219
										Guardar
269
									</button>
220
									</button>
270
									<button
221
									<button
271
										type="button"
222
										type="button"
272
										className="btn btn-secondary btn-edit-cancel"
223
										className="btn btn-secondary btn-edit-cancel"
273
										onClick={() => history.goBack()}
224
										onClick={() => history.goBack()}
274
									>
225
									>
275
                                        Cancelar
226
										Cancelar
276
									</button>
227
									</button>
277
								</div>
228
								</div>
278
							</div>
229
							</div>
279
						</div>
230
						</div>
280
					</div>
231
					</div>