{% extends 'timeseer.html' %}
{% from 'flows.html' import flows_header with context %}
{% from 'macros.html' import menu_back %}

{% block menu %}
{{ menu_back(url_for('flows.display_flow', flowevaluationid=block_evaluation.flow_evaluation.db_id, sourcename=source_name)) }}
{% endblock %}

{% block main %}
{{ flows_header(block_evaluation.flow_evaluation, 'Exports') }}

{% if exports|count > 0 %}
<ul class="list-group"></ul>
{% for export in exports|sort(attribute='date', reverse=True) %}
{% if export.date %}
    <li class="list-group-item">
        <form method='POST' action="{{ url_for('.download') }}">
            <input type="hidden" name="fileid" value="{{ export.db_id }}">
            <div class="row align-items-center">
                <div class="col-lg">
                    <div class="row">
                        <span>{{ export.filename }}</span>
                    </div>
                    <div class="row">
                        <small class='text-muted'>{{ export.date|datetimeformat }}</small>
                    </div>
                </div>
                <div class="col-lg-auto mt-lg-0 mt-2">
                    <button type='submit' class="btn btn-primary">Download</button>
                </div>
            </div>
        </form>
    </li>
{% endif %}
{% endfor %}
</ul>
{% else %}
<p class="alert alert-info">No exports found.</p>
{% endif %}
{% endblock %}
