From 276b2330019667a0343a2363cb3e640a3c80a862 Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Mon, 17 Oct 2016 14:13:50 -0400 Subject: [PATCH] creada la interfaz para subir documentos de escala y ser vistos, aprobados por el coordinador --- app/Resources/views/base_app.html.twig | 5 +- .../cea/reconocimiento_escala_mostrar.html.twig | 141 +++++++++++++++ app/Resources/views/cea/servicios.html.twig | 2 + .../solicitudes/reconocimientoEscala.html.twig | 124 +++++++++++++ src/AppBundle/Controller/AscensoController.php | 198 +++++++++++++++++++++ src/AppBundle/Form/ReconocimientoEscalaType.php | 62 +++++++ 6 files changed, 530 insertions(+), 2 deletions(-) create mode 100644 app/Resources/views/cea/reconocimiento_escala_mostrar.html.twig create mode 100644 app/Resources/views/solicitudes/reconocimientoEscala.html.twig create mode 100644 src/AppBundle/Form/ReconocimientoEscalaType.php diff --git a/app/Resources/views/base_app.html.twig b/app/Resources/views/base_app.html.twig index b25babb..2bf5796 100644 --- a/app/Resources/views/base_app.html.twig +++ b/app/Resources/views/base_app.html.twig @@ -60,8 +60,9 @@ {% endif %} diff --git a/app/Resources/views/cea/reconocimiento_escala_mostrar.html.twig b/app/Resources/views/cea/reconocimiento_escala_mostrar.html.twig new file mode 100644 index 0000000..b1defae --- /dev/null +++ b/app/Resources/views/cea/reconocimiento_escala_mostrar.html.twig @@ -0,0 +1,141 @@ +{% extends 'base_app.html.twig' %} +{% block stylesheets %} + {{ parent() }} + +{% endblock %} + +{%block body %} + +
+
+ {% for message in app.session.flashBag.get('notice') %} +

{{ message }}

+ + {%endfor %} +
+
+

Solicitud de Reconocimiento Escala {{servicio.id}}: + {{ servicio.idRolInstitucion.idRol.idPersona.primerNombre }}, + {{ servicio.idRolInstitucion.idRol.idPersona.primerApellido }} +

+
+
+ {% if servicio.idEstatus.id == 1 %} +

Estatus {{servicio.idEstatus}} + {% elseif servicio.idEstatus.id == 3 %} +

Estatus {{servicio.idEstatus}} + {% else %} +

Estatus {{servicio.idEstatus}} + {% endif %} +

+
+ +
+
+ +
+ +
+ +
+ +
+ + + + + {% if escalas is not null %} +
+ + + + + + {% for escala in escalas %} + + + + + + + {%endfor %} +
EscalafónFechaTipo
{{escala.idEscala }}{{escala.fechaEscala | date('d-m-Y') }}{{escala.idTipoEscala }}
+

Tipo de Reconocimiento:{% if not ascenso %} Concurso de oposición {% else %} Ascenso {% endif %}

+
+ {% endif %} + +
+ {% if not ascenso %} + + + {% else %} + + + + {% endif %} +
+
+
+ +
+ +
+ +
+

Documentos Consignados

+
+ + + {% if not ascenso %} +
+
+ + + +
+

Constancia de Aprobación de Concurso.

+
+
+
+ {% else %} + + +
+
+ + + +
+

Constancia de Aprobación de Ascenso.

+
+
+
+ + + + {% endif %} + +
+ +
+ + + +
+ +
+ +
+ +{% endblock %} + + +{% block javascripts %} + {{ parent() }} + + {% endblock %} \ No newline at end of file diff --git a/app/Resources/views/cea/servicios.html.twig b/app/Resources/views/cea/servicios.html.twig index 6d6d766..3bbcb98 100644 --- a/app/Resources/views/cea/servicios.html.twig +++ b/app/Resources/views/cea/servicios.html.twig @@ -76,6 +76,8 @@ {% elseif servicio.idServicioCe.id == 5 %} + {% elseif servicio.idServicioCe.id == 6 %} + {% endif %} diff --git a/app/Resources/views/solicitudes/reconocimientoEscala.html.twig b/app/Resources/views/solicitudes/reconocimientoEscala.html.twig new file mode 100644 index 0000000..db63be7 --- /dev/null +++ b/app/Resources/views/solicitudes/reconocimientoEscala.html.twig @@ -0,0 +1,124 @@ +{% extends 'base_app.html.twig' %} + +{% block stylesheets %} + {{ parent() }} + + +{% endblock %} + + + +{% block body %} +
+

