{% extends 'generic/object_list.html' %}
{% load static %}
{% load buttons %}
{% load helpers %}
{% load humanize %}
{% load i18n %}


{% block page-header %}
  <div class="container-fluid mt-2 d-print-none">
    <div class="d-flex justify-content-between">

      {# Title #}
      <div>
        <h1 class="page-title">{% block pagetitle %}{% trans 'Client Credentials' %}{% endblock %}</h1>
      </div>

      {# Controls #}
      <div class="d-print-none">
        {% block controls %}
          <div class="btn-list">
            <a href="{% url 'plugins:netbox_diode_plugin:client_credential_add' %}" type="button" class="btn btn-primary">
              <i class="mdi mdi-plus-thick"></i> {% trans "Add a Credential" %}
            </a>          
          </div>
        {% endblock controls %}
      </div>

    </div>
  </div>
{% endblock %}

{% block title %}{% trans "Client Credentials" %}{% endblock %}

{% block content %}
    {# Object list tab #}
    <div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
        <form method="post" class="form form-horizontal">
            {% csrf_token %}
            {# "Select all" form #}
            {% if table.paginator.num_pages > 1 %}
              <div id="select-all-box" class="d-none card d-print-none">
                <div class="form col-md-12">
                  <div class="card-body d-flex justify-content-between">
                    <div class="form-check">
                      <input type="checkbox" id="select-all" name="_all" class="form-check-input" />
                      <label for="select-all" class="form-check-label">
                        {% blocktrans trimmed with count=table.page.paginator.count object_type_plural=table.data.verbose_name_plural %}
                          Select <strong>all <span class="total-object-count">{{ count }}</span> {{ object_type_plural }}</strong> matching query
                        {% endblocktrans %}
                      </label>
                    </div>
                    <div class="bulk-action-buttons">
                    </div>
                  </div>
                </div>
              </div>
            {% endif %}
    
            <div class="form form-horizontal">
              {% 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 %}" />
    
              {# Objects table #}
              <div class="card">
                <div class="htmx-container table-responsive" id="object_list">
                  {% include 'htmx/table.html' %}
                </div>
              </div>
              {# /Objects table #}
    
            </div>
          </form>    

    </div>
    {# /Object list tab #}

{% endblock content %}

