diff --git a/sapl/base/forms.py b/sapl/base/forms.py
index 33e1a3a89..1461a666a 100644
--- a/sapl/base/forms.py
+++ b/sapl/base/forms.py
@@ -1759,6 +1759,20 @@ class RelatorioNormasPorAutorFilterSet(django_filters.FilterSet):
(Button('limpar',
'Limpar Autor',
css_class='btn btn-primary btn-sm'), 10)])
+ buttons = FormActions(
+ *[
+ HTML('''
+
+
+
+
+ ''')
+ ],
+ Submit('pesquisar', _('Pesquisar'), css_class='float-right',
+ onclick='return true;'),
+ css_class='form-group row justify-content-between'
+ ,
+ )
self.form.helper = SaplFormHelper()
self.form.helper.form_method = 'GET'
@@ -1768,5 +1782,5 @@ class RelatorioNormasPorAutorFilterSet(django_filters.FilterSet):
HTML(autor_label),
HTML(autor_modal),
row3,
- form_actions(label='Pesquisar'))
- )
\ No newline at end of file
+ buttons)
+ )
diff --git a/sapl/base/views.py b/sapl/base/views.py
index b2f16a652..4461d2dfc 100644
--- a/sapl/base/views.py
+++ b/sapl/base/views.py
@@ -34,7 +34,8 @@ from sapl.relatorios.views import (relatorio_materia_em_tramitacao, relatorio_ma
relatorio_historico_tramitacao, relatorio_fim_prazo_tramitacao,
relatorio_atas, relatorio_audiencia, relatorio_normas_mes,
relatorio_normas_vigencia, relatorio_historico_tramitacao_adm,
- relatorio_reuniao, relatorio_estatisticas_acesso_normas)
+ relatorio_reuniao, relatorio_estatisticas_acesso_normas,
+ relatorio_normas_por_autor)
from sapl import settings
from sapl.audiencia.models import AudienciaPublica, TipoAudienciaPublica
@@ -2120,10 +2121,11 @@ class RelatorioHistoricoTramitacaoAdmView(RelatorioMixin, FilterView):
return context
-class RelatorioNormasPorAutorView(FilterView):
+class RelatorioNormasPorAutorView(RelatorioMixin, FilterView):
model = NormaJuridica
filterset_class = RelatorioNormasPorAutorFilterSet
template_name = 'base/RelatorioNormasPorAutor_filter.html'
+ relatorio = relatorio_normas_por_autor
def get_filterset_kwargs(self, filterset_class):
super().get_filterset_kwargs(filterset_class)
@@ -2139,7 +2141,7 @@ class RelatorioNormasPorAutorView(FilterView):
qtdes = {}
for tipo in TipoNormaJuridica.objects.all():
- qs = kwargs['object_list']
+ qs = context['object_list']
qtde = len(qs.filter(tipo_id=tipo.id))
if qtde > 0:
qtdes[tipo] = qtde
@@ -2166,13 +2168,3 @@ class RelatorioNormasPorAutorView(FilterView):
' - ' + self.request.GET['data_1'])
return context
-
- def get(self, request, *args, **kwargs):
- super(RelatorioHistoricoTramitacaoAdmView, self).get(request)
- is_relatorio = request.GET.get('relatorio', None)
- context = self.get_context_data(filter=self.filterset)
-
- if is_relatorio:
- return relatorio_historico_tramitacao_adm(request, context)
- else:
- return self.render_to_response(context)
diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py
index 16988f0cd..9402897ab 100755
--- a/sapl/relatorios/views.py
+++ b/sapl/relatorios/views.py
@@ -1408,6 +1408,9 @@ def relatorio_historico_tramitacao_adm(obj, request, context):
def relatorio_estatisticas_acesso_normas(obj, request, context):
return cria_relatorio(request, context, 'relatorios/relatorio_estatisticas_acesso_normas.html')
+def relatorio_normas_por_autor(obj, request, context):
+ return cria_relatorio(request, context, 'relatorios/relatorio_normas_por_autor.html')
+
def relatorio_sessao_plenaria_pdf(request, pk):
base_url=request.build_absolute_uri()
logger = logging.getLogger(__name__)
diff --git a/sapl/templates/relatorios/relatorio_normas_por_autor.html b/sapl/templates/relatorios/relatorio_normas_por_autor.html
new file mode 100644
index 000000000..bef56df73
--- /dev/null
+++ b/sapl/templates/relatorios/relatorio_normas_por_autor.html
@@ -0,0 +1,106 @@
+{% load i18n %}
+{% load common_tags %}
+{% load static %}
+
+
+
+
+
+
+
+ Matérias por Autor
+
+ PARÂMETROS DE PESQUISA:
+ Autor: {{ autor }}
+ Tipo de Norma: {{ tipo }}
+ Data: {{periodo}}
+ {% if object_list %}
+
+
+ | QUADRO GERAL |
+
+ | Tipo de Norma |
+ Quantidade |
+
+
+
+ {% for key, value in qtdes.items %}
+
+ | {{key.sigla}} - {{key}} |
+ {{value}} |
+
+ {% endfor %}
+
+
+ {% for norma in object_list %}
+ {% ifchanged norma.autorianorma_set.first.autor %}
+
+
+ |
+ | Autor: {{ norma.autorianorma_set.first.autor }} |
+
+ | Norma |
+ Ementa |
+ Coautor(es) |
+
+
+ {% endifchanged %}
+
+
+ |
+ {{norma.tipo.sigla}} {{norma.numero}}/{{norma.ano}}
+ |
+ {% autoescape off %}{{norma.ementa}} {{norma.observacao}}{% endautoescape %} |
+
+ {% if norma.autorianorma_set.first != norma.autorianorma_set.last %}
+ {% for autor in norma.autorianorma_set.all %}
+ {% if not autor.primeiro_autor %}
+ {{ autor.autor }}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ |
+
+
+
+ {% endfor %}
+
+ {% else %}
+ Não foram encontradas normas com os parâmetros pesquisados.
+ {% endif %}
+
+