Commit 130bd10b4b6d8d34d9f7cbd3834502fdff2d585b

Authored by Wilmer Ramones
1 parent 91bbebb4b6
Exists in master

calcualdo el tiempo desde el ultimo escalafon y cuanto le hace falta para solici…

…tar el nuevo escalafón y se muestra en pantalla si le falta o si ya puede y cuanto ese ese tiempo.
app/Resources/views/cea/index.html.twig
... ... @@ -27,6 +27,21 @@
27 27 </div>
28 28 {%endif %}
29 29 <div class="row">
  30 + {% if tiempoProxEscalafon %}
  31 + {% if suffix == '' %}
  32 + <h4 class="alert alert-info">
  33 + Estimado docente, le recordamos que para solicitar ascenso aun le faltan:
  34 + {% else %}
  35 + <h4 class="alert alert-warning">
  36 + Estimado docente ya tiene el tiempo para solicitar ascenso desde hace:
  37 + {% endif %}
  38 + <strong>
  39 + {% if tiempoProxEscalafon.y > 0 %} {{ tiempoProxEscalafon.y }} año/s {% endif %}
  40 + {% if tiempoProxEscalafon.m > 0 %} {{ tiempoProxEscalafon.m }} mes/es y {% endif %}
  41 + {% if tiempoProxEscalafon.d > 0 %} {{ tiempoProxEscalafon.d }} día/s {% endif %}
  42 + </strong>
  43 + </h4>
  44 + {% endif %}
30 45 <div class="col-md-6">
31 46 <div class="widget widget-nopad">
32 47 <div class="widget-header"> <i class="fa fa-list-alt"></i>
... ... @@ -38,7 +53,9 @@
38 53 <div class="widget-content">
39 54  
40 55 <h6 class="bigstats">
41   - Estimado Docente, le damos la más cordial bienvenida al Sistema del Centro de Estudios Ambientales (CEA) de la Universidad Bolivariana de Venezuela (UBV) CEA@UBV.
  56 + Estimado Docente, le damos la más cordial bienvenida al Sistema del
  57 + Centro de Estudios Ambientales (CEA) de la Universidad Bolivariana
  58 + de Venezuela (UBV) CEA@UBV.
42 59  
43 60 </h6>
44 61  
... ...
src/AppBundle/Controller/AppController.php
... ... @@ -62,9 +62,10 @@ class AppController extends Controller {
62 62 $escalafones = $this->getDoctrine()->getRepository("AppBundle:Escalafones")->findOneById($escalafon->getIdEscala()->getId() + 1); //tiempo para el proximo escalafon
63 63 if($escalafones){
64 64 //tiempo para el prox escalafon
65   - $tiempoProxEscalafon = $escalafon->getFechaEscala()->modify('+4 years');
66   - $tiempoTranscurrido = $tiempoProxEscalafon->diff(new \DateTime("now"));
67   - var_dump($tiempoTranscurrido); exit;
  65 + $tiempoProxEscalafon = $escalafon->getFechaEscala()->modify('+' . $escalafones->getTiempo() . 'years');
  66 + $hoy = new \DateTime("now");
  67 + $tiempoTranscurrido = $hoy->diff($tiempoProxEscalafon);
  68 + $suffix = ( $tiempoTranscurrido->invert ? ' ago' : '' );
68 69 }
69 70 }
70 71  
... ... @@ -76,7 +77,9 @@ class AppController extends Controller {
76 77 if($adscripcion->getIdEstatus()->getId() == 1) $adscrito = true;
77 78  
78 79 return $this->render('cea/index.html.twig', array (
79   - 'adscrito' => $adscrito
  80 + 'adscrito' => $adscrito,
  81 + 'tiempoProxEscalafon' => $tiempoTranscurrido,
  82 + 'suffix' => $suffix
80 83 ));
81 84 }
82 85  
... ...