{% extends "base.j2" %}

{% block content %}
{% include 'routing_header.j2' %}

<div class="mt-2 text-secondary">{{ "routing_iptables_note"|lang }}</div>

{% for set, ips in sets.items() %}
    <h6 class="text-primary mt-4">{{ set }}</h6>

    {% if ips %}
        {% for ip in ips %}
            <div>{{ ip }} (<a href="routing_rules.cgi?action=del&amp;set={{ set }}&amp;ip={{ ip }}" onclick="return confirm('{{ 'routing_deleting_confirmation'|lang|format(ip, set) }}')">{{ "routing_del"|lang }}</a>)</div>
        {% endfor %}
    {% else %}
        <span class="text-secondary">{{ "routing_no_records"|lang }}</span>
    {% endif %}

    <div style="max-width: 300px">
        <form method="get" action="routing_rules.cgi">
            <input type="hidden" name="action" value="add">
            <input type="hidden" name="set" value="{{ set }}">
            <div class="input-group mt-2">
                <input type="text" name="ip" placeholder="x.x.x.x/y" class="form-control">
                <button type="submit" class="btn btn-outline-primary">{{ "routing_add"|lang }}</button>
            </div>
        </form>
    </div>
{% endfor %}
{% endblock %}