{% extends "base.html" %}

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

{% block nav %}
	<a href="/e/dc_contracts">DC Contracts</a> &raquo;
	<a href="/e/dc_contracts/{{contract.id}}">{{contract.name}}</a> &raquo;
	Issues [<a href="/e/dc_contracts/{{contract.id}}/add_issue">add</a>]
{% endblock %}

{% block content %}
	<table class="sticky">
		<thead>
			<tr>
				<th>View</th>
				<th>Issue Id</th>
				<th>Date Created</th>
				<th>Status</th>
				<th>Subject</th>
				<th>Supplies</th>
			</tr>
		</thead>
		<tbody>
			{% for bundle in issue_bundles %}
				<tr>
					<td><a href="/e/dc_issues/{{bundle.issue.id}}">View</a></td>
					<td>{{bundle.issue.id}}</td>
					<td>{{bundle.issue.date_created|hh_format}}</td>
					<td>
						{% if bundle.issue.is_open %}
							Open
						{% else %}
							Closed
						{% endif %}
					</td>
					<td>{{bundle.issue.properties['subject']}}</td>
					<td>
						<ul>
							{% for supply in bundle.supplies %}
								{% set era = supply.eras[0] %}
								<li>
									<a href="/e/supplies/{{supply.id}}">{{era.imp_mpan_core or ''}} {{era.exp_mpan_core or ''}}</a>
								</li>
							{% endfor %}
						</ul>
					</td>
				</tr>
			{% endfor %}
		</tbody>
	</table>

{% endblock %}
