Commit 389106120f97798221d7d911477793d34976f984
1 parent
7de7716f
Exists in
master
and in
7 other branches
Inclusão de filtro na página de cadastro de operações
Showing
4 changed files
with
32 additions
and
22 deletions
Show diff stats
admin1/dicionario/core.js
admin1/usuarios/operacoes/index.js
| ... | ... | @@ -88,13 +88,13 @@ function pegaOperacoes(){ |
| 88 | 88 | } |
| 89 | 89 | ); |
| 90 | 90 | ondeListaOperacoes.html(html); |
| 91 | - //indice | |
| 91 | + //filtro | |
| 92 | 92 | html = Mustache.to_html( |
| 93 | - "{{#data}}" + $("#indiceTpl").html() + "{{/data}}", | |
| 93 | + "{{#data}}" + $("#templateFiltro").html() + "{{/data}}", | |
| 94 | 94 | {"data":json["operacoes"]} |
| 95 | 95 | ); |
| 96 | - //indice lateral | |
| 97 | - $("#indice").html(html); | |
| 96 | + $("#filtro").html("<option value='' >---</option>" + html); | |
| 97 | + | |
| 98 | 98 | //monta um template para o modal de inclusao de nova operacao |
| 99 | 99 | html = Mustache.to_html( |
| 100 | 100 | $("#templateOperacoes").html(), |
| ... | ... | @@ -220,3 +220,18 @@ function salvarOperacao(id_operacao){ |
| 220 | 220 | } |
| 221 | 221 | ); |
| 222 | 222 | } |
| 223 | +function filtra(obj,id){ | |
| 224 | + $("#" + id + " .panel").each( | |
| 225 | + function(i,el){ | |
| 226 | + if(obj.value == ""){ | |
| 227 | + $(el).show(); | |
| 228 | + } | |
| 229 | + else { | |
| 230 | + $(el).hide(); | |
| 231 | + } | |
| 232 | + } | |
| 233 | + ); | |
| 234 | + if(obj.value != ""){ | |
| 235 | + $("#"+obj.value).show(); | |
| 236 | + } | |
| 237 | +} | ... | ... |
admin1/usuarios/operacoes/index.php
| ... | ... | @@ -16,7 +16,7 @@ include "../../head.php"; |
| 16 | 16 | </div> |
| 17 | 17 | <div class="container"> |
| 18 | 18 | <div class="row center-block"> |
| 19 | - <div class="col-sm-12 col-md-10"> | |
| 19 | + <div class="col-md-12"> | |
| 20 | 20 | <div class="well hidden" id="titulo"> |
| 21 | 21 | <button data-toggle="modal" data-target="#ajudaPrincipal" |
| 22 | 22 | class="btn btn-primary btn-fab btn-fab-mini pull-right"> |
| ... | ... | @@ -24,6 +24,12 @@ include "../../head.php"; |
| 24 | 24 | </button> |
| 25 | 25 | <h3>{{{operacoes}}}</h3> |
| 26 | 26 | <h4>{{{txtAjuda}}}</h4> |
| 27 | + <!-- aqui entra o filtro --> | |
| 28 | + <div class="form-group"> | |
| 29 | + <label class="control-label">{{{filtro}}}</label> | |
| 30 | + <select onchange="filtra(this,'corpo')" id="filtro" class="form-control input-lg"> | |
| 31 | + </select> | |
| 32 | + </div> | |
| 27 | 33 | <div class="row pull-right"> |
| 28 | 34 | <a onclick="adicionaOperacaoDialogo();" href="javascript:void(0)" class="btn btn-primary" role="button">{{{adicionar}}}</a> |
| 29 | 35 | </div> |
| ... | ... | @@ -44,22 +50,10 @@ include "../../head.php"; |
| 44 | 50 | </div> |
| 45 | 51 | </div> |
| 46 | 52 | </div> |
| 47 | - <!-- lateral--> | |
| 48 | - <div class="col-md-2 hidden-sm hidden"> | |
| 49 | - <nav class="bs-docs-sidebar affix-top" style="" id="indiceSpy"> | |
| 50 | - <ul class="nav nav-pills nav-stacked" role="tablist"> | |
| 51 | - <li><a onclick="$('.panel').show();" href="#">Links <i class="material-icons">visibility</i></a></li> | |
| 52 | - </ul> | |
| 53 | - <ul class="nav nav-pills nav-stacked" role="tablist" id="indice"> | |
| 54 | - </ul> | |
| 55 | - </nav> | |
| 56 | - </div> | |
| 57 | - | |
| 58 | 53 | </div> |
| 59 | 54 | </div> |
| 60 | -<!-- li do indice lateral--> | |
| 61 | -<script id="indiceTpl" type="x-tmpl-mustache"> | |
| 62 | -<li id="link-{{id_operacao}}"><a onclick="$('.panel').hide();$('#form-{{id_operacao}}').show();" href="#">{{{codigo}}}</a></li> | |
| 55 | +<script id="templateFiltro" type="x-tmpl-mustache"> | |
| 56 | +<option value="form-{{id_operacao}}">{{{codigo}}}</option> | |
| 63 | 57 | </script> |
| 64 | 58 | <script id="templateOperacoes" type="x-tmpl-mustache"> |
| 65 | 59 | <div class="panel panel-default" id="form-{{id_operacao}}"> |
| ... | ... | @@ -118,6 +112,7 @@ include "../../head.php"; |
| 118 | 112 | var t = $("#titulo"); |
| 119 | 113 | //complementa dicionario |
| 120 | 114 | i3GEOadmin.operacoes.dicionario.adicionar = i3GEOadmin.core.dicionario.adicionar; |
| 115 | + i3GEOadmin.operacoes.dicionario.filtro = i3GEOadmin.core.dicionario.filtro; | |
| 121 | 116 | t.html( |
| 122 | 117 | Mustache.to_html( |
| 123 | 118 | t.html(), | ... | ... |
init/index.js
| ... | ... | @@ -103,7 +103,7 @@ botoesIni = [ |
| 103 | 103 | "titulo":$trad(3,g_traducao_init), |
| 104 | 104 | "subtitulo": $trad("3a",g_traducao_init), |
| 105 | 105 | "fa": "cogs", |
| 106 | - "target": "_blank" | |
| 106 | + "target": "_self" | |
| 107 | 107 | },{ |
| 108 | 108 | "img":"folder-image.png", |
| 109 | 109 | "href": "../exemplos/index.php", | ... | ... |