{% extends "base.html" %}

{% block title %}
	&raquo; Non-core Contracts &raquo; {{contract.name}} &raquo;
 	Automatic Importer
{% endblock %}

{% block nav %}
	<a href="/non_core_contracts">Non-Core Contracts</a> &raquo;
	<a href="/non_core_contracts/{{contract.id}}">{{contract.name}}</a>
	&raquo; Automatic Importer
{% endblock %}

{% block content %}
	<div class="layer-section">
		<div class="section-content">
			<div class="section-data">
				<p>
					<a
							href="/non_core_contracts/{{contract.id}}/auto_importer"
							>Refresh page</a>
					</p>
					{% if importer %}
						<table class="DataTable widthAuto">
							<tr>
								<th>Is Locked?</th>
								<td>{{importer.is_locked()}}</td>
							</tr>
						</table>
						<br>
						{% if not importer.is_locked() %}
							<form method="post">
								<fieldset>
									<legend>Import Now</legend>
									<input type="submit" value="Import" name="now">
								</fieldset>
							</form>
						{% endif %}
						<br>
						<h4>Log</h4>
						<ul>
							{% for message in importer.messages %}
								<li>{{message}}</li>
							{% endfor %}
						</ul>
					{% else %}
						<p>Importer not present.</p>
					{% endif %}
			</div>
		</div>
	</div>	
{% endblock %}
