{% extends "@ChillMain/layout.html.twig" %}

{% block title %}
	{{ 'Aside activity list'|trans }}
{% endblock title %}

{% block content %}
	<div class="col-md-10 asideactivity-list">
		<h2>{{ 'My aside activities'|trans }}</h2>

		{% if entities|length == 0 %}
			<p class="chill-no-data-statement">
				{{ "There aren't any aside activities."|trans }}
				<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
			</p>
		{% else %}

			<div class="flex-table">

				{% for entity in entities %}

					<div class="item-bloc">
						<div class="item-row wrap-header">

							<div class="item-col">
								<h3>
									{{ entity.type|chill_entity_render_box }}
								</h3>
								<div>
									{% if entity.date %}
										<span>{{ entity.date|format_date('long') }}</span>
									{% endif %}
									{% if entity.date %}
										<span class="duration">

											<i class="fa fa-fw fa-hourglass-end"></i>
											{{ entity.duration|date('H:i') }}

										</span>
									{% endif %}
								</div>
                                {%- if entity.location.name is defined -%}
                                    <div><i class="fa fa-fw fa-map-marker"></i>{{ entity.location.name }}</div>
                                {%- endif -%}

                                {%- if entity.concernedPersonsCount > 0 -%}
                                    <div><i class="fa fa-fw fa-user"></i>{{ entity.concernedPersonsCount }}</div>
                                {%- endif -%}

							</div>
							<div class="item-col" style="justify-content: flex-end;">
								<div class="box">
									<ul class="list-content fa-ul">
										<li>
											<span>
												<abbr class="referrer" title={{ 'Created by'|trans }}>{{ 'By'|trans }}:</abbr>
												<b>{{ entity.createdBy|chill_entity_render_box({'at_date': entity.date}) }}</b>
											</span>
										</li>
										<li>
											<span>
												<abbr class="referrer" title={{ 'Created for'|trans }}>{{ 'For'|trans }}:</abbr>
												<b>{{ entity.agent|chill_entity_render_box({'at_date': entity.date}) }}</b>

											</span>
										</li>
									</ul>
									<div class="action">
										<ul class="record_actions">
											<li>
												<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_view', { 'id': entity.id } ) }}" class="btn btn-show btn-mini"></a>
											</li>
											<li>
												<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
											</li>
											<li>
												<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
				{% endfor %}
			</div>

			{{ chill_pagination(paginator) }}

			<ul class="record_actions sticky-form-buttons">
				<li>
					<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
						{{ 'Create'|trans }}
					</a>
				</li>
			</ul>
		{% endif %}
    </div>
	{% endblock %}
