{% extends 'generic/object.html' %}
{% load buttons %}
{% load helpers %}
{% load plugins %}

{% block title %}VRF {{ object }}{% endblock %}

{% block breadcrumbs %}
  <li class="breadcrumb-item"><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li>
  <li class="breadcrumb-item">{{ object }}</li>
{% endblock %}

{% block content %}
<div class="row">
	<div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">
                VRF
            </h5>
            <div class="card-body">
                <table class="table table-hover attr-table">
                    <tr>
                        <td colspan="2">
                        {% if object.enforce_unique %}
                            <span class="badge bg-info">Unique IP Space</span>
                        {% else %}
                            <span class="badge bg-warning text-body">Non-Unique IP Space</span>
                        {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">Route Distinguisher</th>
                        <td><code>{{ object.rd }}</code></td>
                    </tr>
                    <tr>
                        <th scope="row">Tenant</th>
                        <td>
                            {% if object.tenant %}
                                <a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a>
                            {% else %}
                                <span class="text-muted">None</span>
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">Description</th>
                        <td>{{ object.description|placeholder }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Prefixes</th>
                        <td>
                            <a href="{% url 'ipam:prefix_list' %}?vrf_id={{ object.pk }}">{{ prefix_count }}</a>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">IP Addresses</th>
                        <td>
                            <a href="{% url 'ipam:ipaddress_list' %}?vrf_id={{ object.pk }}">{{ ipaddress_count }}</a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        {% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='ipam:vrf_list' %}
        {% include 'inc/custom_fields_panel.html' %}
        {% plugin_left_page object %}
	</div>
	<div class="col col-md-6">
        {% include 'inc/panel_table.html' with table=import_targets_table heading="Import Route Targets" %}
        {% include 'inc/panel_table.html' with table=export_targets_table heading="Export Route Targets" %}
        {% plugin_right_page object %}
    </div>
</div>
<div class="row">
    <div class="col col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}
