{% extends "admin-base.twig" %}

{% block adminpage %}

{% set current_user = user %}

<style type="text/css">
.props li {
    margin-bottom: 5px;
}
.props li b {
    width: 90px;
    display: inline-block;
}
</style>

<div>
    <ul class="unstyled props">
        <li><b>ID:</b> {{ the_user.id }}</li>
        <li><b>Name:</b> {{ the_user.name }}</li>
        <li><b>E-Mail:</b> {{ the_user.email }}</li>
        <li><b>Charts:</b> <a href="/admin/charts/{{ the_user.id }}">{{ the_user.charts | length }}</a></li>
        <li><b>Created At:</b> {{ the_user.createdAt }}</li>
        <li><b>Role:</b> {{ the_user.role }}</li>
    </ul>
</div>

{{ hook('admin_user_detail_top', the_user) }}

<div class="row">

    <div class="span4">
        <h3>History</h2>

        <table class="table">
            {% for event in history %}
                <tr><td>{{ event.time | date }}</td><td>{{ event.event | raw }}</tr>
            {% endfor %}
        </table>
    </div>
    <div class="span2">
        <h3>Private Plugins</h3>
        <ul class="plugin-list">
        {% for plugin in userPlugins %}
            <li>{{ plugin.id }}</li>
        {% endfor %}
        </ul>
    </div>
    <div class="span2">
        <h3>Products</h3>
        <ul class="plugin-list">
        {% for product in the_user.products %}
            <li><a href="/admin/products?id={{ product.id }}">{{ product.name }}</a></li>
        {% endfor %}
        </ul>
    </div>
    <div class="span2">
        <h3>Organizations</h3>
        <ul class="plugin-list">
        {% for org in the_user.organizations %}
            <li><a href="/admin/organizations/{{ org.id }}">{{ org.name }}</a></li>
        {% endfor %}
        </ul>
    </div>
</div>



{{ hook('admin_user_detail_bottom') }}

{% endblock %}
