{% import "../macros/staff-nav.html" as staff_nav %}

{% extends "base.html" %}

{% block title %}Bany{% endblock %}

{% block content %}
<h1 class="title">Bany</h1>
{% call staff_nav::staff_nav() %}
<hr>
<h2>Bany</h2>
<form method="post" action="/staff/actions/remove-bans">
    <div class="table-wrap">
        <table class="data-table center">
            <tr>
                <th></th>
                <th>IP</th>
                <th>Nástěnka</th>
                <th>Důvod</th>
                <th>Udělil</th>
                <th>Odvolatelný</th>
                <th>Odvolání</th>
                <th>Udělěn</th>
                <th>Vyprší</th>
            </tr>
            {% for ban in bans %}
                <tr>
                    <td><input name="bans[]" type="checkbox" value="{{ ban.id }}"></td>
                    <td title="{{ ban.ip_range }}">
                        {% if ban.ip_range.network() == ban.ip_range.broadcast() %}
                            {{ ban.ip_range.ip() }}
                        {% else %}
                            {{ ban.ip_range.network() }}-{{ ban.ip_range.broadcast() }}
                        {% endif %}
                    </td>
                    <td>{% if let Some(board) = ban.board %}/{{ board }}/{% else %}<i>Všechny</i>{% endif %}</td>
                    <td><div class="post-content">{{ ban.reason }}</div></td>
                    <td>{{ ban.issued_by }}</td>
                    <td>{% if ban.appealable %}Ano{% else %}Ne{% endif %}</td>
                    <td>{% if let Some(appeal) = ban.appeal %}<div class="post-content">{{ appeal }}</div>{% else %}-{% endif %}</td>
                    <td><time datetime="{{ ban.created }}">{{ ban.created|czech_datetime }}</time></td>
                    {% if let Some(expires) = ban.expires %}
                        <td><time datetime="{{ expires }}">{{ expires|czech_datetime }}</time></td>
                    {% else %}
                        <td>Nikdy</td>
                    {% endif %}
                </tr>
            {% endfor %}
        </table>
    </div>

    <input class="button" type="submit" value="Odstranit vybrané">
</form>
{% endblock %}