{% extends "core/site-base.html" %}

{% block tabtitle %}
Simmate
{% endblock %}

{% block banner %}
{% include "core/header.html"%}
{% endblock %}


{% block body %}

<!-- NOTE: for this section to work, be sure to read datatable.html -->

<div class="container p-4 bg-light border" id="search-results">

  <div class="container p-4">

    <!-- Breadcrumb links -->
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="{% url 'workflows' %}">workflows</a></li>
        <li class="breadcrumb-item"><a href="{% url 'workflows_by_type' workflow.type %}">{{ workflow.type }}</a></li>
        <li class="breadcrumb-item"><a href="{% url 'workflow_detail' workflow.type workflow.name_short %}">
            {{ workflow.name_short }}</a></li>
        <li class="breadcrumb-item active">{{ calculation.id }}</li>
      </ol>
    </nav>

    <!-- Calculation Info -->
    <div class="container p-4">

      <h2>Prefect Cloud:</h2>
      {% if calculation.flow_run_view %}
      <ul>
        <li><b>Name:</b> {{ calculation.prefect_flow_run_name }}</li>
        <li><b>ID:</b> {{ calculation.prefect_flow_run_id }}</li>
        <li><b>Current State:</b> {{ calculation.prefect_state }}</li>
      </ul>
      <a role="button" class="btn btn-primary btn" href="{{ calculation.prefect_cloud_link }}" target="_blank">
        Monitor on Prefect</a>
      {% else %}
      <a>This workflow run was ran locally and not through Prefect Cloud</a>
      {% endif %}

      </br>
      </br>

      <h2>Calculation Information:</h2>
      <ul>
        <li><b>File Location:</b> {{ calculation.directory }}</li>
        <li><b>Created at:</b> {{ calculation.created_at }}</li>
        <li><b>Last updated at:</b> {{ calculation.updated_at }}</li>
        <li><b>Corrections Used:</b> {{ calculation.corrections }}</li>
      </ul>

    </div>


    {{ figure_convergence_html | safe }}

  </div>

</div>


{% endblock %}

{% block extrafooter %}
{% include "core/datatable.html" %}
{% endblock %}