Commit c4489191a96868d09331476ed2dd236541b3e29f
1 parent
cb25f94c
Exists in
master
and in
7 other branches
Conversão do formulário de cadastro de usuários para bootstrap
Showing
7 changed files
with
100 additions
and
27 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin1/dicionario/usuarios.js
| @@ -47,7 +47,7 @@ i3GEOadmin.usuarios.dicionario = { | @@ -47,7 +47,7 @@ i3GEOadmin.usuarios.dicionario = { | ||
| 47 | es : "" | 47 | es : "" |
| 48 | } ], | 48 | } ], |
| 49 | 'enviaSenha' : [ { | 49 | 'enviaSenha' : [ { |
| 50 | - pt : "enviar senha", | 50 | + pt : "enviar senha por e-mail", |
| 51 | en : "", | 51 | en : "", |
| 52 | es : "" | 52 | es : "" |
| 53 | } ], | 53 | } ], |
admin1/usuarios/cadastro/exec.php
| @@ -32,7 +32,8 @@ $funcoesEdicao = array ( | @@ -32,7 +32,8 @@ $funcoesEdicao = array ( | ||
| 32 | "ADICIONARUSUARIO", | 32 | "ADICIONARUSUARIO", |
| 33 | "ALTERARUSUARIO", | 33 | "ALTERARUSUARIO", |
| 34 | "ADICIONAPAPELUSUARIO", | 34 | "ADICIONAPAPELUSUARIO", |
| 35 | - "EXCLUIRUSUARIO" | 35 | + "EXCLUIRUSUARIO", |
| 36 | + "ENVIARSENHA" | ||
| 36 | ); | 37 | ); |
| 37 | if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) { | 38 | if (in_array ( strtoupper ( $funcao ), $funcoesEdicao )) { |
| 38 | if (verificaOperacaoSessao ( "admin/html/usuarios" ) == false) { | 39 | if (verificaOperacaoSessao ( "admin/html/usuarios" ) == false) { |
| @@ -45,11 +46,10 @@ $funcao = strtoupper ( $funcao ); | @@ -45,11 +46,10 @@ $funcao = strtoupper ( $funcao ); | ||
| 45 | // converte os parametros de definicao dos papeis em um array | 46 | // converte os parametros de definicao dos papeis em um array |
| 46 | if ($funcao == "ADICIONARUSUARIO" || $funcao == "ALTERARUSUARIO") { | 47 | if ($funcao == "ADICIONARUSUARIO" || $funcao == "ALTERARUSUARIO") { |
| 47 | $papeis = array (); | 48 | $papeis = array (); |
| 48 | - $papeis [] = 1; // admin | ||
| 49 | foreach ( array_keys ( $_POST ) as $k ) { | 49 | foreach ( array_keys ( $_POST ) as $k ) { |
| 50 | $teste = explode ( "-", $k ); | 50 | $teste = explode ( "-", $k ); |
| 51 | - if ($teste [0] == "id_papel") { | ||
| 52 | - $papeis [] = $teste [1] * 1; | 51 | + if ($teste[0] == "id_papel") { |
| 52 | + $papeis[] = $teste[1] * 1; | ||
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | array_unique ( $papeis ); | 55 | array_unique ( $papeis ); |
| @@ -64,6 +64,13 @@ switch ($funcao) { | @@ -64,6 +64,13 @@ switch ($funcao) { | ||
| 64 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 64 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
| 65 | exit (); | 65 | exit (); |
| 66 | } | 66 | } |
| 67 | + if(strtolower($enviaSenha) == "on"){ | ||
| 68 | + if($senha == "" || $email == ""){ | ||
| 69 | + $dados = header ( "HTTP/1.1 500 para enviar a senha é necessário preencher o valor de senha e e-mail" ); | ||
| 70 | + } else { | ||
| 71 | + $dados = enviarSenha( $senha, $email ); | ||
| 72 | + } | ||
| 73 | + } | ||
| 67 | retornaJSON ( $dados ); | 74 | retornaJSON ( $dados ); |
| 68 | } else { | 75 | } else { |
| 69 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 76 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
| @@ -83,6 +90,13 @@ switch ($funcao) { | @@ -83,6 +90,13 @@ switch ($funcao) { | ||
| 83 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 90 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
| 84 | exit (); | 91 | exit (); |
| 85 | } | 92 | } |
| 93 | + if(strtolower($enviaSenha) == "on"){ | ||
| 94 | + if($senha == "" || $email == ""){ | ||
| 95 | + $dados = header ( "HTTP/1.1 500 para enviar a senha é necessário preencher o valor de senha e e-mail" ); | ||
| 96 | + } else { | ||
| 97 | + $dados = enviarSenha( $senha, $email ); | ||
| 98 | + } | ||
| 99 | + } | ||
| 86 | retornaJSON ( $dados ); | 100 | retornaJSON ( $dados ); |
| 87 | exit (); | 101 | exit (); |
| 88 | break; | 102 | break; |
| @@ -100,23 +114,23 @@ switch ($funcao) { | @@ -100,23 +114,23 @@ switch ($funcao) { | ||
| 100 | // pega os papeis registrados para cada operacao | 114 | // pega os papeis registrados para cada operacao |
| 101 | $p = array (); | 115 | $p = array (); |
| 102 | foreach ( $papeis as $papel ) { | 116 | foreach ( $papeis as $papel ) { |
| 103 | - if ($papel ["id_usuario"] == $usuario ["id_usuario"]) { | ||
| 104 | - $p [$papel ["id_papel"]] = $papel; | 117 | + if ($papel["id_usuario"] == $usuario["id_usuario"]) { |
| 118 | + $p[$papel["id_papel"]] = $papel; | ||
| 105 | } | 119 | } |
| 106 | } | 120 | } |
| 107 | - $usuarios ["papeis"] = $p; | ||
| 108 | - $o [] = $usuario; | 121 | + $usuario["papeis"] = $p; |
| 122 | + $o[] = $usuario; | ||
| 109 | } | 123 | } |
| 110 | $papeis = pegaDados ( "SELECT * from " . $esquemaadmin . "i3geousr_papeis order by nome", $dbh ); | 124 | $papeis = pegaDados ( "SELECT * from " . $esquemaadmin . "i3geousr_papeis order by nome", $dbh ); |
| 111 | $dbhw = null; | 125 | $dbhw = null; |
| 112 | $dbh = null; | 126 | $dbh = null; |
| 113 | if ($papeis == false) { | 127 | if ($papeis == false) { |
| 114 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 128 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
| 115 | - exit (); | 129 | + exit(); |
| 116 | } | 130 | } |
| 117 | retornaJSON ( array ( | 131 | retornaJSON ( array ( |
| 118 | "usuarios" => $o, | 132 | "usuarios" => $o, |
| 119 | - "papeis" => $papeis | 133 | + "papeis" => $papeis |
| 120 | ) ); | 134 | ) ); |
| 121 | break; | 135 | break; |
| 122 | case "EXCLUIRUSUARIO" : | 136 | case "EXCLUIRUSUARIO" : |
| @@ -130,8 +144,28 @@ switch ($funcao) { | @@ -130,8 +144,28 @@ switch ($funcao) { | ||
| 130 | retornaJSON ( $id_usuario ); | 144 | retornaJSON ( $id_usuario ); |
| 131 | exit (); | 145 | exit (); |
| 132 | break; | 146 | break; |
| 147 | + case "ENVIARSENHA" : | ||
| 148 | + if($senha == "" || $email == ""){ | ||
| 149 | + header ( "HTTP/1.1 500 erro ao enviar e-mail. Prrencha o valor de e-mail e senha" ); | ||
| 150 | + exit (); | ||
| 151 | + } | ||
| 152 | + $retorna = enviarSenha ( $senha, $email ); | ||
| 153 | + if ($retorna == false) { | ||
| 154 | + header ( "HTTP/1.1 500 erro ao enviar e-mail $email" ); | ||
| 155 | + exit (); | ||
| 156 | + } | ||
| 157 | + retornaJSON ( true ); | ||
| 158 | + exit (); | ||
| 159 | + break; | ||
| 133 | } | 160 | } |
| 134 | cpjson ( $retorno ); | 161 | cpjson ( $retorno ); |
| 162 | + | ||
| 163 | +function enviarSenha( $senha, $email ){ | ||
| 164 | + $to = $email; | ||
| 165 | + $subject = 'senha i3geo criada em '. date('l jS \of F Y h:i:s A'); | ||
| 166 | + $message = $senha; | ||
| 167 | + return mail($to, $subject, $message); | ||
| 168 | +} | ||
| 135 | // $papeis deve ser um array | 169 | // $papeis deve ser um array |
| 136 | function adicionarUsuario($ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw) { | 170 | function adicionarUsuario($ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw) { |
| 137 | global $esquemaadmin; | 171 | global $esquemaadmin; |
| @@ -145,6 +179,7 @@ function adicionarUsuario($ativo, $data_cadastro, $email, $login, $nome_usuario, | @@ -145,6 +179,7 @@ function adicionarUsuario($ativo, $data_cadastro, $email, $login, $nome_usuario, | ||
| 145 | "senha" => '' | 179 | "senha" => '' |
| 146 | ); | 180 | ); |
| 147 | $id_usuario = i3GeoAdminInsertUnico ( $dbhw, "i3geousr_usuarios", $dataCol, "nome_usuario", "id_usuario" ); | 181 | $id_usuario = i3GeoAdminInsertUnico ( $dbhw, "i3geousr_usuarios", $dataCol, "nome_usuario", "id_usuario" ); |
| 182 | + $data_cadastro = date('l jS \of F Y h:i:s A'); | ||
| 148 | $retorna = alterarUsuario ( $id_usuario, $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw ); | 183 | $retorna = alterarUsuario ( $id_usuario, $ativo, $data_cadastro, $email, $login, $nome_usuario, $senha, $papeis, $dbhw ); |
| 149 | return $retorna; | 184 | return $retorna; |
| 150 | } catch ( PDOException $e ) { | 185 | } catch ( PDOException $e ) { |
| @@ -161,10 +196,8 @@ function alterarUsuario($id_usuario, $ativo, $data_cadastro, $email, $login, $no | @@ -161,10 +196,8 @@ function alterarUsuario($id_usuario, $ativo, $data_cadastro, $email, $login, $no | ||
| 161 | "nome_usuario" => $nome_usuario, | 196 | "nome_usuario" => $nome_usuario, |
| 162 | "login" => $login, | 197 | "login" => $login, |
| 163 | "email" => $email, | 198 | "email" => $email, |
| 164 | - "ativo" => $ativo, | ||
| 165 | - "data_cadastro" => $data_cadastro | 199 | + "ativo" => $ativo |
| 166 | ); | 200 | ); |
| 167 | - | ||
| 168 | // se a senha foi enviada, ela sera trocada | 201 | // se a senha foi enviada, ela sera trocada |
| 169 | if ($senha != "") { | 202 | if ($senha != "") { |
| 170 | $dataCol ["senha"] = md5 ( $senha ); | 203 | $dataCol ["senha"] = md5 ( $senha ); |
| @@ -193,7 +226,7 @@ function adicionaPapelUsuario($id_usuario, $id_papel, $dbhw) { | @@ -193,7 +226,7 @@ function adicionaPapelUsuario($id_usuario, $id_papel, $dbhw) { | ||
| 193 | global $esquemaadmin; | 226 | global $esquemaadmin; |
| 194 | $dataCol = array ( | 227 | $dataCol = array ( |
| 195 | "id_usuario" => $id_usuario, | 228 | "id_usuario" => $id_usuario, |
| 196 | - "id_papel" => $id_papel | 229 | + "id_papel" => $id_papel |
| 197 | ); | 230 | ); |
| 198 | $resultado = i3GeoAdminInsert ( $dbhw, "i3geousr_papelusuario", $dataCol ); | 231 | $resultado = i3GeoAdminInsert ( $dbhw, "i3geousr_papelusuario", $dataCol ); |
| 199 | return $resultado; | 232 | return $resultado; |
admin1/usuarios/cadastro/index.js
| @@ -42,6 +42,8 @@ function pegaUsuarios(){ | @@ -42,6 +42,8 @@ function pegaUsuarios(){ | ||
| 42 | ) | 42 | ) |
| 43 | .done( | 43 | .done( |
| 44 | function(data, status){ | 44 | function(data, status){ |
| 45 | + //valor do filtro atual | ||
| 46 | + var filtro = valorFiltro(); | ||
| 45 | //objeto json com os dados viondos do banco | 47 | //objeto json com os dados viondos do banco |
| 46 | var json = jQuery.parseJSON(data); | 48 | var json = jQuery.parseJSON(data); |
| 47 | //template dos checkbox | 49 | //template dos checkbox |
| @@ -58,6 +60,7 @@ function pegaUsuarios(){ | @@ -58,6 +60,7 @@ function pegaUsuarios(){ | ||
| 58 | "salvar": $trad("salva",i3GEOadmin.core.dicionario), | 60 | "salvar": $trad("salva",i3GEOadmin.core.dicionario), |
| 59 | "onSalvar": "salvarUsuarioDialogo",//funcao | 61 | "onSalvar": "salvarUsuarioDialogo",//funcao |
| 60 | "enviaSenha": $trad("enviaSenha",i3GEOadmin.usuarios.dicionario), | 62 | "enviaSenha": $trad("enviaSenha",i3GEOadmin.usuarios.dicionario), |
| 63 | + "onEnviarSenha": "EnviarSenha",//funcao | ||
| 61 | "usuario": $trad("usuario",i3GEOadmin.usuarios.dicionario), | 64 | "usuario": $trad("usuario",i3GEOadmin.usuarios.dicionario), |
| 62 | "nome": $trad("nome",i3GEOadmin.usuarios.dicionario), | 65 | "nome": $trad("nome",i3GEOadmin.usuarios.dicionario), |
| 63 | "labelDataCadastro": $trad("dataCadastro",i3GEOadmin.usuarios.dicionario), | 66 | "labelDataCadastro": $trad("dataCadastro",i3GEOadmin.usuarios.dicionario), |
| @@ -111,12 +114,16 @@ function pegaUsuarios(){ | @@ -111,12 +114,16 @@ function pegaUsuarios(){ | ||
| 111 | {"data":json["usuarios"]} | 114 | {"data":json["usuarios"]} |
| 112 | ); | 115 | ); |
| 113 | $("#filtro").html("<option value='' >---</option>" + html); | 116 | $("#filtro").html("<option value='' >---</option>" + html); |
| 114 | - | 117 | + if(filtro != ""){ |
| 118 | + defineFiltro(filtro); | ||
| 119 | + filtra(pegaFiltro()); | ||
| 120 | + } | ||
| 115 | //monta um template para o modal de inclusao de novo usuario | 121 | //monta um template para o modal de inclusao de novo usuario |
| 116 | html = Mustache.to_html( | 122 | html = Mustache.to_html( |
| 117 | $("#templateUsuarios").html(), | 123 | $("#templateUsuarios").html(), |
| 118 | { | 124 | { |
| 119 | "id_usuario": "modal", | 125 | "id_usuario": "modal", |
| 126 | + "enviaSenha": $trad("enviaSenha",i3GEOadmin.usuarios.dicionario), | ||
| 120 | "excluir": $trad("cancelar",i3GEOadmin.core.dicionario), | 127 | "excluir": $trad("cancelar",i3GEOadmin.core.dicionario), |
| 121 | "onExcluir": "fechaModalGeral",//funcao | 128 | "onExcluir": "fechaModalGeral",//funcao |
| 122 | "salvar": $trad("salva",i3GEOadmin.core.dicionario), | 129 | "salvar": $trad("salva",i3GEOadmin.core.dicionario), |
| @@ -238,8 +245,18 @@ function salvarUsuario(id_usuario){ | @@ -238,8 +245,18 @@ function salvarUsuario(id_usuario){ | ||
| 238 | } | 245 | } |
| 239 | ); | 246 | ); |
| 240 | } | 247 | } |
| 241 | -function filtra(obj,id){ | ||
| 242 | - $("#" + id + " .panel").each( | 248 | +function pegaFiltro(){ |
| 249 | + return $i("filtro"); | ||
| 250 | +} | ||
| 251 | +function valorFiltro(){ | ||
| 252 | + return pegaFiltro().value; | ||
| 253 | +} | ||
| 254 | +function defineFiltro(valor){ | ||
| 255 | + pegaFiltro().value = valor; | ||
| 256 | +} | ||
| 257 | +function filtra(obj){ | ||
| 258 | + | ||
| 259 | + $("#corpo .panel").each( | ||
| 243 | function(i,el){ | 260 | function(i,el){ |
| 244 | if(obj.value == ""){ | 261 | if(obj.value == ""){ |
| 245 | $(el).show(); | 262 | $(el).show(); |
| @@ -253,3 +270,4 @@ function filtra(obj,id){ | @@ -253,3 +270,4 @@ function filtra(obj,id){ | ||
| 253 | $("#"+obj.value).show(); | 270 | $("#"+obj.value).show(); |
| 254 | } | 271 | } |
| 255 | } | 272 | } |
| 273 | + |
admin1/usuarios/cadastro/index.php
| @@ -27,7 +27,7 @@ include "../../head.php"; | @@ -27,7 +27,7 @@ include "../../head.php"; | ||
| 27 | <!-- aqui entra o filtro --> | 27 | <!-- aqui entra o filtro --> |
| 28 | <div class="form-group"> | 28 | <div class="form-group"> |
| 29 | <label class="control-label">{{{filtro}}}</label> | 29 | <label class="control-label">{{{filtro}}}</label> |
| 30 | - <select onchange="filtra(this,'corpo')" id="filtro" class="form-control input-lg"> | 30 | + <select onchange="filtra(this)" id="filtro" class="form-control input-lg"> |
| 31 | </select> | 31 | </select> |
| 32 | </div> | 32 | </div> |
| 33 | <div class="row pull-right"> | 33 | <div class="row pull-right"> |
| @@ -81,7 +81,7 @@ include "../../head.php"; | @@ -81,7 +81,7 @@ include "../../head.php"; | ||
| 81 | <div class="form-group form-group-lg"> | 81 | <div class="form-group form-group-lg"> |
| 82 | <label class="col-md-2 control-label" for="novasenha">{{{labelNovaSenha}}}</label> | 82 | <label class="col-md-2 control-label" for="novasenha">{{{labelNovaSenha}}}</label> |
| 83 | <div class="col-md-10"> | 83 | <div class="col-md-10"> |
| 84 | - <input type="password" value="" class="form-control" name="novasenha" > | 84 | + <input type="password" value="" class="form-control" name="senha" > |
| 85 | </div> | 85 | </div> |
| 86 | </div> | 86 | </div> |
| 87 | <div class="form-group form-group-lg"> | 87 | <div class="form-group form-group-lg"> |
| @@ -93,7 +93,7 @@ include "../../head.php"; | @@ -93,7 +93,7 @@ include "../../head.php"; | ||
| 93 | <div class="form-group form-group-lg"> | 93 | <div class="form-group form-group-lg"> |
| 94 | <label class="col-md-2 control-label" for="data_cadastro">{{{labelDataCadastro}}}</label> | 94 | <label class="col-md-2 control-label" for="data_cadastro">{{{labelDataCadastro}}}</label> |
| 95 | <div class="col-md-10"> | 95 | <div class="col-md-10"> |
| 96 | - <input type="date" value="{{{email}}}" class="form-control" name="data_cadastro"> | 96 | + <input disabled="" type="text" value="{{{data_cadastro}}}" class="form-control" name="data_cadastro"> |
| 97 | </div> | 97 | </div> |
| 98 | </div> | 98 | </div> |
| 99 | <div class="form-group form-group-lg"> | 99 | <div class="form-group form-group-lg"> |
| @@ -105,12 +105,19 @@ include "../../head.php"; | @@ -105,12 +105,19 @@ include "../../head.php"; | ||
| 105 | </select> | 105 | </select> |
| 106 | </div> | 106 | </div> |
| 107 | </div> | 107 | </div> |
| 108 | + <div class="form-group form-group-lg"> | ||
| 109 | + <div class="col-md-2"></div> | ||
| 110 | + <div class="checkbox col-md-10"> | ||
| 111 | + <label> | ||
| 112 | + <input type="checkbox" checked name="enviaSenha" /> {{{enviaSenha}}} | ||
| 113 | + </label> | ||
| 114 | + </div> | ||
| 115 | + </div> | ||
| 108 | </div> | 116 | </div> |
| 109 | </div> | 117 | </div> |
| 110 | </form> | 118 | </form> |
| 111 | <div class="pull-right"> | 119 | <div class="pull-right"> |
| 112 | <a href="javascript:void(0)" onclick="{{onExcluir}}('{{id_usuario}}')" class="btn btn-danger" role="button">{{excluir}}</a> | 120 | <a href="javascript:void(0)" onclick="{{onExcluir}}('{{id_usuario}}')" class="btn btn-danger" role="button">{{excluir}}</a> |
| 113 | - <a href="javascript:void(0)" onclick="{{onEnviarSenha}}('{{id_usuario}}')" class="btn btn-default" role="button">{{{enviaSenha}}}</a> | ||
| 114 | <a href="javascript:void(0)" onclick="{{onSalvar}}('{{id_usuario}}')" class="btn btn-primary" role="button">{{salvar}}</a> | 121 | <a href="javascript:void(0)" onclick="{{onSalvar}}('{{id_usuario}}')" class="btn btn-primary" role="button">{{salvar}}</a> |
| 115 | </div> | 122 | </div> |
| 116 | </div> | 123 | </div> |
admin1/usuarios/operacoes/index.js
| @@ -46,6 +46,8 @@ function pegaOperacoes(){ | @@ -46,6 +46,8 @@ function pegaOperacoes(){ | ||
| 46 | ) | 46 | ) |
| 47 | .done( | 47 | .done( |
| 48 | function(data, status){ | 48 | function(data, status){ |
| 49 | + //valor do filtro atual | ||
| 50 | + var filtro = valorFiltro(); | ||
| 49 | //objeto json com os dados viondos do banco | 51 | //objeto json com os dados viondos do banco |
| 50 | var json = jQuery.parseJSON(data); | 52 | var json = jQuery.parseJSON(data); |
| 51 | //template dos checkbox | 53 | //template dos checkbox |
| @@ -94,7 +96,10 @@ function pegaOperacoes(){ | @@ -94,7 +96,10 @@ function pegaOperacoes(){ | ||
| 94 | {"data":json["operacoes"]} | 96 | {"data":json["operacoes"]} |
| 95 | ); | 97 | ); |
| 96 | $("#filtro").html("<option value='' >---</option>" + html); | 98 | $("#filtro").html("<option value='' >---</option>" + html); |
| 97 | - | 99 | + if(filtro != ""){ |
| 100 | + defineFiltro(filtro); | ||
| 101 | + filtra(pegaFiltro()); | ||
| 102 | + } | ||
| 98 | //monta um template para o modal de inclusao de nova operacao | 103 | //monta um template para o modal de inclusao de nova operacao |
| 99 | html = Mustache.to_html( | 104 | html = Mustache.to_html( |
| 100 | $("#templateOperacoes").html(), | 105 | $("#templateOperacoes").html(), |
| @@ -204,7 +209,7 @@ function salvarOperacao(id_operacao){ | @@ -204,7 +209,7 @@ function salvarOperacao(id_operacao){ | ||
| 204 | modalAguarde(true); | 209 | modalAguarde(true); |
| 205 | $.post( | 210 | $.post( |
| 206 | "exec.php?funcao=alterarOperacao", | 211 | "exec.php?funcao=alterarOperacao", |
| 207 | - "id_operacao="+ id_operacao+"&"+parametros | 212 | + "id_operacao="+ id_operacao +"&"+parametros |
| 208 | ) | 213 | ) |
| 209 | .done( | 214 | .done( |
| 210 | function(data, status){ | 215 | function(data, status){ |
| @@ -220,8 +225,18 @@ function salvarOperacao(id_operacao){ | @@ -220,8 +225,18 @@ function salvarOperacao(id_operacao){ | ||
| 220 | } | 225 | } |
| 221 | ); | 226 | ); |
| 222 | } | 227 | } |
| 223 | -function filtra(obj,id){ | ||
| 224 | - $("#" + id + " .panel").each( | 228 | +function pegaFiltro(){ |
| 229 | + return $i("filtro"); | ||
| 230 | +} | ||
| 231 | +function valorFiltro(){ | ||
| 232 | + return pegaFiltro().value; | ||
| 233 | +} | ||
| 234 | +function defineFiltro(valor){ | ||
| 235 | + pegaFiltro().value = valor; | ||
| 236 | +} | ||
| 237 | +function filtra(obj){ | ||
| 238 | + | ||
| 239 | + $("#corpo .panel").each( | ||
| 225 | function(i,el){ | 240 | function(i,el){ |
| 226 | if(obj.value == ""){ | 241 | if(obj.value == ""){ |
| 227 | $(el).show(); | 242 | $(el).show(); |
admin1/usuarios/operacoes/index.php
| @@ -27,7 +27,7 @@ include "../../head.php"; | @@ -27,7 +27,7 @@ include "../../head.php"; | ||
| 27 | <!-- aqui entra o filtro --> | 27 | <!-- aqui entra o filtro --> |
| 28 | <div class="form-group"> | 28 | <div class="form-group"> |
| 29 | <label class="control-label">{{{filtro}}}</label> | 29 | <label class="control-label">{{{filtro}}}</label> |
| 30 | - <select onchange="filtra(this,'corpo')" id="filtro" class="form-control input-lg"> | 30 | + <select onchange="filtra(this)" id="filtro" class="form-control input-lg"> |
| 31 | </select> | 31 | </select> |
| 32 | </div> | 32 | </div> |
| 33 | <div class="row pull-right"> | 33 | <div class="row pull-right"> |