Commit 3f3fb8d128cca4af3790352afc9daf9cfc2b5b0f

Authored by Wilmer
1 parent 7c64c6581f
Exists in master

formalizar el PIDA para ser revisado

app/Resources/views/solicitudes/pida.html.twig
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 </h4> 36 </h4>
37 </div> 37 </div>
38 <div class="row"> 38 <div class="row">
  39 + {% if servicio.idEstatus.id == 2 %}
39 <div class="col-md-4"> 40 <div class="col-md-4">
40 41
41 42
@@ -51,14 +52,19 @@ @@ -51,14 +52,19 @@
51 </ul> 52 </ul>
52 53
53 <button type="submit" class="btn btn-success">Añadir</button> 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 {{ form_end(form) }} 56 {{ form_end(form) }}
56 </div> 57 </div>
57 58
58 </div> 59 </div>
59 </div> 60 </div>
  61 + {% endif %}
60 {% if pida %} 62 {% if pida %}
  63 + {% if servicio.idEstatus.id == 2 %}
61 <div class="col-md-7"> 64 <div class="col-md-7">
  65 + {% else %}
  66 + <div class="col-md-11">
  67 + {% endif %}
62 <div class="account-container register"> 68 <div class="account-container register">
63 <div class="content clearfix"> 69 <div class="content clearfix">
64 <h2>Mi pida <span class="small" style="float: right;"> Estatus: {{ servicio.idEstatus }}</span></h2> 70 <h2>Mi pida <span class="small" style="float: right;"> Estatus: {{ servicio.idEstatus }}</span></h2>
@@ -94,7 +100,7 @@ @@ -94,7 +100,7 @@
94 <tr> 100 <tr>
95 <td rowspan="{{ pid.pidaTareaEspecifico | length }}"> 101 <td rowspan="{{ pid.pidaTareaEspecifico | length }}">
96 {{ pid.idPlanHistoricoNacionalEstrategico.nombre }} 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 </td> 104 </td>
99 <td rowspan="{{ pid.pidaTareaEspecifico | length }}"> 105 <td rowspan="{{ pid.pidaTareaEspecifico | length }}">
100 {{ pid.idActividadDocente.nombre }} 106 {{ pid.idActividadDocente.nombre }}
@@ -103,9 +109,9 @@ @@ -103,9 +109,9 @@
103 {% for tarea in pid.pidaTareaEspecifico | sort %} 109 {% for tarea in pid.pidaTareaEspecifico | sort %}
104 <td>{{ tarea.pidaTareaEspecifico }} 110 <td>{{ tarea.pidaTareaEspecifico }}
105 {% if loop.index == loop.length %} 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 {% else %} 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 {% endif %} 115 {% endif %}
110 </td> 116 </td>
111 <td>{{ tarea.idPidaPlazo }}</td> 117 <td>{{ tarea.idPidaPlazo }}</td>
@@ -120,8 +126,11 @@ @@ -120,8 +126,11 @@
120 </tr> 126 </tr>
121 {% endfor %} 127 {% endfor %}
122 </table> 128 </table>
  129 + {% if servicio.idEstatus.id == 2 %}<button id="finalizarPida" data-servicio="{{ servicio.id }}" class="btn btn-primary">Finalizar PIDA</button>{% endif %}
123 </div> 130 </div>
  131 +
124 </div> 132 </div>
  133 +
125 </div> 134 </div>
126 {% endif %} 135 {% endif %}
127 136
@@ -309,6 +318,30 @@ @@ -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 $('[id^="estatus"]').click(function() { 345 $('[id^="estatus"]').click(function() {
313 alert("presionado: " + $(this).attr('data-id')) 346 alert("presionado: " + $(this).attr('data-id'))
314 $("#id_estatus").val($(this).attr('data-id')); 347 $("#id_estatus").val($(this).attr('data-id'));
src/AppBundle/Controller/AjaxController.php
@@ -311,6 +311,45 @@ class AjaxController extends Controller { @@ -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 /**