{% extends "base.html" %}

{% block title %}
	&raquo; Supplies &raquo; 
	Supply {{channel.era.supply.id}} Era
 	{{channel.era.start_date|hh_format}} &raquo; 
	Channel {% if channel.imp_related %}Import{% else %}Export{% endif %}
	{{channel.channel_type}}
{% endblock %}

{% block nav %}
	&raquo; <a href="/supplies">Supplies</a> &raquo; 
	<a href="/supplies/{{channel.era.supply.id }}">Supply
	{{channel.era.supply.name}}
 	Era {{channel.era.start_date|hh_format}}</a> &raquo; 
	<a href="/channels/{{channel.id}}">Channel
	{% if channel.imp_related %}Import{% else %}Export{% endif %}
	{{channel.channel_type}}</a> &raquo; Edit
{% endblock %}

{% block content %}
	{% if request.method == 'GET' and request.values.delete %}
	<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Are you sure you want to delete this channel?</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form method="post">
							<fieldset>
								<input type="submit" name="delete" value="Delete">
								<a href="/channels/{{channel.id}}/edit">Cancel</a>
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
	
		
	{% else %}
	
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Delete HH Data</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm textWidthAuto">
						<form method="post" action="/channels/{{channel.id}}/edit">
							<fieldset>
								From {{input_date('start', None, 'minute')}} to
								{{input_date('finish', None, 'minute')}}
								<br>
								<input type="submit" name="delete_data" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
			
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Insert HH datum</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm textWidthAuto">
						<form method="post" action="/channels/{{channel.id}}/edit">
							<fieldset>
								<label>Start Date </label>
									{{input_date('start', None, 'minute')}}
								
								Value {{input_text('value', '')}}
							
								<label>Status </label>
								<select name="status">
									{{input_option('status', 'E', 'E')}}
									{{input_option('status', 'A', 'A')}}
								</select>	
								<br>
								<input type="submit" name="insert" value="Insert">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
		
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Delete this channel</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form action="/channels/{{channel.id}}/edit">
							<fieldset>
								<input type="hidden" name="channel_id" value="{{channel.id}}">
								<input type="hidden" name="start_year" value="{{now.year}}">
								<input type="hidden" name="start_month" value="{{now.month}}">
								<input type="submit" name="delete" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
			
	{% endif %}
{% endblock %}
