{% 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>Import / Export Related?</th>
				<th>Type</th>
			</tr>
		</thead>
		<tbody>
			{% for channel in channels %}
				<tr>
					<td>
						{% if channel.imp_related %}
							Import
						{% else %}
							Export
						{% endif %}
					</td>
					<td>
						{{channel.channel_type}}
					</td>
				</tr>
			{% endfor %}
		<tbody>
	</table>

	<form action="/e/eras/{{era.id}}/add_channel" method="post">
		<fieldset>
			<legend>Add a channel</legend>	
			<label>Import / Export</label>
			<select name="imp_related">
				{% for lb, vl in (('Import Related', 'true'), ('Export Related', 'false')) %}
					{{input_option('is_import', vl, lb)}}
				{% endfor %}
			</select>
			<label>Channel Type</label>
			<select name="channel_type">
				{{input_option('channel_type', 'ACTIVE', 'ACTIVE')}}
				{{input_option('channel_type', 'REACTIVE_IMP', 'REACTIVE_IMP')}}
				{{input_option('channel_type', 'REACTIVE_EXP', 'REACTIVE_EXP')}}
			</select>
			<input type="submit" value="Add">
		</fieldset>
	</form>

{% endblock %}
