{% set t = activity.type %}
<div class="item-bloc activity-item{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">

    <div class="item-row">
        <div class="wrap-list">
            <div class="wl-row">
                <div class="wl-col title">
                    {% if activity.date %}
                        <p class="date-label">
                            {{ activity.date|format_date('short') }}
                        </p>
                    {% endif %}
                </div>
                <div class="wl-col list">
                    <h2 class="badge-title">
                        <span class="title_label"></span>
                        <span class="title_action">
                            {{ activity.type.name | localize_translatable_string }}

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

    <div class="item-row column separator">
        <div class="wrap-list">
            {% if activity.location and t.locationVisible %}
                <div class="wl-row">
                    <div class="wl-col title"><h3>{{ 'location'|trans }}</h3></div>
                    <div class="wl-col list">
                        <p class="wl-item">
                            {{ activity.location.name }}
                            <span>({{ activity.location.locationType.title|localize_translatable_string }})</span>
                        </p>
                    </div>
                </div>
            {% endif %}

            {% if activity.attendee and t.attendeeVisible %}
                <div class="wl-row">
                    <div class="wl-col title"><h3>{{ 'Attendee'|trans }}</h3></div>
                    <div class="wl-col list">
                        <p class="wl-item">
                            {{ activity.attendee.name|localize_translatable_string }}
                        </p>
                    </div>
                </div>
            {% endif %}

            {% if activity.sentReceived is not empty and t.sentReceivedVisible %}
                <div class="wl-row">
                    <div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
                    <div class="wl-col list">
                        <p class="wl-item">
                            {{ activity.sentReceived|capitalize|trans }}
                        </p>
                    </div>
                </div>
            {% endif %}

            {% if activity.user is not null and t.userVisible %}
                <div class="wl-row">
                    <div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
                    <div class="wl-col list">
                        <p class="wl-item">
                            <span class="badge-user">{{ activity.user|chill_entity_render_box({'at_date': activity.date}) }}</span>
                        </p>
                    </div>
                </div>
            {% endif %}
        </div>

        {% include '@ChillActivity/Activity/concernedGroups.html.twig' with {
            'context': context,
            'render': 'wrap-list',
            'entity': activity,
            'badge_person': true
        } %}

        <div class="wrap-list">
            {%- if activity.reasons is not empty and t.reasonsVisible -%}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Reasons'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        {% for r in activity.reasons %}
                            <p class="wl-item reasons">
                                {{ r|chill_entity_render_box }}
                            </p>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}

            {%- if activity.socialIssues is not empty and t.socialIssuesVisible -%}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Social issues'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        {% for r in activity.socialIssues %}
                            <p class="wl-item social-issues">
                                {{ r|chill_entity_render_box }}
                            </p>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}

            {%- if activity.socialActions is not empty and t.socialActionsVisible -%}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Social actions'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        {% for r in activity.socialActions %}
                            <p class="wl-item social-actions">
                                {{ r|chill_entity_render_box }}
                            </p>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}

            {% if activity.comment.comment is not empty and is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Comment'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        {{ activity.comment|chill_entity_render_box({
                            'disable_markdown': false,
                            'metadata': false,
                        }) }}
                    </div>
                </div>
            {% endif %}

            {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) and activity.privateComment.hasCommentForUser(app.user) %}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Private comment'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        <section class="chill-entity entity-comment-embeddable">
                            <blockquote class="chill-user-quote private-quote">
                                {{ activity.privateComment.comments[app.user.id]|chill_markdown_to_html }}
                            </blockquote>
                        </section>
                    </div>
                </div>
            {% endif %}

            {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) and activity.documents|length > 0 %}
                <div class="wl-row">
                    <div class="wl-col title">
                        <h3>{{ 'Documents'|trans }}</h3>
                    </div>
                    <div class="wl-col list">
                        <ul>
                            {% for d in activity.documents %}
                                <li class="document-list-item">{{ d.title|chill_print_or_message('document.Any title') }} {{ d|chill_document_button_group(d.title, is_granted('CHILL_ACTIVITY_UPDATE', activity), {small: true}) }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            {% endif %}

        </div>
    </div>

    <div class="item-row separator">
        <div class="item-col item-meta">
            {% set notif_counter = chill_count_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) %}
            {% if notif_counter.total > 0 %}
                {{ chill_counter_notifications('Chill\\ActivityBundle\\Entity\\Activity', activity.id) }}
            {% endif %}
        </div>
        <div class="item-col">
            <ul class="record_actions">
                {{ recordAction }}
            </ul>
        </div>
    </div>

</div>
