{% load rules %}
{% load projectroles_tags %}
{% load projectroles_common_tags %}

{% has_perm 'projectroles.view_project' request.user p as can_view_project %}

<tr class="sodar-pr-project-list-item" id="sodar-pr-project-search-item-{{ p.sodar_uuid }}">
  <td>
    <div class="sodar-overflow-container {% if not can_view_project %}text-muted{% endif %}">
      {% if can_view_project %}
        <a href="{% url 'projectroles:detail' project=p.sodar_uuid %}"
           class="sodar-pr-project-search-link">
      {% endif %}
        {% get_project_title_html p as project_title %}
        {% autoescape off %}
          {% highlight_search_term project_title search_terms %}
          {% get_remote_icon p request %}
        {% endautoescape %}
        {% if not can_view_project and request.user.is_authenticated and p.parent %}
          <a href="{% url 'projectroles:roles' project=p.parent.sodar_uuid %}"
             class="sodar-pr-project-findable"
             title="Findable project: Request access from category owner or delegate"
             data-toggle="tooltip">
            <i class="iconify ml-1" data-icon="mdi:account-supervisor"></i>
          </a>
        {% endif %}
      {% if can_view_project %}
        </a>
      {% endif %}
    </div>
  </td>
  {% if p.description %}
    <td>
      <div class="sodar-overflow-container {% if not can_view_project %}text-muted{% endif %}">
        {% autoescape off %}
          {% highlight_search_term p.description search_terms %}
        {% endautoescape %}
      </div>
    </td>
  {% else %}
    <td class="text-muted">N/A</td>
  {% endif %}
</tr>
