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

{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}

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

{% macro recordAction(period) %}
    {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE', period) %}
        <li>
            <a href="{{ path('chill_person_accompanying_course_delete', {'accompanying_period_id': period.id }) }}"
               class="btn btn-delete" title="{{ 'Delete'|trans }}"></a>
        </li>
    {% endif %}
    <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 in draft'|trans }}</h1>
        <p class="help-text">{{ 'Display draft periods created by me'|trans }}</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>

        {% if accompanyingPeriods|length > 0 %}
            {{ chill_pagination(pagination) }}
        {% endif %}

    </div>

{% endblock %}
