{% extends "materia/materialegislativa_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block actions %} {% endblock %}
{% block detail_content %}
	<fieldset>
		<legend>Matéria Legislativa</legend>
		{% include "materia/resumo_detail_materia.html" %}

		<fieldset>
			<legend>Relatorias</legend>
			<table class="table table-striped table-bordered">
				<thead class="thead-default">
					<tr>
						<th>Data Designação</th>
						<th>Comissão</th>
						<th>Parlamentar</th>
					</tr>
				</thead>
					{% for r in relatorias %}
						<tr>
							<td><a href="{% url 'relatoria_edit' object.id r.id %}">{{r.data_designacao_relator|date:'d/m/Y'}}</a></td>
							<td>{{r.comissao}}</td>
							<td>{{r.parlamentar}}</td>
						</tr>
					{% endfor %}
			</table>
		</fieldset>

		<fieldset class="form-group">
			<legend>Adicionar Relator</legend>
				<form method="POST">
					{% csrf_token %}

          <div class="row">
            <div class="col-md-12">
              Localização Atual
              <input type="text" name="comissao" disabled value="{{comissao.nome}}" class="form-control"/>
            </div>
          </div>
          <div class="row">
            <div class="col-md-6">
              Data Designação*
              <input type="text" name="data_designacao_relator" class ="dateinput form-control" />
            </div>
            <div class="col-md-6">
              Data Destituição
              <input type="text" name="data_destituicao_relator" class ="dateinput form-control" />
            </div>
          </div>
          <div class="row">
            <div class="col-md-6">
              Parlamentar*
              <select name="parlamentar" class="form-control">
                <option value=""> ---------- </option>
                {% for p in parlamentares %}
                <option value="{{p.parlamentar_id}}"> {{p.parlamentar}} </option>
                {% endfor %}
              </select>
            </div>
            <div class="col-md-6">
              Motivo Fim Relatoria
              <select name="tipo_fim_relatoria" class="form-control">
                <option value=""> ---------- </option>
                {% for t in tipo_fim_relatoria %}
                <option value="{{t.id}}"> {{t.descricao}} </option>
                {% endfor %}
              </select>
            </div>
          </div>
					<br />
					<input type="submit" name="salvar" value="Salvar" class="btn btn-primary" {% if not comissao.nome %} disabled {% endif %} />
				</form>
		</fieldset>
	</fieldset>
{% endblock %}