diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index e72b41f26..fe4a77eb7 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -227,6 +227,11 @@ class NormaPesquisaSimplesForm(forms.Form): required=False, widget=forms.DateInput(format='%d/%m/%Y') ) + + titulo = forms.CharField( + label='Título do Relatório', + required=False, + max_length=150) def __init__(self, *args, **kwargs): super(NormaPesquisaSimplesForm, self).__init__(*args, **kwargs) @@ -235,12 +240,15 @@ class NormaPesquisaSimplesForm(forms.Form): [('tipo_norma', 6), ('data_inicial', 3), ('data_final', 3)]) + + row2 = to_row( + [('titulo', 12)]) self.helper = FormHelper() self.helper.layout = Layout( Fieldset( ('Índice de Normas'), - row1, + row1, row2, form_actions(label='Pesquisar') ) ) diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 7ff408983..983ebac93 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -246,12 +246,16 @@ class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView): template_name = 'materia/impressos/norma.html' permission_required = ('materia.can_access_impressos', ) + def form_valid(self, form): normas = NormaJuridica.objects.all().order_by( - '-numero') + 'numero') template_norma = 'materia/impressos/normas_pdf.html' + + titulo = form.cleaned_data['titulo'] + if form.cleaned_data['tipo_norma']: normas = normas.filter(tipo=form.cleaned_data['tipo_norma']) @@ -265,6 +269,7 @@ class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView): normas = normas[:2000] context = {'quantidade': qtd_resultados, + 'titulo': titulo, 'normas': normas} return gerar_pdf_impressos(self.request, context, template_norma) diff --git a/sapl/templates/materia/impressos/normas_pdf.html b/sapl/templates/materia/impressos/normas_pdf.html index 1732b682b..22074d0a9 100644 --- a/sapl/templates/materia/impressos/normas_pdf.html +++ b/sapl/templates/materia/impressos/normas_pdf.html @@ -11,15 +11,26 @@ font-family: arial; font-size: 70%; } + #titulo + { + font-size: xx-large; + text-align: center; + } +
-{% if quantidade > 30 %} +{% if quantidade > 2000 %} {% endif %} +