{% load humanize %}
<h2>{{ task.tool.name }} task</h2>
Created by {{ task.creator }} on {{ task.creation_time }} ({{ task.creation_time|naturaltime }}).
<br>
Urgency: {{ task.get_urgency_display|lower }}
<br>
{% if task.force_shutdown %}
    <span class="danger-highlight glyphicon glyphicon-fire"></span> This task forced the tool to remain shut down.
    <br>
{% endif %}
{% if task.safety_hazard %}
    <span class="danger-highlight glyphicon glyphicon-fire"></span> This task was considered a safety hazard to the {{ facility_name }}.
    <br>
{% endif %}
{% if task.problem_category %}
    Problem category: {{ task.problem_category|lower }}
    <br>
{% endif %}
<p>
    <h4>Problem description</h4>
    {{ task.problem_description|linebreaksbr }}
    <p>
        {% if task.task_images %}
            <div>
                images:
                <ul>
                    {% for image in task.task_images %}
                        <li>
                            <a href="{{ image.image.url }}" target="_blank" style="margin-right: 5px">{{ image.filename }}</a>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
        {% if task.progress_description %}
            <p>
                <h4>Progress</h4>
                {{ task.progress_description|linebreaksbr }}
                <p>
                {% endif %}
                {% if task.cancelled %}
                    <p>
                        <h4 class="primary-highlight">Cancelled on {{ task.resolution_time }}</h4>
                        <p>
                        {% endif %}
                        {% if task.resolved %}
                            <h4 class="success-highlight">Resolved by {{ task.resolver }} on {{ task.resolution_time }}</h4>
                            {% if task.resolution_category %}
                                Resolution category: {{ task.resolution_category|lower }}
                                <br>
                            {% endif %}
                            {% if task.resolution_description %}{{ task.resolution_description|linebreaksbr }}{% endif %}
                        {% endif %}
