Browse Source

Fix #3011 - Adicionar Matérias à Pauta (#3010)

* Refatoração Pauta Reunião

* Refatoração
pull/3013/head
João Rodrigues 5 years ago
committed by Edward
parent
commit
5b8f6e9f28
  1. 38
      sapl/comissoes/forms.py
  2. 32
      sapl/comissoes/views.py
  3. 42
      sapl/materia/forms.py
  4. 82
      sapl/materia/views.py
  5. 135
      sapl/templates/comissoes/pauta.html
  6. 110
      sapl/templates/comissoes/reuniao_detail.html
  7. 34
      sapl/templates/materia/em_lote/anexada.html

38
sapl/comissoes/forms.py

@ -1,7 +1,9 @@
import django_filters
import logging import logging
from crispy_forms.layout import Fieldset, Layout
from django import forms from django import forms
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import transaction from django.db import transaction
@ -11,10 +13,12 @@ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import (Comissao, Composicao, DocumentoAcessorio, from sapl.comissoes.models import (Comissao, Composicao, DocumentoAcessorio,
Participacao, Reuniao, Periodo) Participacao, Periodo, Reuniao)
from sapl.materia.models import PautaReuniao from sapl.crispy_layout_mixin import form_actions, SaplFormHelper, to_row
from sapl.materia.models import MateriaEmTramitacao, PautaReuniao
from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar
from sapl.utils import FileFieldCheckMixin from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import FileFieldCheckMixin, FilterOverridesMetaMixin
class ComposicaoForm(forms.ModelForm): class ComposicaoForm(forms.ModelForm):
@ -416,6 +420,32 @@ class ReuniaoForm(ModelForm):
return self.cleaned_data return self.cleaned_data
class PautaReuniaoFilterSet(django_filters.FilterSet):
class Meta(FilterOverridesMetaMixin):
model = MateriaEmTramitacao
fields = ['materia__tipo', 'materia__ano', 'materia__numero', 'materia__data_apresentacao']
def __init__(self, *args, **kwargs):
super(PautaReuniaoFilterSet, self).__init__(*args, **kwargs)
self.filters['materia__tipo'].label = "Tipo da Matéria"
self.filters['materia__ano'].label = "Ano da Matéria"
self.filters['materia__data_apresentacao'].label = "Data (Inicial - Final)"
row1 = to_row([('materia__numero', 4), ('materia__tipo', 4), ('materia__ano', 4)])
row2 = to_row([('materia__data_apresentacao', 12)])
self.form.helper = SaplFormHelper()
self.form.helper.form_method = "GET"
self.form.helper.layout = Layout(
Fieldset(
_("Pesquisa de Matérias"), row1, row2,
form_actions(label="Pesquisar")
)
)
class PautaReuniaoForm(forms.ModelForm): class PautaReuniaoForm(forms.ModelForm):
class Meta: class Meta:

32
sapl/comissoes/views.py

