{% extends "pages/main.html" %}
{% load staticfiles %}
{% block title %} Violations {% endblock %}

{% block container %}

<h2>Monitor violations : {{ monitor.name }}</h2>
<a href="javascript: history.go(-1)">Back</a>

<div class="table-responsive">
    <table class="table table-striped">
        <thead>
          <tr>
            <th>id</th>
            <th>Step</th>
            <th>Time</th>
            <th>Comment</th>
            <th>Verdict</th>
            <th>Remediation Monitor</th>
            <th>Action</th>
          </tr>
        </thead>
        <tbody>
         {% for v in monitor.violations %}
          <tr>
            <td>
                {% if v.vid|length > 10 %}
                    {{ v.vid|slice:":10" }}...
                {% else %}
                    {{ v.vid }}
                {% endif %}
            </td>
            <td>{{ v.step }}</td>
            <td>{{ v.timestamp }}</td>
            <td>{{ v.comment }}</td>
            <td>
                {% if v.verdict|stringformat:"s" == "ViolationStatus.LEGITIMATE" %}
                    <span class="label label-success">LEGITIMATE</span>
                {% elif v.verdict|stringformat:"s" == "ViolationStatus.ILLEGITIMATE" %}
                    <span class="label label-danger">ILLEGITIMATE</span>
                {% elif v.verdict|stringformat:"s" == "ViolationStatus.UNREAD" %}
                    <span class="label label-default">UNREAD</span>
                {% else %}
                    <span class="label label-success"> {{ v.verdict }}</span>
                {% endif %}
            </td>
           <td>
               {% if v.remediation_mon != None %}
                    {% if v.remediation_mon.mon.last|stringformat:"s" == "?" %}
                    <span class="label label-default b3res">
                    {% elif v.remediation_mon.mon.last|stringformat:"s" == "⊥" %}
                        <span class="label label-danger b3res">
                    {% else %}
                        <span class="label label-success b3res">
                    {% endif %}
                    {{ v.remediation_mon.mon.last }}</span>
               {% endif %}
            </td>
            <td>
                <a class="btn btn-warning" type="button" href="{% url 'monitor_violation_audit' monitor.id v.vid %}">Audit</a>
            </td>
          </tr>
         {% endfor %}
        </tbody>
    </table>
</div>

{% endblock %}

