{% extends "layout.html" %}
{% block submenu %}
<ul>
  {%- if show_back %}
  <li><a href="/my/datasets">&#8592; Go back</a>
  {%- endif %}
  <li class="create-button"><a href="/my/datasets/{{dataset.uuid}}/private_link/new">Create new private link</a>
</ul>
{% endblock %}
{% block body %}
<h1>Private links</h1>
<p>Manage private links for <strong>{{dataset.title}}</strong>.</p>
<p><strong>Note</strong>: Private links give access to a dataset including
  access to the files within the dataset, regardless of the embargo,
  restricted access, or closed access settings.</p>
{%- if private_links %}
<table id="private-links-table" class="corporate-identity-table">
  <thead><tr><th>Private link</th><th>Purpose</th><th>Shared with</th><th>Expire date</th><th>Actions</th></tr></thead>
  <tbody>
    {%- for link in private_links: %}
    <tr>
      <td><a href="/private_datasets/{{link.id_string}}">{{link.id_string}}</a></td>
      <td>{{link.purpose}}</td>
      <td>{{link.whom}}</td>
      <td>{{"Expired" if link.is_expired else link.expires_date }}</td>
      <td><a href="/my/datasets/{{dataset.uuid}}/private_link/{{link.id_string}}/delete" class="fas fa-trash-can" title="Remove"></a></td>
    </tr>
    {%- endfor %}
  </tbody>
</table>
{%- else %}
<div class="center"><a href="/my/datasets/{{dataset.uuid}}/private_link/new" class="button corporate-identity-standard-button">Create new private link</a></div>
{%- endif %}
{% endblock %}
