Michel de Almeida Silva
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
21 additions and
4 deletions
-
sapl/sessao/views.py
-
sapl/templates/sessao/votacao/votacao_nominal_bloco.html
|
|
@ -5084,11 +5084,28 @@ class VotacaoEmBlocoNominalView(PermissionRequiredForAppCrudMixin, TemplateView) |
|
|
|
context.update({'expedientes': expedientes}) |
|
|
|
|
|
|
|
total_presentes = presentes.count() |
|
|
|
context.update({'parlamentares': self.get_parlamentares(), |
|
|
|
|
|
|
|
# Preserva votos selecionados pelo usuário ao retornar com erro |
|
|
|
presentes_list = [p.parlamentar for p in presentes] |
|
|
|
votos_post = {} |
|
|
|
for votos in self.request.POST.getlist('voto_parlamentar'): |
|
|
|
try: |
|
|
|
voto, parlamentar_id = votos.split(':', 1) |
|
|
|
votos_post[int(parlamentar_id)] = voto |
|
|
|
except ValueError: |
|
|
|
continue |
|
|
|
|
|
|
|
parlamentares_ctx = [] |
|
|
|
for parlamentar in Parlamentar.objects.filter(ativo=True): |
|
|
|
if parlamentar in presentes_list: |
|
|
|
parlamentares_ctx.append([parlamentar, votos_post.get(parlamentar.id)]) |
|
|
|
|
|
|
|
context.update({'parlamentares': parlamentares_ctx, |
|
|
|
'total_presentes': total_presentes, |
|
|
|
'resultado_votacao': TipoResultadoVotacao.objects.all(), |
|
|
|
'form': form, |
|
|
|
'origem': self.request.POST['origem']}) |
|
|
|
'origem': self.request.POST['origem'], |
|
|
|
'votos_from_post': True}) |
|
|
|
|
|
|
|
return self.render_to_response(context) |
|
|
|
|
|
|
|
|
|
@ -47,8 +47,8 @@ |
|
|
|
{% for parlamentar in parlamentares %} |
|
|
|
<div class="col-md-4" id="styleparlamentar">{{parlamentar.0.nome_parlamentar}}</div> |
|
|
|
<div class="col-md-5"> |
|
|
|
{% if parlamentar.1 %} <input type="hidden" name="voto_parlamentar" value="{{parlamentar.1}}:{{parlamentar.0.id}}" /> {% endif %} |
|
|
|
<select id="voto_parlamentar" name="voto_parlamentar" class="form-control" {% if parlamentar.1 %} disabled {% endif %}> |
|
|
|
{% if parlamentar.1 and not votos_from_post %} <input type="hidden" name="voto_parlamentar" value="{{parlamentar.1}}:{{parlamentar.0.id}}" /> {% endif %} |
|
|
|
<select id="voto_parlamentar" name="voto_parlamentar" class="form-control" {% if parlamentar.1 and not votos_from_post %} disabled {% endif %}> |
|
|
|
<option value="Não Votou:{{parlamentar.0.id}}">Não Votou</option> |
|
|
|
<option value="Sim:{{parlamentar.0.id}}" {% if parlamentar.1 == 'Sim' %} selected {% endif %}>Sim</option> |
|
|
|
<option value="Não:{{parlamentar.0.id}}" {% if parlamentar.1 == 'Não' %} selected {% endif %}>Não</option> |
|
|
|