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

{% set activeRouteKey = '' %}

{% block title 'Tasks for {{ name }}'|trans({ '{{ name }}' : person|chill_entity_render_string }) %}

{% block content %}
    <div class="task-list"">

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

        {{ filter_order|chill_render_filter_order_helper }}

        {% if tasks|length == 0 %}
            <p class="chill-no-data-statement">{{ 'Any tasks'|trans }}</p>
        {% else %}
            <div class="flex-table chill-task-list">
                {% for task in tasks %}
                    {% include '@ChillTask/SingleTask/List/index_item.html.twig' with { 'showContext' : false } %}
                {% endfor %}
            </div>
        {% endif %}

        {{ chill_pagination(paginator) }}

        {% if is_granted('CHILL_TASK_TASK_CREATE_FOR_PERSON', person) %}
            <ul class="record_actions sticky-form-buttons">
                <li>
                    <a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
                        {{ 'Create' | trans }}
                    </a>
                </li>
            </ul>
        {% endif %}

    </div>
{% endblock %}

{% block css %}
    {{ encore_entry_link_tags('page_task_list') }}
    {{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}
{% block js %}
    {{ encore_entry_script_tags('page_task_list') }}
    {{ encore_entry_script_tags('mod_pickentity_type') }}
{% endblock %}