@ -12,18 +12,22 @@ from django.views.generic.detail import DetailView
from django.views.generic.edit import FormMixin, UpdateView from django.views.generic.edit import FormMixin, UpdateView
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django_filters.views import FilterView
from sapl.base.models import AppConfig as AppsAppConfig from sapl.base.models import AppConfig as AppsAppConfig
from sapl.comissoes.apps import AppConfig from sapl.comissoes.apps import AppConfig
from sapl.comissoes.forms import (ComissaoForm, ComposicaoForm, from sapl.comissoes.forms import (ComissaoForm, ComposicaoForm,
DocumentoAcessorioCreateForm, DocumentoAcessorioCreateForm,
DocumentoAcessorioEditForm, DocumentoAcessorioEditForm,
ParticipacaoCreateForm, ParticipacaoEditForm, ParticipacaoCreateForm, ParticipacaoEditForm,
PautaReuniaoForm, PeriodoForm, ReuniaoForm) PautaReuniaoForm, PeriodoForm, ReuniaoForm,
PautaReuniaoFilterSet)
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux,
MasterDetailCrud, MasterDetailCrud,
PermissionRequiredForAppCrudMixin) PermissionRequiredForAppCrudMixin)
from sapl.materia.models import (MateriaLegislativa, Tramitacao, PautaReuniao, from sapl.materia.models import (MateriaLegislativa, Tramitacao, PautaReuniao,
MateriaEmTramitacao) MateriaEmTramitacao)
from sapl.utils import show_results_filter_set
from .models import (CargoComissao, Comissao, Composicao, DocumentoAcessorio, from .models import (CargoComissao, Comissao, Composicao, DocumentoAcessorio,
Participacao, Periodo, Reuniao, TipoComissao) Participacao, Periodo, Reuniao, TipoComissao)
@ -218,7 +222,7 @@ class ReuniaoCrud(MasterDetailCrud):
context['mats'] = MateriaLegislativa.objects.filter( context['mats'] = MateriaLegislativa.objects.filter(
pk__in=materias_pk pk__in=materias_pk
).order_by('tipo', '-ano', '-numero') ).order_by('tipo', '-ano', 'numero')
context['num_mats'] = len(context['mats']) context['num_mats'] = len(context['mats'])
context['reuniao_pk'] = self.kwargs['pk'] context['reuniao_pk'] = self.kwargs['pk']
@ -296,8 +300,8 @@ class RemovePautaView(PermissionRequiredMixin, CreateView):
context['materias'] = MateriaLegislativa.objects.filter( context['materias'] = MateriaLegislativa.objects.filter(
pk__in=materias_pk pk__in=materias_pk
).order_by('tipo', '-ano', '-numero') ).order_by('tipo', '-ano', 'numero')
context['num_materias'] = len(context['materias']) context['numero_materias'] = len(context['materias'])
return context return context
@ -319,9 +323,8 @@ class RemovePautaView(PermissionRequiredMixin, CreateView):
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)
class AdicionaPautaView(PermissionRequiredMixin, CreateView): class AdicionaPautaView(PermissionRequiredMixin, FilterView):
model = PautaReuniao filterset_class = PautaReuniaoFilterSet
form_class = PautaReuniaoForm
template_name = 'comissoes/pauta.html' template_name = 'comissoes/pauta.html'
permission_required = ('comissoes.add_reuniao', ) permission_required = ('comissoes.add_reuniao', )
@ -336,12 +339,19 @@ class AdicionaPautaView(PermissionRequiredMixin, CreateView):
context['object'] = Reuniao.objects.get(pk=self.kwargs['pk']) context['object'] = Reuniao.objects.get(pk=self.kwargs['pk'])
context['root_pk'] = context['object'].comissao.pk context['root_pk'] = context['object'].comissao.pk
materias_comissao = lista_materias_comissao(context['object'].comissao.pk) qr = self.request.GET.copy()
materias_pauta = PautaReuniao.objects.filter(reuniao=context['object'])
materias_pauta = PautaReuniao.objects.filter(reuniao=context['object'])
nao_listar = [mp.materia.pk for mp in materias_pauta] nao_listar = [mp.materia.pk for mp in materias_pauta]
context['materias'] = materias_comissao.exclude(pk__in=nao_listar)
context['num_materias'] = len(context['materias']) context['object_list'] = context['object_list'].filter(
tramitacao__unidade_tramitacao_destino__comissao=context['root_pk']
).exclude(materia__pk__in=nao_listar).order_by(
"materia__tipo", "-materia__ano", "materia__numero"
)
context['numero_resultados'] = len(context['object_list'])
context['show_results'] = show_results_filter_set(qr)
return context return context

42
sapl/materia/forms.py

