{% extends 'layout.html.twig' %}

{% block title %}
	{{ project.title }}
	&raquo; Compilation errors
{% endblock %}

{% block content %}
	<section class="row-fluid">
		<div class="span2 sidebar">

			<ul class="side-nav nav nav-list">
				<li class="nav-header">Navigation</li>
				{% set error_count = 0 %}
				{% for file in project.files %}
					{% if file.allerrors.count > 0 %}
						<li>
							<a href="#{{ file.path }}">
								<i class="fa-solid fa-file" style="color: #000000"></i>
								{{ file.path }}</a>
						</li>
					{% endif %}
					{% set error_count = error_count + file.allerrors.count %}
				{% endfor %}
			</ul>
		</div>

		<div class="span10 offset2">
			<ul class="breadcrumb">
				<li>
					<a href="/">
						<i class="fa-solid fa-bug" style="color: #b94a48"></i>
					</a>
					<span class="divider">\</span>
				</li>
				<li>Compilation Errors</li>
			</ul>

			{% if error_count <= 0 %}
				<div class="alert alert-important">No errors have been found in this project.</div>
			{% endif %}

			{% for file in project.files %}
				<div class="package-contents">
					{% if file.allerrors.count > 0 %}
						<a name="{{ file.path }}" id="{{ file.path }}"></a>
						<h3>
							<i class="fa-solid fa-file" style="color: #000000"></i>
							{{ file.path }}
							<small style="float: right;padding-right: 10px;">{{ file.allerrors.count }}</small>
						</h3>
						<div>
							<table class="table markers table-bordered">
								<thead>
									<tr>
										<th>Type</th>
										<th>Line</th>
										<th>Description</th>
									</tr>
								</thead>
								<tbody>
									{% for error in file.allerrors %}
										<tr>
											<td>{{ error.severity }}</td>
											<td>{{ error.line }}</td>
											<td>{{ error.code|trans(error.context) }}</td>
										</tr>
									{% endfor %}
								</tbody>
							</table>
						</div>
					{% endif %}
				</div>
			{% endfor %}
		</div>
	</section>
{% endblock %}
