Commit 920d3e4181cdd176b7c5af9936cdbd743317b440

Authored by wilmer
1 parent 6031902c8a
Exists in master

aparece el texto para poder añadir tutores faltantes de los 6 que necesita

app/Resources/views/cea/ascenso_mostar.html.twig
... ... @@ -2,10 +2,11 @@
2 2 {% block stylesheets %}
3 3 {{ parent() }}
4 4 <link href="{{ asset('assets/vendor/lightbox2/dist/css/lightbox.css') }}" rel="stylesheet">
  5 + <link rel="stylesheet" href="{{ asset('assets/vendor/chosen/chosen.min.css') }}">
5 6 {% endblock %}
6 7  
7 8 {%block body %}
8   -
  9 + {% set cantidadJurado = 6 %}
9 10 <div class="content-wrapper">
10 11 <div class="container">
11 12 {% for message in app.session.flashBag.get('notice') %}
... ... @@ -25,10 +26,9 @@
25 26 <h4 class="alert alert-danger">Estatus <strong>{{servicio.idEstatus}}</strong>
26 27 {% else %}
27 28 <h4 class="alert alert-warning">Estatus <strong>{{servicio.idEstatus}}</strong>
28   - {% endif %}
29   - </h4>
  29 + {% endif %}
  30 + </h4>
30 31 </div>
31   -
32 32 </div>
33 33 <div class="row">
34 34  
... ... @@ -45,7 +45,7 @@
45 45  
46 46 {% if escalas is not null %}
47 47 <div class="form-group">
48   - <label for="Escalafones">Escalafones Obtenidos:</label>
  48 + <label for="Escalafones">{{ cantidadJurado }}Escalafones Obtenidos:</label>
49 49 <table class="table table-striped table-bordered">
50 50 <th>Escalafón</th>
51 51 <th>Fecha</th>
... ... @@ -60,17 +60,36 @@
60 60 {%endfor %}
61 61 </table>
62 62  
63   - <p ><strong>Escalafón Solicita:</strong> {{ ascenso.idEscalafones.nombre }} </p>
  63 + <p><strong>Escalafón Solicita:</strong> {{ ascenso.idEscalafones.nombre }} </p>
64 64  
65 65 <h4>Jurados propuestos por el Docente</h4>
  66 + {% set añadirJurado = true %}
  67 + {% set cantidadJurado = 6 %}
66 68 {% for tutor in ascenso.tutoresAscenso %}
  69 + {% if loop.length >= 5 %}
  70 + {% set añadirJurado = false %}
  71 + {% else %}
  72 + {% set cantidadJurado = cantidadJurado - loop.index %}
  73 + {% endif %}
67 74 <p class="well">
  75 +
68 76 <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong>
69 77 {{ tutor.institucion }} -> {{ tutor.idEscala.nombre }}
70 78 <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor">
71   - <input type="button" class="btn btn-danger btn-xs" value="cam" id="cambiar_tutor">
  79 + <input type="button" class="btn btn-danger btn-xs" value="cam" id="cambiar_tutor">
72 80 </p>
73 81 {% endfor %}
  82 + {% if añadirJurado %}
  83 + {{ dump(cantidadJurado) }}
  84 + <p id="falta" class="label label-danger" data-faltaid = '{{cantidadJurado}}'>
  85 + El docente no tiene o le faltó completar posibles jurados
  86 + </p>
  87 + {% form_theme form 'bootstrap_3_layout.html.twig' %}
  88 + {{ form_start(form) }}
  89 + {{ form_widget(form) }}
  90 + {{ form_end(form) }}
  91 + <button class="btn btn-primary btn-sm" id="añadirJurados">Añadir Jurados</button>
  92 + {% endif %}
74 93  
75 94  
76 95 </div>
... ... @@ -247,12 +266,28 @@
247 266  
248 267 {% block javascripts %}
249 268 {{ parent() }}
  269 + <script type="text/javascript" src="{{ asset('assets/vendor/chosen/chosen.jquery.min.js') }}"></script>
250 270 <script type="text/javascript" src="{{ asset('assets/vendor/lightbox2/dist/js/lightbox.min.js') }}"></script>
251 271  
252 272 <script>
  273 + var cantidad = $("#falta").data('faltaid');
  274 + alert(cantidad);
253 275 $("#actualizar_tutor").click(function(){
254 276 alert("click");
255 277 });
  278 +
  279 + $("#aadd_tutor_tutores_ascenso").on("chosen:ready", function() {
  280 + $("#add_tutor_tutores_ascenso").chosen('destroy').chosen({ max_selected_options: 2 });
  281 + });
  282 +
  283 +
  284 + $("#add_tutor_tutores_ascenso").chosen({
  285 + no_results_text: "<a data-toggle='modal' data-target='#buscarTutores' href='#'>Tutor no registrado, click aquí para registrar!</a>",
  286 + max_selected_options: cantidad
  287 +
  288 + });
  289 +
  290 +
256 291  
257 292  
258 293 </script>
... ...
src/AppBundle/Controller/AscensoController.php
... ... @@ -398,7 +398,7 @@ class AscensoController extends Controller
398 398  
399 399  
400 400 /**
401   - * Encuentra y muestra una entidad de tipo Adscripción.
  401 + * Encuentra y muestra una entidad de tipo Ascenso.
402 402 *
403 403 * @Route("/ascenso/{id}", name="cea_ascenso_show")
404 404 * @Method("GET")
... ... @@ -421,13 +421,16 @@ class AscensoController extends Controller
421 421 'idRolInstitucion' => $servicio->getIdRolInstitucion(),
422 422 'idServicioCe' => 1
423 423 ));
  424 +
  425 + $form = $this->createForm('AppBundle\Form\AddTutorType');
424 426  
425 427 return $this->render('cea/ascenso_mostar.html.twig', array(
426 428 'ascenso' => $ascenso,
427 429 'servicio' => $servicio,
428 430 'escalas' => $escala,
429 431 'pida' => $pida,
430   - 'antiguedad' => $antiguedad
  432 + 'antiguedad' => $antiguedad,
  433 + 'form' => $form->createView(),
431 434 ));
432 435 }
433 436  
... ...
src/AppBundle/Form/AddTutorType.php
... ... @@ -0,0 +1,49 @@
  1 +<?php
  2 +/**
  3 + * Created by Netbeans.
  4 + * User: Wilmer Ramones
  5 + * Date: 29/06/16
  6 + * Time: 09:07 AM
  7 + * Modificado: 07/07/2016
  8 + */
  9 +
  10 +namespace AppBundle\Form;
  11 +
  12 +
  13 +
  14 +use Symfony\Component\Form\AbstractType;
  15 +use Symfony\Component\Form\FormBuilderInterface;
  16 +
  17 +
  18 +use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  19 +use Doctrine\ORM\EntityRepository;
  20 +
  21 +class AddTutorType extends AbstractType
  22 +{
  23 + public function buildForm(FormBuilderInterface $builder, array $options)
  24 + {
  25 + $builder
  26 +
  27 +
  28 +
  29 + ->add('tutores_ascenso', EntityType::class, array(
  30 + 'placeholder' => 'Añadir Posibles Jurados...',
  31 + 'class' => 'AppBundle:TutoresAscenso',
  32 + 'required' => false,
  33 + 'label' => 'Asignar Jurados',
  34 + 'multiple' => true,
  35 + 'group_by' => 'institucion',
  36 + ))
  37 +
  38 +
  39 +
  40 +
  41 + ;
  42 +
  43 +
  44 + }
  45 +
  46 +
  47 +
  48 +
  49 +}
... ...