Commit 3724a2c8062fe6eb6480cb3ebc0343e5a61b28d1
1 parent
8832e399be
Exists in
master
muestra cuanto tiempo tiene o le falta para solicitar ascenso a todos los usuarios
Showing
2 changed files
with
22 additions
and
0 deletions
Show diff stats
app/Resources/views/usuarios/index.html.twig
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | <th>Estado</th> |
21 | 21 | <th>Adscripción</th> |
22 | 22 | <th>Escalafón Actual</th> |
23 | + <th>Tiempo para ascender</th> | |
23 | 24 | <th>Acciones</th> |
24 | 25 | </tr> |
25 | 26 | </thead> |
... | ... | @@ -44,6 +45,25 @@ |
44 | 45 | |
45 | 46 | |
46 | 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 | 67 | <td> |
48 | 68 | <a href="{{ path('admin_usuarios_show', { 'id': usuario.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye" ></i></a> |
49 | 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 | 28 | $em = $this->getDoctrine()->getManager(); |
29 | 29 | |
30 | 30 | $usuarios = $em->getRepository('AppBundle:Usuarios')->findAll(); |
31 | + $escalas = $em->getRepository('AppBundle:Escalafones')->findBy(array(), array('id' => 'ASC')); | |
31 | 32 | |
32 | 33 | return $this->render('usuarios/index.html.twig', array( |
33 | 34 | 'usuarios' => $usuarios, |
35 | + 'escalas' => $escalas | |
34 | 36 | )); |
35 | 37 | } |
36 | 38 | ... | ... |