{% extends "layout_local_experiment.html" %}


{% block content %}


<div class="pb-2">
  <h1>{{ experiment.title }}</h1>
  <p class="text-muted">Remember that you can only access experiments from the Alfred database, if <code>exp_id</code>
    in your <code>config.conf</code> matches the experiment ID in mortimer.</p>

  <p class="text-muted">The ID for this experiment is: <span
      class="badge badge-secondary">{{ experiment.exp_id }}</span></p>

</div>

<div class="row row-cols-1 row-cols-md-2 row-cols-xl">

  <div class="col mb-4">
    <div class="card h-100 text-center border-primary">
      <div class="card-header border-primary">
        Complete datasets
      </div>
      <div class="card-body text-primary">
        <h1 class="card-text">{{ datasets["all_finished_datasets"] }}</h1>
      </div>
      <div class="card-footer text-muted border-primary">
        Total datasets: <span class="badge badge-light">{{ datasets["all_datasets"] }}</span>
      </div>
    </div>
  </div>

  <div class="col mb-4">
    <div class="card h-100 text-center">
      <div class="card-header">Export Data</div>
      <div class="card-body">
        <a class="btn btn-primary mt-1 mb-1"
          href="{{ url_for('local_experiments.local_export', experiment_title=experiment.title, username=experiment.author) }}">Export
          Data</a>
      </div>

    </div>
  </div>

  <div class="col mb-4">
    <div class="card h-100 text-center border-success">
      <div class="card-header border-success">
        Last Update
      </div>
      <div class="card-body">
        <h2 class="card-text text-success">{{ experiment.last_update.strftime('%Y-%m-%d') }}</h2>
        <span class="text-muted">{{ experiment.last_update.strftime('%H:%M') }}</span>
      </div>
      <div class="card-footer text-muted border-success">
        Created on <span class="badge badge-light">{{ experiment.date_created.strftime('%Y-%m-%d, %H:%M') }}</span>
      </div>
    </div>
  </div>

  <div class="col mb-4">
    <div class="card h-100 text-center border-info">
      <div class="card-header border-info">
        Last activity
      </div>
      <div class="card-body border-info">
        <h2 class="card-text text-info">
          {% if last_activity != 'none' %}
          {{ last_activity.strftime('%Y-%m-%d') }}
          {% else %}
          - none -
          {% endif %}
        </h2>
        <span class="text-muted">
          {% if last_activity != 'none' %}
          {{ last_activity.strftime('%H:%M') }}
          {% else %}
          - none -
          {% endif %}
        </span>
      </div>
      <div class="card-footer text-muted border-info">
        First activity on <span class="badge badge-light">
          {% if first_activity != 'none' %}
          {{ first_activity.strftime('%Y-%m-%d, %H:%M') }}
          {% else %}
          - none -
          {% endif %}
        </span>
      </div>
    </div>
  </div>
</div>



{% if experiment.description %}
<h6 class="border-bottom pt-2 mt-3"><b>Description</b></h6>

<p class="article-content">{{ experiment.description }}</p>
{% else %}
{% endif %}


<div class="article content-section mt-5 float-right">

  <button type="button" class="btn btn-danger ml-1 mt-2 mb-2" data-toggle="modal" data-target="#deleteModal"><i
      class='fas fa-trash mr-2'></i>Delete from Mortimer</button>

</div>

<!-- Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel"
  aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="deleteModalLabel">Delete Experiment</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        Are you sure that you want to delete this experiment? The data stored in Mortimer will be lost! <br><br>The
        experimental data in the Alfred database will <b>not</b> be deleted by this.
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <form method="POST"
          action="{{ url_for('local_experiments.delete_experiment', experiment_title=experiment.title, username=experiment.author) }}">
          <input class="btn btn-danger" type="submit" value="Delete">
        </form>
      </div>
    </div>
  </div>
</div>



{% endblock content %}