Browse Source

Adiciona tipo em relatório de presença em sessão plenária

pull/2884/head
Edward Ribeiro 7 years ago
parent
commit
ff12fe47a3
  1. 6
      sapl/base/forms.py
  2. 14
      sapl/base/views.py
  3. 1
      sapl/templates/base/RelatorioPresencaSessao_filter.html

6
sapl/base/forms.py

@ -874,6 +874,7 @@ class RelatorioPresencaSessaoFilterSet(django_filters.FilterSet):
model = SessaoPlenaria
fields = ['data_inicio',
'sessao_legislativa',
'tipo',
'legislatura']
def __init__(self, *args, **kwargs):
@ -883,8 +884,9 @@ class RelatorioPresencaSessaoFilterSet(django_filters.FilterSet):
self.filters['data_inicio'].label = 'Período (Inicial - Final)'
row1 = to_row([('data_inicio', 12)])
row2 = to_row([('legislatura', 6),
('sessao_legislativa', 6)])
row2 = to_row([('legislatura', 4),
('sessao_legislativa', 4),
('tipo', 4)])
self.form.helper = SaplFormHelper()
self.form.helper.form_method = 'GET'

14
sapl/base/views.py

@ -43,7 +43,7 @@ from sapl.protocoloadm.models import (Protocolo, TipoDocumentoAdministrativo,
StatusTramitacaoAdministrativo,
DocumentoAdministrativo, Anexado)
from sapl.sessao.models import (PresencaOrdemDia, SessaoPlenaria,
SessaoPlenariaPresenca, Bancada)
SessaoPlenariaPresenca, Bancada, TipoSessaoPlenaria)
from sapl.utils import (parlamentares_ativos, gerar_hash_arquivo, SEPARADOR_HASH_PROPOSICAO,
show_results_filter_set, mail_service_configured,
intervalos_tem_intersecao, remover_acentos)
@ -345,20 +345,18 @@ class RelatorioPresencaSessaoView(FilterView):
cd = self.filterset.form.cleaned_data
if not cd['data_inicio'] and not cd['sessao_legislativa'] \
and not cd['legislatura']:
and not cd['legislatura'] and not cd['tipo']:
msg = _("Formulário inválido! Preencha pelo menos algum dos campos.")
messages.error(self.request, msg)
return context
# Caso a data tenha sido preenchida, verifica se foi preenchida corretamente
if ('data_inicio_0' in self.request.GET) and self.request.GET['data_inicio_0'] and \
not(('data_inicio_1' in self.request.GET) and self.request.GET['data_inicio_1']):
if self.request.GET.get('data_inicio_0') and not self.request.GET.get('data_inicio_1'):
msg = _("Formulário inválido! Preencha a data do Período Final.")
messages.error(self.request, msg)
return context
if not(('data_inicio_0' in self.request.GET) and self.request.GET['data_inicio_0']) and \
('data_inicio_1' in self.request.GET) and self.request.GET['data_inicio_1']:
if not self.request.GET.get('data_inicio_0') and self.request.GET.get('data_inicio_1'):
msg = _("Formulário inválido! Preencha a data do Período Inicial.")
messages.error(self.request, msg)
return context
@ -474,6 +472,10 @@ class RelatorioPresencaSessaoView(FilterView):
' - ' + self.request.GET['data_inicio_1'])
context['sessao_legislativa'] = ''
context['legislatura'] = ''
tipo_pk = self.request.GET.get('tipo')
context['tipo'] = '' if not tipo_pk else TipoSessaoPlenaria.objects.get(id=tipo_pk)
if sessao_legislativa_pk:
context['sessao_legislativa'] = SessaoLegislativa.objects.get(id=sessao_legislativa_pk)
if legislatura_pk:

1
sapl/templates/base/RelatorioPresencaSessao_filter.html

@ -22,6 +22,7 @@
<b>PERÍODO: {{periodo}}</b><br />
<b>Legislatura: {{legislatura}}</b><br />
<b>Sessão Legislativa: {{sessao_legislativa}}</b><br />
<b>Tipo Sessão Plenária: {{tipo}}<br /> </b>
<b>TOTAIS NO PERÍODO - SESSÕES: {{total_sessao}} - ORDENS DO DIA: {{total_ordemdia}}</b>
<table class="table table-bordered table-hover presenca_table">
<thead class="thead-default" align="center">

Loading…
Cancel
Save