{% extends "base.html" %}

{% block title %}
	Gas Contracts &raquo; {{g_contract.name}}
{% endblock %}

{% block nav %}
	<a href="/g_contracts">Gas Contracts</a> &raquo;
	<a href="/g_contracts/{{g_contract.id}}">{{g_contract.name}}</a> &raquo; Edit
{% endblock %}

{% block content %}
	{% if request.method == 'GET' and request.values.delete %}
		<div class="layer-section">
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm textWidthAuto">
						<form method="post" action="">
							<fieldset>
								<legend>
									Are you sure you want to delete this contract?
								</legend>
								<input type="submit" name="delete" value="Delete">
							</fieldset>
						</form>
						<p>
							<a href=".">Cancel</a>
						</p>
					</div>
				</div>
			</div>
		</div>
	{% else %}
		<div class="layer-section">
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm textWidthAuto">
						<form action="" method="post">
							<fieldset>
								<legend>Update Contract</legend>
								<br>
								<label>Name</label>
								{{input_text('name', g_contract.name)}}
								<br>
								<br>
								Charge script
								<br>
								{{input_textarea(
									'charge_script', g_contract.charge_script, 40, 80)}}
								<br>
								<br>
								Properties
								<br>
								{{input_textarea('properties', g_contract.properties, 20, 80)}}
								<br />
								<br />
								<input type="submit" name="update" value="Update">
							</fieldset>
						</form>
						<br />
						<form action="/g_contracts/{{g_contract.id}}/edit">
							<fieldset>
								<legend>Delete this contract</legend>
								<input type="submit" name="delete" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
		</div>
	{% endif %}
{% endblock %}
