Commit 1e8e3249f3d0abb67b57bf2011286f432836aafb
1 parent
dd222cdb2b
Exists in
master
creada a traves de los listeners el fomulario de envio de documentos rechazados,…
… se creo su servicio y solo muestra los que le faltan al docente; así como tambien se realizó el guardado
Showing
5 changed files
with
174 additions
and
99 deletions
Show diff stats
app/Resources/views/base_app.html.twig
app/Resources/views/solicitudes/adscripcion_show.twig
... | ... | @@ -125,8 +125,6 @@ |
125 | 125 | </div> |
126 | 126 | |
127 | 127 | </div> |
128 | - <form action="{{ path('cea_solicitudes_actualizar', { 'id': todo.adscripcion.id}) }}" method="POST" | |
129 | - name="rechazar"> | |
130 | 128 | <div class="row"> |
131 | 129 | |
132 | 130 | <div class="col-md-6"> |
... | ... | @@ -141,7 +139,7 @@ |
141 | 139 | <div class="form-group"> |
142 | 140 | <label for="username">Fecha de Ingreso UBV:</label> |
143 | 141 | <input type="date" class="form-control" id="username" name="primerApellido" |
144 | - value="{{ todo.adscripcion.fechaIngreso|date('Y-m-d') }}"/> | |
142 | + value="{{ todo.adscripcion.fechaIngreso|date('Y-m-d') }}" readonly/> | |
145 | 143 | </div> |
146 | 144 | {% if todo.escalafones is not null %} |
147 | 145 | <div class="form-group"> |
... | ... | @@ -189,73 +187,46 @@ |
189 | 187 | <div class="form-group"> |
190 | 188 | <label for="titulo">Título del Trabajo:</label> |
191 | 189 | <input type="text" class="form-control" |
192 | - value="{{ todo.adscripcion.tituloTrabajo }}"/> | |
190 | + value="{{ todo.adscripcion.tituloTrabajo }}" readonly/> | |
193 | 191 | </div> |
194 | 192 | {% endif %} |
195 | 193 | |
196 | 194 | </div> |
197 | 195 | </div> |
198 | 196 | <div class="col-md-5"> |
199 | - <h3>Documentos Consignados</h3> | |
200 | - | |
197 | + <h4>Documentos en <span style="color: red;">Rojo</span> (rechazados), en <span style="color: green;">verde</span> (aprobados)</h4> | |
201 | 198 | <div class="widget-content"> |
202 | 199 | |
203 | - {% for verificado in todo.documentosVerificados %} | |
200 | + {% for verificado in todo.documentosVerificados | sort %} | |
204 | 201 | {% if verificado.idServicio.id == servicio.id %} |
205 | - {% set extension = verificado.ubicacion | split('.') | last %} | |
206 | - <div {% if extension != "pdf" %}class="col-xs-6"{% else %}class="col-xs-12"{% endif %}> | |
207 | - | |
208 | - <div class="thumbnail"> | |
209 | - {% if extension == "pdf" %} | |
210 | - {% if verificado.idTipoDocumentos.id <= 4 %} | |
211 | - <object type="application/pdf" data="{{asset('uploads/adscripcion/'~ verificado.ubicacion)}}" width="100%" height="300px"></object> | |
212 | - {% else %} | |
213 | - <object type="application/pdf" data="{{asset('uploads/ascenso/'~ verificado.ubicacion)}}" width="100%" height="300px"></object> | |
214 | - {% endif %} | |
215 | - {% else %} | |
216 | - {% if verificado.idTipoDocumentos.id <= 4 %} | |
217 | - <a href="{{ asset('uploads/adscripcion/'~ verificado.ubicacion) }}" | |
218 | - data-lightbox="adscripcion"> | |
219 | - <img src="{{ asset('uploads/adscripcion/thumb/'~ verificado.ubicacion) }}"/> | |
220 | - </a> | |
221 | - {% else %} | |
222 | - <a href="{{ asset('uploads/ascenso/'~ verificado.ubicacion) }}" | |
223 | - data-lightbox="adscripcion"> | |
224 | - <img src="{{ asset('uploads/ascenso/thumb/'~ verificado.ubicacion) }}"/> | |
225 | - </a> | |
226 | - {% endif %} | |
227 | - {% endif %} | |
228 | - | |
229 | - <div class="caption"> | |
230 | - <p>{{ verificado.idTipoDocumentos.nombre }}</p> | |
231 | - {% if verificado.idEstatus.id == 2 or verificado.idEstatus.id == 3 %} | |
232 | - <div class="wrapper"> | |
233 | - <label for="yes_radio{{ loop.index }}" class="yes-lbl"><i class="fa fa-check"></i> | |
234 | - </label> | |
235 | - <input type="radio" value="1" name="{{ verificado.idTipoDocumentos.identificador }}" class="yes_radio" id="yes_radio{{ loop.index }}" {% if verificado.idEstatus.id == 1 %} checked="checked" {% endif %}> | |
236 | - <label for="maybe_radio{{ loop.index }}" class="maybe-lbl"> | |
237 | - <i class="fa fa-question"></i> | |
238 | - </label> | |
239 | - <input type="radio" value="" name="{{ verificado.idTipoDocumentos.identificador }}" class="maybe_radio" id="maybe_radio{{ loop.index }}" {% if verificado.idEstatus.id == 2 %} checked="checked" {% endif %} disabled> | |
240 | - <label for="no_radio{{ loop.index }}" class="no-lbl"><i | |
241 | - class="fa fa-close"></i></label><input type="radio" value="3" | |
242 | - name="{{ verificado.idTipoDocumentos.identificador }}" | |
243 | - class="no_radio" | |
244 | - id="no_radio{{ loop.index }}" {% if verificado.idEstatus.id == 3 %} checked="checked" {% endif %}> | |
245 | - | |
246 | - <div class="toggle"></div> | |
247 | - </div> | |
248 | - {% endif %} | |
249 | - </div> | |
250 | - {% endif %} | |
251 | - </div> | |
252 | - | |
253 | - </div> | |
202 | + {% if verificado.idEstatus.id == 3 %} | |
203 | + {% if verificado.idTipoDocumentos.id <= 4 %} | |
204 | + <a style="color:red;" target="_blank" href="{{ asset('uploads/adscripcion/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a><br> | |
205 | + {% else %} | |
206 | + <a style="color:red;" target="_blank" href="{{ asset('uploads/ascenso/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a><br> | |
207 | + {% endif %} | |
208 | + | |
209 | + {% elseif verificado.idEstatus.id == 1 %} | |
210 | + {% if verificado.idTipoDocumentos.id <= 4 %} | |
211 | + <a style="color:green;" target="_blank" href="{{ asset('uploads/adscripcion/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a><br> | |
212 | + {% else %} | |
213 | + <a style="color:green;" target="_blank" href="{{ asset('uploads/ascenso/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a> | |
214 | + {% endif %} | |
215 | + {% else %} | |
216 | + {% if verificado.idTipoDocumentos.id <= 4 %} | |
217 | + <a target="_blank" style="color:yellow;" href="{{ asset('uploads/adscripcion/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a><br> | |
218 | + {% else %} | |
219 | + <a style="color:yellow;" target="_blank" href="{{ asset('uploads/ascenso/' ~ verificado.ubicacion) }}">{{ verificado.idTipoDocumentos.nombre }}</a> | |
220 | + {% endif %} | |
221 | + {% endif %} | |
222 | + {% endif %} | |
254 | 223 | |
255 | 224 | {% endfor %} |
256 | 225 | |
257 | - | |
258 | - | |
226 | + {% form_theme form 'bootstrap_3_layout.html.twig' %} | |
227 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }} | |
228 | + {{ form_widget(form) }} | |
229 | + {{ form_end(form) }} | |
259 | 230 | |
260 | 231 | |
261 | 232 | |
... | ... | @@ -285,47 +256,14 @@ |
285 | 256 | </div> |
286 | 257 | {% endif %} |
287 | 258 | {% if servicio.idEstatus.id == 3 %} |
288 | - <button type="submit" class="btn btn-success" id="aprobar" name="aprobar">Aprobar</button> | |
289 | - {% elseif servicio.idEstatus.id == 2 %} | |
290 | - <button type="submit" class="btn btn-success" id="aprobar" name="aprobar">Aprobar</button> | |
291 | - <a data-toggle="modal" data-target="#motivo_rechazo" class="btn btn-danger">Rechazar</a> | |
259 | + <button type="submit" class="btn btn-success" id="actualizar" name="actualizar">Actualizar Adscripción</button> | |
292 | 260 | {% endif %} |
293 | 261 | |
294 | 262 | |
295 | - <!-- Modal --> | |
296 | - <div class="modal fade" id="motivo_rechazo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
297 | - <div class="modal-dialog" role="document"> | |
298 | - | |
299 | - <div class="modal-content"> | |
300 | - <div class="modal-header"> | |
301 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span | |
302 | - aria-hidden="true">×</span></button> | |
303 | - <h4 class="modal-title" id="myModalLabel">Rechazo de Solicitud</h4> | |
304 | - </div> | |
305 | - | |
306 | - <div class="modal-body"> | |
307 | - | |
308 | - | |
309 | - <div class="form-group"> | |
310 | - <label for="message-text" class="control-label">Mensaje:</label> | |
311 | - <textarea class="form-control" id="message-text" name="message-text"></textarea> | |
312 | - </div> | |
313 | - | |
314 | - </div> | |
315 | - <div class="modal-footer"> | |
316 | - <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |
317 | - <button type="submit" class="btn btn-primary" name="rechazar" id="rechazar">Enviar | |
318 | - Correo | |
319 | - </button> | |
320 | - </div> | |
321 | - </div> | |
322 | - | |
323 | - </div> | |
324 | - </div> | |
325 | 263 | </div> |
326 | 264 | |
327 | 265 | </div> |
328 | - </form> | |
266 | + | |
329 | 267 | {% endblock %} |
330 | 268 | |
331 | 269 | ... | ... |
app/config/services.yml
... | ... | @@ -4,6 +4,8 @@ parameters: |
4 | 4 | # parameter_name: value |
5 | 5 | |
6 | 6 | services: |
7 | -# service_name: | |
8 | -# class: AppBundle\Directory\ClassName | |
9 | -# arguments: ["@another_service_name", "plain_value", "%parameter_name%"] | |
7 | + app.form.adscripcion_edit: | |
8 | + class: AppBundle\Form\AdscripcionEditType | |
9 | + arguments: ['@security.token_storage'] | |
10 | + tags: | |
11 | + - { name: form.type } | ... | ... |
src/AppBundle/Controller/AdscripcionController.php
... | ... | @@ -578,20 +578,58 @@ class AdscripcionController extends Controller |
578 | 578 | * Encuentra y muestra una entidad de tipo Adscripción para los docentes. |
579 | 579 | * |
580 | 580 | * @Route("/adscripcion_show/{id}", name="adscripcion_show") |
581 | - * @Method("GET") | |
581 | + * @Method({"GET", "POST"}) | |
582 | 582 | * |
583 | 583 | */ |
584 | - public function adscripcionShowAction(DocenteServicio $servicio) | |
584 | + public function adscripcionShowAction(DocenteServicio $servicio, Request $request) | |
585 | 585 | { |
586 | 586 | $em = $this->getDoctrine()->getManager(); |
587 | 587 | $todo = $em->getRepository("AppBundle:RolInstitucion")->findOneById($servicio->getIdRolInstitucion()); |
588 | 588 | |
589 | + $form = $this->createForm('AppBundle\Form\AdscripcionEditType'); | |
590 | + | |
591 | + | |
592 | + | |
593 | + $form->handleRequest($request); | |
594 | + | |
595 | + | |
596 | + if ($form->isSubmitted() && $form->isValid()) { | |
597 | + | |
598 | + foreach ($form->getData() as $key => $value) { | |
599 | + | |
600 | + //var_dump($key); exit; | |
601 | + $constancia = $form->get($key)->getData(); | |
602 | + $nombre = md5(uniqid()).'.'.$constancia->guessExtension(); | |
603 | + $constancia->move( | |
604 | + $this->container->getParameter('adscripcion_directory'), | |
605 | + $nombre | |
606 | + ); | |
607 | + thumbnail($nombre, $this->container->getParameter('adscripcion_directory'), $this->container->getParameter('adscripcion_thumb_directory')); | |
608 | + | |
609 | + $documento = $this->getDoctrine()->getRepository("AppBundle:DocumentosVerificados")->findOneBy(array( | |
610 | + 'idRolInstitucion' => $servicio->getIdRolInstitucion()->getId(), | |
611 | + 'idTipoDocumentos' => $this->getDoctrine()->getRepository("AppBundle:TipoDocumentos")->findOneByIdentificador($key)->getId(), | |
612 | + 'idEstatus' => 3 | |
613 | + )); | |
614 | + | |
615 | + $documento->setUbicacion($nombre); | |
616 | + $documento->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(2)); | |
617 | + $em = $this->getDoctrine()->getManager(); | |
618 | + $em->persist($documento); | |
619 | + $em->flush(); | |
620 | + } | |
621 | + | |
622 | + | |
623 | + | |
624 | + return $this->redirect($this->generateUrl('adscripcion_show', array('id' => $servicio->getId()))); | |
625 | + } | |
589 | 626 | |
590 | 627 | |
591 | 628 | return $this->render('solicitudes/adscripcion_show.twig', array( |
592 | 629 | 'servicio' => $servicio, |
593 | 630 | 'servicio' => $servicio, |
594 | - 'todo' => $todo | |
631 | + 'todo' => $todo, | |
632 | + 'form' => $form->createView() | |
595 | 633 | )); |
596 | 634 | } |
597 | 635 | ... | ... |
src/AppBundle/Form/AdscripcionEditType.php
... | ... | @@ -0,0 +1,91 @@ |
1 | +<?php | |
2 | +/** | |
3 | + * Created by Netbeans. | |
4 | + * User: Wilmer Ramones | |
5 | + * Date: 29/06/16 | |
6 | + * Time: 09:07 AM | |
7 | + * Modificado: 07/07/2016 | |
8 | + */ | |
9 | + | |
10 | +namespace AppBundle\Form; | |
11 | + | |
12 | + | |
13 | +use Symfony\Component\Form\AbstractType; | |
14 | +use Symfony\Component\Form\Extension\Core\Type\FileType; | |
15 | +use Symfony\Component\Form\FormBuilderInterface; | |
16 | +use Symfony\Component\Form\FormEvents; | |
17 | +use Symfony\Component\Form\FormEvent; | |
18 | +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | |
19 | +use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
20 | +use Symfony\Component\Validator\Constraints\File; | |
21 | +use Symfony\Component\Validator\Constraints\NotBlank; | |
22 | + | |
23 | +class AdscripcionEditType extends AbstractType | |
24 | +{ | |
25 | + | |
26 | + private $tokenStorage; | |
27 | + | |
28 | + public function __construct(TokenStorageInterface $tokenStorage) | |
29 | + { | |
30 | + $this->tokenStorage = $tokenStorage; | |
31 | + } | |
32 | + | |
33 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
34 | + { | |
35 | + // grab the user, do a quick sanity check that one exists | |
36 | + $user = $this->tokenStorage->getToken()->getUser(); | |
37 | + if (!$user) { | |
38 | + throw new \LogicException( | |
39 | + 'The FriendMessageFormType cannot be used without an authenticated user!' | |
40 | + ); | |
41 | + } | |
42 | + | |
43 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($user) { | |
44 | + | |
45 | + $form = $event->getForm(); | |
46 | + $existe = false; | |
47 | + foreach ($user->getIdRolInstitucion()->getDocumentosVerificados() as $documentos){ | |
48 | + if($documentos->getIdServicio()->getIdServicioCe()->getId() == 2 && $documentos->getIdEstatus()->getId() == 3){ | |
49 | + $existe = true; | |
50 | + $form->add($documentos->getIdTipoDocumentos()->getIdentificador(), FileType::class, array( | |
51 | + 'label' => $documentos->getIdTipoDocumentos()->getNombre(), | |
52 | + 'constraints' => array( | |
53 | + new NotBlank(), | |
54 | + new File(array( | |
55 | + 'maxSize' => '1024K', | |
56 | + 'mimeTypes' => [ | |
57 | + 'application/pdf', | |
58 | + 'application/x-pdf', | |
59 | + 'image/png', | |
60 | + 'image/jpg', | |
61 | + 'image/jpeg' | |
62 | + ], | |
63 | + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' | |
64 | + )) | |
65 | + ) | |
66 | + )); | |
67 | + | |
68 | + | |
69 | + } | |
70 | + | |
71 | + } | |
72 | + if($existe){ | |
73 | + $form->add('send', SubmitType::class, array( | |
74 | + 'label' => 'Reenviar Documentos Rechazados', | |
75 | + 'attr' => array( | |
76 | + 'class' => 'btn btn-success btn-block', | |
77 | + 'data-loading-text' => "<i class='fa fa-circle-o-notch fa-spin'></i> Procesando Solicitud..." | |
78 | + ) | |
79 | + )); | |
80 | + } | |
81 | + | |
82 | + | |
83 | + }); | |
84 | + | |
85 | + } | |
86 | + | |
87 | + | |
88 | + | |
89 | + | |
90 | + | |
91 | +} | ... | ... |