{% extends "base.html" %}

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


{% block nav %}
	<a href="/e/supplies">Supplies</a> &raquo; 
	<a href="/e/supplies/{{hh.channel.era.supply.id}}">Supply
	 	{{hh.channel.era.supply.name}} Era {{hh.channel.era.start_date|date_format}}</a>
	&raquo; 
	<a href="/e/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|date_format}} Edit
{% endblock %}

{% block content %}

	{% if request.method == 'GET' and request.values.delete %}

		<form action="/e/hh_data/{{hh.id}}/edit" method="post">
			<fieldset>
				<legend>Are you sure you want to delete this half-hour?</legend>	
				<input type="submit" name="delete" value="Delete">
				<a href="/hh_data/{{hh.id}}/edit">Cancel</a>
			</fieldset>
		</form>
		
	{% else %}

		<form action="/e/hh_data/{{hh.id}}/edit" method="post">
			<fieldset>
				<legend>Update HH datum</legend>	
				
				<label>Start Date</label> {{input_date('start', hh.start_date)}}
				<label>Value</label> {{input_text('value', hh.value)}}
				<label>Status</label>
				<select name="status">
					{% for rt in ['A', 'E'] %}
						{{input_option('status', rt, rt, hh.status)}}
					{% endfor %}
				</select>
				<input type="submit" name="update" value="Update">
			</fieldset>
		</form>

		<form>
			<fieldset>
				<legend>Delete this half-hour</legend>	
				<input type="submit" name="delete" value="Delete">
			</fieldset>
		</form>
	{% endif %}
{% endblock %}
