{% extends "materia/materialegislativa_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block detail_content %}
	<fieldset>
		<legend>Matéria Legislativa</legend>
		<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
			<li>Tipo: <b>{{materialegislativa.tipo.sigla}}</b></li>
			<li>Número: <b>{{materialegislativa.numero}}</b></li>
			<li>Ano: <b>{{materialegislativa.ano}}</b></li>
		</ul>
		Ementa: <b>{{materialegislativa.ementa}}</b>

		<fieldset>
			<legend>Editar Tramitação</legend>
				<form method="POST">
					{% csrf_token %}
					<ul class="small-block-grid-2 medium-block-grid-2 large-block-grid-2">
						<li>
							<label>Data Tramitação</label>
							<input type="text" name="data_tramitacao" class="dateinput" value="{{tramitacao.data_tramitacao|date:'d/m/Y'}}" disabled />
						</li>
						<li>
							<label>Unidade Local</label>
							<input type="text" name="unidade_tramitacao_local" value="{{tramitacao.unidade_tramitacao_local}}" disabled />
						</li>
					</ul>

					<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
						<li>
							<label>Status*</label>
							<select name="status">
								{% for s in status %}
									<option value="{{s.id}}" {% if s.id == tramitacao.status.id %} selected {% endif %}>
										{{s.descricao}}
									</option>
								{% endfor %}
							</select>
						</li>
						<li>
							<label>Turno*</label>
							<select name="turno">
								{% for a, b in turno %}
									<option value="{{a}}">{{b}}</option>
								{% endfor %}
							</select>
						</li>
						<li>
							<input type="checkbox" name="urgente" value="{{tramtiacao.urgente}}" /> Urgente ?<br />
						</li>
					</ul>

					<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
						<li>
							<label>Unidade Destino</label>
							<select name="unidade_tramitacao_destino">
								{% for u in unidade_tramitacao %}
									<option value="{{u.id}}" {% if u.id == tramitacao.unidade_tramitacao_destino.id %} selected {% endif %}>
										{{u.orgao}} - {{u.comissao}}
									</option>
								{% endfor %}
							</select>
						</li>
					</ul>

					<ul class="small-block-grid-3 medium-block-grid-3 large-block-grid-3">
						<li>
							<label>Data Encaminhamento</label>
							<input type="text" name="data_encaminhamento" class="dateinput" value="{{tramitacao.data_encaminhamento|date:'d/m/Y'}}" />
						</li>
						<li>
							<label>Data Fim Prazo</label>
							<input type="text" name="data_fim_prazo" class="dateinput" value="{{tramitacao.data_fim_prazo|date:'d/m/Y'}}" />
						</li>
						<li>
							<input type="checkbox" name="ultima" value="{{tramtiacao.ultima}}" /> Ultima<br />
						</li>
					</ul>

					<ul class="small-block-grid-1 medium-block-grid-1 large-block-grid-1">
						<li>
							<label>Texto da Ação</label>
							<textarea rows="4" cols="50" name="texto">{{tramitacao.texto}}</textarea> 
						</li>
					</ul>

					<input type="submit" value="Salvar" id="salvar" name="salvar" class="primary button" />
					<input type="submit" value="Excluir" id="excluir" name="excluir" class="primary button" />		
				</form>
		</fieldset>
	</fieldset>
{% endblock %}