{% extends "base.html" %}

{% block content %}
<div class="row">
    <h2>Configuration du VPN</h2>
    
    <div class="large-6 columns">
        <div class="panel">
            <h3>Statut</h3>
            <form action="{{ object.get_absolute_url }}" method="post">{% csrf_token %}
            <table class="full-width">
                <tr>
                    <td class="center"><span class="label">Identifiant</span></td>
                    <td>{{object.login}}</td>
                </tr>{% block password %}
                <tr>
                    <td class="center" colspan="2">
                        <a class="button radius tiny" id="passgen" href="{% url 'vpn:generate_password' object.pk %}"><i class="fa fa-refresh"></i>
 Générer un nouveau mot de passe</a>
                    </td>
                </tr>
                {% endblock %}<tr class="flatfield">
                    <td class="center">{{ form.comment.label_tag }}</td>
                    <td>{{ form.comment }}</td>
                </tr>
                <tr>
                    <td class="center boolviewer" colspan="2">
                        <input type="checkbox" disabled="disabled"{% if object.activated %} checked="checked"{% endif %} />
                        <span>Ce VPN est {{ object.activated|yesno:"activé,désactivé" }}</span>
                    </td>
                </tr>
                <tr><td class="center" colspan="2"><input type="submit" value="Valider" /></td></tr>
            </table>
        </div>
    </div>

    <div class="large-6 columns">
        <div class="panel">
            <h3>Adresses IP</h3>
            <table class="full-width">
              {{ form.non_field_errors }}
                <tr class="flatfield">
                    <td class="center">{{ form.ipv4_endpoint.label_tag }}</td>
                    <td>{{ form.ipv4_endpoint }} {{ form.ipv4_endpoint.errors }}</td>
                </tr>
                <tr class="flatfield">
                    <td class="center">{{ form.ipv6_endpoint.label_tag }}</td>
                    <td>{{ form.ipv6_endpoint }} {{ form.ipv6_endpoint.errors }}</td>
                </tr>
                <tr>
                    <td class="center"><span class="label">Sous-réseaux</span></td>
                    <td>
                        {% for subnet in object.administrative_subscription.ip_subnet.all %}{{ subnet }}<br/>{% endfor %}
                    </td>
                </tr>
              <tr><td class="center" colspan="2"><input type="submit" value="Valider" /></td></tr>
            </table>
        </div>
    </div>
    </form>
</div>

<div class="row">
    <h3 class="graphtitle">Graphe de trafic sur <span id="trafic_zoom">24 heures</span> :</h3>
    <img id="trafic_graph" src="{% url 'vpn:get_graph' vpn_id=object.pk %}" alt="Graphe de trafic {{ object.login }}" />
</div>

{% endblock %}
