{% extends '_base.html' %}
{% load render_table from django_tables2 %}

{% block title %}VLAN {{ vlan.display_name }}{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-9">
        <ol class="breadcrumb">
            <li><a href="{% url 'dcim:site' slug=vlan.site.slug %}">{{ vlan.site }}</a></li>
            <li><a href="{% url 'ipam:vlan_list' %}?site={{ vlan.site.slug }}">VLANs</a></li>
            <li>{{ vlan.name }} ({{ vlan.vid }})</li>
        </ol>
    </div>
    <div class="col-md-3">
    <form action="{% url 'ipam:vlan_list' %}" method="get">
        <div class="input-group">
            <input type="text" name="vid" class="form-control" placeholder="VLAN ID search" />
            <span class="input-group-btn">
                <button type="submit" class="btn btn-primary">
                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                </button>
            </span>
        </div>
    </form>
    </div>
</div>
<div class="pull-right">
    {% if perms.ipam.change_vlan %}
        <a href="{% url 'ipam:vlan_edit' pk=vlan.pk %}" class="btn btn-warning">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
            Edit this VLAN
        </a>
    {% endif %}
    {% if perms.ipam.delete_vlan %}
        <a href="{% url 'ipam:vlan_delete' pk=vlan.pk %}" class="btn btn-danger">
            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
            Delete this VLAN
        </a>
    {% endif %}
</div>
<h1>VLAN {{ vlan.display_name }}</h1>
<div class="row">
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>VLAN</strong>
            </div>
            <table class="table table-hover panel-body">
                <tr>
                    <td>Site</td>
                    <td><a href="{% url 'dcim:site' slug=vlan.site.slug %}">{{ vlan.site }}</a></td>
                </tr>
                <tr>
                    <td>VLAN ID</td>
                    <td>{{ vlan.vid }}</td>
                </tr>
                <tr>
                    <td>Name</td>
                    <td>{{ vlan.name }}</td>
                </tr>
                <tr>
                    <td>Status</td>
                    <td>
                        <span class="label label-{{ vlan.get_status_class }}">{{ vlan.get_status_display }}</span>
                    </td>
                </tr>
                <tr>
                    <td>Role</td>
                    <td>{{ vlan.role }}</td>
                </tr>
                <tr>
                    <td>Created</td>
                    <td>{{ vlan.created }}</td>
                </tr>
                <tr>
                    <td>Last Updated</td>
                    <td>{{ vlan.last_updated }}</td>
                </tr>
		    </table>
        </div>
	</div>
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Prefixes</strong>
            </div>
            {% if prefixes %}
                <table class="table table-hover panel-body">
                    {% for p in prefixes %}
                        <tr>
                            <td>
                                <a href="{% url 'ipam:prefix' pk=p.pk %}">{{ p }}</a>
                            </td>
                            <td>
                                {% if p.site %}
                                    <a href="{% url 'dcim:site' slug=p.site.slug %}">{{ p.site }}</a>
                                {% endif %}
                            </td>
                            <td>{{ p.get_status_display }}</td>
                            <td>{{ p.role }}</td>
                        </tr>
                    {% endfor %}
                </table>
            {% else %}
                <div class="panel-body text-muted">None</div>
            {% endif %}
        </div>
	</div>
</div>
{% endblock %}
