{% extends "vault/base.html" %}
{% load i18n static pagination %}

{% block title %}Identity{% endblock %}

{% block css %}
  <link rel="stylesheet" type="text/css" href="{% static 'identity/css/project.css' %}" />
{% endblock %}

{% block content_title %}Identity{% endblock %}

{% block content_breadcrumb %}
<a href="#">Identity</a>
<span>{% trans 'Projects' %}</span>
{% endblock %}

{% block content_top %}
  <a href="{% url "add_project" %}" class="create-project btn btn-primary btn-sm">
    {% trans 'New Project' %}
  </a>
{% endblock %}

{% block content %}
<div class="box-table">
  <table class="items-list table">
    <thead>
      <tr>
        <th>{% trans 'Project' %}</th>
        <th>{% trans 'Project Id' %}</th>
        <th>{% trans 'Created By' %}</th>
        <th>{% trans 'Owner' %}</th>
        <th>{% trans 'Enabled' %}</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      {% for project in projects %}
      <tr>
        <td>{{ project.name }}</td>
        <td>{{ project.id }}</td>
        <td>
          {% if project.created_by %}
          <span class="service-name {{ project.created_by }}">{{ project.created_by }}</span>
          {% endif %}
        </td>
        <td>{{ project.team.name }}</td>
        <td>{{ project.enabled }}</td>
        <td class="text-end">
          <a href="{% url 'edit_project' project=project_name project_id=project.id %}"
             title="Edit" class="edit-item btn btn-sm btn-light">
             <i class="fas fa-edit"></i> {% trans 'edit' %}
          </a>
        </td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
{% pagination projects %}
{% endblock %}

{% block js_bottom %}
{{ block.super }}
<script>
  Base.Paginator.init();
</script>
{% endblock %}
