{% 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 active == true %}active{% endif %}" aria-current="page" href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true}) }}">{{ ['Confirmed'|trans, 'course.inactive_short'|trans, 'course.inactive_long'|trans]|join(', ') }}</a>
            </li>
            <li class="nav-item ">
                <a class="nav-link {% if active == false %}active{% endif %}" href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': false}) }}">{{ 'course.closed'|trans }}</a>
            </li>
        </ul>

        <p>{{ 'Number of periods'|trans }}: <span class="badge rounded-pill bg-primary">{{ 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 %}
