{% import '_includes/macros/status.html.twig' as statusTools %}
{% import '_includes/macros/date.html.twig' as dateTools %}
{% set hideActor=hideActor|default(false) %}
{% set hideActivity=hideActivity|default(false) %}

<table>
	<thead>
		<tr>
			{% if not hideActivity %}
			<td class="text-right">Activité</td>
			{% endif %}
			<td>Nom</td>
			<td>Status</td>
			{% if not hideActor %}
			<td>Acteur</td>
			{% endif %}
			<td class="text-center">Planifié</td>
			<td class="text-center">Executé</td>
			<td class="text-center"><span class="d-none">Actions</span></td>
		</tr>
	</thead>
	<tbody>
		{% for task in tasks %}
		<tr>
			{% if not hideActivity %}
			<td class="text-right">{% if task.activity is not null %} <a
				href="{{ url('activity_activity', {id: task.activity.id}, false) }}"
				title="Editer l'activité">{{ task.activity.name }}</a> {% endif %}</td>
			{% endif %}
			<td><a href="{{ url('task_task', {id: task.id}, false) }}" title="editer">{{ task.name }}</a></td>
			<td>{{ statusTools.statusName(task.status) }}</td>
			{% if not hideActor %}
			<td>{% if task.actor is not null %}<a
				href="{{ url('actor_actor', {id: task.actor.id}, false) }}"
				title="Editer l'acteur" title="Editer l'acteur">{{ task.actor.displayName }}</a>
				{% endif %}</td>
			{% endif %}
			<td class="text-center">{% if task.planifiedDate is not null %}
				{{ dateTools.euro(task.planifiedDate) }} {% endif %}</td>
			<td class="text-center">{% if task.executionDate is not null %}
				{{ dateTools.euro(task.executionDate) }} {% endif %}</td>
			<td class="text-center">{% if taskDeleteForm is defined %} {% include '_includes/html/genericForm.html.twig' with {'form': taskDeleteForm, 'data': {task: task, variant: 'icon'}} only %}
				{% endif %}</td>
		</tr>
		{% endfor %}
	</tbody>
</table>