diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py
index b7c92bcc6..baf935dbb 100644
--- a/sapl/protocoloadm/forms.py
+++ b/sapl/protocoloadm/forms.py
@@ -1,9 +1,9 @@
import logging
-from crispy_forms.bootstrap import InlineRadios, Alert
+from crispy_forms.bootstrap import InlineRadios, Alert, FormActions
from sapl.crispy_layout_mixin import SaplFormHelper
-from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout, Div
+from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout, Div, Submit
from django import forms
from django.core.exceptions import (MultipleObjectsReturned,
ObjectDoesNotExist, ValidationError)
@@ -170,6 +170,7 @@ class DocumentoAdministrativoFilterSet(django_filters.FilterSet):
o = AnoNumeroOrderingFilter(help_text='')
+
class Meta(FilterOverridesMetaMixin):
model = DocumentoAdministrativo
fields = ['tipo',
@@ -207,17 +208,33 @@ class DocumentoAdministrativoFilterSet(django_filters.FilterSet):
row4 = to_row(
[
('tramitacao', 2),
- ('tramitacaoadministrativo__status', 5),
- ('tramitacaoadministrativo__unidade_tramitacao_destino', 5),
+ ('tramitacaoadministrativo__status', 4),
+ ('tramitacaoadministrativo__unidade_tramitacao_destino', 6),
])
+ 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'
self.form.helper.layout = Layout(
Fieldset(_('Pesquisar Documento'),
- row1, row2,
- row3, row4,
- form_actions(label='Pesquisar'))
+ row1, row2,
+ row3, row4,
+ buttons,)
)
diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py
index 050696504..2db1ac334 100755
--- a/sapl/protocoloadm/views.py
+++ b/sapl/protocoloadm/views.py
@@ -36,6 +36,7 @@ from sapl.protocoloadm.models import Protocolo
from sapl.utils import (create_barcode, get_base_url, get_client_ip,
get_mime_type_from_file_extension, lista_anexados,
show_results_filter_set, mail_service_configured)
+from sapl.relatorios.views import relatorio_doc_administrativos
from .forms import (AcompanhamentoDocumentoForm, AnularProtocoloAdmForm,
DocumentoAcessorioAdministrativoForm,
@@ -901,17 +902,16 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin,
context = super(PesquisarDocumentoAdministrativoView,
self).get_context_data(**kwargs)
- paginator = context['paginator']
- page_obj = context['page_obj']
-
- context['page_range'] = make_pagination(
- page_obj.number, paginator.num_pages)
-
+ if self.paginate_by:
+ paginator = context['paginator']
+ page_obj = context['page_obj']
+ context['page_range'] = make_pagination(
+ page_obj.number, paginator.num_pages)
+
return context
def get(self, request, *args, **kwargs):
super(PesquisarDocumentoAdministrativoView, self).get(request)
-
# Se a pesquisa estiver quebrando com a paginação
# Olhe esta função abaixo
# Provavelmente você criou um novo campo no Form/FilterSet
@@ -924,9 +924,7 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin,
url = url[ponto_comeco:]
else:
url = ''
-
self.filterset.form.fields['o'].label = _('Ordenação')
-
# é usada essa verificação anônima para quando os documentos administrativos
# estão no modo ostensivo, mas podem existir documentos administrativos
# restritos
@@ -934,18 +932,21 @@ class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin,
length = self.object_list.filter(restrito=False).count()
else:
length = self.object_list.count()
-
+
+ is_relatorio = url!='' and request.GET.get('relatorio',None)
+ self.paginate_by = None if is_relatorio else self.paginate_by
context = self.get_context_data(filter=self.filterset,
filter_url=url,
numero_res=length
)
-
context['show_results'] = show_results_filter_set(
self.request.GET.copy())
-
- return self.render_to_response(context)
-
-
+
+ if is_relatorio:
+ return relatorio_doc_administrativos(request,context)
+ else:
+ return self.render_to_response(context)
+
class AnexadoCrud(MasterDetailCrud):
model = Anexado
parent_field = 'documento_principal'
diff --git a/sapl/relatorios/views.py b/sapl/relatorios/views.py
index 72595b239..cb1d05cca 100755
--- a/sapl/relatorios/views.py
+++ b/sapl/relatorios/views.py
@@ -1325,4 +1325,28 @@ def resumo_ata_pdf(request,pk):
response['Content-Transfer-Encoding'] = 'binary'
response.write(pdf_file)
- return response
\ No newline at end of file
+ return response
+
+
+def relatorio_doc_administrativos(request, context):
+ base_url = request.build_absolute_uri()
+ casa = CasaLegislativa.objects.first()
+ rodape = ' '.join(get_rodape(casa))
+
+ context.update({'data': dt.today().strftime('%d/%m/%Y')})
+ context.update({'rodape': rodape})
+
+ header_context = {"casa": casa, 'logotipo':casa.logotipo, 'MEDIA_URL': MEDIA_URL}
+
+ html_template = render_to_string('relatorios/relatorio_doc_administrativos.html', context)
+ html_header = render_to_string('relatorios/header_ata.html', header_context)
+
+ pdf_file = make_pdf(base_url=base_url,main_template=html_template,header_template=html_header)
+
+ response = HttpResponse(content_type='application/pdf;')
+ response['Content-Disposition'] = 'inline; filename=relatorio.pdf'
+ response['Content-Transfer-Encoding'] = 'binary'
+ response.write(pdf_file)
+
+ return response
+
diff --git a/sapl/static/sapl/css/relatorio.css b/sapl/static/sapl/css/relatorio.css
index c3f2ec21f..b51a40c2b 100644
--- a/sapl/static/sapl/css/relatorio.css
+++ b/sapl/static/sapl/css/relatorio.css
@@ -16,7 +16,7 @@ h3 {
page-break-after: avoid;
}
-p {
+p, a {
font-size: 10pt;
text-align: justify;
text-justify: inter-word;
diff --git a/sapl/templates/protocoloadm/documentoadministrativo_filter.html b/sapl/templates/protocoloadm/documentoadministrativo_filter.html
index bf3a5e19e..bd8c3a9f4 100644
--- a/sapl/templates/protocoloadm/documentoadministrativo_filter.html
+++ b/sapl/templates/protocoloadm/documentoadministrativo_filter.html
@@ -81,3 +81,42 @@
{% block table_content %}
{% endblock table_content %}
+
+
+{% block extra_js %}
+
+
+
+
+
+{% endblock %}
diff --git a/sapl/templates/relatorios/relatorio_doc_administrativos.html b/sapl/templates/relatorios/relatorio_doc_administrativos.html
new file mode 100644
index 000000000..75723a976
--- /dev/null
+++ b/sapl/templates/relatorios/relatorio_doc_administrativos.html
@@ -0,0 +1,85 @@
+{% load i18n %}
+{% load common_tags %}
+{% load static %}
+
+
+
+
+
+
+
+
+ Documentos Administrativos
+ {% if documentoadministrativo_list|length %}
+ Número de documentos: {{numero_res}}
+ {% for d in documentoadministrativo_list %}
+
+ {% if request.user.is_anonymous and not d.restrito or not request.user.is_anonymous%}
+
{{d.tipo.sigla}} {{d.numero}}/{{d.ano}} - {{d.tipo}}
+
Interessado: {{ d.interessado|default_if_none:"Não informado"}}
+
+
Assunto: {{ d.assunto|safe}}
+
+ {% if d.protocolo %}
+
Protocolo: {{ d.protocolo}}
+ {% endif %}
+ {% define d.tramitacaoadministrativo_set.last as tram %}
+ {% if tram.unidade_tramitacao_destino %}
+
Localização Atual: {{tram.unidade_tramitacao_destino}}
+
+
Status: {{tram.status}}
+
+ {% endif %}
+ {% define d.documentoacessorioadministrativo_set.all as acess %}
+ {% if d.documentoacessorioadministrativo_set.all.exists %}
+
Documentos Acessórios:
+
+ {{ d.documentoacessorioadministrativo_set.all.count }}
+
+
+ {% endif %}
+ {% if d.tramitacao and mail_service_configured %}
+
Acompanhar Documento
+ {% endif %}
+ {% endif %}
+
+
+ {% endfor %}
+ {% else %}
+ Nenhum documento encontrado com essas especificações
+ {% endif %}
+
\ No newline at end of file