{% extends "layout.html" %}
{% block headers %}
<style>
#content { max-width: 85% !important; min-width: 880pt; }
</style>
{% endblock %}
{% block submenu %}
<ul>
  <li class="active">Dashboard
  <li><a href="/review/overview">Overview</a>
</ul>
{% endblock %}
{% block body %}
<h1>Reviewer dashboard</h1>
<h2>Datasets assigned to me</h2>
{%- if assigned_reviews %}
<table id="assigned-table" class="reviewer-table branded-table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Submitter</th>
      <th>Affiliation</th>
      <th>Status</th>
      <th>E-mail address</th>
      <th>Date</th>
      <th>Reminder</th>
      <th>Accepted</th>
      <th>Actions</th>
    </tr>
  </thead>
  <tbody>{% for review in assigned_reviews: %}
    <tr>
      <td>
        <a href="/review/goto-dataset/{{review.dataset_uuid}}">{{review.dataset_title}}</a>
      </td>
      <td>
        {{review.submitter_first_name | default("", False)}}
        {{review.submitter_last_name | default("", False)}}
      </td>
      <td>{{review.group_name | default("Unknown", False)}}</td>
      <td>{{review.status | default("unassigned", False)}}</td>
      <td>{{review.submitter_email}}</td>
      <td>{{review.request_date}}</td>
      <td></td>
      <td></td>
      <td><a href="/review/unassign/{{review.dataset_uuid}}" class="fas fa-angle-double-down" title="Unassign"></a></td>
    </tr>
  {% endfor %}</tbody>
</table>
{%- else %}
<p>There are no reviews assigned to you.</p>
{%- endif %}
<h2>Unassigned dataset reviews</h2>
{%- if unassigned_reviews %}
<table id="assigned-table" class="reviewer-table branded-table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Submitter</th>
      <th>Affiliation</th>
      <th>Status</th>
      <th>E-mail address</th>
      <th>Date</th>
      <th>Actions</th>
    </tr>
  </thead>
  <tbody>{% for review in unassigned_reviews: %}
    <tr>
      <td>{{review.dataset_title}}</td>
      <td>
        {{review.submitter_first_name | default("", False)}}
        {{review.submitter_last_name | default("", False)}}
      </td>
      <td>{{review.group_name | default("Unknown", False)}}</td>
      <td>{{review.status | default("unassigned", False)}}</td>
      <td>{{review.submitter_email}}</td>
      <td>{{review.request_date}}</td>
      <td><a href="/review/assign-to-me/{{review.dataset_uuid}}" class="fas fa-angle-double-up" title="Assign to me"></a></td>
    </tr>
  {% endfor %}</tbody>
</table>
{%- else %}
<p>There are no pending review requests.</p>
{%- endif %}
<h2>Recently published datasets</h2>
{%- if published_reviews %}
<table id="published-table" class="reviewer-table branded-table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Submitter</th>
      <th>Affiliation</th>
      <th>E-mail address</th>
      <th>Requested date</th>
      <th>Published date</th>
    </tr>
  </thead>
  <tbody>{% for review in published_reviews: %}
    <tr>
      <td><a href="/datasets/{{review.container_uuid}}">{{review.dataset_title}}</a> (version {{review.dataset_version}})</td>
      <td>
        {{review.submitter_first_name | default("", False)}}
        {{review.submitter_last_name | default("", False)}}
      </td>
      <td>{{review.group_name | default("Unknown", False)}}</td>
      <td>{{review.submitter_email}}</td>
      <td>{{review.request_date}}</td>
      <td>{{review.published_date}}</td>
    </tr>
  {% endfor %}</tbody>
</table>
{%- else %}
<p>There are no recently published datasets.</p>
{%- endif %}
<h2>Recently declined datasets</h2>
{%- if declined_reviews %}
<table id="declined-table" class="reviewer-table branded-table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Submitter</th>
      <th>Affiliation</th>
      <th>E-mail address</th>
      <th>Requested date</th>
      <th>Declined date</th>
    </tr>
  </thead>
  <tbody>{% for review in declined_reviews: %}
    <tr>
      <td>{{review.dataset_title}}</td>
      <td>
        {{review.submitter_first_name | default("", False)}}
        {{review.submitter_last_name | default("", False)}}
      </td>
      <td>{{review.group_name | default("Unknown", False)}}</td>
      <td>{{review.submitter_email}}</td>
      <td>{{review.request_date}}</td>
      <td>{{review.declined_date}}</td>
    </tr>
  {% endfor %}</tbody>
</table>
{%- else %}
<p>There are no recently declined datasets.</p>
{%- endif %}

{% endblock %}
