mirror of https://github.com/interlegis/sapl.git
Browse Source
* Configurando app parlamentaares para frontend * Adaptando pagina de parlamentar para vuejs Fix #3030 * Mudando endpoints para drf * Tirando arquivos desnecessarios * Update sapl/api/serializers.py Co-Authored-By: Leandro Silva <leandroroberto.br@gmail.com> * Update sapl/templates/parlamentares/parlamentares_list.html Co-Authored-By: Leandro Silva <leandroroberto.br@gmail.com> * Update sapl/templates/parlamentares/parlamentares_list.html Co-Authored-By: Leandro Silva <leandroroberto.br@gmail.com> * Corrigindo apresentação de parlamentar na pesquisa * Atualiza arquivos VueJSpull/3057/head
Ulysses Lara
5 years ago
committed by
Edward
18 changed files with 555 additions and 55 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1 @@ |
|||||
|
!function(e){function a(a){for(var t,o,i=a[0],u=a[1],l=a[2],p=0,f=[];p<i.length;p++)o=i[p],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&f.push(n[o][0]),n[o]=0;for(t in u)Object.prototype.hasOwnProperty.call(u,t)&&(e[t]=u[t]);for(c&&c(a);f.length;)f.shift()();return s.push.apply(s,l||[]),r()}function r(){for(var e,a=0;a<s.length;a++){for(var r=s[a],t=!0,i=1;i<r.length;i++){var u=r[i];0!==n[u]&&(t=!1)}t&&(s.splice(a--,1),e=o(o.s=r[0]))}return e}var t={},n={parlamentar:0},s=[];function o(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.m=e,o.c=t,o.d=function(e,a,r){o.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,a){if(1&a&&(e=o(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var t in e)o.d(r,t,function(a){return e[a]}.bind(null,t));return r},o.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(a,"a",a),a},o.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},o.p="/static/sapl/frontend/";var i=window.webpackJsonp=window.webpackJsonp||[],u=i.push.bind(i);i.push=a,i=i.slice();for(var l=0;l<i.length;l++)a(i[l]);var c=u;s.push([3,"chunk-vendors"]),r()}({3:function(e,a,r){e.exports=r("71e4")},"49c2":function(e,a,r){},"71e4":function(e,a,r){"use strict";r.r(a),function(e){r("cadf"),r("551c"),r("f751"),r("097d"),r("49c2");var a=r("a026"),t=r("44d4"),n=r("bc3a"),s=r.n(n);s.a.defaults.xsrfCookieName="csrftoken",s.a.defaults.xsrfHeaderName="X-CSRFToken",a.a.use(t.a),new a.a({delimiters:["[[","]]"],el:"#app2",data:function(){return{nome_pesquisa:"",is_pesquisa:!1,legislatura_selecionada:"",legislaturas:[],parlamentares:[]}},watch:{nome_pesquisa:function(e){this.debouncepesquisaParlamentar()}},created:function(){this.debouncepesquisaParlamentar=e.debounce(this.pesquisaParlamentar,500)},methods:{getParlamentares:function(e){var a=this;this.legislatura_selecionada&&s.a.get("/api/parlamentares/parlamentar/"+this.legislatura_selecionada+"/parlamentares_by_legislatura/").then((function(e){a.parlamentares=e.data})).catch((function(e){console.error("Ocorreu um erro ao obter os dados de parlamentares:"+e)}))},pesquisaParlamentar:function(e){var a=this;s.a.get("/api/parlamentares/parlamentar/search_parlamentares/",{params:{nome_parlamentar:this.nome_pesquisa}}).then((function(e){a.parlamentares=e.data})).catch((function(e){console.error("Erro ao procurar parlamentar:"+e)}))},pesquisaChange:function(e){this.is_pesquisa=!this.is_pesquisa,this.is_pesquisa?this.parlamentares=[]:this.getParlamentares()}},mounted:function(){var e=this;s.a.get("/api/parlamentares/legislatura/").then((function(a){e.legislaturas=a.data.results,e.legislatura_selecionada=a.data.results[0].id})).then((function(a){e.getParlamentares()})).catch((function(e){console.error("Ocorreu um erro ao obter os dados de legislação: "+e)}))}})}.call(this,r("2ef0"))}}); |
Binary file not shown.
@ -1,76 +1,94 @@ |
|||||
{% extends "crud/list.html" %} |
{% extends "base.html" %} |
||||
{% load i18n %} |
{% load i18n %} |
||||
{% load crispy_forms_tags cropping%} |
{% load crispy_forms_tags cropping%} |
||||
{% block actions %} |
{% load common_tags %} |
||||
|
{% load render_bundle from webpack_loader %} |
||||
|
{% load webpack_static from webpack_loader %} |
||||
|
|
||||
|
{% block base_content %} |
||||
|
|
||||
|
<div id="app2"> |
||||
|
|
||||
<div class="actions btn-group float-right btn-group-sm" role="group"> |
<div class="actions btn-group float-right btn-group-sm" role="group"> |
||||
<a href="{% url 'sapl.parlamentares:pesquisar_parlamentar' %}" class="btn btn-outline-primary">Pesquisar Parlamentar</a> |
<a v-if="is_pesquisa" v-on:click="pesquisaChange" class="btn btn-primary text-white">Listar Parlamentar</a> |
||||
|
<a v-else v-on:click="pesquisaChange" class="btn btn-outline-primary text-info">Pesquisar Parlamentar</a> |
||||
{% if not request.user.is_anonymous %} |
{% if not request.user.is_anonymous %} |
||||
<a href="{% url 'sapl.parlamentares:vincular_parlamentar' %}" class="btn btn-outline-primary">Vincular Parlamentar</a> |
<a href="{% url 'sapl.parlamentares:vincular_parlamentar' %}" class="btn btn-outline-primary">Vincular Parlamentar</a> |
||||
{% endif %} |
{% endif %} |
||||
{% block more_buttons %}{% endblock more_buttons %} |
{% block more_buttons %}{% endblock more_buttons %} |
||||
</div> |
</div> |
||||
{% endblock actions %} |
<div class="clearfix"></div> |
||||
{% block extra_content %} |
<!--Pesquisa parlamentares--> |
||||
|
<div v-if="is_pesquisa"> |
||||
|
<h2>Pesquisar Parlamentar</h2> |
||||
|
<div class="input-group input-group-lg"> |
||||
|
<div class="input-group-prepend"> |
||||
|
<span class="input-group-text" id="inputGroup-sizing-lg">Pesquisar</span> |
||||
|
</div> |
||||
|
<input v-model="nome_pesquisa" type="text" class="form-control" aria-label="Pesquisa" aria-describedby="inputGroup-sizing-sm"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!--Lista parlamentares--> |
||||
|
<div v-else> |
||||
<fieldset class="form-group"> |
<fieldset class="form-group"> |
||||
<legend>Selecione o Período</legend> |
<legend>Selecione o Período</legend> |
||||
<form method="GET"> |
<form method="GET"> |
||||
<select name="pk" class="form-control" onChange="form.submit();"> |
<select @change="getParlamentares" class="form-control" v-model="legislatura_selecionada"> |
||||
{% for l in legislaturas %} |
<option v-for="option in legislaturas" v-bind:value="option.id"> |
||||
<option value="{{l.id}}" {% if l.id == legislatura_id %} selected {% endif %}> |
[[ option.__str__ ]] |
||||
{{l}} |
|
||||
</option> |
</option> |
||||
{% endfor %} |
</select> |
||||
</select> |
|
||||
</form> |
</form> |
||||
</fieldset> |
</fieldset> |
||||
<br/> |
<br/> |
||||
{% endblock %} |
</div> |
||||
|
|
||||
{% block container_table_list %} |
|
||||
{% if not rows %} |
|
||||
<p>{{ NO_ENTRIES_MSG }}</p> |
|
||||
{% else %} |
|
||||
<div class="container-table lista-parlamentares"> |
<div class="container-table lista-parlamentares"> |
||||
<div class="result-count">{% blocktrans with verbose_name_plural=view.verbose_name_plural %}Total de {{ verbose_name_plural }}: <strong>{{count}}</strong>{% endblocktrans %}</div> |
<div class="result-count">Total de Parlamentares: <strong>[[parlamentares.length]]</strong></div> |
||||
<table class="table table-striped table-hover table-link-ordering"> |
<table class="table table-striped table-hover table-link-ordering"> |
||||
<thead> |
<thead> |
||||
<tr> |
<tr> |
||||
{% for name in headers %} |
<th colspan=2 >Parlamentar</th> |
||||
{% if forloop.first %} |
<th>Parido</th> |
||||
<th colspan=2> |
<th>Ativo?</th> |
||||
{% else %} |
<th v-if="!is_pesquisa" >Titlar?</th> |
||||
<th> |
|
||||
{% endif %} |
|
||||
{{ name }} |
|
||||
</th> |
|
||||
{% endfor %} |
|
||||
</tr> |
</tr> |
||||
</thead> |
</thead> |
||||
<tbody> |
<tbody> |
||||
{% for value_list in rows %} |
<tr v-for="parlamentar in parlamentares"> |
||||
<tr> |
<th> |
||||
{% for value, href, obj in value_list %} |
<img class="img-fluid img-thumbnail" v-bind:src="parlamentar.fotografia" @error="(() => parlamentar.fotografia = '')"/> |
||||
{% if forloop.first %} |
</th> |
||||
<td> |
<th> |
||||
{% if obj.fotografia %} |
<a v-bind:href="'/parlamentar/'+parlamentar.id">[[ parlamentar.nome_parlamentar]]</a> |
||||
<div id="w-100"> |
</th> |
||||
<img class="img-fluid img-thumbnail" src="{% cropped_thumbnail obj "cropping"%}"> |
<th> |
||||
</div> |
[[ parlamentar.partido ]] |
||||
{% endif %} |
</th> |
||||
</td> |
<th> |
||||
{% endif %} |
<p v-if="[[ parlamentar.ativo ]]">Sim</p> |
||||
<td> |
<p v-else>Não</p> |
||||
{% if href %} |
</th> |
||||
<a href="{{ href }}">{{ value|safe|default:"" }}</a> |
<th v-if="!is_pesquisa"> |
||||
{% else %} |
<p v-if='[[ parlamentar.titular]]'>Sim</p> |
||||
{{ value|safe|default:"" }} |
<p v-else>Não</p> |
||||
{% endif %} |
</th> |
||||
</td> |
</tr> |
||||
{% endfor %} |
</tbody> |
||||
</tr> |
|
||||
{% endfor %} |
|
||||
</tbody> |
|
||||
</table> |
</table> |
||||
</div> |
</div> |
||||
{% endif %} |
|
||||
|
{% endblock base_content %} |
||||
|
|
||||
|
|
||||
|
{% block webpack_loader_css %} |
||||
|
{{ block.super }} |
||||
|
{% render_bundle 'parlamentar' 'css' %} |
||||
|
{% endblock %} |
||||
|
|
||||
|
{% block webpack_loader_js %} |
||||
|
{% render_chunk_vendors 'js' %} |
||||
|
{% render_bundle 'global' 'js' %} |
||||
|
{% render_bundle 'parlamentar' 'js' %} |
||||
{% endblock %} |
{% endblock %} |
||||
|
Loading…
Reference in new issue