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

{% set activeRouteKey = 'chill_activity_activity_list' %}

{% block title %}{{ 'Activity list' |trans }}{% endblock title %}


{% block js %}
    {{ parent() }}
    {{ encore_entry_script_tags('mod_notification_toggle_read_status') }}
    {{ encore_entry_script_tags('mod_document_action_buttons_group') }}
{% endblock %}

{% block css %}
    {{ parent() }}
    {{ encore_entry_link_tags('mod_notification_toggle_read_status') }}
    {{ encore_entry_link_tags('mod_document_action_buttons_group') }}
{% endblock %}

{% block content %}

    {% set person_id = null %}
    {% if person %}
        {% set person_id = person.id %}
    {% endif %}

    {% set accompanying_course_id = null %}
    {% if accompanyingCourse %}
        {% set accompanying_course_id = accompanyingCourse.id %}
    {% endif %}

    <h1>{{ 'Activity list' |trans }}</h1>

    {% include '@ChillActivity/Activity/list.html.twig' with {'context': 'accompanyingCourse'} %}

    {% if is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) %}
    <ul class="record_actions sticky-form-buttons">
        <li>
            <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
               class="btn btn-create">{{ 'Create'|trans }}
            </a>
        </li>
    </ul>
    {% endif %}

{% endblock %}
