{% extends 'account/base.html' %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% load i18n %}

{% block title %}{% trans "User Profile" %}{% endblock %}

{% block content %}
  <div class="row mb-3">
    <div class="col-md-6">
      <div class="card">
        <h2 class="card-header">{% trans "Account Details" %}</h2>
        <table class="table table-hover attr-table">
          <tr>
            <th scope="row">{% trans "Username" %}</th>
            <td>{{ request.user.username }}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Full Name" %}</th>
            <td>
              {% if request.user.first_name or request.user.last_name %}
                {{ request.user.first_name }} {{ request.user.last_name }}
              {% else %}
                {{ ''|placeholder }}
              {% endif %}
            </td>
          </tr>
          <tr>
            <th scope="row">{% trans "Email" %}</th>
            <td>{{ request.user.email|placeholder }}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Account Created" %}</th>
            <td>{{ request.user.date_joined|isodate }}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Last Login" %}</th>
            <td>{{ request.user.last_login|isodatetime:"minutes"|placeholder }}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Superuser" %}</th>
            <td>{% checkmark request.user.is_superuser %}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Staff" %}</th>
            <td>{% checkmark request.user.is_staff %}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="col-md-6">
      <div class="card">
        <h2 class="card-header">{% trans "Assigned Groups" %}</h2>
        <ul class="list-group list-group-flush">
          {% for group in request.user.groups.all %}
            <li class="list-group-item">{{ group }}</li>
          {% empty %}
            <li class="list-group-item text-muted">{% trans "None" %}</li>
          {% endfor %}
        </ul>
      </div>
    </div>
  </div>
  {% if perms.core.view_objectchange %}
    <div class="row">
      <div class="col-md-12">
        <div class="card">
          <h2 class="card-header text-center">{% trans "Recent Activity" %}</h2>
          <div class="table-responsive">
            {% render_table changelog_table 'inc/table.html' %}
          </div>
        </div>
      </div>
    </div>
  {% endif %}
{% endblock %}
