<div class="task-show">

	<h1>{{ 'Task'|trans }}</h1>

	<h2>{{ task.title }}
		{% for place in workflow_marked_places(task) %}
			<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
		{% endfor %}
	</h2>

	<dl class="chill_view_data">

		<dt class="inline">{{ 'Description'|trans }}</dt>
		<dd>
			{% if task.description is empty %}
				<span class="chill-no-data-statement">{{"No description"|trans}}</span>
			{% else %}
				<blockquote class="chill-user-quote">
					{{ task.description|chill_markdown_to_html }}
				</blockquote>
			{% endif %}
		</dd>

		<dt class="inline">{{ 'Assignee'|trans }}</dt>
		<dd>
			{% if task.assignee is null %}
				<span class="chill-no-data-statement">{{"No one assignee"|trans}}</span>
			{% else %}
				{{ task.assignee }}
			{% endif %}
		</dd>

		{% if task.scope is not null %}
			<dt class="inline">{{ 'Scope'|trans }}</dt>
			<dd>
				<span class="scope">{{ task.scope.name|localize_translatable_string }}</span>
			</dd>
		{% endif %}

		<h3>{{"Dates"|trans}}</h3>
		{% if task.startDate is null and task.endDate is null and task.warningDate is null %}
			<dt></dt>
			<dd>
				<span class="chill-no-data-statement">{{"No dates specified"|trans}}</span>
			</dd>
		</dt>
	{% else %}
		{% if task.startDate is not null %}
			<dt class="inline">{{ 'Start'|trans }}</dt>
			<dd>{{ task.startDate|format_date('long') }}</dd>
		{% endif %}

		{% if task.endDate is not null %}
			<dt class="inline">{{ 'End'|trans }}</dt>
			<dd>{{ task.endDate|format_date('long') }}</dd>
		{% endif %}

		{% if task.warningDate is not null %}
			<dt class="inline">{{ 'Warning'|trans }}</dt>
			<dd>{{ task.warningDate|format_date('long') }}</dd>
		{% endif %}

	{% endif %}
</dl>

{% if timeline is not null %}
	<h3>{{"Timeline"|trans}}</h3>
	{{ timeline|raw }}
{% endif %}

<ul class="record_actions sticky-form-buttons">
	<li class="cancel">
		<a class="btn btn-cancel" href={% if task.person is not null %} "{{ chill_return_path_or('chill_task_singletask_list', { 'person_id': task.person.id } ) }}" {% else %} "{{ chill_return_path_or('chill_task_singletask_by-course_list', {'id': task.course.id}) }}" {% endif %}>
			{{'Cancel'|trans}}
		</a>
	</li>

	{% if workflow_transitions(task)|length > 0 %}
		<li>
			<div class="btn-group">
				<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button" id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
					{{'Change task status'|trans}}
				</a>
				<ul class="dropdown-menu" aria-labelledby="taskExchange">
					{% for transition in workflow_transitions(task) %}
						<li>
							<a class="dropdown-item" href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
								{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
							</a>
						</li>
					{% endfor %}
				</ul>
			</div>
		</li>
	{% endif %}

    {% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
        <li>
            <a href="{{ chill_path_forward_return_path('chill_task_single_task_delete', { 'id': task.id } ) }}" class="btn btn-delete">
                {{ 'Delete'|trans }}
            </a>
        </li>
    {% endif %}

	{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
		<li>
			<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_task_single_task_edit', { 'id': task.id }) }}">
				{{ 'Edit the task'|trans }}
			</a>
		</li>
	{% endif %}

</ul></div>
