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 %}