diff --git a/app/Resources/views/usuarios/index.html.twig b/app/Resources/views/usuarios/index.html.twig index da5680e..b29bf80 100644 --- a/app/Resources/views/usuarios/index.html.twig +++ b/app/Resources/views/usuarios/index.html.twig @@ -20,6 +20,7 @@ Estado Adscripción Escalafón Actual + Tiempo para ascender Acciones @@ -44,6 +45,25 @@ + + {% set time = 0 %} + {% for escalafones in usuario.idRolInstitucion.escalafones | sort %} + {% if loop.last %} + {% for escala in escalas %} + {% if escala.id == (escalafones.idEscala.id + 1) %} + {% set time = date(escalafones.fechaEscala | date_modify("+4 years") |date("m/d/Y")) %} + {% endif %} + {% endfor %} + {% set difference = date(time | date('Y/m/d')).diff(date('now' | date('Y/m/d'))) %} + {% if difference.invert %} + Falta: + {% else %} + desde: + {% endif %} + {{ difference | date("%Y años %m meses %d días") }} + {% endif %} + {% endfor %} + diff --git a/src/AppBundle/Controller/UsuariosController.php b/src/AppBundle/Controller/UsuariosController.php index bddf00c..6e50cac 100644 --- a/src/AppBundle/Controller/UsuariosController.php +++ b/src/AppBundle/Controller/UsuariosController.php @@ -28,9 +28,11 @@ class UsuariosController extends Controller $em = $this->getDoctrine()->getManager(); $usuarios = $em->getRepository('AppBundle:Usuarios')->findAll(); + $escalas = $em->getRepository('AppBundle:Escalafones')->findBy(array(), array('id' => 'ASC')); return $this->render('usuarios/index.html.twig', array( 'usuarios' => $usuarios, + 'escalas' => $escalas )); }