Commit 3724a2c8062fe6eb6480cb3ebc0343e5a61b28d1

Authored by Wilmer
1 parent 8832e399be
Exists in master

muestra cuanto tiempo tiene o le falta para solicitar ascenso a todos los usuarios

app/Resources/views/usuarios/index.html.twig
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 <th>Estado</th> 20 <th>Estado</th>
21 <th>Adscripción</th> 21 <th>Adscripción</th>
22 <th>Escalafón Actual</th> 22 <th>Escalafón Actual</th>
  23 + <th>Tiempo para ascender</th>
23 <th>Acciones</th> 24 <th>Acciones</th>
24 </tr> 25 </tr>
25 </thead> 26 </thead>
@@ -44,6 +45,25 @@ @@ -44,6 +45,25 @@
44 45
45 46
46 </td> 47 </td>
  48 + <td>
  49 + {% set time = 0 %}
  50 + {% for escalafones in usuario.idRolInstitucion.escalafones | sort %}
  51 + {% if loop.last %}
  52 + {% for escala in escalas %}
  53 + {% if escala.id == (escalafones.idEscala.id + 1) %}
  54 + {% set time = date(escalafones.fechaEscala | date_modify("+4 years") |date("m/d/Y")) %}
  55 + {% endif %}
  56 + {% endfor %}
  57 + {% set difference = date(time | date('Y/m/d')).diff(date('now' | date('Y/m/d'))) %}
  58 + {% if difference.invert %}
  59 + Falta:
  60 + {% else %}
  61 + desde:
  62 + {% endif %}
  63 + {{ difference | date("%Y años %m meses %d días") }}
  64 + {% endif %}
  65 + {% endfor %}
  66 + </td>
47 <td> 67 <td>
48 <a href="{{ path('admin_usuarios_show', { 'id': usuario.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye" ></i></a> 68 <a href="{{ path('admin_usuarios_show', { 'id': usuario.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye" ></i></a>
49 <a href="{{ path('admin_usuarios_edit', { 'id': usuario.id }) }}" class="btn btn-xs btn-primary"><i class="fa fa-edit"></i></a> 69 <a href="{{ path('admin_usuarios_edit', { 'id': usuario.id }) }}" class="btn btn-xs btn-primary"><i class="fa fa-edit"></i></a>
src/AppBundle/Controller/UsuariosController.php
@@ -28,9 +28,11 @@ class UsuariosController extends Controller @@ -28,9 +28,11 @@ class UsuariosController extends Controller
28 $em = $this->getDoctrine()->getManager(); 28 $em = $this->getDoctrine()->getManager();
29 29
30 $usuarios = $em->getRepository('AppBundle:Usuarios')->findAll(); 30 $usuarios = $em->getRepository('AppBundle:Usuarios')->findAll();
  31 + $escalas = $em->getRepository('AppBundle:Escalafones')->findBy(array(), array('id' => 'ASC'));
31 32
32 return $this->render('usuarios/index.html.twig', array( 33 return $this->render('usuarios/index.html.twig', array(
33 'usuarios' => $usuarios, 34 'usuarios' => $usuarios,
  35 + 'escalas' => $escalas
34 )); 36 ));
35 } 37 }
36 38