{% extends "@ChillMain/layout.html.twig" %}

{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}

{% block title %}{{ 'My accompanying periods'|trans }}{% endblock title %}

{% macro recordAction(period) %}
    <li>
        <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
        class="btn btn-show" title="{{ 'See accompanying period'|trans }}"></a>
    </li>
{% endmacro %}


{% block content %}

    <div class="col-md-10">
        <h1>{{ 'My accompanying periods'|trans }}</h1>

        <ul class="nav nav-pills justify-content-center">
            <li class="nav-item">
                <a class="nav-link {% if activeTab == 'referrer' %}active{% endif %}"
                   aria-current="page"
                   href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true, 'filter': 2}) }}">
                    {{ 'my_parcours_filters.referrer_parcours'|trans }}
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if activeTab == 'referrer_to_works' %}active{% endif %}"
                   aria-current="page"
                   href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true, 'filter': 4}) }}">
                    {{ 'my_parcours_filters.referrer_acpw'|trans }}
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if activeTab == 'both' %}active{% endif %}"
                   aria-current="page"
                   href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true, 'filter': 6}) }}">
                    {{ 'my_parcours_filters.referrer_parcours_and_acpw'|trans }}
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if activeTab == 'intervening' %}active{% endif %}"
                   aria-current="page"
                   href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true, 'filter': 8}) }}">
                    {{ 'my_parcours_filters.parcours_intervening'|trans }}
                </a>
            </li>
        </ul>

        {{ statusFilter|chill_render_filter_order_helper }}

        <p>{{ 'Number of periods'|trans }}: <span class="badge rounded-pill bg-primary mt-3">{{ pagination.totalItems }}</span></p>

        <div class="flex-table accompanyingcourse-list">
            {% for period in accompanyingPeriods %}
                {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
            {% else %}
                <p class="chill-no-data-statement">{{ 'Any accompanying period'|trans }}</p>
            {% endfor %}
        </div>

        {{ chill_pagination(pagination) }}

    </div>

{% endblock %}
