From d8d9842ef60ac415f7abdc78157feaea24405510 Mon Sep 17 00:00:00 2001 From: cristian-longhi Date: Wed, 8 Nov 2017 14:33:58 -0200 Subject: [PATCH] =?UTF-8?q?Ajustes=20no=20Painel=20e=20na=20Vota=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/painel/views.py | 20 +++++++++ sapl/static/styles/app.scss | 2 +- sapl/templates/sessao/votacao/nominal.html | 50 +++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/sapl/painel/views.py b/sapl/painel/views.py index 9682b5b01..ff86017ec 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -360,9 +360,11 @@ def get_votos(response, materia): if type(materia) == OrdemDia: registro = RegistroVotacao.objects.filter( ordem=materia, materia=materia.materia).last() + tipo = 'ordem' elif type(materia) == ExpedienteMateria: registro = RegistroVotacao.objects.filter( expediente=materia, materia=materia.materia).last() + tipo = 'expediente' if not registro: response.update({ @@ -374,6 +376,24 @@ def get_votos(response, materia): 'tipo_resultado': 'Ainda não foi votada.', }) + if materia.tipo_votacao == 2: + if tipo == 'ordem': + votos_parlamentares = VotoParlamentar.objects.filter( + ordem_id=materia.id).order_by( + 'parlamentar__nome_parlamentar') + else: + votos_parlamentares = VotoParlamentar.objects.filter( + expediente_id=materia.id).order_by( + 'parlamentar__nome_parlamentar') + + + for i, p in enumerate(response['presentes']): + try: + if votos_parlamentares.get(parlamentar_id=p['parlamentar_id']).voto: + response['presentes'][i]['voto'] = 'Voto Informado' + except ObjectDoesNotExist: + response['presentes'][i]['voto'] = '' + else: total = (registro.numero_votos_sim + registro.numero_votos_nao + diff --git a/sapl/static/styles/app.scss b/sapl/static/styles/app.scss index 7ca2d652a..74fcd42b4 100644 --- a/sapl/static/styles/app.scss +++ b/sapl/static/styles/app.scss @@ -497,7 +497,7 @@ p { /* Estilização da Listagem de Votos em sessões plenárias */ #styleparlamentar { - border: 1px solid #d6e1e5; + border: 0px solid #d6e1e5; border-top-color: rgb(214, 225, 229); border-right-color: rgb(214, 225, 229); border-bottom-color: rgb(214, 225, 229); diff --git a/sapl/templates/sessao/votacao/nominal.html b/sapl/templates/sessao/votacao/nominal.html index ad494dae5..b7716e57e 100644 --- a/sapl/templates/sessao/votacao/nominal.html +++ b/sapl/templates/sessao/votacao/nominal.html @@ -40,7 +40,16 @@ {% endfor %} - + + Situação da Votação: + +
+
+
+
+
+ +
@@ -70,6 +79,45 @@ window.history.back(); } + function conta_votos() { + var votos_sim = 0; + var votos_nao = 0; + var votos_abstencao = 0; + var nao_votou = 0; + //alert($("#voto_parlamentar").text()); + $('[name=voto_parlamentar]').each(function() { + if (($(this).is(':hidden')) == false) { + switch ($(this).val().substring(0,4)) { + case "Sim:": + votos_sim = votos_sim + 1; + //alert("votos sim: " + votos_sim); + break; + case "Não:": + votos_nao = votos_nao + 1; + //alert("votos não: " + votos_sim); + break; + case "Abst": + votos_abstencao = votos_abstencao + 1; + //alert("abstenções: " + votos_abstencao); + break; + case "Não ": + nao_votou = nao_votou + 1; + //alert("ainda não votaram: " + nao_votou); + break; + }; + }; + }); + + $("#soma_votos").empty(); + $("#soma_votos").append("
Sim: " + votos_sim + "
"); + $("#soma_votos").append("
Não: " + votos_nao + "
"); + $("#soma_votos").append("
Abstenções: " + votos_abstencao + "
"); + $("#soma_votos").append("
Ainda não votaram: " + nao_votou + "
"); + + } + + window.onload = conta_votos(); + $(window).on('beforeunload', function () { $("input[type=submit], input[type=button]").prop("disabled", "disabled"); });