{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% block extra_controls %}
    <a href="{% url 'plugins:netbox_fms:spliceplan_editor' pk=object.pk %}" class="btn btn-info">
        <i class="mdi mdi-pencil"></i> {% trans "Visual Editor" %}
    </a>
    <form method="post" action="{% url 'plugins:netbox_fms:spliceplan_import_device' pk=object.pk %}" class="d-inline">
        {% csrf_token %}
        <button type="submit" class="btn btn-warning">
            <i class="mdi mdi-download"></i> {% trans "Import from Device" %}
        </button>
    </form>
    <a href="{% url 'plugins:netbox_fms:spliceplan_apply' pk=object.pk %}" class="btn btn-success">
        <i class="mdi mdi-check-circle"></i> {% trans "Apply" %}
    </a>
    <a href="{% url 'plugins:netbox_fms:spliceplan_export' pk=object.pk %}" class="btn btn-secondary">
        <i class="mdi mdi-export"></i> {% trans "Export Draw.io" %}
    </a>
{% endblock %}

{% block content %}
<div class="row mb-3">
    <div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">{% trans "Splice Plan" %}</h5>
            <table class="table table-hover attr-table">
                <tr>
                    <th scope="row">{% trans "Name" %}</th>
                    <td>{{ object.name }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Closure" %}</th>
                    <td>{{ object.closure|linkify }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Project" %}</th>
                    <td>{% if object.project %}{{ object.project|linkify }}{% else %}&mdash;{% endif %}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Status" %}</th>
                    <td>{{ object.get_status_display }}</td>
                </tr>
                <tr>
                    <th scope="row">{% trans "Diff Stale" %}</th>
                    <td>{{ object.diff_stale|yesno }}</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="col col-md-6">
        {% if object.description %}
        <div class="card">
            <h5 class="card-header">{% trans "Description" %}</h5>
            <div class="card-body">{{ object.description|markdown }}</div>
        </div>
        {% endif %}
    </div>
</div>
<div class="row mb-3">
    <div class="col col-md-12">
        <div class="card">
            <h5 class="card-header">{% trans "Splice Entries" %}</h5>
            <div class="card-body table-responsive">
                {% render_table entries_table %}
            </div>
        </div>
    </div>
</div>
{% plugin_full_width_page object %}
{% endblock %}
