<div class="item-bloc">
    <div class="item-row">
        <div class="item-col">
            <div class="denomination h2">
                {{ task.title }}
                {% for place in  workflow_marked_places(task) %}
                    <span class="task-status badge type-{{ task.type }} place-{{ place }}">
                        {{ place|trans }}
                    </span>
                {% endfor %}
            </div>
            {% if  task.type != 'task_default'%}
                <span class="task-type">
                    {{ task_workflow_metadata(task, 'definition.name')|trans }}
                </span>
            {% endif %}
            {% if showContext %}
                <div>
                    {% if task.person is not null %}
                        <span class="chill-task-list__row__person">
                                                {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
                                                    targetEntity: { name: 'person', id: task.person.id },
                                                    action: 'show',
                                                    displayBadge: true,
                                                    buttonText: task.person|chill_entity_render_string,
                                                    isDead: task.person.deathdate is not null
                                                } %}
                                            </span>
                    {% elseif task.course is not null %}
                        <div style="margin-bottom: 1rem;">
                        {% for part in task.course.currentParticipations %}
                            {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
                                targetEntity: { name: 'person', id: part.person.id },
                                action: 'show',
                                displayBadge: true,
                                buttonText: part.person|chill_entity_render_string,
                                isDead: part.person.deathdate is not null
                            } %}
                        {% endfor %}
                        </div>
                        <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': task.course.id }) }}"
                           class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
                            <i class="fa fa-random fa-fw"></i>
                        </a>
                    {% endif %}
                </div>
            {% endif %}
        </div>


        <div class="item-col">
            <div class="container">
                {% if task.assignee is not null %}
                    <div class="assignee row">
                        <span>{{ task.assignee|chill_entity_render_box }}</span>
                    </div>
                {% endif %}

                {% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
                    <div class="dates row">
                        <ul class="column">
                            {% if task.startDate is not null %}
                                <li title="{{ 'Start'|trans|escape('html_attr') }}">
                                    <i class="fa fa-play"></i>
                                    {{ task.startDate|format_date('medium') }}
                                </li>
                            {% endif %}
                            {% if task.warningDate is not null %}
                                <li title="{{ 'Warning'|trans|escape('html_attr') }}">
                                    <i class="fa fa-exclamation-triangle"></i>
                                    {{ task.warningDate|format_date('medium') }}
                                </li>
                            {% endif %}
                            {% if task.endDate is not null %}
                                <li title="{{ 'End'|trans|escape('html_attr') }}">
                                    <i class="fa fa-hourglass-end"></i>
                                    {{ task.endDate|format_date('medium') }}
                                </li>
                            {% endif %}
                        </ul>
                    </div>
                {% endif %}

                {# {% if task.course is not null %}
                    <a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': task.course.id }) }}"
                        class="btn btn-sm btn-outline-primary" style="float:right;" title="{{ 'See accompanying period'|trans }}">
                        <i class="fa fa-random fa-fw"></i>
                    </a>
                {% endif %} #}
            </div>

        </div>

    </div>
    <div class="item-row separator">
        <ul class="record_actions">
            {% if workflow_transitions(task)|length > 0 %}
                <li>
                    <div class="btn-group">
                        <a class="btn btn-task-exchange dropdown-toggle" href="#" role="button" id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
                            {{'Change task status'|trans}}
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="taskExchange">
                            {% for transition in workflow_transitions(task) %}
                                <li>
                                    <a class="dropdown-item" href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'list_params': app.request.query.all }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
                                        {{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
                                    </a>
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                </li>
            {% endif %}

            <li>
                <a href="{{ chill_path_add_return_path('chill_task_single_task_show', { 'id': task.id }) }}" class="btn btn-show "></a>
            </li>

            {% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
                <li>
                    <a href="{{ chill_path_add_return_path('chill_task_single_task_edit', { 'id': task.id }) }}" class="btn btn-update "></a>
                </li>
            {% endif %}

            {% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
                <li>
                    <a href="{{ chill_path_add_return_path('chill_task_single_task_delete', { 'id': task.id } ) }}" class="btn btn-delete "></a>
                </li>
            {% endif %}
        </ul>

    </div>
</div>
