{% extends "base.html" %}

{% block content %}
<div class="row">
    <h2>Configuration du VPN</h2>
    
    <div class="large-6 columns">
        <div class="panel">
            <h3>Statut</h3>
            <table class="full-width">
                <tr>
                    <td class="center"><span class="label">Identifiant</span></td>
                    <td>{{object.login}}</td>
                </tr>
                <tr>
                    <td class="center" colspan="2">
                        <a class="button" href="{% url 'vpn:generate_password' object.pk %}">Générer un nouveau mot de passe</a>
                    </td>
                </tr>
                {% if object.comment %}<tr>
                    {% if object.comment|length < 24 %}<td class="center"><span class="label">Commentaire</span></td>
                    <td>{% else %}<td colspan="2">{% endif %}{{object.comment}}</td>
                </tr>{% endif %}
                <tr>
                    <td class="center boolviewer" colspan="2">
                        <input type="checkbox" disabled="disabled"{% if object.activated %} checked="checked"{% endif %} />
                        <span>{% if object.activated %}Ce VPN est actif{% else %}Ce VPN est inactif{% endif %}</span>
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <div class="large-6 columns">
        <div class="panel">
            <h3>Adresses IP</h3>
            <table class="full-width">
                <tr>
                    <td class="center"><span class="label">Sous-réseaux</span></td>
                    <td>
                        {% if object.ipv4_endpoint or object.ipv6_endpoint %}<ul>
                            {% for subnet in object.administrative_subscription.ip_subnet.all %}<li>{{ subnet }}</li>{% endfor %}
                        </ul>{% else %}<span class="italic">Aucune adresse</span>{% endif %}
                    </td>
                </tr>
                <tr>
                    <td class="center"><span class="label">Sorties</span></td>
                    <td>
                        {% if object.ipv4_endpoint or object.ipv6_endpoint %}<ul>
                            {% if object.ipv4_endpoint %}<li>{{ object.ipv4_endpoint }}</li>{% endif %}
                            {% if object.ipv6_endpoint %}<li>{{ object.ipv6_endpoint }}</li>{% endif %}
                        </ul>{% else %}<span class="italic">Aucune adresse</span>{% endif %}
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>

{% endblock %}
