Commit d79af0c276794cabb3fd89d728f20ae3f8a97ca9

Authored by Gedeson Wasley
1 parent e5538be5
Exists in master and in 1 other branch 3.1

Correções de exclusões

src/Cacic/CommonBundle/Controller/SoftwareEstacaoController.php
... ... @@ -45,7 +45,7 @@ class SoftwareEstacaoController extends Controller
45 45 $this->get('session')->getFlashBag()->add('success', 'Dados salvos com sucesso!');
46 46  
47 47 return $this->redirect(
48   - $this->generateUrl( 'cacic_software_estacao_editar',
  48 + $this->generateUrl( 'cacic_software_estacao_index',
49 49 array(
50 50 'idComputador' => $SoftwareEstacao->getIdComputador()->getIdComputador(),
51 51 'idSoftware' => $SoftwareEstacao->getIdSoftware()->getIdSoftware()
... ... @@ -105,6 +105,7 @@ class SoftwareEstacaoController extends Controller
105 105 */
106 106 public function excluirAction( Request $request )
107 107 {
  108 +
108 109 if ( ! $request->isXmlHttpRequest() ) // Verifica se se trata de uma requisição AJAX
109 110 throw $this->createNotFoundException( 'Página não encontrada' );
110 111  
... ...
src/Cacic/CommonBundle/Controller/UorgTypeController.php
... ... @@ -70,26 +70,27 @@ class UorgTypeController extends Controller
70 70 /**
71 71 *
72 72 * [AJAX] Remove a UNIDADE ORGANIZACIONAL INFORMADA E TODAS AS UNIDADES A ELA RELACIONADAS
73   - * @param int $idUorg
  73 + * @param int $idTipoUorg
74 74 * @param Symfony\Component\HttpFoundation\Request $request
75 75 */
76 76 public function excluirAction( Request $request )
77 77 {
78   - //Debug::dump($request->get('id'));die;
79   -/*
  78 + //Debug::dump($request->get('idUorgType'));die;
  79 +
80 80 if ( ! $request->isXmlHttpRequest() ) // Verifica se se trata de uma requisição AJAX
81   - throw $this->createNotFoundException( 'Página não encontrada' );*/
82   -
83   - $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( (int)$request->get('id') );
  81 + throw $this->createNotFoundException( 'Página não encontrada' );
  82 +
  83 + $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( $request->get('id') );
84 84 if ( ! $uorg )
85 85 throw $this->createNotFoundException( 'Unidade Organizacional não encontrada' );
86   -
  86 +
87 87 $em = $this->getDoctrine()->getManager();
88 88 $em->remove( $uorg );
89 89 $em->flush();
90   - $this->get('session')->getFlashBag()->add('error', 'Item excluído com sucesso!');
91 90  
92   - return $this->redirect($this->generateUrl('cacic_uorg_type_index') );
  91 + $response = new Response( json_encode( array('status' => 'ok') ) );
  92 + $response->headers->set('Content-Type', 'application/json');
93 93  
  94 + return $response;
94 95 }
95 96 }
96 97 \ No newline at end of file
... ...
src/Cacic/CommonBundle/Resources/views/SoftwareEstacao/index.html.twig
... ... @@ -48,9 +48,9 @@
48 48 <i class="btn-icon-only icon-edit icon-large"></i>
49 49 </a>
50 50  
51   - <a href="{{ path('cacic_software_estacao_excluir') }}"
52   - class="btn btn-small btn-danger bt-excluir-compositekey"
53   - data-composite-keys="{'idComputador': {{ software['idComputador'] }}, 'idSoftware': {{ software['idSoftware'] }}}"
  51 + <a href="{{ path('cacic_software_estacao_excluir') }}"
  52 + class="btn btn-small btn-danger bt-excluir-compositekey"
  53 + data-composite-keys='{"idComputador": {{ software['idComputador'] }}, "idSoftware": {{ software['idSoftware'] }}}'
54 54 title="{{ "Excluir Item"|trans }}"
55 55 >
56 56 <i class="btn-icon-only icon-trash icon-large"></i>
... ...
src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig
... ... @@ -27,14 +27,14 @@
27 27 </thead>
28 28 <tbody>
29 29 {% for uorg in uorgTypes %}
30   - <tr>
  30 + <tr id="item_{{ uorg.idTipoUorg }}" class="{{ cycle(['row0', 'row1'], loop.index) }}">
31 31 <td>{{ uorg.nmTipoUorg }}</td>
32 32 <td>{{ uorg.tedescricao }}</td>
33   - <td>
  33 + <td style="text-align: center" class="td-actions">
34 34 <a href="{{ path('cacic_uorg_type_cadastrar', {'idUorgType': uorg.idTipoUorg }) }}" class="btn btn-small" title="{{ "Editar Item"|trans }}">
35 35 <i class="btn-icon-only icon-edit icon-large"></i>
36 36 </a>
37   - <a href="{{ path('cacic_uorg_type_excluir', {'id': uorg.idTipoUorg }) }}" class="btn btn-small btn-danger btn-excluir" title="{{ "Excluir Item"|trans }}" onClick="return confirm('Tem certeza que deseja excluir esse registro?')">
  37 + <a href="{{ path('cacic_uorg_type_excluir') }}" class="btn btn-small btn-danger bt-excluir" title="{{ "Excluir Item"|trans }}">
38 38 <i class="btn-icon-only icon-trash icon-large"></i>
39 39 </a>
40 40 </td>
... ... @@ -80,7 +80,7 @@
80 80 };
81 81 $( "#System_Excluir" ).data( 'params', { 'url': url, 'id': uorgId, 'callback': callback } ).dialog( "open" );
82 82 }
83   -
  83 +
84 84 </script>
85 85  
86 86 {% endblock %}
... ...