@ -1,6 +1,7 @@
import django_filters
import logging import logging
import os import os
import sapl
from crispy_forms.bootstrap import Alert, InlineRadios from crispy_forms.bootstrap import Alert, InlineRadios
from crispy_forms.layout import (HTML, Button, Field, Fieldset, from crispy_forms.layout import (HTML, Button, Field, Fieldset,
@ -11,7 +12,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.files.base import File from django.core.files.base import File
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import models, transaction from django.db import models, transaction
from django.db.models import Max, Q, F from django.db.models import F, Max, Q
from django.forms import ModelChoiceField, ModelForm, widgets from django.forms import ModelChoiceField, ModelForm, widgets
from django.forms.forms import Form from django.forms.forms import Form
from django.forms.models import ModelMultipleChoiceField from django.forms.models import ModelMultipleChoiceField
@ -21,36 +22,37 @@ from django.utils.encoding import force_text
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import django_filters
import sapl
from sapl.base.models import AppConfig, Autor, TipoAutor from sapl.base.models import AppConfig, Autor, TipoAutor
from sapl.comissoes.models import Comissao, Participacao, Composicao from sapl.comissoes.models import Comissao, Composicao, Participacao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC, from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_PRIVATE) STATUS_TA_PRIVATE)
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column, from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions,
to_row) to_column, to_row, SaplFormHelper)
from sapl.crispy_layout_mixin import SaplFormHelper
from sapl.materia.models import (AssuntoMateria, Autoria, MateriaAssunto, from sapl.materia.models import (AssuntoMateria, Autoria, MateriaAssunto,
MateriaLegislativa, Orgao, RegimeTramitacao, MateriaLegislativa, Orgao,
TipoDocumento, TipoProposicao, StatusTramitacao, RegimeTramitacao, StatusTramitacao,
TipoDocumento, TipoProposicao,
UnidadeTramitacao) UnidadeTramitacao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica, from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica) TipoNormaJuridica)
from sapl.parlamentares.models import Legislatura, Partido, Parlamentar from sapl.parlamentares.models import Legislatura, Partido, Parlamentar
from sapl.protocoloadm.models import Protocolo, DocumentoAdministrativo, Anexado from sapl.protocoloadm.models import (Anexado, DocumentoAdministrativo,
Protocolo)
from sapl.settings import MAX_DOC_UPLOAD_SIZE from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import (YES_NO_CHOICES, SEPARADOR_HASH_PROPOSICAO, from sapl.utils import (autor_label, autor_modal,
ChoiceWithoutValidationField, ChoiceWithoutValidationField,
MateriaPesquisaOrderingFilter, RangeWidgetOverride, choice_anos_com_materias, FileFieldCheckMixin,
autor_label, autor_modal, gerar_hash_arquivo, FilterOverridesMetaMixin, gerar_hash_arquivo,
lista_anexados, MateriaPesquisaOrderingFilter,
models_with_gr_for_model, qs_override_django_filter, models_with_gr_for_model, qs_override_django_filter,
choice_anos_com_materias, FilterOverridesMetaMixin, FileFieldCheckMixin, RangeWidgetOverride, SEPARADOR_HASH_PROPOSICAO,
lista_anexados) YES_NO_CHOICES)
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, from .models import (AcompanhamentoMateria, Anexada, Autoria,
DocumentoAcessorio, Numeracao, Proposicao, Relatoria, DespachoInicial, DocumentoAcessorio, Numeracao,
TipoMateriaLegislativa, Tramitacao, UnidadeTramitacao) Proposicao, Relatoria, TipoMateriaLegislativa,
Tramitacao, UnidadeTramitacao)
def CHOICE_TRAMITACAO(): def CHOICE_TRAMITACAO():

82
sapl/materia/views.py

