{% extends "base.html" %}

{% block inside_head %}
	<style>
		section > article {
			border-style: solid;
			border-color: var(--bg-color);
			border-width: thin;
			padding: 1em;
		}
		section > h4 {
			margin-bottom: 0em;
		}
	</style>
{% endblock %}

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

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

{% block content %}

	<table>
		<thead>
			<tr>
				<th>Id</th>
				<th>Date Created</th>
				<th>Open?</th>
				<th>Subject</th>
				<th>Supplies [<a href="/e/dc_issues/{{issue.id}}/attach_supply">attach</a>]</th>
		</thead>
		<tbody>
			<tr>
				<td>{{issue.id}}</td>
				<td>{{issue.date_created|hh_format}}</td>
				<td>{{issue.is_open}}</td>
				<td>{{issue.properties.subject}}</td>
				<td>
					<ul>
						{% for supply in supplies %}
							<li>
								{% set era = supply.eras[0] %}
								<a href="/e/supplies/{{supply.id}}">{{era.imp_mpan_core}}
									{{era.exp_mpan_core or ''}}</a>

							</li>
						{% endfor %}
					</ul>
				</td>
			</tr>
		</tbody>
	</table>
	{% for entry in issue.entries %}
		<section>
			<h4>{{entry.timestamp|hh_format}} [<a href="/e/dc_entries/{{entry.id}}/edit">edit</a>]</h4>

			<article>{{entry.markdown|markdown}}</article>
		</section>
	{% endfor %}

	<p><a href="/e/dc_issues/{{issue.id}}/add_entry">Add Entry</a>

	<h4>Properties</h4>

	<pre>{{issue.properties|tojson}}</pre>

{% endblock %}
