{% extends "base_nav.html" %}
{% load humanize %}
{% load i18n %}
{% load staticfiles %}
{% block "title" %}{% trans "Access Requests" %}{% endblock %}
{% block "nav_browse" %}active{% endblock %}
{% block "content" %}
<div class="container">
	<div class="row">
		<div class="col-md-12">
			<h1>
				{% trans "Access Requests" %}
			</h1>
			<h3>{% trans "Pending your review" %}</h3>
			<br>
			{% if reviewable %}
			<div class="panel panel-default">
				<table class="table table-hover">
					<tr>
						<th>{% trans "Requester" %}</th>
						<th>{% trans "Secret" %}</th>
						<th></th>
					</tr>
					{% for access_request in reviewable %}
					<tr>
						<td>
							{{ access_request.requester.username }}
						</td>
						<td>
							<a href="{{ access_request.secret.get_absolute_url }}">{{ access_request.secret.name }}</a>
						</td>
						<td>
							<a href="{{ access_request.get_absolute_url }}" class="btn btn-default"><i class="fa fa-eye"></i> &nbsp; {% trans "Review" %}</a>
						</td>
					</tr>
					{% endfor %}
				</table>
			</div>
			{% else %}
			<div class="alert alert-info">{% trans "Currently, there are no access requests for you to review." %}</div>
			{% endif %}
			<br>
			<h3>{% trans "Created by you" %}</h3>
			<br>
			{% if pending_review %}
			<div class="panel panel-default">
				<table class="table table-hover">
					<tr>
						<th>{% trans "Secret" %}</th>
						<th>{% trans "Reviewer(s)" %}</th>
					</tr>
					{% for access_request in pending_review %}
					<tr>
						<td>
							<a href="{{ access_request.secret.get_absolute_url }}">{{ access_request.secret.name }}</a>
						</td>
						<td>
							{{ access_request.reviewers.all|join:", " }}
						</td>
					</tr>
					{% endfor %}
				</table>
			</div>
			{% else %}
			<div class="alert alert-info">{% trans "You don't have any open access requests." %}</div>
			{% endif %}
		</div>
	</div>
</div>
{% endblock %}