+ Estimado (a) Docente + {{app.user.idRolInstitucion.idRol.idPersona.primerNombre}} + {{app.user.idRolInstitucion.idRol.idPersona.primerApellido}}, + Aqui podra enviar la solicitud de reconocimiento de Escalafon. + +

+
+
+
+

Reconocimiento Escala

+

Por favor adjunte el digital de la aprobación de {{ tipo }}

+ {% form_theme form 'bootstrap_3_layout.html.twig' %} + {{ form_start(form) }} + {{ form_widget(form) }} + {{ form_end(form) }} +
+ +
+ + +{% endblock %} + + + + +{% block javascripts %} + {{ parent() }} + +{% endblock %} diff --git a/src/AppBundle/Controller/AscensoController.php b/src/AppBundle/Controller/AscensoController.php index 568486f..0deb2a6 100644 --- a/src/AppBundle/Controller/AscensoController.php +++ b/src/AppBundle/Controller/AscensoController.php @@ -189,6 +189,127 @@ class AscensoController extends Controller + + + /** + * @Route("/solicitud/reconocimiento/escala", name="cea_solicitud_recocimiento_escala") + */ + public function reconocimientoEscalaAction(Request $request) + { + + + //si ya tiene una solicitud en espera, enviarlo a la pagina de los servicios + $solicitud = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->findOneBy( + array('idRolInstitucion' => $this->getUser()->getIdRolInstitucion(), 'idServicioCe' => 6) + ); + if($solicitud){ + if($solicitud->getIdEstatus()->getId() != 5 ){ + return $this->redirect($this->generateUrl('servicios_index')); + } + } + + $concurso = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneBy( + array('idRolInstitucion' => $this->getUser()->getIdRolInstitucion()) + ); + + + $solicitudAscenso = $this->getDoctrine()->getRepository('AppBundle:Ascenso')->findOneBy( + array( + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion(), + 'idEstatus' => 1 + ) + ); + + $form = $this->createForm('AppBundle\Form\ReconocimientoEscalaType'); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + + $adscripcion = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $constanciaAscenso = $form->get('reconocimiento')->getData(); + + $nombreAscenso = md5(uniqid()).'.'.$constanciaAscenso->guessExtension(); + + // Guardar el archivo y crear la miniatura de cada uno + $constanciaAscenso->move( + $this->container->getParameter('ascenso_directory'), + $nombreAscenso + ); + thumbnail($nombreAscenso, $this->container->getParameter('ascenso_directory'), $this->container->getParameter('ascenso_thumb_directory')); + if (!$concurso->getOposicion()){ + $adscripcion->setOposicion($nombreAscenso); + }else{ + switch ($solicitudAscenso->getIdEscalafones()->getId()){ + case 2: $adscripcion->setAsistente($nombreAscenso); + break; + case 3: $adscripcion->setAsociado($nombreAscenso); + break; + case 4: $adscripcion->setAgregado($nombreAscenso); + break; + case 5: $adscripcion->setTitular($nombreAscenso); + break; + default: + break; + } + + } + + + + //Crear la solicitud de Servicio + $servicios = new DocenteServicio(); + + $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(6)); + $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); + $em = $this->getDoctrine()->getManager(); + $em->persist($servicios); + $em->persist($adscripcion); + + $em->flush(); + return $this->redirect($this->generateUrl('cea_index')); + } + + + if(!$concurso->getOposicion()){ + return $this->render( + 'solicitudes/reconocimientoEscala.html.twig', + array( + 'form' => $form->createView(), + 'tipo' => 'Concurso de Oposición' + ) + ); + } + + + + if(!$solicitudAscenso){ + $this->addFlash('danger', 'Estimado Docente, No posee ninguna solicitud de Ascenso Activa.'); + return $this->redirect($this->generateUrl('cea_index')); + } + + + + + + + return $this->render( + 'solicitudes/reconocimientoEscala.html.twig', + array( + 'form' => $form->createView(), + 'tipo' => 'Ascenso ' . $solicitudAscenso->getIdEscalafones()->getNombre() + ) + ); + + + + + + + } + + + /** * Encuentra y muestra una entidad de tipo Adscripción. * @@ -219,6 +340,46 @@ class AscensoController extends Controller } + + + /** + * Encuentra y muestra una entidad de tipo Adscripción. + * + * @Route("/reconocimientoEscala/{id}", name="cea_reconocimientoEscala_show") + * @Method("GET") + * @Security("has_role('ROLE_COORDINADOR_REGIONAL')") + */ + public function reconocimientoEscalaShowAction(DocenteServicio $servicio) + { + $escala = $this->getDoctrine()->getRepository('AppBundle:DocenteEscala')->findBy(array( + 'idRolInstitucion' => $servicio->getIdRolInstitucion()->getId() + )); + + + $adscripcion = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneByIdRolInstitucion($servicio->getIdRolInstitucion()); + $ascenso = $this->getDoctrine()->getRepository('AppBundle:Ascenso')->findOneByIdRolInstitucion($servicio->getIdRolInstitucion()); + $pida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findOneByIdRolInstitucion($servicio->getIdRolInstitucion()); + + if($ascenso == NULL){ + $escalafones = $this->getDoctrine()->getRepository('AppBundle:Escalafones')->findAll(); + }else{ + $escalafones = $this->getDoctrine()->getRepository('AppBundle:Escalafones')->findOneById($ascenso->getIdEscalafones()->getId()); + } + + + + return $this->render('cea/reconocimiento_escala_mostrar.html.twig', array( + 'ascenso' => $ascenso, + 'adscripcion' => $adscripcion, + 'servicio' => $servicio, + 'escalas' => $escala, + 'pida' => $pida, + 'escalafones' => $escalafones + + )); + } + + /** * Encuentra y muestra una entidad de tipo Adscripción. * @@ -296,6 +457,43 @@ class AscensoController extends Controller + + /** + * Encuentra y muestra una entidad de tipo Adscripción. + * + * @Route("/reconocimiento/escala/{id}/{escala}/{estatus}", name="cea_escala_actualizar") + * @Method({"GET", "POST"}) + * @Security("has_role('ROLE_COORDINADOR_REGIONAL')") + */ + public function actualizarEscalaAction(DocenteServicio $servicio, $escala, $estatus, Request $request) + { + $escala_docente = new DocenteEscala(); + if ($request->getMethod() == 'POST') { + $escala_docente->setIdRolInstitucion($servicio->getIdRolInstitucion()); + $escala_docente->setidEscala($this->getDoctrine()->getRepository('AppBundle:Escalafones')->findOneById($this->get('request')->request->get('escala'))); + $escala_docente->setFechaEscala(new \DateTime($this->get('request')->request->get('fecha_escala'))); + $escala_docente->setIdTipoEscala($this->getDoctrine()->getRepository('AppBundle:TipoAscenso')->findOneById($this->get('request')->request->get('tipo'))); + + + + $em = $this->getDoctrine()->getManager(); + $em->persist($escala_docente); + + $servicio->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4)); + $em->persist($servicio); + + $em->flush(); + } + + + $this->addFlash('success', 'Escala Agregada Satisfactoriamente'); + return $this->redirect($this->generateUrl('cea_index')); + + } + + + + } diff --git a/src/AppBundle/Form/ReconocimientoEscalaType.php b/src/AppBundle/Form/ReconocimientoEscalaType.php new file mode 100644 index 0000000..f62a3d1 --- /dev/null +++ b/src/AppBundle/Form/ReconocimientoEscalaType.php @@ -0,0 +1,62 @@ +add('reconocimiento', FileType::class, array( + 'label' => 'Digital Aprobación de Escala', + 'constraints' => array( + new NotBlank(), + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) + ) + )) + ->add('send', SubmitType::class, array( + 'label' => 'Enviar reconocimiento de Escala', + 'attr' => array('class' => 'btn btn-success btn-block') + )) + + ; + + + } + + + + + + + +} -- 2.0.0