{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}

{% block header %}
    <div class="row noprint">
        <div class="col-sm-8 col-md-9">
            <ol class="breadcrumb">
                <li><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li>
                <li>{{ vrf }}</li>
            </ol>
        </div>
        <div class="col-sm-4 col-md-3">
            <form action="{% url 'ipam:vrf_list' %}" method="get">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="Search VRFs" />
                    <span class="input-group-btn">
                        <button type="submit" class="btn btn-primary">
                            <span class="fa fa-search" aria-hidden="true"></span>
                        </button>
                    </span>
                </div>
            </form>
        </div>
    </div>
    <div class="pull-right noprint">
        {% plugin_buttons vrf %}
        {% if perms.ipam.add_vrf %}
            {% clone_button vrf %}
        {% endif %}
        {% if perms.ipam.change_vrf %}
            {% edit_button vrf %}
        {% endif %}
        {% if perms.ipam.delete_vrf %}
            {% delete_button vrf %}
        {% endif %}
    </div>
    <h1>{% block title %}VRF {{ vrf }}{% endblock %}</h1>
    {% include 'inc/created_updated.html' with obj=vrf %}
    <div class="pull-right noprint">
        {% custom_links vrf %}
    </div>
    <ul class="nav nav-tabs">
        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
            <a href="{{ vrf.get_absolute_url }}">VRF</a>
        </li>
        {% if perms.extras.view_objectchange %}
            <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
                <a href="{% url 'ipam:vrf_changelog' pk=vrf.pk %}">Change Log</a>
            </li>
        {% endif %}
    </ul>
{% endblock %}

{% block content %}
<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 attr-table">
                <tr>
                    <td>Route Distinguisher</td>
                    <td>{{ vrf.rd }}</td>
                </tr>
                <tr>
                    <td>Tenant</td>
                    <td>
                        {% if vrf.tenant %}
                            <a href="{{ vrf.tenant.get_absolute_url }}">{{ vrf.tenant }}</a>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Unique IP Space</td>
                    <td>
                        {% if vrf.enforce_unique %}
                            <i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
                        {% else %}
                            <i class="glyphicon glyphicon-remove text-danger" title="No"></i>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>{{ vrf.description|placeholder }}</td>
                </tr>
                <tr>
                    <td>Prefixes</td>
                    <td>
                        <a href="{% url 'ipam:prefix_list' %}?vrf_id={{ vrf.pk }}">{{ prefix_count }}</a>
                    </td>
                </tr>
		    </table>
        </div>
        {% include 'extras/inc/tags_panel.html' with tags=vrf.tags.all url='ipam:vrf_list' %}
        {% plugin_left_page vrf %}
	</div>
	<div class="col-md-6">
        {% include 'inc/custom_fields_panel.html' with obj=vrf %}
        {% plugin_right_page vrf %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page vrf %}
    </div>
</div>
{% endblock %}
