{% extends 'safety/safety_base.html' %}
{% load custom_tags_and_filters %}
{% block title %}Safety issues{% endblock %}
{% block safety_title %}Resolved safety issues{% endblock %}
{% block tab_content %}
    <p>This page lists previously reported and resolved safety issues.</p>
    <div class="text-right" style="margin-bottom: 15px">
        {% button type="info" url="safety_issues" value="Current safety issues"  icon="glyphicon-list" %}
    </div>
    {% for ticket in tickets %}
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <h4>Concern</h4>
                    {{ ticket.concern|linebreaksbr }}
                </div>
                <div class="form-group">
                    {% if not ticket.visible %}
                        <span class="glyphicon glyphicon-eye-close"></span> This issue is hidden from users
                        <br>
                    {% endif %}
                    {% if ticket.location %}
                        Location: {{ ticket.location }}
                        <br>
                    {% endif %}
                    {% if ticket.reporter %}
                        Reported on {{ ticket.creation_time }}
                        {% if user.is_staff %}by {{ ticket.reporter }}{% endif %}
                        <br>
                    {% else %}
                        Reported anonymously on {{ ticket.creation_time }}
                        <br>
                    {% endif %}
                    Resolved on {{ ticket.resolution_time }} by {{ ticket.resolver }}
                </div>
                {% if ticket.progress %}
                    <div class="form-group">
                        <h4>Progress</h4>
                        {{ ticket.progress|linebreaksbr }}
                    </div>
                {% endif %}
                <div class="form-group">
                    {% if ticket.resolution %}
                        <h4>Resolution</h4>
                        <p>{{ ticket.resolution|linebreaksbr }}</p>
                    {% else %}
                        <h4>This problem was resolved, but no resolution information was provided.</h4>
                    {% endif %}
                </div>
            </div>
        </div>
    {% empty %}
        <strong>There are no past issues.</strong>
    {% endfor %}
{% endblock %}
