{% set user_id = null %} {% if user %} {% set user_id = user.id %} {% endif %} {% set accompanying_course_id = null %} {% if accompanyingCourse %} {% set accompanying_course_id = accompanyingCourse.id %} {% endif %}

{{ 'Calendar list' |trans }}

{% if calendarItems|length == 0 %}

{{ "There is no calendar items."|trans }}

{% else %}
{% for calendar in calendarItems %}
{% if calendar.startDate %}

{{ calendar.startDate|format_datetime('long') }}

{% endif %} {% if calendar.endDate %}

{{ calendar.endDate|format_datetime('long') }}

{% endif %}

{{ calendar.endDate.diff(calendar.startDate)|date("%H:%M")}}

{% if context == 'user' and calendar.accompanyingPeriod is not empty %} {% endif %}
    {% if calendar.user %}
  • {{ 'by'|trans }}{{ calendar.user.usernameCanonical }}
  • {% endif %} {% if calendar.mainUser is not empty %}
  • {{ 'main user concerned'|trans }}{{ calendar.mainUser.usernameCanonical }}
  • {% endif %}
  • {%- if calendar.comment.isEmpty -%} {{ 'No comments'|trans }} {%- else -%} {{ calendar.comment|chill_entity_render_box }} {%- endif -%}
  • {# TOOD {% if is_granted('CHILL_ACTIVITY_UPDATE', calendar) %} #}
  • {# TOOD {% endif %} {% if is_granted('CHILL_ACTIVITY_DELETE', calendar) %} #}
  • {# {% endif %} #}
{% if calendar.comment.comment is not empty or calendar.users|length > 0 or calendar.thirdParties|length > 0 or calendar.users|length > 0 %}
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': calendar } %}
{% if calendar.comment.comment is not empty %}
{{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %} {% if context != 'user' %} {# TODO set this condition in configuration #} {% endif %}