{% extends "sentry/admin/users/list.html" %}

{% load crispy_forms_tags %}
{% load i18n %}
{% load sentry_admin_helpers %}
{% load sentry_helpers %}

{% block title %}{% trans "Change User" %} | {{ block.super }}{% endblock %}

{% block main %}
    <section class="body">
        <form action="" method="post">
            {% csrf_token %}
            {{ form|as_crispy_errors }}
            {% for field in form %}
                {{ field|as_crispy_field }}
            {% endfor %}
            <fieldset class="form-actions">
                <button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
                {% if the_user.id != request.user.id %}
                    <a href="{% url 'sentry-admin-remove-user' the_user.pk %}" class="btn btn-danger">{% trans "Remove User" %}</a>
                {% else %}
                    <a href="#" class="btn disabled btn-danger">{% trans "Cannot remove yourself" %}</a>
                {% endif %}
            </fieldset>
        </form>
        {% if project_list %}
            <h3>{% trans "Projects" %}</h3>
            <br/>
            <table class="table table-bordered table-striped">
                <colgroup>
                    <col>
                    <col style="width:150px;">
                    <col style="width:150px;">
                </colgroup>
                <thead>
                    <tr>
                        <th>{% trans "Project" %}</th>
                        <th style="text-align:center;">{% trans "Daily Events" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for project, avg_events in project_list|with_event_counts %}
                        <tr>
                            <td>
                                {{ project.name }} <a href="{% url 'sentry-stream' project.team.slug project.slug %}">[view]</a>
                                </a>
                            </td>
                            <td style="text-align:center; vertical-align:middle;">
                                <em>~{{ avg_events }}</em>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endif %}
    </section>
{% endblock %}
