mirror of https://github.com/interlegis/sapl.git
5 changed files with 352 additions and 167 deletions
@ -1,19 +1,191 @@ |
|||
{% extends "sessao/votacao/votacao_bloco_expediente.html" %} |
|||
{% extends "crud/detail.html" %} |
|||
{% load i18n %} |
|||
{% load crispy_forms_tags %} |
|||
{% block actions %}{% endblock %} |
|||
|
|||
{% block buttons %} |
|||
{% block sections_nav %} |
|||
{% endblock %} |
|||
|
|||
{% if filter_url and not filter.form.errors %} |
|||
{% block detail_content %} |
|||
{% block buttons %} |
|||
|
|||
{% comment %} {% if filter_url and not filter.form.errors %} |
|||
<div class="actions btn-group pull-right" role="group"> |
|||
<a href="{% url 'sapl.sessao:votacao_bloco_ordemdia' pk_sessao %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a> |
|||
<a href="{% url 'sapl.sessao:votacao_bloco_expediente' pk_sessao %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a> |
|||
</div> |
|||
|
|||
<div class="actions btn-group pull-right" role="group"> |
|||
<a href="{% url 'sapl.sessao:ordemdia_list' pk_sessao %}" class="btn btn-default">{% trans 'Matérias da Ordem do Dia' %}</a> |
|||
<a href="{% url 'sapl.sessao:expedientemateria_list' pk_sessao %}" class="btn btn-default">{% trans 'Matérias do Expediente' %}</a> |
|||
</div> |
|||
|
|||
{% endif %} |
|||
{% endif %} {% endcomment %} |
|||
|
|||
{% endblock %} |
|||
{% endblock %} |
|||
|
|||
<p></p> |
|||
|
|||
<form method="POST" enctype="application/x-www-form-urlencoded" action="{% url 'sapl.sessao:votacaoblocosimb' pk %}"> |
|||
{% csrf_token %} |
|||
<br><br> |
|||
<table class="table table-striped table-bordered"> |
|||
<thead class="thead-default"> |
|||
<tr> |
|||
<td><h3>{% trans "Tipo de Votação" %}</h3></td> |
|||
</tr> |
|||
</thead> |
|||
<tr> |
|||
<td class="col-md-12"> |
|||
<fieldset id="tipo_votacao" name="tipo"> |
|||
<input type="radio" name="tipo_votacao" id="tipo_votacao1" value="1" onchange="alteraTipoVotacao()" checked="checked"> <label for="tipo">Simbólica</label> |
|||
</br> |
|||
<input type="radio" name="tipo_votacao" id="tipo_votacao2" value="2" onchange="alteraTipoVotacao()" > <label for="tipo">Nominal</label> |
|||
</br> |
|||
</fieldset> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
|
|||
<br> |
|||
<h3 id='frase_selecione'>Selecione a(s) ordem(s) do dia desejada(s).</h3> |
|||
<table id='tab_ordens' class="table table-striped table-bordered"> |
|||
<thead class="thead-default"> |
|||
<tr> |
|||
<td><h3>{% trans "Ordem do dia" %}</h3></td> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<div class="checkbox" id="check_all"> |
|||
<label for="id_check_all"> |
|||
<input type="checkbox" id="id_check_all" onchange="checkAll(this)" /> Marcar/Desmarcar Todos |
|||
</label> |
|||
</div> |
|||
|
|||
{% for o in ordem_dia %} |
|||
<tr class="{% if o.tipo_votacao == 1 %}Simbolica{% else %}Nominal{% endif %}" {% if o.tipo_votacao == 2 %} style="display:none;" {% endif %}> |
|||
<td> |
|||
<input type="checkbox" name="marcadas_id_{{o.tipo_votacao}}" id="{{o.id}}" value="{{o.id}}" {% if check %} checked {% endif %}> |
|||
<strong><a href="{% url 'sapl.materia:materialegislativa_detail' o.id %}">{{o.materia.tipo.sigla}} {{o.materia.numero}}/{{o.materia.ano}} - {{o.materia.tipo}}</strong></a></br> |
|||
{% if o.materia.numeracao_set.last %} |
|||
<strong>Processo:</strong> {{o.materia.numeracao_set.last}}</br> |
|||
{% endif %} |
|||
<strong>Autor:</strong> |
|||
{% for a in o.materia.autoria_set.all %} |
|||
{% if not forloop.first %} |
|||
, {{a.autor|default_if_none:""}} |
|||
{% else %} |
|||
{{a.autor|default_if_none:""}} |
|||
{% endif %} |
|||
{% endfor %} |
|||
</br> |
|||
{% if o.materia.numero_protocolo %} |
|||
<strong>Protocolo:</strong> {{o.materia.numero_protocolo}}</br> |
|||
{% endif %} |
|||
{% if o.materia.tramitacao_set.last %} |
|||
{% if o.materia.tramitacao_set.last.turno %} |
|||
<strong>Turno:</strong> |
|||
{% for t in turno_choices %} |
|||
{% if t.0 == o.materia.tramitacao_set.last.turno %} |
|||
{{ t.1 }} |
|||
{% endif %} |
|||
{% endfor %}</br> |
|||
{% endif %} |
|||
{% endif %} |
|||
<strong>Ementa:</strong> {{ o.ementa|safe }}</br> |
|||
<p></p> |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
<input type="submit" value="Registrar votação" class="btn btn-primary" id="but_reg"> |
|||
<input type="hidden" id="origem" name="origem" value="ordem"> |
|||
</form> |
|||
|
|||
|
|||
<table class="table table-striped table-bordered" style="display:none" id="nenhuma_ordem"> |
|||
<tr> |
|||
<td> |
|||
<h3>Nenhuma ordem do dia aberta.</h3> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
|
|||
{% endblock detail_content %} |
|||
|
|||
{% block extra_js %} |
|||
<script> |
|||
$(document).ready(function(){ |
|||
checa_tipo_votacao(); |
|||
}); |
|||
|
|||
$(window).on('beforeunload', function () { |
|||
$("input[type=submit], input[type=button]").prop("disabled", "disabled"); |
|||
}); |
|||
|
|||
</script> |
|||
|
|||
<script language="JavaScript"> |
|||
function checkAll(ele) { |
|||
/* $('[name=ordem_id_1]').each(function() { |
|||
$(this).prop('unchecked', event.target.checked ? 'checked': null); |
|||
$(this).trigger('click'); |
|||
}); */ |
|||
let checkboxes = document.getElementsByName('marcadas_id_1'); |
|||
if (ele.checked) { |
|||
for (let i = 0; i < checkboxes.length; i++) { |
|||
if (checkboxes[i].type == 'checkbox') { |
|||
checkboxes[i].checked = true; |
|||
} |
|||
} |
|||
} else { |
|||
for (let i = 0; i < checkboxes.length; i++) { |
|||
if (checkboxes[i].type == 'checkbox') { |
|||
checkboxes[i].checked = false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
checkboxes = document.getElementsByName('marcadas_id_2'); |
|||
if (ele.checked) { |
|||
for (let i = 0; i < checkboxes.length; i++) { |
|||
if (checkboxes[i].type == 'checkbox') { |
|||
checkboxes[i].checked = true; |
|||
} |
|||
} |
|||
} else { |
|||
for (let i = 0; i < checkboxes.length; i++) { |
|||
if (checkboxes[i].type == 'checkbox') { |
|||
checkboxes[i].checked = false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
function alteraTipoVotacao() { |
|||
$(".Simbolica").toggle(); |
|||
$(".Nominal").toggle(); |
|||
|
|||
checa_tipo_votacao(); |
|||
} |
|||
|
|||
function checa_tipo_votacao(){ |
|||
tipo_votacao = document.querySelector('input[name="tipo_votacao"]:checked').value; |
|||
numero_ordens = document.getElementsByName('marcadas_id_'+tipo_votacao).length; |
|||
|
|||
if(numero_ordens == 0){ |
|||
document.getElementById('frase_selecione').style.display = 'none'; |
|||
document.getElementById('tab_ordens').style.display = 'none'; |
|||
document.getElementById('check_all').style.display = 'none'; |
|||
document.getElementById('but_reg').style.display = 'none'; |
|||
document.getElementById('nenhuma_ordem').style.display = ''; |
|||
} |
|||
else{ |
|||
document.getElementById('frase_selecione').style.display = ''; |
|||
document.getElementById('tab_ordens').style.display = ''; |
|||
document.getElementById('check_all').style.display = ''; |
|||
document.getElementById('but_reg').style.display = ''; |
|||
document.getElementById('nenhuma_ordem').style.display = 'none'; |
|||
} |
|||
} |
|||
</script> |
|||
{% endblock extra_js%} |
|||
|
|||
Loading…
Reference in new issue