Commit 137d775bf236b502e00ea00a70a09ce0fb4a6cd5
1 parent
eb38720952
Exists in
master
aparecen los datos de los nuevos jurados agregados
Showing
2 changed files
with
17 additions
and
6 deletions
Show diff stats
app/Resources/views/cea/ascenso_mostar.html.twig
... | ... | @@ -65,6 +65,7 @@ |
65 | 65 | <h4>Jurados propuestos por el Docente</h4> |
66 | 66 | {% set añadirJurado = true %} |
67 | 67 | {% set cantidadJurado = 6 %} |
68 | + <div id="seccion_jurados"> | |
68 | 69 | {% for tutor in ascenso.tutoresAscenso %} |
69 | 70 | {{ loop.length }} |
70 | 71 | {% if loop.length == 6 %} |
... | ... | @@ -72,6 +73,7 @@ |
72 | 73 | {% else %} |
73 | 74 | {% set cantidadJurado = cantidadJurado - 1 %} |
74 | 75 | {% endif %} |
76 | + | |
75 | 77 | <p class="well" id="well_{{tutor.id}}"> |
76 | 78 | |
77 | 79 | <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong> |
... | ... | @@ -79,7 +81,9 @@ |
79 | 81 | <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor"> |
80 | 82 | <input type="button" class="btn btn-danger btn-xs eliminar_jurado" value="X" id="{{ tutor.id }}"> |
81 | 83 | </p> |
84 | + | |
82 | 85 | {% endfor %} |
86 | + </div> | |
83 | 87 | {% if añadirJurado %} |
84 | 88 | {{ dump(cantidadJurado) }} |
85 | 89 | <p id="falta" class="label label-danger" data-faltaid = '{{cantidadJurado}}'> |
... | ... | @@ -271,9 +275,8 @@ |
271 | 275 | <script type="text/javascript" src="{{ asset('assets/vendor/lightbox2/dist/js/lightbox.min.js') }}"></script> |
272 | 276 | |
273 | 277 | <script> |
274 | - var cantidad = $("#falta").data('faltaid'); | |
275 | - alert(cantidad); | |
276 | - $(".eliminar_jurado").click(function(){ | |
278 | + var cantidad = $("#falta").data('faltaid'); | |
279 | + $(".eliminar_jurado").click(function(){ | |
277 | 280 | $.ajax({ |
278 | 281 | method: "POST", |
279 | 282 | url: "{{ url('ajax_eliminar_tutor') }}", |
... | ... | @@ -308,8 +311,7 @@ |
308 | 311 | |
309 | 312 | |
310 | 313 | |
311 | - $( "#añadirJurados" ).click(function() { | |
312 | - alert('hola'); | |
314 | + $( "#añadirJurados" ).click(function() { | |
313 | 315 | $.ajax({ |
314 | 316 | method: "POST", |
315 | 317 | url: "{{ url('ajax_adicionar_tutor') }}", |
... | ... | @@ -318,7 +320,10 @@ |
318 | 320 | data: ({ jurados: $("#add_tutor_tutores_ascenso").val(), ascensoId: {{ ascenso.id }} }), |
319 | 321 | success: function (data) { |
320 | 322 | console.log(data); |
321 | - | |
323 | + for (var i = 0; i < data.adicionar_nombres.length; i ++){ | |
324 | + $("#seccion_jurados").append( "<p class='well' id='well_" + data.jurados[i] + "'><strong>" + data.adicionar_nombres[i] + ":</strong>" + data.adicionar_institucion[i] + "<input type='button' class='btn btn-danger btn-xs' value='X' id='" + data.adicionar_id[i] + "'/></p>" ); | |
325 | + $("#" + data.jurados[i] ).addClass("eliminar_jurado") | |
326 | + } | |
322 | 327 | |
323 | 328 | }, |
324 | 329 | error: function (XMLHttpRequest, textStatus, errorThrown) { | ... | ... |
src/AppBundle/Controller/AjaxController.php
... | ... | @@ -207,6 +207,9 @@ class AjaxController extends Controller { |
207 | 207 | foreach ($jurados as $jurado){ |
208 | 208 | $adicionar = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($jurado); |
209 | 209 | $ascenso->addTutoresAscenso($adicionar); |
210 | + $nuevos_nombres[] = $adicionar->getNombres() . " " . $adicionar->getApellidos(); | |
211 | + $nuevos_institucion[] = $adicionar->getInstitucion() . " -> " . $adicionar->getIdEscala()->getNombre(); | |
212 | + $nuevos_id[] = $adicionar->getId(); | |
210 | 213 | } |
211 | 214 | |
212 | 215 | |
... | ... | @@ -220,6 +223,9 @@ class AjaxController extends Controller { |
220 | 223 | $response->setData(array( |
221 | 224 | 'response' => 'success', |
222 | 225 | 'jurados' => $jurados, |
226 | + 'adicionar_nombres' => $nuevos_nombres, | |
227 | + 'adicionar_institucion' => $nuevos_institucion, | |
228 | + 'adicionar_id' => $nuevos_id, | |
223 | 229 | 'ascenso' => $ascensoId |
224 | 230 | )); |
225 | 231 | ... | ... |