{% extends 'netbox_storage/partition/base.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% load perms %}

{% block content %}
    {% include 'inc/table_controls_htmx.html' with table_modal="PhysicalVolumeTable_config" %}

    <form method="post">
        {% csrf_token %}
        <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />

        <div class="card">
            <div class="card-body" id="object_list">
                {% include 'htmx/table.html' %}
            </div>
        </div>

        {% with bulk_edit_url="plugins:netbox_storage:physicalvolume_bulk_edit" bulk_delete_url="plugins:netbox_storage:physicalvolume_bulk_delete" %}
            <div class="noprint bulk-buttons">
                <div class="bulk-button-group">
                    {% block bulk_buttons %} {% endblock %}
                    <button type="submit" name="_edit" formaction="{% url bulk_edit_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-warning btn-sm">
                        <i class="mdi mdi-pencil" aria-hidden="true"></i> Edit Selected
                    </button>
                    <button type="submit" name="_delete" formaction="{% url bulk_delete_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger btn-sm">
                        <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete Selected
                    </button>
                </div>
            </div>
        {% endwith %}
    </form>

{% endblock %}

{% block modals %}
    {{ block.super }}
    {% table_config_form table %}
{% endblock modals %}