{% load buttons %}
{% load i18n %}

<div class=" show {% if request.GET.tab == 'new' or request.GET.tab is None %}active{% endif %}" id="new-device-list" role="tabpanel" aria-labelledby="new-device-list-tab">
  {# Object table controls #}
  {% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}  
  <form method="post" class="form form-horizontal">
         <!-- sync button -->
        {# Object table controls #}
        <div class="dropdown mb-3">
            <button type="button" class="btn  btn-yellow dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="mdi mdi-refresh"></i>&nbsp;{% trans "Migrate" %}
            </button>
            {% block bulk_buttons %}
            <ul class="dropdown-menu">
              {% bulk_edit_button model query_params=request.GET %}
              <li>
                  <button type="submit" name="_rename" formaction="{% url 'plugins:slurpit_netbox:onboard' %}?migrate=create&return_url={% url 'plugins:slurpit_netbox:slurpitimporteddevice_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="dropdown-item">
                    <i class="mdi mdi-plus" aria-hidden="true"></i> {% trans "Re-Create device" %}
                  </button>
              </li>
              <li>
                  <button type="submit" name="_rename" formaction="{% url 'plugins:slurpit_netbox:onboard' %}?migrate=update&return_url={% url 'plugins:slurpit_netbox:slurpitimporteddevice_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="dropdown-item">
                    <i class="mdi mdi-pencil" aria-hidden="true"></i> {% trans "Update existing device" %}
                  </button>
              </li>
              <li>
                <button type="submit" name="_rename" formaction="{% url 'plugins:slurpit_netbox:onboard' %}?migrate=update_slurpit&return_url={% url 'plugins:slurpit_netbox:slurpitimporteddevice_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="dropdown-item">
                  <i class="mdi mdi-check" aria-hidden="true"></i> {% trans "Only mark as onboarded" %}
                </button>
            </li>
            </ul>
            {% endblock %}
            <button type="submit" name="_rename" formaction="{% url 'plugins:slurpit_netbox:onboard' %}?remove=true&return_url={% url 'plugins:slurpit_netbox:slurpitimporteddevice_list' %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger ms-2 protect-btn" >
              <i class="mdi mdi-close" aria-hidden="true"></i> {% trans "Remove" %}
            </button>
          </div>
      {% csrf_token %}
      {# "Select all" form #}

        <div id="select-all-box" class="d-none card noprint">
          <div class="form col-md-12">
            <div class="card-body">
              <div class="float-end">
                {% if 'bulk_edit' in actions %}
                  {% bulk_edit_button model query_params=request.GET %}
                {% endif %}
                {% if 'bulk_delete' in actions %}
                  {% bulk_delete_button model query_params=request.GET %}
                {% endif %}
              </div>
              <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.rows|length object_type_plural=table.data.verbose_name_plural %}
                    Select <strong>all of the {{ count }} {{ object_type_plural }}</strong>
                  {% endblocktrans %}
                </label>
              </div>
            </div>
          </div>
        </div>


      <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 %}" />

        {# Object table #}

            {% if prerequisite_model %}
              {% include 'inc/missing_prerequisites.html' %}
            {% endif %}
        <span>In green is the incoming change from Slurp'it</span>
        <div class="card">
          <div class="card-body htmx-container" id="object_list">
            {% include 'htmx/table.html' %}
          </div>
        </div>

        
      </div>
    </form>
  </div>