{% extends "cradmin_legacy/base.django.html" %}
{% load i18n %}
{% load cradmin_legacy_tags %}

{% block title %}
    {{ request.user.get_displayname }} - {% trans "Account" %}
{% endblock title %}

{% block pageheader-inner %}
    <h1 class="test-primary-h1">{% trans "Account overview" %}</h1>
{% endblock pageheader-inner %}

{% block content %}
    <div class="container">
        <div class="devilry-dashboard-container">

            <h3>{% trans "Name" %}</h3>
            <p class="test-fullname">
                {% if request.user.fullname %}
                    {{ request.user.fullname }}
                {% else %}
                    <em class="text-warning">{% trans "Name not registered for account" %}</em>
                {% endif %}
            </p>

            <h3>{% trans "Short name" %}</h3>
            <p>
                <small class="text-muted">({% trans "Shown instead of your name some places in the UI" %})</small>
                <br>
                <span class="test-shortname">{{ request.user.shortname }}</span>
            </p>

            <h3>{% trans "Last login" %}</h3>
            <p class="test-last-login">
                {{ request.user.last_login|date:"DATETIME_FORMAT" }}
            </p>

            {% if not email_auth_backend %}
                <h3 class="test-usernames-title">
                    {% if username_count > 1 %}
                        {% trans "Usernames" %}
                    {% else %}
                        {% trans "Username" %}
                    {% endif %}
                </h3>
                <ul class="list-unstyled">
                    {% for username in usernames %}
                        <li class="test-username">
                            {{ username.username }}
                        </li>
                    {% endfor %}
                </ul>
            {% endif %}

            <h3 class="test-emails-title">
                {% if useremail_count > 1 %}
                    {% trans "Email addresses" %}
                {% else %}
                    {% trans "Email address" %}
                {% endif %}
            </h3>
            <ul class="list-unstyled">
                {% for useremail in useremails %}
                    <li class="test-email">
                        {{ useremail.email }}
                        {% if useremail_count > 1 %}
                            {% if useremail.use_for_notifications %}
                                <small class="text-muted">({% trans "use for notifications" %})</small>
                            {% endif %}
                        {% endif %}
                    </li>
                {% endfor %}
            </ul>

            <h3>{% trans 'Language' %}</h3>
                <a class="btn btn-default" href="{% cradmin_appurl 'select_language' %}">
                    {% trans 'Change language' %}
                </a>
        </div>

        <form method="POST" action="{% url 'account_logout' %}">
            {% csrf_token %}
            <button class="btn btn-primary">
                {% trans "Sign out" %}
            </button>
        </form>
    </div>
{% endblock content %}
