{% extends "base.html" %}

{% block title %}
	&raquo; Supplies &raquo; Supply {{era.supply.id}} Era {{era.start_date|hh_format}} &raquo; 
 	Add Channel
{% endblock %}

{% block nav %}
	<a href="/supplies">Supplies</a> &raquo; 
	<a href="/e/supplies/{{era.supply.id}}">Supply {{era.supply.id}} Era
	{{era.start_date|hh_format}}</a> &raquo; 
	Add Channel
{% endblock %}

{% block content %}

	<table>
		<caption>Existing Channels</caption>	
		<thead>
			<tr>
				<th>View</th>
				<th>Import / Export Related?</th>
				<th>Type</th>
			</tr>
		</thead>
		<tbody>
			{% for channel in channels %}
				<tr>
					<td><a href="/e/channels/{{channel.id}}">View</a></td>
					<td>
						{% if channel.imp_related %}
							Import
						{% else %}
							Export
						{% endif %}
					</td>
					<td>
						{{channel.channel_type}}
					</td>
				</tr>
			{% endfor %}
		<tbody>
	</table>

	<table>
		<caption>Add Channels</caption>	
		<thead>
			<tr>
				<th>Import / Export Related?</th>
				<th>Type</th>
				<th>Add</th>
			</tr>
		</thead>
		<tbody>
			{% for channel in add_channels %}
				<tr>
					<td>
						{% if channel.imp_related %}
							Import
						{% else %}
							Export
						{% endif %}
					</td>
					<td>
						{{channel.channel_type}}
					</td>
					<td>
						<form action="/e/eras/{{era.id}}/add_channel" method="post">
							<fieldset>
								<input type="hidden" name="imp_related" value="{{channel.imp_related|lower}}">
								<input type="hidden" name="channel_type" value="{{channel.channel_type}}">
								<input type="submit" value="Add">
							</fieldset>
						</form>
					</td>
				</tr>
			{% endfor %}
		<tbody>
	</table>

{% endblock %}