@ -1,13 +1,17 @@
from datetime import datetime
import itertools import itertools
import logging import logging
import os import os
from random import choice import sapl
import shutil import shutil
from string import ascii_letters, digits
import tempfile import tempfile
import weasyprint
from crispy_forms.layout import HTML from crispy_forms.layout import HTML
from datetime import datetime
from random import choice
from string import ascii_letters, digits
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import permission_required
@ -18,65 +22,53 @@ from django.db.models import Max, Q
from django.http import HttpResponse, JsonResponse from django.http import HttpResponse, JsonResponse
from django.http.response import Http404, HttpResponseRedirect from django.http.response import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.template import RequestContext, loader from django.template import loader, RequestContext
from django.utils import formats, timezone from django.utils import formats, timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView, TemplateView, CreateView, UpdateView from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from django_filters.views import FilterView from django_filters.views import FilterView
import weasyprint
import weasyprint
import sapl
from sapl.base.email_utils import do_envia_email_confirmacao from sapl.base.email_utils import do_envia_email_confirmacao
from sapl.base.models import Autor, CasaLegislativa, AppConfig as BaseAppConfig from sapl.base.models import Autor, CasaLegislativa, AppConfig as BaseAppConfig
from sapl.base.signals import tramitacao_signal from sapl.base.signals import tramitacao_signal
from sapl.comissoes.models import Comissao, Participacao, Composicao from sapl.comissoes.models import Comissao, Participacao, Composicao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_RESTRICT, from sapl.compilacao.models import STATUS_TA_IMMUTABLE_RESTRICT, STATUS_TA_PRIVATE
STATUS_TA_PRIVATE)
from sapl.compilacao.views import IntegracaoTaView from sapl.compilacao.views import IntegracaoTaView
from sapl.crispy_layout_mixin import SaplFormHelper from sapl.crispy_layout_mixin import form_actions, SaplFormHelper, SaplFormLayout
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions from sapl.crud.base import (Crud, CrudAux, make_pagination, MasterDetailCrud,
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, PermissionRequiredForAppCrudMixin, RP_DETAIL, RP_LIST)
MasterDetailCrud, from sapl.materia.forms import (AnexadaForm, AutoriaForm, AutoriaMultiCreateForm,
PermissionRequiredForAppCrudMixin, make_pagination) ConfirmarProposicaoForm, DevolverProposicaoForm,
from sapl.materia.forms import (AnexadaForm, AutoriaForm, DespachoInicialCreateForm, LegislacaoCitadaForm,
AutoriaMultiCreateForm, MateriaPesquisaSimplesForm, OrgaoForm, ProposicaoForm,
ConfirmarProposicaoForm, TipoProposicaoForm, TramitacaoForm, TramitacaoUpdateForm)
DevolverProposicaoForm, LegislacaoCitadaForm,
OrgaoForm, ProposicaoForm, TipoProposicaoForm,
TramitacaoForm, TramitacaoUpdateForm, MateriaPesquisaSimplesForm,
DespachoInicialCreateForm)
from sapl.norma.models import LegislacaoCitada from sapl.norma.models import LegislacaoCitada
from sapl.parlamentares.models import Legislatura from sapl.parlamentares.models import Legislatura
from sapl.protocoloadm.models import Protocolo from sapl.protocoloadm.models import Protocolo
from sapl.settings import MEDIA_ROOT, MAX_DOC_UPLOAD_SIZE from sapl.settings import MAX_DOC_UPLOAD_SIZE, MEDIA_ROOT
from sapl.utils import (YES_NO_CHOICES, autor_label, autor_modal, SEPARADOR_HASH_PROPOSICAO, from sapl.utils import (autor_label, autor_modal, gerar_hash_arquivo, get_base_url,
gerar_hash_arquivo, get_base_url, get_client_ip, get_client_ip, get_mime_type_from_file_extension, lista_anexados,
get_mime_type_from_file_extension, montar_row_autor, mail_service_configured, montar_row_autor, SEPARADOR_HASH_PROPOSICAO,
show_results_filter_set, mail_service_configured, lista_anexados) show_results_filter_set, YES_NO_CHOICES)
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
AnexadaEmLoteFilterSet, AnexadaEmLoteFilterSet, AdicionarVariasAutoriasFilterSet,
AdicionarVariasAutoriasFilterSet, DespachoInicialForm, compara_tramitacoes_mat, DespachoInicialForm, DocumentoAcessorioForm,
DocumentoAcessorioForm, EtiquetaPesquisaForm, EtiquetaPesquisaForm, ExcluirTramitacaoEmLote, FichaPesquisaForm,
FichaPesquisaForm, FichaSelecionaForm, MateriaAssuntoForm, FichaSelecionaForm, filtra_tramitacao_destino,
MateriaLegislativaFilterSet, MateriaLegislativaForm, filtra_tramitacao_destino_and_status, filtra_tramitacao_status,
MateriaAssuntoForm, MateriaLegislativaFilterSet, MateriaLegislativaForm,
MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet, MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet,
ReceberProposicaoForm, RelatoriaForm, ReceberProposicaoForm, RelatoriaForm, TramitacaoEmLoteFilterSet,
TramitacaoEmLoteFilterSet, UnidadeTramitacaoForm, TramitacaoEmLoteForm, UnidadeTramitacaoForm)
filtra_tramitacao_destino, from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria, DespachoInicial,
filtra_tramitacao_destino_and_status, DocumentoAcessorio, MateriaAssunto, MateriaLegislativa, Numeracao, Orgao,
filtra_tramitacao_status, Origem, Proposicao, RegimeTramitacao, Relatoria, StatusTramitacao,
ExcluirTramitacaoEmLote, compara_tramitacoes_mat, TipoDocumento, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao,
TramitacaoEmLoteForm) Tramitacao, UnidadeTramitacao)
from .models import (AcompanhamentoMateria, Anexada, AssuntoMateria, Autoria,
DespachoInicial, DocumentoAcessorio, MateriaAssunto,
MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao,
RegimeTramitacao, Relatoria, StatusTramitacao,
TipoDocumento, TipoFimRelatoria, TipoMateriaLegislativa,
TipoProposicao, Tramitacao, UnidadeTramitacao)
AssuntoMateriaCrud = CrudAux.build(AssuntoMateria, 'assunto_materia') AssuntoMateriaCrud = CrudAux.build(AssuntoMateria, 'assunto_materia')

