diff --git a/app/Resources/views/solicitudes/pida.html.twig b/app/Resources/views/solicitudes/pida.html.twig
index f9a3780..5c3c7a0 100644
--- a/app/Resources/views/solicitudes/pida.html.twig
+++ b/app/Resources/views/solicitudes/pida.html.twig
@@ -77,6 +77,8 @@
{{ tarea.pidaTareaEspecifico }}
{% if loop.index == loop.length %}
+
+ {% else %}
+ -
{% endif %}
|
{{ tarea.idPidaPlazo }} |
@@ -201,6 +203,28 @@
$("#id_pida").val($(this).attr('data-id'));
});
+ $('[id^="remove"]').click(function() {
+ var x = confirm("eliminar tarea: " + $(this).attr('data-id'));
+ if(x) {
+ $.ajax({
+ method: "POST",
+ url: "{{ url('ajax_eliminar_tarea') }}",
+ async: true,
+ cache: false,
+ data: ({eliminar: $(this).attr('data-id')}),
+ success: function (data) {
+ console.log(data);
+ location.reload();
+ },
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
+ console.log(errorThrown);
+
+ }
+
+ });
+ }
+ });
+
diff --git a/src/AppBundle/Controller/AjaxController.php b/src/AppBundle/Controller/AjaxController.php
index 07eb571..3f6632a 100644
--- a/src/AppBundle/Controller/AjaxController.php
+++ b/src/AppBundle/Controller/AjaxController.php
@@ -239,10 +239,10 @@ class AjaxController extends Controller {
/**
- * @Route("/ajax/add/tarea", name="ajax_add_tarea")
+ * @Route("/ajax/add/tarea", name="ajax_eliminar_tarea")
* @Method({"POST"})
*/
- public function addTareaAction(Request $request){
+ public function eliminarTareaAction(Request $request){
if($request->isXmlHttpRequest()){
$encoders = array(new JsonEncoder());
@@ -250,26 +250,21 @@ class AjaxController extends Controller {
$serializer = new Serializer($normalizers, $encoders);
- $pida = filter_input(INPUT_POST, 'pida', FILTER_SANITIZE_SPECIAL_CHARS);
+ $id = filter_input(INPUT_POST, 'eliminar', FILTER_SANITIZE_SPECIAL_CHARS);
$em = $this->getDoctrine()->getManager();
- $pida = $em->getRepository("AppBundle:AdscripcionPida")->findOneById($pida);
- var_dump($request->request); exit;
- $pida->addPidaTareaEspecifico($tarea);
- $em->persist($pida);
+ $tarea = $em->getRepository("AppBundle:PidaTareaEspecifico")->findOneById($id);
+ $em->remove($tarea);
$em->flush();
+
+
$response = new JsonResponse();
$response->setStatusCode(200);
$response->setData(array(
- 'response' => 'success',
- 'jurados' => $jurados,
- 'adicionar_nombres' => $nuevos_nombres,
- 'adicionar_institucion' => $nuevos_institucion,
- 'adicionar_id' => $nuevos_id,
- 'ascenso' => $ascensoId
+ 'response' => 'success'
));
return $response;