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

{% block title %}Aggregate: {{ aggregate }}{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a href="{% url 'ipam:aggregate_list' %}">Aggregates</a></li>
            <li><a href="{% url 'ipam:aggregate_list' %}?rir={{ aggregate.rir.slug }}">{{ aggregate.rir }}</a></li>
            <li>{{ aggregate }}</li>
        </ol>
    </div>
</div>
<div class="pull-right">
    {% if perms.ipam.change_aggregate %}
        <a href="{% url 'ipam:aggregate_edit' pk=aggregate.pk %}" class="btn btn-warning">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
            Edit this aggregate
        </a>
    {% endif %}
    {% if perms.ipam.delete_aggregate %}
        <a href="{% url 'ipam:aggregate_delete' pk=aggregate.pk %}" class="btn btn-danger">
            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
            Delete this aggregate
        </a>
    {% endif %}
</div>
<h1>{{ aggregate }}</h1>
<div class="row">
	<div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Aggregate</strong>
            </div>
            <table class="table table-hover panel-body">
                <tr>
                    <td>Family</td>
                    <td>{{ aggregate.get_family_display }}</td>
                </tr>
                <tr>
                    <td>RIR</td>
                    <td>
                        <a href="{% url 'ipam:aggregate_list' %}?rir={{ aggregate.rir.slug }}">{{ aggregate.rir }}</a>
                    </td>
                </tr>
                <tr>
                    <td>Date Added</td>
                    <td>
                        {% if aggregate.date_added %}
                            <span>{{ aggregate.date_added }}</span>
                        {% else %}
                            <span class="text-muted">Not defined</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td>
                        {% if aggregate.description  %}
                            <span>{{ aggregate.description }}</span>
                        {% else %}
                            <span class="text-muted">None</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>Created</td>
                    <td>{{ aggregate.created }}</td>
                </tr>
                <tr>
                    <td>Last Updated</td>
                    <td>{{ aggregate.last_updated }}</td>
                </tr>
            </table>
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %}
	</div>
</div>
{% endblock %}
