<div class="activity-list">
    {% for activity in activities | slice(0,5) %}
        {% set t = activity.type %}

        <a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
            class="dashboard-link" title="{{ 'Show the activity'|trans }}">

            <div class="dashboard">
                <span class="title_label"></span>
                <span class="title_action">

                    {%- if activity.date -%}
                        <p class="date-label">{{ activity.date|format_date('short') }}</p>
                    {%- endif -%}

                    <span class="like-h3">{{ activity.type.name|localize_translatable_string }}</span>

                    {% if activity.emergency %}
                        <span class="badge bg-danger rounded-pill fs-6">{{ 'Emergency'|trans|upper }}</span>
                    {% endif %}

                    <ul class="small_in_title mt-3">

                        {% if activity.sentReceived is not empty and t.sentReceivedVisible %}
                            <li>
                                <span class="item-key">{{ 'Sent received'|trans ~ ' : ' }}</span>
                                <b>{{ activity.sentReceived|capitalize|trans }}</b>
                            </li>
                        {% endif %}

                        {% if activity.location and t.locationVisible %}
                            <li>
                                <span class="item-key">{{ 'location'|trans ~ ': ' }}</span>
                                <b>
                                    <span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
                                    {{ activity.location.name }}
                                </b>
                            </li>
                        {% endif %}

                        {% if activity.user and t.userVisible %}
                            <li>
                                <span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
                                <span class="badge-user">{{ activity.user|chill_entity_render_box({'at_date': activity.date}) }}</span>
                            </li>
                        {% endif %}

                        <li class="associated-persons">
                            <span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
                            {% for p in activity.personsAssociated %}
                                <span class="badge-person">{{ p|chill_entity_render_box({'addAgeBadge': true}) }}</span>
                            {% endfor %}
                        </li>
                    </ul>

                    <ul class="list-content my-3">
                        {%- if t.reasonsVisible -%}
                            {%- if activity.reasons is not empty -%}
                                <li class="reasons">
                                    {% for r in activity.reasons %}
                                        {{ r|chill_entity_render_box }}
                                    {% endfor %}
                                </li>
                            {%- endif -%}
                        {% endif %}
                        {%- if t.socialIssuesVisible %}
                            {%- if activity.socialIssues is not empty -%}
                                <li class="social-issues">
                                    {% for r in activity.socialIssues %}
                                        {{ r|chill_entity_render_box }}
                                    {% endfor %}
                                </li>
                            {%- endif -%}
                        {% endif %}
                        {%- if t.socialActionsVisible -%}
                            {%- if activity.socialActions is not empty -%}
                                <li class="social-actions">
                                    {% for r in activity.socialActions %}
                                        {{ r|chill_entity_render_box }}
                                    {% endfor %}
                                </li>
                            {%- endif -%}
                        {% endif %}
                    </ul>

                </span>
            </div>
        </a>
    {% endfor %}
</div>
