{% extends 'ddm/project_admin/base.html' %}

{% block page_title %}Data Donation Setup{% endblock %}

{% block main_heading %}Data Donation Blueprints{% endblock %}

{% block main_body %}
<div class="ddm-admin-section">
  <div class="ddm-admin-section-header">Donation Blueprints</div>
  <div class="ddm-admin-section-body">
    <table class="table">
      <tr>
        <th>Name</th>
        <th>Assigned to</th>
        <th>Instructions</th>
        <th></th>
        <th></th>
      </tr>
      {% for blueprint in donation_blueprints %}
      <tr>
        <td>{{ blueprint.name }}</td>
        <td>{{ blueprint.zip_blueprint }}</td>
        <td>
          {% if blueprint.zip_blueprint %}
          Defined on zip container
          {% elif blueprint.get_instructions %}
          <a href="{% url 'instruction-overview' blueprint.project.pk 'blueprint' blueprint.pk %}">Show Instructions</a>
          {% else %}
          No instructions – <a href="{% url 'instruction-create' blueprint.project.pk 'blueprint' blueprint.pk %}">Add Instructions</a>
          {% endif %}
        </td>
        <td><a href="{{ blueprint.get_absolute_url }}">Edit Blueprint</a></td>
        <td><a href="{% url 'blueprint-delete' blueprint.project.pk blueprint.pk %}">Delete Blueprint</a></td>
      </tr>
      {% empty %}
      <tr>
        <td>No blueprints created yet.</td>
      </tr>
      {% endfor %}
    </table>
    <a class="ddm-btn" href="{% url 'blueprint-create' project_pk %}"><b>+</b>&nbsp;&nbsp;Create new Blueprint</a>
  </div>
</div>


<div class="ddm-admin-section">
  <div class="ddm-admin-section-header">Zip Containers</div>
  <div class="ddm-admin-section-body">
    <table class="table">
      <tr>
        <th>Name</th>
        <th>Instructions</th>
        <th></th>
        <th></th>
      </tr>
      {% for blueprint in zipped_blueprints %}
      <tr>
        <td>{{ blueprint.name }}</td>
        <td>
          {% if blueprint.get_instructions %}
          <a href="{% url 'instruction-overview' blueprint.project.pk 'zip-blueprint' blueprint.pk %}">Show Instructions</a>
          {% else %}
          <a href="{% url 'instruction-create' blueprint.project.pk 'zip-blueprint' blueprint.pk %}">Add Instructions</a>
          {% endif %}
        </td>
        <td><a href="{{ blueprint.get_absolute_url }}">Edit Zip Container</a></td>
        <td><a href="{% url 'zipped-blueprint-delete' blueprint.project.pk blueprint.pk %}">Delete Container</a></td>
      </tr>
      {% empty %}
      <tr>
        <td>No Zip Containers created yet.</td>
      </tr>
      {% endfor %}
    </table>
    <a class="ddm-btn" href="{% url 'zipped-blueprint-create' project_pk %}"><b>+</b>&nbsp;&nbsp;Create new Zip Container</a>
  </div>
</div>

{% endblock %}

{% block breadcrumbs %}
<a href="{% url 'project-list' %}">Projects</a> /
<a href="{% url 'project-detail' project_pk %}">"{{ project.name|truncatechars:15 }}" Project</a> /
Donation Blueprints
{% endblock %}
