|
@ -1,17 +1,17 @@ |
|
|
from datetime import date |
|
|
from datetime import date |
|
|
|
|
|
|
|
|
|
|
|
import sapl |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import HTML, Field, Fieldset, Layout |
|
|
from crispy_forms.layout import HTML, Field, Fieldset, Layout |
|
|
from django import forms |
|
|
from django import forms |
|
|
from django.forms import ModelForm |
|
|
from django.forms import ModelForm |
|
|
from django.utils.safestring import mark_safe |
|
|
from django.utils.safestring import mark_safe |
|
|
|
|
|
|
|
|
import sapl |
|
|
|
|
|
from materia.models import TipoMateriaLegislativa |
|
|
from materia.models import TipoMateriaLegislativa |
|
|
from sapl.layout import form_actions |
|
|
from sapl.layout import form_actions |
|
|
|
|
|
|
|
|
from .models import (Autor, DocumentoAcessorioAdministrativo, |
|
|
from .models import (Autor, DocumentoAcessorioAdministrativo, |
|
|
TipoDocumentoAdministrativo, TramitacaoAdministrativo) |
|
|
DocumentoAdministrativo, TipoDocumentoAdministrativo, |
|
|
|
|
|
TramitacaoAdministrativo) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_range_anos(): |
|
|
def get_range_anos(): |
|
@ -19,6 +19,12 @@ def get_range_anos(): |
|
|
+ [(year, year) for year in range(date.today().year, 1960, -1)] |
|
|
+ [(year, year) for year in range(date.today().year, 1960, -1)] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tramitacao(): |
|
|
|
|
|
return [('', '--------'), |
|
|
|
|
|
(True, 'Sim'), |
|
|
|
|
|
(False, 'Não')] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TIPOS_PROTOCOLO = [('', 'Selecione'), |
|
|
TIPOS_PROTOCOLO = [('', 'Selecione'), |
|
|
('0', 'Enviado'), |
|
|
('0', 'Enviado'), |
|
|
('1', 'Recebido')] |
|
|
('1', 'Recebido')] |
|
@ -82,14 +88,14 @@ class ProtocoloForm(forms.Form): |
|
|
required=False, |
|
|
required=False, |
|
|
queryset=TipoMateriaLegislativa.objects.all(), |
|
|
queryset=TipoMateriaLegislativa.objects.all(), |
|
|
empty_label='Selecione', |
|
|
empty_label='Selecione', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
autor = forms.ModelChoiceField( |
|
|
autor = forms.ModelChoiceField( |
|
|
label='Autor', |
|
|
label='Autor', |
|
|
required=False, |
|
|
required=False, |
|
|
queryset=Autor.objects.all().order_by('tipo'), |
|
|
queryset=Autor.objects.all().order_by('tipo'), |
|
|
empty_label='Selecione', |
|
|
empty_label='Selecione', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
assunto = forms.CharField(label='Assunto', required=False) |
|
|
assunto = forms.CharField(label='Assunto', required=False) |
|
|
|
|
|
|
|
@ -248,7 +254,7 @@ class ProtocoloMateriaForm(forms.Form): |
|
|
required=False, |
|
|
required=False, |
|
|
queryset=TipoMateriaLegislativa.objects.all(), |
|
|
queryset=TipoMateriaLegislativa.objects.all(), |
|
|
empty_label='Selecione', |
|
|
empty_label='Selecione', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
num_paginas = forms.CharField(label='Núm. Páginas', required=True) |
|
|
num_paginas = forms.CharField(label='Núm. Páginas', required=True) |
|
|
ementa = forms.CharField( |
|
|
ementa = forms.CharField( |
|
@ -259,7 +265,7 @@ class ProtocoloMateriaForm(forms.Form): |
|
|
required=False, |
|
|
required=False, |
|
|
queryset=Autor.objects.all().order_by('tipo'), |
|
|
queryset=Autor.objects.all().order_by('tipo'), |
|
|
empty_label='Selecione', |
|
|
empty_label='Selecione', |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
observacao = forms.CharField(required=True, |
|
|
observacao = forms.CharField(required=True, |
|
|
widget=forms.Textarea, |
|
|
widget=forms.Textarea, |
|
@ -408,3 +414,91 @@ class TramitacaoAdmForm(ModelForm): |
|
|
) |
|
|
) |
|
|
super(TramitacaoAdmForm, self).__init__( |
|
|
super(TramitacaoAdmForm, self).__init__( |
|
|
*args, **kwargs) |
|
|
*args, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DocumentoAdministrativoForm(ModelForm): |
|
|
|
|
|
|
|
|
|
|
|
data = forms.DateField(label=u'Data', |
|
|
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
|
|
required=False, |
|
|
|
|
|
widget=forms.DateInput( |
|
|
|
|
|
format='%d/%m/%Y', |
|
|
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
|
|
|
|
data_fim_prazo = forms.DateField(label=u'Data Fim Prazo', |
|
|
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
|
|
required=False, |
|
|
|
|
|
widget=forms.DateInput( |
|
|
|
|
|
format='%d/%m/%Y', |
|
|
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
|
|
|
|
tramitacao = forms.ChoiceField(required=True, |
|
|
|
|
|
label='Em Tramitação?', |
|
|
|
|
|
choices=tramitacao(), |
|
|
|
|
|
widget=forms.Select( |
|
|
|
|
|
attrs={'class': 'selector'})) |
|
|
|
|
|
|
|
|
|
|
|
assunto = forms.CharField( |
|
|
|
|
|
label='Descrição', required=False, |
|
|
|
|
|
widget=forms.Textarea()) |
|
|
|
|
|
|
|
|
|
|
|
observacao = forms.CharField( |
|
|
|
|
|
label='Descrição', required=False, |
|
|
|
|
|
widget=forms.Textarea()) |
|
|
|
|
|
|
|
|
|
|
|
class Meta: |
|
|
|
|
|
model = DocumentoAdministrativo |
|
|
|
|
|
fields = ['tipo', |
|
|
|
|
|
'numero', |
|
|
|
|
|
'ano', |
|
|
|
|
|
'data', |
|
|
|
|
|
'numero_protocolo', |
|
|
|
|
|
'assunto', |
|
|
|
|
|
'interessado', |
|
|
|
|
|
'tramitacao', |
|
|
|
|
|
'dias_prazo', |
|
|
|
|
|
'data_fim_prazo', |
|
|
|
|
|
'observacao', |
|
|
|
|
|
'texto_integral' |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|
|
|
|
row1 = sapl.layout.to_row( |
|
|
|
|
|
[('tipo', 4), |
|
|
|
|
|
('numero', 4), |
|
|
|
|
|
('ano', 4)]) |
|
|
|
|
|
|
|
|
|
|
|
row2 = sapl.layout.to_row( |
|
|
|
|
|
[('data', 6), |
|
|
|
|
|
('numero_protocolo', 6)]) |
|
|
|
|
|
|
|
|
|
|
|
row3 = sapl.layout.to_row( |
|
|
|
|
|
[('assunto', 12)]) |
|
|
|
|
|
|
|
|
|
|
|
row4 = sapl.layout.to_row( |
|
|
|
|
|
[('interessado', 9), |
|
|
|
|
|
('tramitacao', 3)]) |
|
|
|
|
|
|
|
|
|
|
|
row5 = sapl.layout.to_row( |
|
|
|
|
|
[('texto_integral', 12)]) |
|
|
|
|
|
|
|
|
|
|
|
row6 = sapl.layout.to_row( |
|
|
|
|
|
[('dias_prazo', 6), |
|
|
|
|
|
('data_fim_prazo', 6)]) |
|
|
|
|
|
|
|
|
|
|
|
row7 = sapl.layout.to_row( |
|
|
|
|
|
[('observacao', 12)]) |
|
|
|
|
|
|
|
|
|
|
|
self.helper = FormHelper() |
|
|
|
|
|
self.helper.layout = Layout( |
|
|
|
|
|
Fieldset('Formulário de Cadastro', |
|
|
|
|
|
Fieldset('Identificação Básica', |
|
|
|
|
|
row1, row2, row3, row4, row5), |
|
|
|
|
|
Fieldset('Outras Informações', |
|
|
|
|
|
row6, row7), |
|
|
|
|
|
form_actions(), |
|
|
|
|
|
), |
|
|
|
|
|
) |
|
|
|
|
|
super(DocumentoAdministrativoForm, self).__init__( |
|
|
|
|
|
*args, **kwargs) |
|
|