From d77d4d8a175cd1abe39d5472de625956aa6fe6b5 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 21 Oct 2015 15:12:27 -0200 Subject: [PATCH] Add Pesquisa DocumentoAdministrativo --- protocoloadm/urls.py | 6 +- protocoloadm/views.py | 59 +++++++++++++- templates/materia/formulario_cadastro.html | 2 +- .../materia/formulario_simplificado.html | 4 +- templates/protocoloadm/documento_detail.html | 8 ++ templates/protocoloadm/pesquisa_doc_adm.html | 76 +++++++++++++++++++ 6 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 templates/protocoloadm/documento_detail.html create mode 100644 templates/protocoloadm/pesquisa_doc_adm.html diff --git a/protocoloadm/urls.py b/protocoloadm/urls.py index d45f2f7dd..4b06db787 100644 --- a/protocoloadm/urls.py +++ b/protocoloadm/urls.py @@ -1,6 +1,8 @@ from django.conf.urls import include, url -from protocoloadm.views import (AnularProtocoloAdmView, ProposicaoReceberView, +from protocoloadm.views import (AnularProtocoloAdmView, + PesquisarDocumentoAdministrativo, + ProposicaoReceberView, ProposicoesIncorporadasView, ProposicoesNaoIncorporadasView, ProposicoesNaoRecebidasView, @@ -40,6 +42,8 @@ urlpatterns = [ ProtocoloDocumentoView.as_view(), name='protocolar_doc'), url(r'^protocoloadm/protocolar-mat', ProtocoloMateriaView.as_view(), name='protocolar_mat'), + url(r'^protocoloadm/pesq-doc-adm', + PesquisarDocumentoAdministrativo.as_view(), name='pesq_doc_adm'), # TODO: move to Proposicoes app diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 188495f44..c1b61e6f6 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -507,7 +507,7 @@ class ProposicaoReceberView(TemplateView): template_name = "protocoloadm/proposicao_receber.html" -class ProposicoesNaoRecebidasView(ListView): +class ProposicoesNaoRecebidasView(TemplateView): template_name = "protocoloadm/proposicoes_naorecebidas.html" model = Proposicao paginate_by = 10 @@ -516,7 +516,7 @@ class ProposicoesNaoRecebidasView(ListView): return Proposicao.objects.filter(data_envio__isnull=False, status='E') -class ProposicoesNaoIncorporadasView(ListView): +class ProposicoesNaoIncorporadasView(TemplateView): template_name = "protocoloadm/proposicoes_naoincorporadas.html" model = Proposicao paginate_by = 10 @@ -536,3 +536,58 @@ class ProposicoesIncorporadasView(ListView): return Proposicao.objects.filter(data_envio__isnull=False, data_recebimento__isnull=False, status='I') + +# class PesquisaDocForm(forms.Form): + + +class PesquisarDocumentoAdministrativo(TemplateView): + template_name = "protocoloadm/pesquisa_doc_adm.html" + + def get_tipos_doc(self): + return TipoDocumentoAdministrativo.objects.all() + + def post(self, request, *args, **kwargs): + + if request.POST['tipo_documento']: + kwargs['tipo_documento'] = request.POST['tipo_documento'] + + if request.POST['numero']: + kwargs['numero'] = request.POST['numero'] + + if request.POST['ano']: + kwargs['ano'] = request.POST['ano'] + + if request.POST['numero_protocolo']: + kwargs['numero_protocolo'] = request.POST['numero_protocolo'] + + if request.POST['periodo_inicial']: + kwargs['periodo_inicial'] = request.POST['periodo_inicial'] + + if request.POST['periodo_final']: + kwargs['periodo_final'] = request.POST['periodo_final'] + + if request.POST['interessado']: + kwargs['interessado'] = request.POST['interessado'] + + if request.POST['assunto']: + kwargs['assunto'] = request.POST['assunto'] + + if request.POST['tramitacao']: + if request.POST['tramitacao'] == 1: + kwargs['tramitacao'] = True + elif request.POST['tramitacao'] == 0: + kwargs['tramitacao'] = False + else: + kwargs['tramitacao'] = request.POST['tramitacao'] + + # if request.POST['localizacao']: + # kwargs['localizacao'] = request.POST['localizacao'] + + # if request.POST['situacao']: + # kwargs['situacao'] = request.POST['situacao'] + + doc = DocumentoAdministrativo.objects.filter(**kwargs) + + return self.render_to_response( + {'documentos': doc} + ) diff --git a/templates/materia/formulario_cadastro.html b/templates/materia/formulario_cadastro.html index 832c5f74c..57ccd9d06 100644 --- a/templates/materia/formulario_cadastro.html +++ b/templates/materia/formulario_cadastro.html @@ -1,4 +1,4 @@ -{% extends "protocoloadm/protocoloadm_detail.html" %} +{% extends "crud/detail.html" %} {% load i18n %} {% load crispy_forms_tags %} diff --git a/templates/materia/formulario_simplificado.html b/templates/materia/formulario_simplificado.html index 954866747..54db1129d 100644 --- a/templates/materia/formulario_simplificado.html +++ b/templates/materia/formulario_simplificado.html @@ -1,12 +1,10 @@ -{% extends "protocoloadm/protocoloadm_detail.html" %} +{% extends "crud/detail.html" %} {% load i18n %} {% load crispy_forms_tags %} {% block detail_content %}
{% csrf_token %} - - {{ form.as_p }}
diff --git a/templates/protocoloadm/documento_detail.html b/templates/protocoloadm/documento_detail.html new file mode 100644 index 000000000..ad7650165 --- /dev/null +++ b/templates/protocoloadm/documento_detail.html @@ -0,0 +1,8 @@ +{% extends "crud/detail.html" %} +{% load i18n %} + +{% block sections_nav %} + +{% endblock sections_nav %} diff --git a/templates/protocoloadm/pesquisa_doc_adm.html b/templates/protocoloadm/pesquisa_doc_adm.html new file mode 100644 index 000000000..b87dd9c82 --- /dev/null +++ b/templates/protocoloadm/pesquisa_doc_adm.html @@ -0,0 +1,76 @@ +{% extends "protocoloadm/documento_detail.html" %} +{% load i18n %} +{% load crispy_forms_tags %} + +{% block detail_content %} +
+ Pesquisa Básica + {% if documentos %} + Total: {{ documentos|length }} + + + {% for d in documentos %} + + + + {% endfor %} +
+ {{ d.tipo.sigla }} {{ d.numero }}/{{ d.ano }} - {{ d.tipo }}
+ {{ d.assunto }}
+ Interessado: {{ d.interessado }} +
+ {% else %} + + {% csrf_token %} + + Tipo Documento: +
+ Número:
+ Ano:
+ Núm. Protocolo:
+ Período Data:
+ Inicial: + Final:
+ Interessado:
+ Assunto:
+ Tramitando: +
+ + + + + {% endif %} +
+{% endblock %} + +{% block foot_js %} + +{% endblock %} \ No newline at end of file