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

{% block title %}VRF {{ vrf }}{% endblock %}

{% block content %}
<div class="pull-right">
    {% if perms.ipam.change_vrf %}
        <a href="{% url 'ipam:vrf_edit' pk=vrf.pk %}" class="btn btn-warning">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
            Edit this VRF
        </a>
    {% endif %}
    {% if perms.ipam.delete_vrf %}
        <a href="{% url 'ipam:vrf_delete' pk=vrf.pk %}" class="btn btn-danger">
            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
            Delete this VRF
        </a>
    {% endif %}
</div>
<h1>{{ vrf }}</h1>
<div class="row">
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>VRF</strong>
            </div>
            <table class="table table-hover panel-body">
                <tr>
                    <td>Route Distinguisher</td>
                    <td>{{ vrf.rd }}</td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>
                        {% if vrf.description  %}
                            <span>{{ vrf.description }}</span>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Created</td>
                    <td>{{ vrf.created }}</td>
                </tr>
                <tr>
                    <td>Last Updated</td>
                    <td>{{ vrf.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.status }}</td>
                            <td>{{ p.role }}</td>
                        </tr>
                    {% endfor %}
                </table>
            {% else %}
                <div class="panel-body text-muted">None</div>
            {% endif %}
        </div>
	</div>
</div>
{% endblock %}
