{% extends '_base.html' %}

{% block content %}
<div class="row">
    <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">
    {% if perms.ipam.change_vrf %}
        <a href="{% url 'ipam:vrf_edit' pk=vrf.pk %}" class="btn btn-warning">
            <span class="fa fa-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="fa fa-trash" aria-hidden="true"></span>
            Delete this VRF
        </a>
    {% endif %}
</div>
<h1>{% block title %}VRF {{ vrf }}{% endblock %}</h1>
{% include 'inc/created_updated.html' with obj=vrf %}
<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>
                        {% if vrf.description %}
                            <span>{{ vrf.description }}</span>
                        {% else %}
                            <span class="text-muted">N/A</span>
                        {% endif %}
                    </td>
                </tr>
		    </table>
        </div>
        {% with vrf.get_custom_fields as custom_fields %}
            {% include 'inc/custom_fields_panel.html' %}
        {% endwith %}
	</div>
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Prefixes</strong>
            </div>
            {% include 'responsive_table.html' with table=prefix_table %}
        </div>
	</div>
</div>
{% endblock %}
