Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3279 leitura em bloco #3294

Open
wants to merge 8 commits into
base: 3.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sapl/sessao/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
OrdemDiaLeituraView,
retirar_leitura,
TransferenciaMateriasExpediente, TransferenciaMateriasOrdemDia,
filtra_materias_copia_sessao_ajax, verifica_materia_sessao_plenaria_ajax)
filtra_materias_copia_sessao_ajax, verifica_materia_sessao_plenaria_ajax,
LeituraEmBloco)


from .apps import AppConfig
Expand Down Expand Up @@ -145,6 +146,9 @@
url(r'^sessao/(?P<pk>\d+)/votacao_bloco_expediente$',
VotacaoEmBlocoExpediente.as_view(),
name='votacao_bloco_expediente'),
url(r'^sessao/(?P<pk>\d+)/leitura_em_bloco$',
LeituraEmBloco.as_view(),
name='leitura_em_bloco'),
url(r'^sessao/(?P<pk>\d+)/resumo$',
ResumoView.as_view(), name='resumo'),
url(r'^sessao/(?P<pk>\d+)/resumo_ata$',
Expand Down
44 changes: 44 additions & 0 deletions sapl/sessao/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def customize_link_materia(context, pk, has_permission, is_expediente):
exist_retirada = obj.retiradapauta_set.filter(materia=obj.materia).exists()
exist_leitura = obj.registroleitura_set.filter(materia=obj.materia).exists()

#import pdb;pdb.set_trace()
ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved

if (obj.tipo_votacao != 4 and not exist_resultado and not exist_retirada) or\
(obj.tipo_votacao == 4 and not exist_leitura):
if obj.votacao_aberta:
Expand Down Expand Up @@ -4127,6 +4129,48 @@ def get_queryset(self):
retiradapauta=None)


class LeituraEmBloco(PermissionRequiredForAppCrudMixin, TemplateView):
app_label = AppConfig.label
logger = logging.getLogger(__name__)

def post(self, request, *args, **kwargs):

ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved

if self.request.POST['origem'] == 'ordem':
ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved
model = OrdemDia
presenca_model = PresencaOrdemDia
else:
ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved
model = ExpedienteMateria
presenca_model = SessaoPlenariaPresenca

spk = SessaoPlenaria.objects.get(pk=kwargs['pk'])
if not (verifica_presenca(request, presenca_model, spk, True)):
ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved
return HttpResponseRedirect(self.get_success_url())

leituras = model.objects.filter(
id__in=request.POST.getlist('marcadas_4'))

for ordem in leituras:
ordem.resultado = "Matéria lida em Bloco"
ordem.votacao_aberta = False
ordem.registro_aberto = False
if self.request.POST['origem'] == 'ordem':
rl = RegistroLeitura(materia=ordem.materia,ordem=ordem,user=request.user,ip=get_client_ip(request))
else:
rl = RegistroLeitura(materia=ordem.materia,expediente=ordem,user=request.user,ip=get_client_ip(request))
rl.save()
ordem.save()
ulyssesBML marked this conversation as resolved.
Show resolved Hide resolved

return HttpResponseRedirect(self.get_success_url())

def get_success_url(self):
if self.request.POST['origem'] == 'ordem':
return reverse('sapl.sessao:ordemdia_list',
kwargs={'pk': self.kwargs['pk']})
else:
return reverse('sapl.sessao:expedientemateria_list',
kwargs={'pk': self.kwargs['pk']})

class VotacaoEmBlocoSimbolicaView(PermissionRequiredForAppCrudMixin, TemplateView):

"""
Expand Down
11 changes: 8 additions & 3 deletions sapl/templates/sessao/votacao/votacao_bloco.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</br>
<input type="radio" name="tipo_votacao" id="tipo_votacao_2" value="2" onchange="alteraTipoVotacao()" > <label for="tipo">Nominal</label>
</br>
<input type="radio" name="tipo_votacao" id="tipo_votacao_4" value="4" onchange="alteraTipoVotacao()" > <label for="tipo">Leitura</label><!--value=3 é pra votação secreta que não pode ser feita em bloco-->
</fieldset>
</td>
</tr>
Expand All @@ -43,8 +44,8 @@ <h3 id='frase_selecione'>{% if expediente %} Selecione o(s) expediente(s) deseja
</div>

{% for o in object_list %}
{% if o.tipo_votacao == 1 or o.tipo_votacao == 2 %}
<tr class="{% if o.tipo_votacao == 1 %}Simbolica{% else %}Nominal{% endif %}" {% if o.tipo_votacao == 2 %} style="display:none;" {% endif %}>
{% if o.tipo_votacao == 1 or o.tipo_votacao == 2 or o.tipo_votacao == 4 %}
<tr class="{% if o.tipo_votacao == 1 %} Simbolica {% elif o.tipo_votacao == 2 %}Nominal{% else %}Leitura{% endif %}" {% if o.tipo_votacao > 1 %} style="display:none;" {% endif %}>
<td>
<input type="checkbox" name="marcadas_{{o.tipo_votacao}}" id="{{o.id}}" value="{{o.id}}" {% if check %} checked {% endif %}>
<strong><a href="{% url 'sapl.materia:materialegislativa_detail' o.materia.id %}">{{o.materia.tipo.sigla}} {{o.materia.numero}}/{{o.materia.ano}} - {{o.materia.tipo}}</strong></a></br>
Expand Down Expand Up @@ -134,6 +135,7 @@ <h3>{% if expediente %} Nenhuma matéria do expediente aberta. {% else %} Nenhum
function alteraTipoVotacao() {
$(".Simbolica").toggle();
$(".Nominal").toggle();
$(".Leitura").toggle();

checa_tipo_votacao();
}
Expand All @@ -160,9 +162,12 @@ <h3>{% if expediente %} Nenhuma matéria do expediente aberta. {% else %} Nenhum
if(tipo_votacao == "1"){
$('#form').attr("action", "{% url 'sapl.sessao:votacaoblocosimb' pk %}")
}
else{
else if(tipo_votacao == "2"){
$('#form').attr("action", "{% url 'sapl.sessao:votacaobloconom' pk %}")
}
else{
$('#form').attr("action", "{% url 'sapl.sessao:leitura_em_bloco' pk %}")
}
}
</script>
{% endblock extra_js%}