Commit 4481b9507d9b6cf98bf4df78f0f0e91d5d09ddec
1 parent
b8951ec0
Exists in
master
and in
1 other branch
Exclusão de tipo UORG
Showing
3 changed files
with
13 additions
and
15 deletions
Show diff stats
src/Cacic/CommonBundle/Controller/UorgTypeController.php
| ... | ... | @@ -73,23 +73,23 @@ class UorgTypeController extends Controller |
| 73 | 73 | * @param int $idUorg |
| 74 | 74 | * @param Symfony\Component\HttpFoundation\Request $request |
| 75 | 75 | */ |
| 76 | - public function excluirAction( $idUorg, Request $request ) | |
| 76 | + public function excluirAction( Request $request ) | |
| 77 | 77 | { |
| 78 | + //Debug::dump($request->get('id'));die; | |
| 79 | +/* | |
| 78 | 80 | if ( ! $request->isXmlHttpRequest() ) // Verifica se se trata de uma requisição AJAX |
| 79 | - throw $this->createNotFoundException( 'Página não encontrada' ); | |
| 81 | + throw $this->createNotFoundException( 'Página não encontrada' );*/ | |
| 80 | 82 | |
| 81 | - $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( $request->get('id') ); | |
| 83 | + $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( (int)$request->get('id') ); | |
| 82 | 84 | if ( ! $uorg ) |
| 83 | 85 | throw $this->createNotFoundException( 'Unidade Organizacional não encontrada' ); |
| 84 | 86 | |
| 85 | 87 | $em = $this->getDoctrine()->getManager(); |
| 86 | 88 | $em->remove( $uorg ); |
| 87 | 89 | $em->flush(); |
| 88 | - | |
| 89 | - $response = new Response( json_encode( array('status' => 'ok') ) ); | |
| 90 | - $response->headers->set('Content-Type', 'application/json'); | |
| 91 | - | |
| 92 | - return $response; | |
| 90 | + $this->get('session')->getFlashBag()->add('error', 'Item excluído com sucesso!'); | |
| 91 | + | |
| 92 | + return $this->redirect($this->generateUrl('cacic_uorg_type_index') ); | |
| 93 | + | |
| 93 | 94 | } |
| 94 | - | |
| 95 | 95 | } |
| 96 | 96 | \ No newline at end of file | ... | ... |
src/Cacic/CommonBundle/Resources/config/routing.yml
| ... | ... | @@ -488,10 +488,8 @@ cacic_uorg_type_cadastrar: |
| 488 | 488 | defaults: { _controller: CacicCommonBundle:UorgType:cadastrar, idUorgType: null} |
| 489 | 489 | |
| 490 | 490 | cacic_uorg_type_excluir: |
| 491 | - pattern: /uorg/type/excluir/{idUorgType} | |
| 492 | - defaults: { _controller: CacicCommonBundle:UorgType:excluir, idUorgType: null} | |
| 493 | - requirements: | |
| 494 | - idUorgType: \d+ | |
| 491 | + pattern: /uorg/type/excluir | |
| 492 | + defaults: { _controller: CacicCommonBundle:UorgType:excluir} | |
| 495 | 493 | |
| 496 | 494 | cacic_grupo_usuario_index: |
| 497 | 495 | pattern: /grupousuario/{page} | ... | ... |
src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig
| ... | ... | @@ -34,7 +34,7 @@ |
| 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', {'idUorgType': uorg.idTipoUorg}) }}" class="btn btn-small btn-danger bt-excluir" title="{{ "Excluir Item"|trans }}"> | |
| 37 | + <a href="{{ path('cacic_uorg_type_excluir', {'id': uorg.idTipoUorg }) }}" class="btn btn-small btn-danger btn-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 %} | ... | ... |