From cd6cc677c647f187dab9ebe2ddf1258d5cee4260 Mon Sep 17 00:00:00 2001 From: Ricardo Lima Canela Date: Tue, 17 Dec 2019 13:00:52 -0300 Subject: [PATCH] Fix #3049 (#3057) --- sapl/base/forms.py | 18 ++++++++++++++++-- sapl/base/views.py | 7 +++++++ .../RelatorioHistoricoTramitacao_filter.html | 1 + .../relatorio_historico_tramitacao.html | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 103fe81f1..5716383dd 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -884,6 +884,8 @@ class RelatorioPresencaSessaoFilterSet(django_filters.FilterSet): class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet): + autoria__autor = django_filters.CharFilter(widget=forms.HiddenInput()) + @property def qs(self): parent = super(RelatorioHistoricoTramitacaoFilterSet, self).qs @@ -912,6 +914,16 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet): [('tipo', 6), ('tramitacao__status', 6)]) + row4 = to_row([ + ('autoria__autor', 0), + (Button('pesquisar', + 'Pesquisar Autor', + css_class='btn btn-primary btn-sm'), 2), + (Button('limpar', + 'limpar Autor', + css_class='btn btn-primary btn-sm'), 2) + ]) + buttons = FormActions( *[ HTML(''' @@ -930,8 +942,10 @@ class RelatorioHistoricoTramitacaoFilterSet(django_filters.FilterSet): self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( - Fieldset(_(''), - row1, row2, row3, + Fieldset(_('Pesquisar'), + row1, row2, row3, row4, + HTML(autor_label), + HTML(autor_modal), buttons, ) ) diff --git a/sapl/base/views.py b/sapl/base/views.py index 58e245013..0a5fc36f2 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -660,6 +660,13 @@ class RelatorioHistoricoTramitacaoView(RelatorioMixin, FilterView): else: context['tramitacao__unidade_tramitacao_destino'] = '' + if self.request.GET['autoria__autor']: + context['autoria__autor'] = \ + (str(Autor.objects.get( + id=self.request.GET['autoria__autor']))) + else: + context['autoria__autor'] = '' + return context diff --git a/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html b/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html index eb427d8fe..eacfcc709 100644 --- a/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html +++ b/sapl/templates/base/RelatorioHistoricoTramitacao_filter.html @@ -14,6 +14,7 @@ PARÂMETROS DE PESQUISA:
 Período: {{ data_tramitacao }}
 Tipo de matéria: {{ tipo }}
+  Autor: {{ autoria__autor }}
 Status atual: {{ tramitacao__status }}
 Local de origem: {{ tramitacao__unidade_tramitacao_local }}
 Local de destino: {{ tramitacao__unidade_tramitacao_destino }}


diff --git a/sapl/templates/relatorios/relatorio_historico_tramitacao.html b/sapl/templates/relatorios/relatorio_historico_tramitacao.html index a377fc421..e5667dae1 100644 --- a/sapl/templates/relatorios/relatorio_historico_tramitacao.html +++ b/sapl/templates/relatorios/relatorio_historico_tramitacao.html @@ -10,6 +10,7 @@ Período: {{ data_tramitacao }}
Tipo de matéria: {{ tipo }}
+ Autor: {{ autoria__autor }}
Status atual: {{ tramitacao__status }}
Local de origem: {{ tramitacao__unidade_tramitacao_local }}
Local de destino: {{ tramitacao__unidade_tramitacao_destino }}