Browse Source

Refatora inputs na presença da sessão

pull/772/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
cdcb6af837
  1. 53
      sapl/templates/sessao/presenca.html

53
sapl/templates/sessao/presenca.html

@ -10,21 +10,24 @@
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
<div class="row"> <div class="controls">
<div class="col-md-6">Presença</div> <div class="checkbox">
<div class="col-md-6">Parlamentar</div> <label for="id_check_all">
</div> <input type="checkbox" id="id_check_all" onchange="checkAll(event)" /> Marcar/Desmarcar Todos
</label>
<div class="row"> </div>
<div class="col-md-12"><input type="checkbox" onClick="checkAll(this)" /> Marcar/Desmarcar Todos</div> </div>
</div> <br />
<div class="controls">
{% for parlamentar, check in view.get_presencas %} {% for parlamentar, check in view.get_presencas %}
<div class="row"> <div class="checkbox">
<div class="col-md-6"><input type="checkbox" name="presenca" value="{{ parlamentar.id }}" {% if check %} checked {% endif %}/></div> <label for="id_presenca_{{forloop.counter}}">
<div class="col-md-6"><label for="parlamentar">{{ parlamentar }}</label></div> <input type="checkbox" id="id_presenca_{{forloop.counter}}" name="presenca" value="{{ parlamentar.id }}" {% if check %} checked {% endif %}/>
</div> {{ parlamentar }}
{% endfor %} </label>
</div>
{% endfor %}
</div>
<br /> <br />
<input type="submit" value="Salvar" class="btn btn-primary" /> <input type="submit" value="Salvar" class="btn btn-primary" />
@ -37,11 +40,11 @@
</br> </br>
{% for parlamentar, check in view.get_presencas %} {% for parlamentar, check in view.get_presencas %}
{% if check %} {% if check %}
<div class="row"> <div class="row">
<div class="col-md-6"><label for="parlamentar"> - {{ parlamentar }}</label></div> <div class="col-md-6"><label for="parlamentar"> - {{ parlamentar }}</label></div>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -51,11 +54,11 @@
{% block extra_js %} {% block extra_js %}
<script language="JavaScript"> <script language="JavaScript">
function checkAll(source) { function checkAll(event) {
checkboxes = document.getElementsByName('presenca'); $('[name=presenca]').each(function() {
for(var i=0, n=checkboxes.length;i<n;i++) { $(this).prop('checked', event.target.checked ? 'checked': null);
checkboxes[i].checked = source.checked; $(this).trigger('click');
} });
} }
</script> </script>
{% endblock %} {% endblock %}

Loading…
Cancel
Save