{% extends "base.html" %}

{% block title %}
	&raquo; DC Contracts
{% endblock %}

{% block nav %}
	DC Contracts [<a href="/e/dc_contracts/add">add</a>]
{% endblock %}

{% block content %}
	<table>
		<caption>Current DC Contracts</caption>
		<thead>
			<tr>
				<th>Name</th>
				<th>Start Date</th>
				<th>DC</th>
			</tr>
		</thead>
		<tbody>
			{% for contract in current_dc_contracts %}
				<tr>
					<td>
						<a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a>
					</td>
					<td>{{ contract.start_rate_script.start_date|hh_format }}</td>
					<td>
						<a href="/e/parties/{{contract.party.id}}"
							>{{contract.party.name}}</a>
					</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>

	<table>
		<caption>Latest File Imports</caption>
		<thead>
			<tr>
				<th>Imported At</th>
				<th>Contract</th>
				<th>File</th>
			</tr>
		</thead>
		<tbody>
			{% for ts, contract_name, path in latest_imports %}
				<tr>
					<td>{{ts|hh_format}}</td>
					<td>{{contract_name}}</td>
					<td>{{path}}</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>

	<table>
		<caption>Ended DC Contracts</caption>
		<thead>
			<tr>
				<th>Name</th>
				<th>Start Date</th>
				<th>Finish Date</th>
				<th>DC</th>
			</tr>
		</thead>
		<tbody>
			{% for contract in ended_dc_contracts %}
				<tr>
					<td>
						<a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a>
					</td>
					<td>{{ contract.start_rate_script.start_date|hh_format }}</td>
					<td>{{ contract.finish_rate_script.finish_date|hh_format }}</td>
					<td>
						<a href="/e/parties/{{contract.party.id}}"
							>{{contract.party.name}}</a>
					</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>
{% endblock %}
