{% load i18n %}
{% load taskfilters %}
<div class="oh-btn-group">
  {% if perms.project.change_project or request.user|is_project_manager:instance %}
    <a
    class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
    data-toggle="oh-modal-toggle"
    data-target="#genericModal"
    hx-get="{% url 'update-project' instance.id %}"
    hx-target="#genericModalBody"
    onclick="event.stopPropagation();"
    >
      <ion-icon
        name="create-outline"
        role="img"
        class="md hydrated"
        style="color: blue"
        aria-label="create outline"
      ></ion-icon>
    </a>
  {% else %}
    <button
    class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
    disabled
    >
    <ion-icon
        name="create-outline"
        role="img"
        class="md hydrated"
        style="color: blue"
        aria-label="create outline"
      ></ion-icon>
    </button>
  {% endif %}
  {% if perms.project.delete_project or request.user|is_project_manager:instance %}
    {% if instance.is_active %}
      <a
        class="oh-btn oh-btn--light-bkg w-100"
        href="{{instance.get_archive_url}}"
        onclick="return confirm('Do you want to {{instance.archive_status}} this project?')"
        title="{% trans 'Archive' %}"
      >
        <ion-icon name="archive"></ion-icon>
      </a>
    {% else %}
      <a
        class="oh-btn oh-btn--light-bkg w-100"
        href="{{instance.get_archive_url}}"
        onclick="return confirm('Do you want to {{instance.archive_status}} this project?')"
        title="{% trans 'Un-Archive' %}"
      >
        <ion-icon name="archive"></ion-icon>
      </a>
    {% endif %}
  {% endif %}
  {% if perms.project.delete_project %}
    <a
      class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
      href="{% url 'delete-project' instance.id %}?view=list"
      onclick="event.preventDefault();event.stopPropagation(); confirm(`{% trans 'Do you want to delete this project?' %}`)"
    >
      <ion-icon
        name="trash-outline"
        role="img"
        class="md hydrated"
        aria-label="trash outline"
      ></ion-icon>
    </a>
  {% endif %}
</div>
