{% extends "base.html" %}

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

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

{% block content %}
	<form method="post">
		<fieldset>
			<legend>Update Contract</legend>
			<input type="hidden" name="mop_contract_id" value="{{contract.id}}">
			<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, 40, 80)}}
			<label>Example</label>
			<code><pre>
has.importer=yes
file.type=.df2
hostname=example.com
username=username
password=password
directory0=downloads1
directory1=downloads2
			</pre></code>
			<input type="submit" value="Update">
		</fieldset>
	</form>						

	<form action="/e/mop_contracts/{{contract.id}}/edit" method="post">
		<fieldset>
			<legend>Update State</legend>	
			<label>State</label>
			{{input_textarea('state', contract.state, 40, 80)}}
			<input type="submit" name="update_state" value="Update">
		</fieldset>
	</form>

	<form hx-delete="/e/mop_contracts/{{contract.id}}/edit"
		hx-confirm="Are you sure you want to delete this contract?">
		<fieldset>
			<legend>Delete this contract</legend>
			<input type="submit" value="Delete">
		</fieldset>
	</form>
{% endblock %}
