Browse Source

Refactor layout of submenus in materia

pull/11/merge
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
c5ca79e6d6
  1. 191
      materia/views.py
  2. 26
      templates/materia/documento_acessorio_edit.html
  3. 74
      templates/materia/legislacao_citada_edit.html
  4. 2
      templates/materia/materia_anexada.html
  5. 29
      templates/materia/materia_anexada_edit.html
  6. 23
      templates/materia/numeracao_edit.html
  7. 52
      templates/materia/tramitacao_edit.html

191
materia/views.py

@ -1,6 +1,8 @@
from datetime import date
from re import sub
import sapl
from comissoes.models import Comissao, Composicao
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, ButtonHolder, Column, Fieldset, Layout,
Submit)
@ -13,12 +15,9 @@ from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from comissoes.models import Comissao, Composicao
from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica
from sapl.crud import build_crud
from vanilla import GenericView
from .models import (Anexada, Autor, Autoria, DespachoInicial,
DocumentoAcessorio, MateriaLegislativa, Numeracao, Orgao,
@ -469,7 +468,7 @@ def get_tipos_documento():
for t in TipoDocumento.objects.all()]
class MateriaAnexadaForm(forms.Form):
class MateriaAnexadaForm(ModelForm):
tipo = forms.ChoiceField(required=True,
label='Tipo',
@ -493,6 +492,25 @@ class MateriaAnexadaForm(forms.Form):
widget=forms.TextInput(
attrs={'class': 'dateinput'}))
class Meta:
model = Anexada
fields = ['tipo', 'data_anexacao', 'data_desanexacao']
def __init__(self, *args, **kwargs):
row1 = sapl.layout.to_row(
[('tipo', 4),
('numero', 4),
('ano', 4)])
row2 = sapl.layout.to_row(
[('data_anexacao', 6),
('data_desanexacao', 6)])
self.helper = FormHelper()
self.helper.layout = Layout(row1, row2)
super(MateriaAnexadaForm, self).__init__(
*args, **kwargs)
class MateriaAnexadaView(FormMixin, GenericView):
template_name = "materia/materia_anexada.html"
@ -755,7 +773,7 @@ def get_tipos_norma():
for t in TipoNormaJuridica.objects.all()]
class LegislacaoCitadaForm(forms.Form):
class LegislacaoCitadaForm(ModelForm):
tipo = forms.ChoiceField(required=True,
label='Tipo Norma',
@ -793,14 +811,7 @@ class LegislacaoCitadaForm(forms.Form):
class Meta:
model = LegislacaoCitada
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.layout = Layout(
Fieldset(
'Incluir Legislação Citada',
'tipo',
fields = ['tipo',
'numero',
'ano',
'disposicao',
@ -814,7 +825,39 @@ class LegislacaoCitadaForm(forms.Form):
'paragrafo',
'inciso',
'alinea',
'item',
'item']
def __init__(self, *args, **kwargs):
row1 = sapl.layout.to_row(
[('tipo', 4),
('numero', 4),
('ano', 4)])
row2 = sapl.layout.to_row(
[('disposicao', 3),
('parte', 3),
('livro', 3),
('titulo', 3)])
row3 = sapl.layout.to_row(
[('capitulo', 3),
('secao', 3),
('subsecao', 3),
('artigo', 3)])
row4 = sapl.layout.to_row(
[('paragrafo', 3),
('inciso', 3),
('alinea', 3),
('item', 3)])
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.layout = Layout(
Fieldset(
'Incluir Legislação Citada',
row1, row2, row3, row4,
ButtonHolder(
Submit('submit', 'Salvar',
css_class='button primary')
@ -948,7 +991,7 @@ class LegislacaoCitadaEditView(FormMixin, GenericView):
'materialegislativa': materia})
class NumeracaoForm(forms.Form):
class NumeracaoForm(ModelForm):
tipo_materia = forms.ChoiceField(required=True,
label='Tipo Matéria',
@ -973,16 +1016,25 @@ class NumeracaoForm(forms.Form):
class Meta:
model = Numeracao
fields = ['tipo_materia',
'numero_materia',
'ano_materia',
'data_materia']
def __init__(self, *args, **kwargs):
row1 = sapl.layout.to_row(
[('tipo_materia', 12)])
row2 = sapl.layout.to_row(
[('numero_materia', 4),
('ano_materia', 4),
('data_materia', 4)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(
'Incluir Numeração',
'tipo_materia',
'numero_materia',
'ano_materia',
'data_materia',
row1, row2,
ButtonHolder(
Submit('submit', 'Salvar',
css_class='button primary')
@ -1078,7 +1130,7 @@ class NumeracaoEditView(FormMixin, GenericView):
return reverse('numeracao', kwargs={'pk': pk})
class DocumentoAcessorioForm(forms.Form):
class DocumentoAcessorioForm(ModelForm):
tipo = forms.ChoiceField(required=True,
label='Tipo',
@ -1101,16 +1153,32 @@ class DocumentoAcessorioForm(forms.Form):
ementa = forms.CharField(
label='Ementa', required=True)
class Meta:
model = DocumentoAcessorio
fields = ['tipo',
'nome',
'data',
'autor',
'ementa']
def __init__(self, *args, **kwargs):
row1 = sapl.layout.to_row(
[('tipo', 4),
('nome', 4),
('data', 4)])
row2 = sapl.layout.to_row(
[('autor', 12)])
row3 = sapl.layout.to_row(
[('ementa', 12)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(
'Incluir Documento Acessório',
'tipo',
'data',
'nome',
'autor',
'ementa',
row1, row2, row3,
ButtonHolder(
Submit('submit', 'Salvar',
css_class='button primary')
@ -1394,59 +1462,30 @@ class TramitacaoForm(ModelForm):
]
def __init__(self, *args, **kwargs):
row1 = sapl.layout.to_row(
[('data_tramitacao', 6),
('unidade_tramitacao_local', 6)])
row2 = sapl.layout.to_row(
[('status', 5),
('turno', 5),
('urgente', 2)])
row3 = sapl.layout.to_row(
[('unidade_tramitacao_destino', 12)])
row4 = sapl.layout.to_row(
[('data_encaminhamento', 5),
('data_fim_prazo', 5),
('ultima', 2)])
row5 = sapl.layout.to_row(
[('texto', 12)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset('Incluir Tramitação',
HTML(
"<ul class='small-block-grid-2 " +
"medium-block-grid-2 large-block-grid-2'>"),
HTML("<li>"),
'data_tramitacao',
HTML("</li>"),
HTML("<li>"),
'unidade_tramitacao_local',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'status',
HTML("</li>"),
HTML("<li>"),
'turno',
HTML("</li>"),
HTML("<li>"),
'urgente',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'unidade_tramitacao_destino',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-3 " +
"medium-block-grid-3 large-block-grid-3'>"),
HTML("<li>"),
'data_encaminhamento',
HTML("</li>"),
HTML("<li>"),
'data_fim_prazo',
HTML("</li>"),
HTML("<li>"),
'ultima',
HTML("</li>"),
HTML("</ul>"),
HTML(
"<ul class='small-block-grid-1 " +
"medium-block-grid-1 large-block-grid-1'>"),
HTML("<li>"),
'texto',
HTML("</li>"),
HTML("</ul>"),
row1, row2, row3, row4, row5,
),
ButtonHolder(
Submit('submit', 'Salvar',

26
templates/materia/documento_acessorio_edit.html

@ -16,8 +16,9 @@
<legend>Editar Documento Acessório</legend>
<form method="POST">
{% csrf_token %}
Tipo*
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<labe>Tipo*</labe>
<select name="tipo">
{% for t in tipos %}
<option value="{{t.id}}" {% if t.id == doc.tipo.id %} selected {% endif %}>
@ -25,19 +26,30 @@
</option>
{% endfor %}
</select>
</li>
Data
<li>
<labe>Data</labe>
<input type="text" name="data" class="dateinput" value="{{doc.data|date:'d/m/Y'}}" />
</li>
Nome*
<li>
<labe>Nome*</labe>
<input type="text" name="nome" value="{{doc.nome}}" />
</li>
</ul>
Autor*
<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2">
<li>
<labe>Autor*</labe>
<input type="text" name="autor" value="{{doc.autor}}" />
</li>
Ementa*
<li>
<labe>Ementa*</labe>
<input type="text" name="ementa" value="{{doc.ementa}}" />
</li>
</ul>
<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />
</form>

74
templates/materia/legislacao_citada_edit.html

@ -18,7 +18,9 @@
{% csrf_token %}
{% if error %} <h5 align="center"><font color="#FF0000">{{ error }}</font></h5> {% endif %}
Tipo Norma*
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<label>Tipo Norma*</label>
<select name="tipo">
{% for tipo in tipos_norma %}
<option value="{{tipo.id}}" {% if tipo == legislacao.norma.tipo %} selected {% endif %}>
@ -26,45 +28,69 @@
</option>
{% endfor %}
</select>
Número*
</li>
<li>
<label>Número*</label>
<input type="text" name="numero" value="{{legislacao.norma.numero}}" />
Ano*
</li>
<li>
<label>Ano*</label>
<input type="text" name="ano" value="{{legislacao.norma.ano}}" />
</li>
</ul>
Disposição
<ul class="small-block-grid-4 medium-block-grid-4 large-block-grid-4">
<li>
<label>Disposição</label>
<input type="text" name="disposicao" value="{{legislacao.disposicoes}}" />
Parte
</li>
<li>
<label>Parte</label>
<input type="text" name="parte" value="{{legislacao.parte}}" />
Livro
</li>
<li>
<label>Livro</label>
<input type="text" name="livro" value="{{legislacao.livro}}" />
Título
</li>
<li>
<label>Título</label>
<input type="text" name="titulo" value="{{legislacao.titulo}}" />
</li>
</ul>
Capítulo
<ul class="small-block-grid-4 medium-block-grid-4 large-block-grid-4">
<li>
<label>Capítulo</label>
<input type="text" name="capitulo" value="{{legislacao.capitulo}}" />
Seção
</li>
<li>
<label>Seção</label>
<input type="text" name="secao" value="{{legislacao.secao}}" />
Subseção
</li>
<li>
<label>Subseção</label>
<input type="text" name="subsecao" value="{{legislacao.subsecao}}" />
Artigo
</li>
<li>
<label>Artigo</label>
<input type="text" name="artigo" value="{{legislacao.artigo}}" />
</li>
</ul>
Inciso
<ul class="small-block-grid-4 medium-block-grid-4 large-block-grid-4">
<li>
<label>Inciso</label>
<input type="text" name="inciso" value="{{legislacao.inciso}}" />
Alínea
</li>
<li>
<label>Alínea</label>
<input type="text" name="alinea" value="{{legislacao.alinea}}" />
Item
</li>
<li>
<label>Item</label>
<input type="text" name="item" value="{{legislacao.item}}" />
</li>
</ul>
<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />

2
templates/materia/materia_anexada.html

@ -34,7 +34,7 @@
<form method="POST">
{% csrf_token %}
{% if error %} <h5 align="center"><font color="#FF0000">{{ error }}</font></h5> {% endif %}
{{ form.as_table }}
{% crispy form %}
<input type="submit" value="Anexar" id="anexar" name="anexar" class="primary button" />
</form>
</fieldset>

29
templates/materia/materia_anexada_edit.html

@ -16,21 +16,38 @@
<form method="POST">
{% csrf_token %}
{% if error %} <h5 align="center"><font color="#FF0000">{{ error }}</font></h5> {% endif %}
Tipo:
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<label>Tipo*</label>
<select id="tipo" name="tipo">
{% for tipo in get_tipos_materia %}
<option value="{{tipo.id}}" {% if tipo.id == data.tipo.id %} selected {% endif %}>{{tipo.sigla}} - {{tipo.descricao}}</option>
{% endfor %}
</select>
Número:
</li>
<li>
<label>Número*</label>
<input type="text" id="numero" name="numero" value="{{data.numero}}"/>
Ano:
</li>
<li>
<label>Ano*</label>
<input type="text" id="ano" name="ano" value="{{data.ano}}"/>
Data Anexação:
</li>
</ul>
<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2">
<li>
<label>Data Anexação*</label>
<input type="text" id="data_anexacao" name="data_anexacao" value="{{data.data_anexacao|date:'d/m/Y'}}" class="dateinput"/>
Data Desanexação:
<input type="text" id="data_desanexacao" name="data_desanexacao" value="{{data.data_desanexacao|date:'d/m/Y'}}" class="dateinput"/>
</li>
<li>
<label>Data Desanexação</label>
<input type="text" id="data_desanexacao" name="data_desanexacao" value="{{data.data_desanexacao|date:'d/m/Y'}}" class="dateinput"/>
</li>
</ul>
<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />
</form>

23
templates/materia/numeracao_edit.html

@ -16,8 +16,9 @@
<legend>Editar Numeração</legend>
<form method="POST">
{% csrf_token %}
Tipo Matéria*
<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
<li>
<label>Tipo Matéria*</label>
<select name="tipo_materialegislativa">
{% for t in tipos %}
<option value="{{t.id}}" {% if t.id == numeracao.tipo_materialegislativa_id %} selected {% endif %}>
@ -25,15 +26,23 @@
</option>
{% endfor %}
</select>
</li>
</ul>
Número*
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<label>Número*</select>label>
<input type="text" name="numero_materialegislativa" value="{{numeracao.numero_materialegislativa}}" />
Ano*
</li>
<li>
<label>Ano*</label>
<input type="text" name="ano_materialegislativa" value="{{numeracao.ano_materialegislativa}}" />
Data
</li>
<li>
<label>Data</label>
<input type="text" name="data_materialegislativa" class="dateinput" value="{{numeracao.data_materialegislativa|date:'d/m/Y'}}" />
</li>
<ul>
<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />

52
templates/materia/tramitacao_edit.html

@ -16,14 +16,20 @@
<legend>Editar Tramitação</legend>
<form method="POST">
{% csrf_token %}
Data Tramitação
<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2">
<li>
<label>Data Tramitação</label>
<input type="text" name="data_tramitacao" class="dateinput" value="{{tramitacao.data_tramitacao|date:'d/m/Y'}}" disabled />
Unidade Local
</li>
<li>
<label>Unidade Local</label>
<input type="text" name="unidade_tramitacao_local" value="{{tramitacao.unidade_tramitacao_local}}" disabled />
</li>
</ul>
Status*
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<label>Status*</label>
<select name="status">
{% for s in status %}
<option value="{{s.id}}" {% if s.id == tramitacao.status.id %} selected {% endif %}>
@ -31,17 +37,23 @@
</option>
{% endfor %}
</select>
Turno*
</li>
<li>
<label>Turno*</label>
<select name="turno">
{% for a, b in turno %}
<option value="{{a}}">{{b}}</option>
{% endfor %}
</select>
</li>
<li>
<input type="checkbox" name="urgente" value="{{tramtiacao.urgente}}" /> Urgente ?<br />
</li>
</ul>
Unidade Destino
<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
<li>
<label>Unidade Destino</label>
<select name="unidade_tramitacao_destino">
{% for u in unidade_tramitacao %}
<option value="{{u.id}}" {% if u.id == tramitacao.unidade_tramitacao_destino.id %} selected {% endif %}>
@ -49,17 +61,29 @@
</option>
{% endfor %}
</select>
</li>
</ul>
Data Encaminhamento
<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
<li>
<label>Data Encaminhamento</label>
<input type="text" name="data_encaminhamento" class="dateinput" value="{{tramitacao.data_encaminhamento|date:'d/m/Y'}}" />
Data Fim Prazo
</li>
<li>
<label>Data Fim Prazo</label>
<input type="text" name="data_fim_prazo" class="dateinput" value="{{tramitacao.data_fim_prazo|date:'d/m/Y'}}" />
</li>
<li>
<input type="checkbox" name="ultima" value="{{tramtiacao.ultima}}" /> Ultima<br />
</li>
</ul>
Texto da Ação
<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
<li>
<label>Texto da Ação</label>
<textarea rows="4" cols="50" name="texto">{{tramitacao.texto}}</textarea>
</li>
</ul>
<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />

Loading…
Cancel
Save