{% load i18n %}
<div class="container px-md-3 py-3 column-gap-5">
  <div class="tw-text-3xl fw-bold font-monospace tw-w-full mb-3">
    {% spaceless %}
    <div>{% translate 'Import Profiles' %}<span>
      <span class="dropdown" data-bs-toggle="tooltip"
                data-bs-title="{% translate "Add" %}">
        <a class="text-decoration-none tw-text-2xl p-1" role="button"
                data-bs-toggle="dropdown"
                data-bs-title="{% translate "Add" %}" aria-expanded="false">
          <i class="fa-solid fa-circle-plus fa-fw"></i>
        </a>
        <ul class="dropdown-menu">
          <li><a class="dropdown-item"
                 role="button"
                 hx-get="{% url 'import_profiles_add' %}"
                 hx-target="#generic-offcanvas">{% trans 'New' %}</a></li>
          <li><a class="dropdown-item"
                 role="button"
                 hx-get="{% url 'import_presets_list' %}"
                 hx-target="#persistent-generic-offcanvas-left">{% trans 'From preset' %}</a></li>
        </ul>
      </span>
    </span></div>
    {% endspaceless %}
  </div>

  <div class="card">
    <div class="card-body table-responsive">
      {% if profiles %}
      <c-config.search></c-config.search>
      <table class="table table-hover text-nowrap">
        <thead>
          <tr>
            <th scope="col" class="col-auto"></th>
            <th scope="col" class="col">{% translate 'Name' %}</th>
            <th scope="col" class="col">{% translate 'Version' %}</th>
          </tr>
        </thead>
        <tbody>
          {% for profile in profiles %}
          <tr class="profile">
            <td class="col-auto">
              <div class="btn-group" role="group" aria-label="{% translate 'Actions' %}">
                <a class="btn btn-secondary btn-sm"
                      role="button"
                      data-bs-toggle="tooltip"
                      data-bs-title="{% translate "Edit" %}"
                      hx-get="{% url 'import_profile_edit' profile_id=profile.id %}"
                      hx-target="#generic-offcanvas">
                  <i class="fa-solid fa-pencil fa-fw"></i></a>
                  <a class="btn btn-secondary btn-sm text-success"
                        role="button"
                        data-bs-toggle="tooltip"
                        data-bs-title="{% translate "Runs" %}"
                        hx-get="{% url 'import_profile_runs_list' profile_id=profile.id %}"
                        hx-target="#persistent-generic-offcanvas-left">
                    <i class="fa-solid fa-person-running fa-fw"></i></a>
                <a class="btn btn-secondary btn-sm text-primary"
                        role="button"
                        data-bs-toggle="tooltip"
                        data-bs-title="{% translate "Import" %}"
                        hx-get="{% url 'import_run_add' profile_id=profile.id %}"
                        hx-target="#generic-offcanvas">
                    <i class="fa-solid fa-file-import fa-fw"></i></a>
                <a class="btn btn-secondary btn-sm text-danger"
                        role="button"
                        data-bs-toggle="tooltip"
                        data-bs-title="{% translate "Delete" %}"
                        hx-delete="{% url 'import_profile_delete' profile_id=profile.id %}"
                        hx-trigger='confirmed'
                        data-bypass-on-ctrl="true"
                        data-title="{% translate "Are you sure?" %}"
                        data-text="{% translate "You won't be able to revert this!" %}"
                        data-confirm-text="{% translate "Yes, delete it!" %}"
                        _="install prompt_swal"><i class="fa-solid fa-trash fa-fw"></i></a>
              </div>
            </td>
            <td class="col">{{ profile.name }}</td>
            <td class="col">{{ profile.get_version_display }}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <c-msg.empty title="{% translate "No import profiles" %}" remove-padding></c-msg.empty>
      {% endif %}
    </div>
  </div>
</div>
