{% extends "network/base.html" %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}

{% block title-page %}{% trans "Index" %}{% endblock %}

{% block content %}

<div class="page-header">
    <h1>{% trans "Dashboard" %}</h1>
</div>

{% include "network/dashboard.html" %}

<div class="page-header">
    <h1>{% trans "Latest modifications" %}</h1>
</div>

<table class="table table-striped table-bordered">
    <tr>
        <th>{% trans "Action" %}</th>
        <th>{% trans "Model" %}</th>
        <th>{% trans "Name" %}</th>
        <th>{% trans "Time elapsed" %}</th>
    </tr>
    {% for l in latest %}
    <tr>
        <td>{% if l.modified_at == l.created_at %}{% trans "created" %}{% else %}{% trans "modified" %}{% endif %}</td>
        <td>{{ l.class_name }}</td>
        <td><a href="{{ l.link }}">{{ l.name }}</a></td>
        <td>{{ l.modified_at|timesince }}</td>
    </tr>
    {% endfor %}
</table>


<div class="page-header">
    <h1>{% trans "Latest blacklists" %}</h1>
</div>

<table class="table table-striped table-bordered">
    <tr>
        <th>{% trans "IP" %}</th>
        <th>{% trans "Reason" %}</th>
        <th>{% trans "Type" %}</th>
        <th>{% trans "Time elapsed" %}</th>
    </tr>
    {% for b in latest_blacklists %}
    <tr>
        <td><a href="{{ b.get_absolute_url }}">{{ b.ipv4 }}</a></td>
        <td>{{ b.reason }}</td>
        <td>{{ b.type }}</td>
        <td>{{ b.modified_at|timesince }}</td>
    </tr>
    {% endfor %}
</table>
{% endblock %}
