Commit 3f3fb8d128cca4af3790352afc9daf9cfc2b5b0f
1 parent
7c64c6581f
Exists in
master
formalizar el PIDA para ser revisado
Showing
2 changed files
with
76 additions
and
4 deletions
Show diff stats
app/Resources/views/solicitudes/pida.html.twig
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | </h4> |
37 | 37 | </div> |
38 | 38 | <div class="row"> |
39 | + {% if servicio.idEstatus.id == 2 %} | |
39 | 40 | <div class="col-md-4"> |
40 | 41 | |
41 | 42 | |
... | ... | @@ -51,14 +52,19 @@ |
51 | 52 | </ul> |
52 | 53 | |
53 | 54 | <button type="submit" class="btn btn-success">Añadir</button> |
54 | - <button type="submit" class="btn btn-primary">Añadir y Finalizar</button> | |
55 | + | |
55 | 56 | {{ form_end(form) }} |
56 | 57 | </div> |
57 | 58 | |
58 | 59 | </div> |
59 | 60 | </div> |
61 | + {% endif %} | |
60 | 62 | {% if pida %} |
63 | + {% if servicio.idEstatus.id == 2 %} | |
61 | 64 | <div class="col-md-7"> |
65 | + {% else %} | |
66 | + <div class="col-md-11"> | |
67 | + {% endif %} | |
62 | 68 | <div class="account-container register"> |
63 | 69 | <div class="content clearfix"> |
64 | 70 | <h2>Mi pida <span class="small" style="float: right;"> Estatus: {{ servicio.idEstatus }}</span></h2> |
... | ... | @@ -94,7 +100,7 @@ |
94 | 100 | <tr> |
95 | 101 | <td rowspan="{{ pid.pidaTareaEspecifico | length }}"> |
96 | 102 | {{ pid.idPlanHistoricoNacionalEstrategico.nombre }} |
97 | - <a data-id="{{ pid.id }}" id="delete{{ pid.id }}" class="btn btn-xs btn-danger">-</a> | |
103 | + {% if servicio.idEstatus.id == 2 %}<a data-id="{{ pid.id }}" id="delete{{ pid.id }}" class="btn btn-xs btn-danger">-</a>{% endif %} | |
98 | 104 | </td> |
99 | 105 | <td rowspan="{{ pid.pidaTareaEspecifico | length }}"> |
100 | 106 | {{ pid.idActividadDocente.nombre }} |
... | ... | @@ -103,9 +109,9 @@ |
103 | 109 | {% for tarea in pid.pidaTareaEspecifico | sort %} |
104 | 110 | <td>{{ tarea.pidaTareaEspecifico }} |
105 | 111 | {% if loop.index == loop.length %} |
106 | - <a data-id="{{ pid.id }}" id="add_actividad{{ pid.id }}" data-toggle="modal" data-target="#nueva_actividad" class="btn btn-xs btn-warning">+</a> | |
112 | + {% if servicio.idEstatus.id == 2 %}<a data-id="{{ pid.id }}" id="add_actividad{{ pid.id }}" data-toggle="modal" data-target="#nueva_actividad" class="btn btn-xs btn-warning">+</a>{% endif %} | |
107 | 113 | {% else %} |
108 | - <a data-id="{{ tarea.id }}" id="remove{{ tarea.id }}" class="btn btn-xs btn-danger">-</a> | |
114 | + {% if servicio.idEstatus.id == 2 %}<a data-id="{{ tarea.id }}" id="remove{{ tarea.id }}" class="btn btn-xs btn-danger">-</a>{% endif %} | |
109 | 115 | {% endif %} |
110 | 116 | </td> |
111 | 117 | <td>{{ tarea.idPidaPlazo }}</td> |
... | ... | @@ -120,8 +126,11 @@ |
120 | 126 | </tr> |
121 | 127 | {% endfor %} |
122 | 128 | </table> |
129 | + {% if servicio.idEstatus.id == 2 %}<button id="finalizarPida" data-servicio="{{ servicio.id }}" class="btn btn-primary">Finalizar PIDA</button>{% endif %} | |
123 | 130 | </div> |
131 | + | |
124 | 132 | </div> |
133 | + | |
125 | 134 | </div> |
126 | 135 | {% endif %} |
127 | 136 | |
... | ... | @@ -309,6 +318,30 @@ |
309 | 318 | } |
310 | 319 | }); |
311 | 320 | |
321 | + $('#finalizarPida').click(function() { | |
322 | + var x = confirm("Desea terminal la edición y Finalizar su pida?"); | |
323 | + if(x) { | |
324 | + $.ajax({ | |
325 | + method: "POST", | |
326 | + url: "{{ url('ajax_finalizar_pida') }}", | |
327 | + async: true, | |
328 | + cache: false, | |
329 | + data: ({finalizar: $(this).attr('data-servicio')}), | |
330 | + success: function (data) { | |
331 | + console.log(data); | |
332 | + location.reload(); | |
333 | + }, | |
334 | + error: function (XMLHttpRequest, textStatus, errorThrown) { | |
335 | + console.log(errorThrown); | |
336 | + | |
337 | + } | |
338 | + | |
339 | + }); | |
340 | + } | |
341 | + }); | |
342 | + | |
343 | + | |
344 | + | |
312 | 345 | $('[id^="estatus"]').click(function() { |
313 | 346 | alert("presionado: " + $(this).attr('data-id')) |
314 | 347 | $("#id_estatus").val($(this).attr('data-id')); | ... | ... |
src/AppBundle/Controller/AjaxController.php
... | ... | @@ -311,6 +311,45 @@ class AjaxController extends Controller { |
311 | 311 | |
312 | 312 | } |
313 | 313 | |
314 | + | |
315 | + | |
316 | + /** | |
317 | + * @Route("/ajax/finalizar/pida", name="ajax_finalizar_pida") | |
318 | + * @Method({"POST"}) | |
319 | + */ | |
320 | + public function finalizarPidaAction(Request $request){ | |
321 | + | |
322 | + if($request->isXmlHttpRequest()){ | |
323 | + $encoders = array(new JsonEncoder()); | |
324 | + $normalizers = array(new ObjectNormalizer()); | |
325 | + | |
326 | + $serializer = new Serializer($normalizers, $encoders); | |
327 | + | |
328 | + $id = filter_input(INPUT_POST, 'finalizar', FILTER_SANITIZE_SPECIAL_CHARS); | |
329 | + | |
330 | + | |
331 | + $em = $this->getDoctrine()->getManager(); | |
332 | + $servicio = $em->getRepository("AppBundle:DocenteServicio")->findOneById($id); | |
333 | + $servicio->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(4)); | |
334 | + $em->persist($servicio); | |
335 | + $em->flush(); | |
336 | + | |
337 | + | |
338 | + | |
339 | + | |
340 | + $response = new JsonResponse(); | |
341 | + $response->setStatusCode(200); | |
342 | + $response->setData(array( | |
343 | + 'response' => 'success' | |
344 | + )); | |
345 | + | |
346 | + return $response; | |
347 | + | |
348 | + | |
349 | + } | |
350 | + | |
351 | + } | |
352 | + | |
314 | 353 | |
315 | 354 | |
316 | 355 | /** | ... | ... |