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

{% block extra_controls %}
<div class="btn-group" role="group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
        <i class="mdi mdi-cloud-sync"></i> ARIN Actions
    </button>
    <ul class="dropdown-menu">
        <li>
            <a class="dropdown-item" href="{% url 'plugins:netbox_rir_manager:rirnetwork_reassign' object.pk %}">
                <i class="mdi mdi-swap-horizontal"></i> Reassign
            </a>
        </li>
        <li>
            <a class="dropdown-item" href="{% url 'plugins:netbox_rir_manager:rirnetwork_reallocate' object.pk %}">
                <i class="mdi mdi-arrow-right-bold"></i> Reallocate
            </a>
        </li>
        <li><hr class="dropdown-divider"></li>
        <li>
            <a class="dropdown-item text-warning" href="{% url 'plugins:netbox_rir_manager:rirnetwork_remove' object.pk %}">
                <i class="mdi mdi-minus-circle"></i> Remove
            </a>
        </li>
        <li>
            <a class="dropdown-item text-danger" href="{% url 'plugins:netbox_rir_manager:rirnetwork_delete_arin' object.pk %}">
                <i class="mdi mdi-delete"></i> Delete at ARIN
            </a>
        </li>
    </ul>
</div>
{% endblock extra_controls %}

{% block content %}
<div class="row mb-3">
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">Network</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">RIR Config</th>
                    <td>{{ object.rir_config|linkify }}</td>
                </tr>
                <tr>
                    <th scope="row">Handle</th>
                    <td>{{ object.handle }}</td>
                </tr>
                <tr>
                    <th scope="row">Net Name</th>
                    <td>{{ object.net_name }}</td>
                </tr>
                <tr>
                    <th scope="row">Net Type</th>
                    <td>{{ object.net_type|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">Organization</th>
                    <td>{{ object.organization|linkify|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">Auto Reassign</th>
                    <td>
                        {% if object.auto_reassign %}
                            <span class="badge text-bg-success">Enabled</span>
                        {% else %}
                            <span class="badge text-bg-secondary">Disabled</span>
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <th scope="row">Last Synced</th>
                    <td>{{ object.last_synced|placeholder }}</td>
                </tr>
            </table>
        </div>
        <div class="card">
            <h5 class="card-header">NetBox Links</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">Aggregate</th>
                    <td>{{ object.aggregate|linkify|placeholder }}</td>
                </tr>
                <tr>
                    <th scope="row">Prefix</th>
                    <td>{{ object.prefix|linkify|placeholder }}</td>
                </tr>
            </table>
        </div>
        {% plugin_left_page object %}
    </div>
    <div class="col col-md-6">
        {% include 'inc/panels/tags.html' %}
        {% plugin_right_page object %}
    </div>
</div>
<div class="row">
    <div class="col col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock content %}
