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,6 +65,7 @@ | ||
| 65 | <h4>Jurados propuestos por el Docente</h4> | 65 | <h4>Jurados propuestos por el Docente</h4> |
| 66 | {% set añadirJurado = true %} | 66 | {% set añadirJurado = true %} |
| 67 | {% set cantidadJurado = 6 %} | 67 | {% set cantidadJurado = 6 %} |
| 68 | + <div id="seccion_jurados"> | ||
| 68 | {% for tutor in ascenso.tutoresAscenso %} | 69 | {% for tutor in ascenso.tutoresAscenso %} |
| 69 | {{ loop.length }} | 70 | {{ loop.length }} |
| 70 | {% if loop.length == 6 %} | 71 | {% if loop.length == 6 %} |
| @@ -72,6 +73,7 @@ | @@ -72,6 +73,7 @@ | ||
| 72 | {% else %} | 73 | {% else %} |
| 73 | {% set cantidadJurado = cantidadJurado - 1 %} | 74 | {% set cantidadJurado = cantidadJurado - 1 %} |
| 74 | {% endif %} | 75 | {% endif %} |
| 76 | + | ||
| 75 | <p class="well" id="well_{{tutor.id}}"> | 77 | <p class="well" id="well_{{tutor.id}}"> |
| 76 | 78 | ||
| 77 | <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong> | 79 | <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong> |
| @@ -79,7 +81,9 @@ | @@ -79,7 +81,9 @@ | ||
| 79 | <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor"> | 81 | <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor"> |
| 80 | <input type="button" class="btn btn-danger btn-xs eliminar_jurado" value="X" id="{{ tutor.id }}"> | 82 | <input type="button" class="btn btn-danger btn-xs eliminar_jurado" value="X" id="{{ tutor.id }}"> |
| 81 | </p> | 83 | </p> |
| 84 | + | ||
| 82 | {% endfor %} | 85 | {% endfor %} |
| 86 | + </div> | ||
| 83 | {% if añadirJurado %} | 87 | {% if añadirJurado %} |
| 84 | {{ dump(cantidadJurado) }} | 88 | {{ dump(cantidadJurado) }} |
| 85 | <p id="falta" class="label label-danger" data-faltaid = '{{cantidadJurado}}'> | 89 | <p id="falta" class="label label-danger" data-faltaid = '{{cantidadJurado}}'> |
| @@ -271,9 +275,8 @@ | @@ -271,9 +275,8 @@ | ||
| 271 | <script type="text/javascript" src="{{ asset('assets/vendor/lightbox2/dist/js/lightbox.min.js') }}"></script> | 275 | <script type="text/javascript" src="{{ asset('assets/vendor/lightbox2/dist/js/lightbox.min.js') }}"></script> |
| 272 | 276 | ||
| 273 | <script> | 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 | $.ajax({ | 280 | $.ajax({ |
| 278 | method: "POST", | 281 | method: "POST", |
| 279 | url: "{{ url('ajax_eliminar_tutor') }}", | 282 | url: "{{ url('ajax_eliminar_tutor') }}", |
| @@ -308,8 +311,7 @@ | @@ -308,8 +311,7 @@ | ||
| 308 | 311 | ||
| 309 | 312 | ||
| 310 | 313 | ||
| 311 | - $( "#añadirJurados" ).click(function() { | ||
| 312 | - alert('hola'); | 314 | + $( "#añadirJurados" ).click(function() { |
| 313 | $.ajax({ | 315 | $.ajax({ |
| 314 | method: "POST", | 316 | method: "POST", |
| 315 | url: "{{ url('ajax_adicionar_tutor') }}", | 317 | url: "{{ url('ajax_adicionar_tutor') }}", |
| @@ -318,7 +320,10 @@ | @@ -318,7 +320,10 @@ | ||
| 318 | data: ({ jurados: $("#add_tutor_tutores_ascenso").val(), ascensoId: {{ ascenso.id }} }), | 320 | data: ({ jurados: $("#add_tutor_tutores_ascenso").val(), ascensoId: {{ ascenso.id }} }), |
| 319 | success: function (data) { | 321 | success: function (data) { |
| 320 | console.log(data); | 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 | error: function (XMLHttpRequest, textStatus, errorThrown) { | 329 | error: function (XMLHttpRequest, textStatus, errorThrown) { |
src/AppBundle/Controller/AjaxController.php
| @@ -207,6 +207,9 @@ class AjaxController extends Controller { | @@ -207,6 +207,9 @@ class AjaxController extends Controller { | ||
| 207 | foreach ($jurados as $jurado){ | 207 | foreach ($jurados as $jurado){ |
| 208 | $adicionar = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($jurado); | 208 | $adicionar = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($jurado); |
| 209 | $ascenso->addTutoresAscenso($adicionar); | 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,6 +223,9 @@ class AjaxController extends Controller { | ||
| 220 | $response->setData(array( | 223 | $response->setData(array( |
| 221 | 'response' => 'success', | 224 | 'response' => 'success', |
| 222 | 'jurados' => $jurados, | 225 | 'jurados' => $jurados, |
| 226 | + 'adicionar_nombres' => $nuevos_nombres, | ||
| 227 | + 'adicionar_institucion' => $nuevos_institucion, | ||
| 228 | + 'adicionar_id' => $nuevos_id, | ||
| 223 | 'ascenso' => $ascensoId | 229 | 'ascenso' => $ascensoId |
| 224 | )); | 230 | )); |
| 225 | 231 |