{% extends "withoutnav_template.html" %}
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading %}
{% from "components/page-footer.html" import page_footer %}

{% block per_page_title %}
Provider versions
{% endblock %}

{% block maincolumn_content %}

<div class="grid-row">
    <div class="column-two-thirds">
        <h1 class="heading-large">{{ provider_versions[0].display_name }}</h1>

    {% call(item, row_number) list_table(
        provider_versions,
        caption='',
        caption_visible=False,
        empty_message='No history for this provider',
        field_headings=['Version', 'Last Updated', 'Updated By', 'Priority', 'Active'],
        field_headings_visible=True
      ) %}

        {{ text_field(item.version) }}

        {% if item.updated_at %}
            {{ text_field(item.updated_at|format_datetime_short) }}
        {% else %}
            {{ text_field('None') }}
        {% endif %}

        {% if item.created_by %}
            {{ text_field(item.created_by.name) }}
        {% else %}
            {{ text_field('None') }}
        {% endif %}

        {{ text_field(item.priority) }}

        {{ text_field(item.active) }}

      {% endcall %}

    {{ page_footer(
      back_link=url_for('main.view_providers'),
      back_link_text="Back to providers"
    ) }}

    </div>
</div>

{% endblock %}
