Commit a10b2c527931dc16e2527f86905094d27eea375b
1 parent
b0eb18a10d
Exists in
master
se trabajó con los roles para asegurar la aplicacion, se trabajó con la busqueda…
… de adscripcion por cedula, se mejoraron los mensajes del sistema
Showing
5 changed files
with
193 additions
and
72 deletions
Show diff stats
app/Resources/views/base_app.html.twig
| ... | ... | @@ -7,34 +7,39 @@ |
| 7 | 7 | <link rel="stylesheet" href="{{ asset('assets/vendor/bootstrap/dist/css/bootstrap.min.css') }}"> |
| 8 | 8 | <link rel="stylesheet" href="{{ asset('assets/vendor/font-awesome/css/font-awesome.min.css') }}"> |
| 9 | 9 | <link rel="stylesheet" href="{{ asset('assets/vendor/AppBundle/main.css') }}"> |
| 10 | - | |
| 10 | + <style> | |
| 11 | + .fade.in { | |
| 12 | + opacity: 0.8; | |
| 13 | + background-color:#398439; | |
| 14 | + } | |
| 15 | + </style> | |
| 11 | 16 | {% endblock %} |
| 12 | 17 | <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> |
| 13 | 18 | </head> |
| 14 | 19 | <body data-offset="20" data-target="#navbar"> |
| 15 | 20 | |
| 16 | 21 | {% block navegacion %} |
| 17 | - <nav class="navbar navbar-default"> | |
| 18 | - <div class="container-fluid"> | |
| 19 | - <div class="navbar-header"> | |
| 20 | - <a class="navbar-brand" href="#"> | |
| 21 | - Centro de Estudios Ambientales UBV | |
| 22 | - </a> | |
| 23 | - </div> | |
| 22 | + <nav class="navbar navbar-default"> | |
| 23 | + <div class="container-fluid"> | |
| 24 | + <div class="navbar-header"> | |
| 25 | + <a class="navbar-brand" href="#"> | |
| 26 | + Centro de Estudios Ambientales UBV | |
| 27 | + </a> | |
| 28 | + </div> | |
| 24 | 29 | |
| 25 | - <div class="collapse navbar-collapse"> | |
| 26 | - <ul class="nav navbar-nav navbar-right"> | |
| 27 | - {% if app.user %} | |
| 28 | - <li><a href="#">Bienvenido {{app.user.username}}</a></li> | |
| 29 | - <li><a href="{{path('logout')}}">Salir</a></li> | |
| 30 | - {% endif %} | |
| 31 | - </ul> | |
| 30 | + <div class="collapse navbar-collapse"> | |
| 31 | + <ul class="nav navbar-nav navbar-right"> | |
| 32 | + {% if app.user %} | |
| 33 | + <li><a href="#">Bienvenido {{app.user.username}}</a></li> | |
| 34 | + <li><a href="{{path('logout')}}">Salir</a></li> | |
| 35 | + {% endif %} | |
| 36 | + </ul> | |
| 32 | 37 | |
| 33 | - </div> | |
| 38 | + </div> | |
| 34 | 39 | |
| 35 | - </div> | |
| 40 | + </div> | |
| 36 | 41 | |
| 37 | - </nav> | |
| 42 | + </nav> | |
| 38 | 43 | |
| 39 | 44 | {% endblock %} |
| 40 | 45 | |
| ... | ... | @@ -42,40 +47,82 @@ |
| 42 | 47 | |
| 43 | 48 | {% block submenu %} |
| 44 | 49 | |
| 45 | - <div class="subnavbar"> | |
| 46 | - <div class="subnavbar-inner"> | |
| 47 | - <div class="container"> | |
| 48 | - <ul class="mainnav"> | |
| 49 | - <li {% if (app.request.attributes.get('_route') == 'cea_index') %} class="active" {% endif %}><a href="{{path('cea_index')}}"><i class="fa fa-list"></i><span>Principal</span> </a> </li> | |
| 50 | - {% if is_granted('ROLE_COORDINADOR_NACIONAL') %} | |
| 51 | - <li {% if (app.request.attributes.get('_route') == 'cea_solicitudes') %} class="active" {% endif %}><a href="{{ path('cea_solicitudes')}}"><i class="fa fa-institution"></i><span>Ver Solicitudes</span> </a> </li> | |
| 52 | - {% endif %} | |
| 53 | - {% if is_granted('ROLE_DOCENTE') %} | |
| 54 | - <li class="dropdown"><a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-dashboard"></i><span>Solicitudes</span> <b class="caret"></b></a> | |
| 55 | - <ul class="dropdown-menu"> | |
| 56 | - <li><a href="icons.html">Adscripción</a></li> | |
| 57 | - <li><a href="faq.html">Ascenso</a></li> | |
| 58 | - <li><a href="pricing.html">Tiempo Deuda</a></li> | |
| 59 | - </ul> | |
| 60 | - </li> | |
| 61 | - {% endif %} | |
| 50 | + <div class="subnavbar"> | |
| 51 | + <div class="subnavbar-inner"> | |
| 52 | + <div class="container"> | |
| 53 | + <ul class="mainnav"> | |
| 54 | + <li {% if (app.request.attributes.get('_route') == 'cea_index') %} class="active" {% endif %}><a href="{{path('cea_index')}}"><i class="fa fa-list"></i><span>Principal</span> </a> </li> | |
| 55 | + {% if is_granted('ROLE_COORDINADOR_NACIONAL') %} | |
| 56 | + <li class="dropdown"><a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-dashboard"></i><span>Ver Adscripciones</span> <b class="caret"></b></a> | |
| 57 | + <ul class="dropdown-menu"> | |
| 58 | + <li> <a data-toggle="modal" data-target="#buscarAdscripcion">Buscar Adscripcion</a></li> | |
| 59 | + <li><a href="{{ path('cea_adscripciones')}}">En espera de Aprobación</a></li> | |
| 60 | + <li><a href="{{ path('cea_adscripciones', { 'estatus': 1 })}}">Aprobadas</a></li> | |
| 61 | + <li><a href="{{ path('cea_adscripciones', { 'estatus': 3 })}}">Rechazadas</a></li> | |
| 62 | 62 | </ul> |
| 63 | - </div> | |
| 64 | - <!-- /container --> | |
| 65 | - </div> | |
| 66 | - <!-- /subnavbar-inner --> | |
| 63 | + </li> | |
| 64 | + {% endif %} | |
| 65 | + {% if is_granted('ROLE_ADSCRITO') %} | |
| 66 | + <li class="dropdown"> | |
| 67 | + <a class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-dashboard"></i> | |
| 68 | + <span>Solicitudes</span> <b class="caret"></b> | |
| 69 | + </a> | |
| 70 | + <ul class="dropdown-menu"> | |
| 71 | + <li><a href="icons.html">Adscripción</a></li> | |
| 72 | + <li><a href="faq.html">Ascenso</a></li> | |
| 73 | + <li><a href="pricing.html">Tiempo Deuda</a></li> | |
| 74 | + </ul> | |
| 75 | + </li> | |
| 76 | + {% endif %} | |
| 77 | + </ul> | |
| 67 | 78 | </div> |
| 68 | - <!-- /subnavbar --> | |
| 69 | - | |
| 79 | + <!-- /container --> | |
| 80 | + </div> | |
| 81 | + <!-- /subnavbar-inner --> | |
| 82 | + </div> | |
| 83 | + <!-- /subnavbar --> | |
| 70 | 84 | {% endblock %} |
| 71 | - | |
| 72 | - | |
| 85 | + | |
| 73 | 86 | {% block body %} |
| 87 | + | |
| 74 | 88 | {% endblock %} |
| 75 | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 76 | 92 | {% block javascripts %} |
| 77 | 93 | <script type="text/javascript" src="{{ asset('assets/vendor/jquery/dist/jquery.min.js') }}"></script> |
| 78 | 94 | <script type="text/javascript" src="{{ asset('assets/vendor/bootstrap/dist/js/bootstrap.min.js') }}" ></script> |
| 79 | 95 | {% endblock %} |
| 96 | + | |
| 97 | + | |
| 98 | + <!-- Ventanas Modales --> | |
| 99 | + | |
| 100 | + <!-- Ventana de buscar adscripcion --> | |
| 101 | + <div class="modal fade bs-example-modal-sm" id="buscarAdscripcion" tabindex="-1" role="dialog"> | |
| 102 | + <form action="{{ path('cea_adscripciones') }}" method="post" role="form"> | |
| 103 | + <div class="modal-dialog" role="document"> | |
| 104 | + <div class="modal-content"> | |
| 105 | + <div class="modal-header"> | |
| 106 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 107 | + <h4 class="modal-title" id="myModalLabel">Cédula o Número de Adscripción a buscar...</h4> | |
| 108 | + </div> | |
| 109 | + <div class="modal-body"> | |
| 110 | + | |
| 111 | + <div class="form-group"> | |
| 112 | + <label for="numero">Cédula del Docente o Número de Adscripción:</label> | |
| 113 | + <input type="number" class="form-control" id="docente" name="docente" value="" /> | |
| 114 | + </div> | |
| 115 | + | |
| 116 | + </div> | |
| 117 | + <div class="modal-footer"> | |
| 118 | + <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button> | |
| 119 | + <button class="btn btn-primary" type="submit">Buscar Adscripcion</button> | |
| 120 | + </div> | |
| 121 | + </div> | |
| 122 | + </div> | |
| 123 | + </form> | |
| 124 | + </div><!-- Fin de la ventanta modal buscar adscripcion --> | |
| 125 | + | |
| 126 | + | |
| 80 | 127 | </body> |
| 81 | 128 | </html> | ... | ... |
app/Resources/views/cea/index.html.twig
| ... | ... | @@ -4,7 +4,12 @@ |
| 4 | 4 | <div class="main"> |
| 5 | 5 | |
| 6 | 6 | <div class="main-inner"> |
| 7 | - <div class="container"> | |
| 7 | + <div class="container"> | |
| 8 | + | |
| 9 | + {% for message in app.session.flashBag.get('danger') %} | |
| 10 | + <div class="alert alert-danger">{{ message }}</div> | |
| 11 | + {%endfor %} | |
| 12 | + | |
| 8 | 13 | {% if not adscrito %} |
| 9 | 14 | <div class="alert alert-info"> |
| 10 | 15 | <button type="button" class="close" data-dismiss="alert">×</button> | ... | ... |
app/Resources/views/cea/solicitudes.html.twig
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <div class="container"> |
| 5 | 5 | <div class="widget widget-table action-table"> |
| 6 | 6 | <div class="widget-header"> <i class="icon-th-list"></i> |
| 7 | - <h3>Listado de solicitudes de Adscripción Al CEA</h3> | |
| 7 | + <h3>Listado de Adscripciones: Estatus {{ estatus_adscripciones }}</h3> | |
| 8 | 8 | </div> |
| 9 | 9 | <!-- /widget-header --> |
| 10 | 10 | <div class="widget-content"> | ... | ... |
app/Resources/views/cea/solicitudes_mostar.html.twig
| ... | ... | @@ -5,35 +5,53 @@ |
| 5 | 5 | {% endblock %} |
| 6 | 6 | |
| 7 | 7 | {%block body %} |
| 8 | - {% for message in app.session.flashBag.get('notice') %} | |
| 9 | - <div class="alert alert-success">{{ message }}</div> | |
| 10 | 8 | |
| 11 | - {%endfor %} | |
| 12 | 9 | <div class="content-wrapper"> |
| 13 | 10 | <div class="container"> |
| 11 | + {% for message in app.session.flashBag.get('notice') %} | |
| 12 | + <h4 class="alert alert-success">{{ message }}</h4> | |
| 13 | + | |
| 14 | + {%endfor %} | |
| 14 | 15 | <div class="row"> |
| 15 | - <div class="col-md-12"> | |
| 16 | - <h4 class="page-head-line">Solicitud de Adscripción número <code>{{adscripcion.id}}</code>: {{ adscripcion.idRolInstitucion.idRol.idPersona.primerNombre }}, {{ adscripcion.idRolInstitucion.idRol.idPersona.primerApellido }} </h4> | |
| 17 | - | |
| 16 | + <div class="col-md-9"> | |
| 17 | + <h4 class="page-head-line">Solicitud de Adscripción número <code>{{adscripcion.id}}</code>: | |
| 18 | + {{ adscripcion.idRolInstitucion.idRol.idPersona.primerNombre }}, | |
| 19 | + {{ adscripcion.idRolInstitucion.idRol.idPersona.primerApellido }} | |
| 20 | + </h4> | |
| 21 | + </div> | |
| 22 | + <div class="col-md-3"> | |
| 23 | + {% if adscripcion.idEstatus.id == 1 %} | |
| 24 | + <h4 class="alert alert-success">Estatus <strong>{{adscripcion.idEstatus}}</strong> | |
| 25 | + {% elseif adscripcion.idEstatus.id == 3 %} | |
| 26 | + <h4 class="alert alert-danger">Estatus <strong>{{adscripcion.idEstatus}}</strong> | |
| 27 | + {% else %} | |
| 28 | + <h4 class="alert alert-warning">Estatus <strong>{{adscripcion.idEstatus}}</strong> | |
| 29 | + {% endif %} | |
| 30 | + </h4> | |
| 18 | 31 | </div> |
| 19 | 32 | |
| 20 | 33 | </div> |
| 21 | 34 | <div class="row"> |
| 22 | - | |
| 35 | + {% if adscripcion.postgrado is null %} | |
| 36 | + <div class="form-group"> | |
| 37 | + <h4 class="alert alert-warning">El Docente al momento de la solicitud informa no haber realizado Concurso de oposición</h4> | |
| 38 | + </div> | |
| 39 | + {% endif %} | |
| 23 | 40 | <div class="col-md-6"> |
| 24 | 41 | |
| 25 | 42 | <div class="col-md-4"> |
| 26 | 43 | <img src="{{ asset('bundles/framework/images/portal/logo_ubv.png') }}" /> |
| 27 | 44 | </div> |
| 28 | 45 | |
| 29 | - <div class="col-md-8"> | |
| 46 | + <div class="col-md-8"> | |
| 47 | + | |
| 30 | 48 | <form action="{{ path('login') }}" method="post" role="form" > |
| 31 | 49 | |
| 32 | 50 | <div class="form-group"> |
| 33 | 51 | <label for="username">Fecha de Ingreso UBV:</label> |
| 34 | 52 | <input type="date" class="form-control" id="username" name="primerApellido" value="{{ adscripcion.fechaIngreso|date('Y-m-d') }}" /> |
| 35 | 53 | </div> |
| 36 | - | |
| 54 | + {% if escalas is not null %} | |
| 37 | 55 | <div class="form-group"> |
| 38 | 56 | <label for="Escalafones">Escalafones:</label> |
| 39 | 57 | <table class="table table-striped table-bordered"> |
| ... | ... | @@ -48,9 +66,12 @@ |
| 48 | 66 | <td>{{escala.idTipoEscala }}</td> |
| 49 | 67 | </tr> |
| 50 | 68 | {%endfor %} |
| 51 | - </table> | |
| 69 | + </table> | |
| 52 | 70 | |
| 53 | 71 | </div> |
| 72 | + {% endif %} | |
| 73 | + | |
| 74 | + | |
| 54 | 75 | {% if adscripcion.idLineaInvestigacion is not null %} |
| 55 | 76 | <div class="form-group"> |
| 56 | 77 | <label for="username">Area y Línea de Investigación:</label> |
| ... | ... | @@ -60,19 +81,18 @@ |
| 60 | 81 | </ul> |
| 61 | 82 | </div> |
| 62 | 83 | {% endif %} |
| 63 | - | |
| 84 | + | |
| 85 | + | |
| 86 | + {% if adscripcion.tituloTrabajo is not null %} | |
| 64 | 87 | <div class="form-group"> |
| 65 | 88 | <label for="titulo">Título del Trabajo:</label> |
| 66 | 89 | <input type="text" class="form-control" value="{{adscripcion.tituloTrabajo}}" /> |
| 67 | - | |
| 68 | - | |
| 69 | 90 | </div> |
| 70 | - | |
| 71 | - | |
| 72 | - | |
| 91 | + {% endif %} | |
| 92 | + | |
| 73 | 93 | |
| 74 | - <a class="btn btn-primary" href="{{ path('cea_solicitudes_actualizar', { 'id': adscripcion.id, 'estatus' : 'true' }) }}" ><span class="fa fa-check"></span> Aprobar</a> | |
| 75 | - <a class="btn btn-danger" href="{{ path('cea_solicitudes_actualizar', { 'id': adscripcion.id, 'estatus' : 'false' }) }}" ><span class="fa fa-close"></span> Rechazar</a> | |
| 94 | + <a class="btn btn-success btn-sm" href="{{ path('cea_solicitudes_actualizar', { 'id': adscripcion.id, 'estatus' : 'true' }) }}" ><span class="fa fa-check"></span> Aprobar</a> | |
| 95 | + <a class="btn btn-danger btn-sm" href="{{ path('cea_solicitudes_actualizar', { 'id': adscripcion.id, 'estatus' : 'false' }) }}" ><span class="fa fa-close"></span> Rechazar</a> | |
| 76 | 96 | </form> |
| 77 | 97 | <hr /> |
| 78 | 98 | </div> | ... | ... |
src/AppBundle/Controller/AppController.php
| ... | ... | @@ -11,6 +11,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
| 11 | 11 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
| 12 | 12 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; |
| 13 | 13 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
| 14 | +use Symfony\Component\HttpFoundation\Request; | |
| 14 | 15 | |
| 15 | 16 | use AppBundle\Entity\Adscripcion; |
| 16 | 17 | |
| ... | ... | @@ -50,17 +51,57 @@ class AppController extends Controller { |
| 50 | 51 | /** |
| 51 | 52 | * Pagina principal de inicio de la session Docente. |
| 52 | 53 | * |
| 53 | - * @Route("/solicitudes", name="cea_solicitudes") | |
| 54 | - * @Method("GET") | |
| 54 | + * @Route("/solicitudes/adscripcion/{estatus}", name="cea_adscripciones") | |
| 55 | + * @Method({"GET", "POST"}) | |
| 55 | 56 | * @Security("has_role('ROLE_COORDINADOR_NACIONAL')") |
| 56 | 57 | */ |
| 57 | - public function verSolicitudesAction() | |
| 58 | + public function verSolicitudesAction($estatus = 2, Request $request) | |
| 58 | 59 | { |
| 59 | 60 | |
| 60 | - $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findBy(array('idEstatus' => 2)); | |
| 61 | - | |
| 61 | + if ($request->getMethod() != 'POST') { | |
| 62 | + $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findBy(array('idEstatus' => $estatus)); | |
| 63 | + switch ($estatus){ | |
| 64 | + case 1: | |
| 65 | + $mensaje = "activas"; | |
| 66 | + break; | |
| 67 | + case 2: | |
| 68 | + $mensaje = "en espera"; | |
| 69 | + break; | |
| 70 | + case 3: | |
| 71 | + $mensaje = "rechazadas"; | |
| 72 | + break; | |
| 73 | + } | |
| 74 | + }else{ | |
| 75 | + | |
| 76 | + $persona = $this->getDoctrine()->getRepository('AppBundle:Persona') | |
| 77 | + ->findOneByCedulaPasaporte($request->get('docente')); | |
| 78 | + | |
| 79 | + if (!$persona) { | |
| 80 | + $this->addFlash('danger', 'Docente ' . $request->get('docente') . ' no Registrado en la Base de Datos del Centro de Estudios.'); | |
| 81 | + return $this->render('cea/index.html.twig', array ( | |
| 82 | + 'adscrito' => true | |
| 83 | + )); | |
| 84 | + } | |
| 85 | + | |
| 86 | + //1. obtener el rol-institucion-persona | |
| 87 | + $rol = $this->getDoctrine()->getRepository( | |
| 88 | + 'AppBundle:RolInstitucion')->findOneByIdRol( | |
| 89 | + $this->getDoctrine()->getRepository( | |
| 90 | + 'AppBundle:Rol')->findOneByIdPersona($persona)); | |
| 91 | + | |
| 92 | + //si no existe el rol del docente, enviar correo al encargado de la región para verificar. | |
| 93 | + if (!$rol) { | |
| 94 | + $this->addFlash('danger', 'Docente no Registrado en la Base de Datos del Centro de Estudios. Por Favor'); | |
| 95 | + return $this->render('cea/index.html.twig'); | |
| 96 | + } | |
| 97 | + | |
| 98 | + | |
| 99 | + $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findByIdRolInstitucion($rol->getId()); | |
| 100 | + $mensaje = "Busqueda : " . $request->get('docente'); | |
| 101 | + } | |
| 62 | 102 | return $this->render('cea/solicitudes.html.twig', array( |
| 63 | - 'adscripciones' => $adscripciones | |
| 103 | + 'adscripciones' => $adscripciones, | |
| 104 | + 'estatus_adscripciones' => $mensaje | |
| 64 | 105 | )); |
| 65 | 106 | } |
| 66 | 107 | |
| ... | ... | @@ -95,11 +136,19 @@ class AppController extends Controller { |
| 95 | 136 | |
| 96 | 137 | $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneById($adscripcion->getId()); |
| 97 | 138 | |
| 98 | - if($estatus) $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); | |
| 99 | - else $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); | |
| 139 | + if($estatus == "true") { | |
| 140 | + $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); | |
| 141 | + $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); | |
| 142 | + $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); | |
| 143 | + }else{ | |
| 144 | + $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); | |
| 145 | + $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); | |
| 146 | + $user->removeRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); | |
| 147 | + } | |
| 100 | 148 | |
| 101 | 149 | $em = $this->getDoctrine()->getManager(); |
| 102 | 150 | $em->persist($adscripciones); |
| 151 | + $em->persist($user); | |
| 103 | 152 | $em->flush(); |
| 104 | 153 | |
| 105 | 154 | $this->addFlash('notice', 'Solicitud Actualizada Correctamente'); | ... | ... |