{% extends "base.html" %}

{% block title %}
	&raquo; Supplier Contracts &raquo; {{contract.name}}
{% endblock %}

{% block nav %}
		<a href="/e/supplier_contracts">Supplier Contracts</a> &raquo; 
		<a href="/e/supplier_contracts/{{contract.id}}">{{contract.name}}</a>
		&raquo; Edit
{% endblock %}

{% block content %}

	{% if request.method == 'GET' and request.values.delete %}
		<form method="post">
			<fieldset>
				<legend>Are you sure you want to delete this contract?</legend>	
				<input type="submit" name="delete" value="Delete">
				<a href="/e/supplier_contracts/{{contract.id}}/edit">Cancel</a>
			</fieldset>
		</form>
	
	{% else %}
	
		<form method="post">
			<fieldset>
				<legend>Update Contract</legend>	
				<label>Party</label>
				<select name="party_id">
					{% for party in parties %}
						{{ input_option('party_id', party.id, party.participant.code + ' : ' + party.name, contract.party.id) }}
					{% endfor %}
				</select>
				<label>Name</label>
				{{input_text('name', contract.name)}}
				<label>Charge script</label>
				{{input_textarea('charge_script', contract.charge_script, 40, 80)}}
				<label>Properties</label>
				{{input_textarea('properties', contract.properties, 20, 80)}}
				<input type="submit" value="Update">
			</fieldset>
		</form>

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