{% extends "sessao/sessaoplenaria_detail.html" %}
{% load i18n %}

{% block detail_content %}
	<form method="POST">
	  {% csrf_token %}

    <div class="row">
      <div class="col-md-6">Presença</div>
      <div class="col-md-6">Parlamentar</div>
    </div>

    <div class="row">
      <div class="col-md-12"><input type="checkbox" onClick="checkAll(this)" /> Marcar/Desmarcar Todos</div>
    </div>

		{% for parlamentar, check in view.get_parlamentares %}
	    <div class="row">
	      <div class="col-md-6"><input type="checkbox" name="presenca" value="{{ parlamentar.id }}" {% if check %} checked {% endif %}/></div>
	      <div class="col-md-6"><label for="parlamentar">{{ parlamentar }}</label></div>
	    </div>
		{% endfor %}

		<br />
		<input type="submit" value="Salvar" class="btn btn-primary" />
	</form>
{% endblock detail_content %}

{% block extra_js %}
	<script language="JavaScript">
		function checkAll(source) {
		  checkboxes = document.getElementsByName('presenca');
		  for(var i=0, n=checkboxes.length;i<n;i++) {
		    checkboxes[i].checked = source.checked;
		  }
		}
	</script>
{% endblock %}