{% extends "base.html" %}

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

{% block nav %}
	&raquo; <a href="/supplier_contracts">Supplier Contracts</a> &raquo; 
	<a href="/supplier_contracts/{{batch.contract.id}}">{{batch.contract.name}}</a>
	&raquo; 
	<a href="/supplier_batches?supplier_contract_id={{batch.contract.id}}">Batches</a>
	&raquo; 
	<a href="/supplier_batches/{{batch.id}}">{{batch.reference}}</a>
 	&raquo; Edit
{% endblock %}

{% block content %}
	{% if request.method == 'GET' and request.values.confirm_delete %}
		<div class="layer-section">
			<div class="section-header">
				<h2>Are you sure you want to delete this batch and all its bills?</h2>	
			</div>
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form method="post" action="">
							<fieldset>
								<input type="submit" name="delete" value="Delete">
								<input
										type="reset" value="Cancel"
										onClick="window.location='/supplier_batches/{{batch.id}}/edit'"/>
							</fieldset>
						</form>
					</div>
				</div>
			</div>
		</div>

	{% else %}
	
	 <div class="layer-section">
		<div class="section-header">
			<h2>Update batch</h2>	
		</div>
		<div class="section-content">
			<div class="section-data">
				<div class="standardForm">
					<form action="" method="post">
						<fieldset>
							<div class="row">
								<div class="col-sm-4">
									<label>
										Reference {{input_text('reference', batch.reference)}}
									</label>
								</div>
							</div>		
							<div class="row">
								<div class="col-sm-4">
									<label>
										Description {{input_text('description', batch.description)}}
									</label>
								</div>
							</div>		
							<input type="submit" name="update" value="Update">
						</fieldset>
					</form>
				</div>
			</div>
		</div>
	</div>

		<div class="layer-section">
			<div class="section-header">
				<h2>Delete this batch</h2>	
			</div>
			<div class="section-content">
				<div class="section-data">
					<div class="standardForm">
						<form action="">
							<fieldset>
								<input type="submit" name="confirm_delete" value="Delete">
							</fieldset>
						</form>
					</div>
				</div>
			</div>
		</div>
	{% endif %}
{% endblock %}
