{% extends "base.html" %}

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


{% block nav %}
	&raquo; <a href="/supplies">Supplies</a> &raquo; 
	<a href="/supplies/{{hh.channel.era.supply.id}}">Supply {{hh.channel.era.supply.name}} Era {{hh.channel.era.start_date|hh_format}}</a>
	&raquo; 
	<a href="/channels/{{hh.channel.id}}">Channel
		{%- if hh.channel.imp_related -%}
			&nbspImport
		{%- else -%}
			&nbspExport
		{%- endif -%}
		&nbsp{{hh.channel.channel_type}}</a> &raquo;
	HH {{hh.start_date|hh_format}} 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 half-hour?</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form method="post">
							<fieldset>
								<input type="hidden" name="hh_datum_id" value="{{hh.id}}">
								<input type="submit" name="delete" value="Delete">
								<input type="reset" value="Cancel" onClick="window.location='/hh_data/{{hh.id}}/edit'" />
							</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>Update HH datum</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<form method="post">
						<fieldset>
							<input type="hidden" name="hh_datum_id" value="{{hh.id}}">
							
							<div class="standardForm textWidthAuto">
								<label>Start Date</label>
								{{input_date('start', hh.start_date)}}
							</div>
							<div class="standardForm">
								<div class="row">
									<div class="col-sm-6">
										Value {{input_text('value', hh.value)}}
									</div>
									<div class="col-sm-6">
										<label>Status
											<select name="status">
												{% for rt in ['A', 'E'] %}
													{{input_option('status', rt, rt, hh.status)}}
												{% endfor %}
											</select>
										</label>
									</div>
								</div>
							</div>
							<input type="submit" name="update" value="Update">
						</fieldset>
					</form>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
		<!-- Layer Section -->
		<div class="layer-section">
			<!-- Section Header -->
			<div class="section-header">
				<h2>Delete this half-hour</h2>	
			</div>
			<!-- End Section Header -->
			<!-- Section Content -->
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form>
							<fieldset>
								<input type="hidden" name="hh_id" value="{{hh.id}}">
								<input type="submit" name="delete" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
			<!-- End Section Content -->
		</div>
		<!-- End Layer Section -->
		
		
		
		<br>
		
	{% endif %}
{% endblock %}
