{% import '@ChillActivity/ActivityReason/macro.html.twig' as m %}

<div>
  <h3>{{ activity.date|format_date('long') }}<span class="activity"> / {{ 'Activity'|trans }}</span>{% if 'person' != context %} / {{ activity.person|chill_entity_render_box({'addLink': true}) }}{% endif %}</h3>
    <div class="statement">
        <span class="statement">{{ '%user% has done an %activity_type%'|trans(
           {
             '%user%' : activity.user,
             '%activity_type%': activity.type.name|localize_translatable_string,
             '%date%' : activity.date|format_date('long') }
        ) }}</span>


        {% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
        <dl class="chill_view_data">
            <dd>{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}{{ activity.comment|chill_entity_render_box({'metadata': false}) }}{% endif %}</dd>

            <dt class="inline">{{ 'Reasons'|trans }}</dt>
            {%- if activity.reasons is empty -%}
            <dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
            {%- else -%}
            <dd>{% for r in activity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
            {%- endif -%}

        </dl>
        {% endif %}

    </div>

    <ul class="record_actions">
        <li>
            <a href="{{ path('chill_activity_activity_show', { 'person_id': activity.person.id, 'id': activity.id} ) }}" class="btn btn-view">
                {{ 'Show the activity'|trans }}
            </a>
        </li>
        {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
        <li>
            <a href="{{ path('chill_activity_activity_edit', { 'person_id': activity.person.id, 'id': activity.id} ) }}" class="btn btn-edit">
                {{ 'Edit the activity'|trans }}
            </a>
        </li>
        {% endif %}
    </ul>
</div>