135
sapl/templates/comissoes/pauta.html

@ -5,64 +5,109 @@
{% block title %} {% block title %}
<h1 class="page-header"> <h1 class="page-header">
{% if opcao %} {% if opcao %}
Adicionar Matérias à Pauta <small>(Reunião: {{object}})</small> Adicionar Matérias à Pauta <small>(Reunião: {{ object }})</small>
{% else %} {% else %}
Remover Matérias da Pauta <small>(Reunião: {{object}})</small> Remover Matérias da Pauta <small>(Reunião: {{ object }})</small>
{% endif %} {% endif %}
</h1> </h1>
{% endblock %} {% endblock %}
{% block detail_content %} {% block detail_content %}
{% if materias %} {% if opcao %}
{% if num_materias == 1 %} {% if not show_results %}
<b>Há {{num_materias}} matéria disponível.</b> <br><br> {% crispy filter.form %}
{% else %}
<b>Há {{num_materias}} matérias disponíveis.</b> <br><br>
{% endif %} {% endif %}
<form method="POST" enctype="multipart/form-data">
{% csrf_token %} {% if show_results %}
<fieldset> {% if numero_resultados > 0 %}
<table class="table table-striped table-hover"> {% if numero_resultados == 1 %}
<div class="controls"> <div style="text-align: right;"><b>Pesquisa concluída com sucesso! Foi encontrada 1 matéria disponível.</b></div><br>
<div class="checkbox"> {% else %}
<label for="id_check_all"> <div style="text-align: right;">
<input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos <b>Pesquisa concluída com sucesso! Foram encontradas {{ numero_resultados }} matérias disponíveis.</b>
</label>
</div>
</div> </div>
<thead> <br>
<tr><th>Matéria</th></tr> {% endif %}
</thead> <form method="POST" enctype="multipart/form-data">
<tbody onload="checks(materias_checked)"> {% csrf_token %}
{% for materia in materias %} <fieldset>
<tr> <legend>Matérias para Adicionar à Pauta</legend>
<td> <table class="table table-striped table-hover">
<input type="checkbox" name="materia_id" value="{{materia.id}}" {% if check %} checked {% endif %}/> <div class="controls">
{{materia.tipo.sigla}} {{materia.numero}}/{{materia.ano}} - {{materia.tipo.descricao}} <div class="checkbox">
</td> <label for="id_check_all">
</tr> <input type="checkbox" id="id_check_all" onchange="checkAll(this)"/> Marcar/Desmarcar Todos
{% endfor %} </label>
</tbody> </div>
</table> </div>
</fieldset> <thead><tr><th>Matéria</th></tr></thead>
{% if opcao %} <tbody>
<input type="submit" value="Salvar" class="btn btn-primary"S> {% for materia_t in object_list %}
<tr>
<td>
<input type="checkbox" name="materia_id" value="{{ materia_t.materia.id }}" {% if check %} checked {% endif %}/>
{{ materia_t.materia.tipo.sigla }}
{{ materia_t.materia.numero }}/{{ materia_t.materia.ano }} - {{ materia_t.materia.tipo.descricao }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</fieldset>
<input type="submit" value="Salvar" class="btn btn-primary"S>
</form>
{% else %} {% else %}
<input type="submit" value="Remover" class="btn btn-danger"S> <br><div style="text-align: center"><b>Nenhuma matéria disponível encontrada.</b></div>
{% endif %} {% endif %}
</form> {% endif %}
{% else %} {% else %}
<b>Não há matéria disponível.</b> <br><br> {% if materias %}
{% if numero_materias == 1 %}
<div style="text-align: right;"><b>Há 1 matéria disponível.</b></div><br>
{% else %}
<div style="text-align: right;"><b>Há {{ numero_materias }} matérias disponíveis.</b></div><br>
{% endif %}
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
<fieldset>
<legend>Matérias para Remover da Pauta</legend>
<table class="table table-striped table-hover">
<div class="controls">
<div class="checkbox">
<label for="id_check_all">
<input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos
</label>
</div>
</div>
<thead><tr><th>Matéria</th></tr></thead>
<tbody>
{% for materia in materias %}
<tr>
<td>
<input type="checkbox" name="materia_id" value="{{ materia.id }}" {% if check %} checked {% endif %}/>
{{ materia.tipo.sigla }} {{ materia.numero }}/{{ materia.ano }} - {{ materia.tipo.descricao }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</fieldset>
<input type="submit" value="Remover" class="btn btn-danger"S>
</form>
{% else %}
<br><div style="text-align: center;"><b>Não há matéria disponível.</b></div>
{% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}
<script language="JavaScript"> <script language="JavaScript">
function checkAll(elem){ function checkAll(elem){
let checkboxes = document.getElementsByName('materia_id'); let checkboxes = document.getElementsByName('materia_id');
for(let i=0; i<checkboxes.length; i++){ for(let i=0; i<checkboxes.length; i++){
if(checkboxes[i].type == 'checkbox') if(checkboxes[i].type == 'checkbox')
checkboxes[i].checked = elem.checked checkboxes[i].checked = elem.checked
}
} }
</script> }
</script>
{% endblock %} {% endblock %}

110
sapl/templates/comissoes/reuniao_detail.html

@ -3,63 +3,57 @@
{% block detail_content %} {% block detail_content %}
{{ block.super }} {{ block.super }}
<h2 class="legend">Pauta</h2> <h2 class="legend">Pauta</h2>
{% if mats %} {% if mats %}
<p>Total de Registros: <b>{{num_mats}}</b></p> <p>Total de Registros: <b>{{ num_mats }}</b></p>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead><tr><th>Matéria</th></tr></thead>
<tr> <tbody>
<th>Matéria</th> {% for mat in mats %}
</tr> <tr><td><a href="{% url 'sapl.materia:materialegislativa_detail' mat.pk %}">{{mat}}</a></td></tr>
</thead> {% endfor %}
<tbody> </tbody>
{% for mat in mats %} </table>
<tr> {% if perms.comissoes.add_reuniao %}
<td> <div class="actions btn-group float-right" role="group">
<a href="{% url 'sapl.materia:materialegislativa_detail' mat.pk %}">{{mat}}</a> <a href="{% url 'sapl.comissoes:pauta_add' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Matéria(s)' %}</a>
</td> {% if num_mats == 1 %}
</tr> <a href="{% url 'sapl.comissoes:pauta_remove' reuniao_pk %}" class="btn btn-outline-primary btn-outline-danger">
{% endfor %} {% trans 'Remover Matéria' %}
</tbody> </a>
</table> {% else %}
{% if perms.comissoes.add_reuniao %} <a href="{% url 'sapl.comissoes:pauta_remove' reuniao_pk %}" class="btn btn-outline-primary btn-outline-danger">
<div class="actions btn-group float-right" role="group"> {% trans 'Remover Matéria(s)' %}
<a href="{% url 'sapl.comissoes:pauta_add' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Matéria' %}</a> </a>
<a href="{% url 'sapl.comissoes:pauta_remove' reuniao_pk %}" class="btn btn-outline-primary btn-outline-danger">{% trans 'Remover Matéria' %}</a>
</div>
{% endif %} {% endif %}
{% else %} </div>
{% if perms.comissoes.add_reuniao %} {% endif %}
<a href="{% url 'sapl.comissoes:pauta_add' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Matéria' %}</a> {% else %}
{% endif %} {% if perms.comissoes.add_reuniao %}
{% endif %} <a href="{% url 'sapl.comissoes:pauta_add' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Matéria(s)' %}</a>
<br /><br /> {% endif %}
<h2 class="legend">Documentos Acessórios</h2> {% endif %}
{% if docs %} <br /><br />
<p>Total de registros: <b>{{num_docs}}</b></p> <h2 class="legend">Documentos Acessórios</h2>
<table class="table table-striped table-hover"> {% if docs %}
<thead> <p>Total de registros: <b>{{ num_docs }}</b></p>
<tr> <table class="table table-striped table-hover">
<th>Documento Acessório</th> <thead><tr><th>Documento Acessório</th></tr></thead>
</tr> <tbody>
</thead> {% for doc in docs %}
<tbody> <tr><td><a href="{% url 'sapl.comissoes:documentoacessorio_detail' doc.pk %}">{{ doc.nome }}</a></td></tr>
{% for doc in docs %} {% endfor %}
<tr> </tbody>
<td> </table>
<a href="{% url 'sapl.comissoes:documentoacessorio_detail' doc.pk %}">{{ doc.nome }}</a> {% if perms.comissoes.add_reuniao %}
</td> <a href="{% url 'sapl.comissoes:documentoacessorio_create' reuniao_pk %}" class="btn btn-outline-primary float-right">
</tr> {% trans 'Adicionar Documento' %}
{% endfor %} </a>
</tbody> {% endif %}
</table> {% else %}
{% if perms.comissoes.add_reuniao %} {% if perms.comissoes.add_reuniao %}
<a href="{% url 'sapl.comissoes:documentoacessorio_create' reuniao_pk %}" class="btn btn-outline-primary float-right">{% trans 'Adicionar Documento' %}</a> <a href="{% url 'sapl.comissoes:documentoacessorio_create' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Documento' %}</a>
{% endif %} {% endif %}
{% else %} {% endif %}
{% if perms.comissoes.add_reuniao %} <br /><br />
<a href="{% url 'sapl.comissoes:documentoacessorio_create' reuniao_pk %}" class="btn btn-outline-primary">{% trans 'Adicionar Documento' %}</a>
{% endif %}
{% endif %}
<br /><br />
{% endblock detail_content %} {% endblock detail_content %}

34
sapl/templates/materia/em_lote/anexada.html

@ -1,12 +1,11 @@
{% extends "crud/detail.html" %} {% extends "crud/detail.html" %}
{% load i18n crispy_forms_tags %} {% load i18n crispy_forms_tags %}
{% block actions %}{% endblock %} {% block actions %}{% endblock %}
{% block detail_content %}
{% block detail_content %}
{% if not show_results %} {% if not show_results %}
{% crispy filter.form %} {% crispy filter.form %}
{% endif %} {% endif %}
{% if show_results %} {% if show_results %}
{% if numero_res > 0 %} {% if numero_res > 0 %}
{% if numero_res == 1 %} {% if numero_res == 1 %}
@ -16,42 +15,30 @@
{% endif %} {% endif %}
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
<fieldset> <fieldset>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label>Data Anexação*</label> <label>Data Anexação*</label><input type="text" name="data_anexacao" class="form-control dateinput" required="True">
<input type="text" name="data_anexacao" class="form-control dateinput" required="True"> </div>
</div> </div>
</div>
<div class="col-md-4"> <div class="col-md-4">
<div class="form-group"> <div class="form-group">
<label>Data Desanexação</label> <label>Data Desanexação</label><input type="text" name="data_desanexacao" class="form-control dateinput">
<input type="text" name="data_desanexacao" class="form-control dateinput"> </div>
</div> </div>
</div> </div>
</div>
</fieldset> </fieldset>
<br /> <br />
<fieldset> <fieldset>
<legend>Matérias para Anexar em Lote</legend> <legend>Matérias para Anexar em Lote</legend>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<div class="controls"> <div class="controls">
<div class="checkbox"> <div class="checkbox">
<label for="id_check_all"> <label for="id_check_all"><input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos</label>
<input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos </div>
</label> </div>
</div> <thead><tr><th>Matéria</th></tr></thead>
</div>
<thead>
<tr><th>Matéria</th></tr>
</thead>
<tbody> <tbody>
{% for materia in object_list %} {% for materia in object_list %}
<tr> <tr>
@ -71,6 +58,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endblock detail_content %} {% endblock detail_content %}
{% block extra_js %} {% block extra_js %}
<script language="JavaScript"> <script language="JavaScript">
function checkAll(elem) { function checkAll(elem) {

Loading…
Cancel
Save