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

{% block breadcrumbs %}
  {{ block.super }}
  <li class="breadcrumb-item"><a href="{% url 'dcim:powerpanel_list' %}?site_id={{ object.site.pk }}">{{ object.site }}</a></li>
  {% if object.location %}
    <li class="breadcrumb-item">{{ object.location|linkify }}</li>
  {% endif %}
{% endblock %}

{% block content %}
<div class="row">
	<div class="col col-md-6">
        <div class="card">
            <h5 class="card-header">
                Power Panel
            </h5>
            <div class="card-body">
                <table class="table table-hover attr-table">
                    <tr>
                        <th scope="row">Site</th>
                        <td>{{ object.site|linkify }}</td>
                    </tr>
                    <tr>
                        <th scope="row">Location</th>
                        <td>{{ object.location|linkify|placeholder }}</td>
                    </tr>
                </table>
            </div>
        </div>
        {% include 'inc/panels/tags.html' %}
        {% plugin_left_page object %}
    </div>
	<div class="col col-md-6">
        {% include 'inc/panels/custom_fields.html' %}
        {% include 'inc/panels/contacts.html' %}
        {% include 'inc/panels/image_attachments.html' %}
        {% plugin_right_page object %}
    </div>
</div>
<div class="row my-3">
    <div class="col col-md-12">
        <form method="post">
            {% csrf_token %}
            <div class="card">
                <div class="card-body table-responsive">
                    {% render_table powerfeed_table 'inc/table.html' %}
                </div>
                <div class="card-footer noprint">
                    {% if perms.dcim.change_powerfeed %}
                        <button type="submit" name="_edit" formaction="{% url 'dcim:powerfeed_bulk_edit' %}?return_url={% url 'dcim:powerpanel' pk=object.pk %}" class="btn btn-warning btn-sm">
                            <span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
                        </button>
                    {% endif %}
                    {% if perms.dcim.delete_cable %}
                        <button type="submit" name="_disconnect" formaction="{% url 'dcim:powerfeed_bulk_disconnect' %}?return_url={% url 'dcim:powerpanel' pk=object.pk %}" class="btn btn-outline-danger btn-sm">
                            <span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect
                        </button>
                    {% endif %}
                    {% if perms.dcim.delete_powerfeed %}
                        <button type="submit" name="_delete" formaction="{% url 'dcim:powerfeed_bulk_delete' %}?return_url={% url 'dcim:powerpanel' pk=object.pk %}" class="btn btn-danger btn-sm">
                            <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
                        </button>
                    {% endif %}
                    {% if perms.dcim.add_powerfeed %}
                        <div class="float-end">
                            <a href="{% url 'dcim:powerfeed_add' %}?power_panel={{ object.pk }}&return_url={% url 'dcim:powerpanel' pk=object.pk %}" class="btn btn-primary btn-sm">
                                <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Power Feeds
                            </a>
                        </div>
                    {% endif %}
                 </div>
            </div>
        </form>
        {% plugin_full_width_page object %}
    </div>
</div>
{% endblock %}
