{% extends 'generic/object.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}
{% load tabs %}
{% load i18n %}
{% load perms %}
{% load render_table from django_tables2 %}
{% block content %}
    <div class="row mb-3">
        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">Service Path</h5>
                <table class="table table-hover attr-table">
                    <tr>
                        <th scope="row">Name</th>
                        <td>{{ object.name }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Kind</th>
                        <td>
                            <span class="badge text-bg-{{ object.get_kind_color }}">{{ object.get_kind_display }}</span>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">Status</th>
                        <td>
                            <span class="badge text-bg-{{ object.get_status_color }}">{{ object.get_status_display }}</span>
                        </td>
                    </tr>
                </table>
            </div>
            {% include 'inc/panels/custom_fields.html' %}
            {% plugin_left_page object %}
        </div>
        <div class="col col-md-6">
            {% include 'inc/panels/tags.html' %}
            {% include 'inc/panels/comments.html' %}
            {% plugin_right_page object %}
        </div>
    </div>
    <div class="row">
        <div class="col col-12">
            <div class="card">
                <h5 class="card-header">
                    {% trans "Segments" %}
                    <div class="card-actions">
                        {% if perms.cesnet_service_path_plugin.add_servicepathsegmentmapping %}
                            <a href="{% url 'plugins:cesnet_service_path_plugin:servicepathsegmentmapping_add' %}?service_path={{ object.pk }}&return_url={{ request.path }}"
                               class="btn btn-ghost-primary btn-sm">
                                <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a Segment" %}
                            </a>
                        {% endif %}
                    </div>
                </h5>
                {% htmx_table 'plugins:cesnet_service_path_plugin:servicepathsegmentmapping_list' service_path_id=object.pk %}
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col col-md-12">{% plugin_full_width_page object %}</div>
    </div>
{% endblock content %}
