{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}

{% block title 'accompanying_course_work.List accompanying course work'|trans %}

{% block js %}
    {{ parent() }}
    {{ encore_entry_script_tags('mod_entity_workflow_pick') }}
    {{ encore_entry_script_tags('mod_pickentity_type') }}
{% endblock %}

{% block css %}
    {{ parent() }}
    {{ encore_entry_link_tags('mod_entity_workflow_pick') }}
    {{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}


{% block content %}
    <div class="accompanying-course-work">

        <h1>{{ block('title') }}</h1>

        {{ filter|chill_render_filter_order_helper }}

        {% if works|length == 0 %}
            <p class="chill-no-data-statement">{{ 'accompanying_course_work.Any work'|trans }}</p>
        {% else %}
            <div class="flex-table">
                {% for w in works %}
                    {% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
                        'displayAction': true,
                        'displayContent': 'short',
                        'displayFontSmall': true,
                        'itemBlocClass': '',
                        'displayNotification': true
                    } %}
                {% endfor %}
            </div>
        {% endif %}

        {{ chill_pagination(paginator) }}

        {% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE', accompanyingCourse) %}
        <ul class="record_actions sticky-form-buttons">
            <li>
                <a href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_new', { 'id': accompanyingCourse.id }) }}"
                   class="btn btn-new">
                    {{ 'accompanying_course_work.create'|trans }}
                </a>
            </li>
        </ul>
        {% endif %}

    </div>
{% endblock %}
