{#
 * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
 *
 * This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillPerson/Person/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': 'person'} %}

    {% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
    <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" tabindex="-1" role="button" aria-disabled="true">{{ 'Create'|trans }}
            </a>
        </li>
    </ul>
    {% endif %}

{% endblock %}
