{% extends 'events/display/conference/base.html' %}


{% block title %}
    {{- page_title -}}
{% endblock %}

{% block page_actions %}
    <div class="toolbar f-j-end">
        <a href="{{ url_for('.program_pdf', event) }}"
           class="i-button icon-file-pdf"
           title="{% trans %}Download PDF{% endtrans %}"></a>
    </div>
{% endblock %}

{% block content %}
    {% if program %}
        <div class="quotation editor-output js-mathjax">
            {{- program -}}
        </div>
    {% endif %}

    <ul class="tracks flexcol f-j-space-between">
        {% for item in items %}
            {% if item.is_track_group %}
                {{ render_group(item) }}
            {% else %}
                {{ render_track(item) }}
            {% endif %}
        {% endfor %}
    </ul>
{% endblock %}

{% macro render_track(track) %}
    <li>
        <div class="track-title flexrow f-a-center">
            <h3 class="f-self-stretch">{{ track.title }}</h3>
            {% if track.code %}
                <span class="track-code">
                    {{- track.code -}}
                </span>
            {%- endif %}
            {% if track.can_convene(session.user) or track.can_review_abstracts(session.user) %}
                <a href="{{ url_for('abstracts.display_reviewable_track_abstracts', track) }}"
                   class="i-link icon-stack-text track-link"
                   title="{% trans %}Review abstracts in this track{% endtrans %}">
                </a>
            {% endif %}
        </div>
        {% if track.description %}
            <div class="description editor-output">
                {{- track.description -}}
            </div>
        {% endif %}
    </li>
{% endmacro %}

{% macro render_group(group) %}
    <li>
        <div class="track-title flexrow f-a-center">
            <h3 class="f-self-stretch">{{ group.title }}</h3>
        </div>
        {% if group.description %}
            <div class="description editor-output">
                {{- group.description -}}
            </div>
        {% endif %}
        {% if group.tracks %}
            <ul class="sub-tracks f-j-space-between ">
                {% for track in group.tracks %}
                    {{ render_track(track) }}
                {% endfor %}
            </ul>
        {% endif %}
    </li>
{% endmacro %}
