Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vuejs painel #3444

Open
wants to merge 19 commits into
base: 3.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Alteracoes na cor de palramentares
  • Loading branch information
AlGouvea authored and eribeiro committed Jul 13, 2021
commit 5d4f775347a0b34ef7ab1ecfbef453c70563ce96
25 changes: 23 additions & 2 deletions frontend/src/__apps/painel/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,32 @@ const v = new Vue({ // eslint-disable-line
return {
message: 'Hello VueJUS', // TODO: remove when porting to VueJS is done
polling: null,
painel_aberto: false,
painel_aberto: true,
sessao_plenaria: '',
sessao_plenaria_data: '',
sessao_plenaria_hora_inicio: '',
brasao: '',
sessao_solene: false,
sessao_solene_tema: '',
presentes:[]
presentes: [],
oradores: []
}
},
methods: {

atribuiColor (parlamentar) {
var color = 'white'
if (parlamentar.voto === 'Voto Informado') {
color = 'yellow'
} else {
if (parlamentar.voto === 'Sim') {
color = 'green'
} else if (parlamentar.voto === 'Não') {
color = 'red'
}
}
parlamentar.color = color
},
fetchData () {
// TODO: how to get no hardcoded URL?
$.get('/painel/704/dados', function (response) {
Expand All @@ -33,7 +48,13 @@ const v = new Vue({ // eslint-disable-line
this.sessao_plenaria_hora_inicio = 'Hora Início: ' + response.sessao_plenaria_hora_inicio
this.sessao_solene = response.sessao_solene
this.sessao_solene_tema = response.sessao_solene_tema

this.presentes = response.presentes
this.presentes.forEach(parlamentar => {
this.atribuiColor(parlamentar)
})

this.oradores = response.oradores
}.bind(this))
},
pollData () {
Expand Down
33 changes: 17 additions & 16 deletions sapl/templates/painel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,15 @@ <h2 class="text-danger"><span v-if="!painel_aberto">PAINEL ENCONTRA-SE FECHADO</
<div class="text-center painel">
<h2 class="text-subtitle">Parlamentares</h2>
<div v-if="painel_aberto">
<table class="table table-striped table-hover table-link-ordering">
<thead>
<table>
<tbody v-for="p in presentes">
<tr>
<th>Parlamentar</th>
<th>Partido</th>
<th>Ativo?</th>
</tr>
</thead>
<tbody v-for="parlamentar in presentes">
<tr>
<th>
[[ parlamentar.nome]]
</th>
<th>
[[ parlamentar.partido ]]
</th>
<td style="padding-right: 20px; color: yellow;">
[[ p.nome]]
</td>
<td style="padding-right: 20px; color: yellow;">
[[ p.partido ]]
</td>
</tr>
</tbody>
</table>
Expand All @@ -102,7 +95,15 @@ <h2 class="text-subtitle">Parlamentares</h2>
<div class="col-md-6 text-center painel" id="aparecer_oradores">
<h2 class="text-subtitle">Oradores</h2>
<div v-if="painel_aberto">
<span id="orador"></span>
<table>
<tbody v-for="o in oradores">
<tr>
<td style="padding-right: 20px; color: white;">
[[ o.numero]]º &nbsp[[o.nome]]
</td>
</tr>
</tbody>
</table>
</div>
<div v-else>
<span style="color:white">
Expand Down