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

{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_peering_manager:irrprefixlistconfig_list' %}">IRR Prefix List Configs</a></li>
{% endblock %}


{% block content %}
<div class="row mb-3">
    <div class="col-md-6">
        <div class="card">
            <h5 class="card-header">
                IRR Prefix List Config
            </h5>
            <div class="card-body">
                <table class="table table-hover attr-table">
                    <tr>
                        <td>Prefix List</td>
                        <td>
                            {% if object.prefix_list %}
                                <a href="{{ object.prefix_list.get_absolute_url }}">{{ object.prefix_list }}</a>
                            {% else %}
                                {{ ''|placeholder }}
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>IRR Source</td>
                        <td>
                            {% if object.irr_source %}
                                <a href="{{ object.irr_source.get_absolute_url }}">{{ object.irr_source }}</a>
                            {% else %}
                                {{ ''|placeholder }}
                            {% endif %}
                        </td>
                    </tr>
                    <tr>
                        <td>Source AS-SET</td>
                        <td>{{ object.source_as_set|placeholder }}</td>
                    </tr>
                    <tr>
                        <td>Sync Interval</td>
                        <td>{{ object.sync_interval }} minutes</td>
                    </tr>
                    <tr>
                        <td>IRR Managed</td>
                        <td>{% checkmark object.is_irr_managed %}</td>
                    </tr>
                </table>
            </div>
            {% if object.is_irr_managed %}
            <div class="card-footer">
                <form method="post" action="{% url 'plugins:netbox_peering_manager:irrprefixlistconfig_sync' pk=object.pk %}" style="display: inline;">
                    {% csrf_token %}
                    <button type="submit" class="btn btn-primary btn-sm">
                        <i class="mdi mdi-sync"></i> Sync from IRR
                    </button>
                </form>
            </div>
            {% endif %}
        </div>
        {% include 'inc/panels/custom_fields.html' %}
        {% include 'inc/panels/tags.html' %}
        {% plugin_left_page object %}
    </div>
    <div class="col-md-6">
        {% plugin_right_page object %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}
