{% extends "admin/admin-layout.html" %}

{% block app_content %}
<h1>Member List</h1> 
<a href="{{ url_for('admin.users_csv') }}" target="_blank">CSV for ACM</a>
<table class="table table-striped">
    <thead>
        <tr>
            <th>Email</th>
            <th>Name</th>
            <th>Created</th>
            <th>Last Login</th>
            <th>Officer?</th>
            <th>Options</th>
        </tr>
    </thead>
    <tbody>
        {% for u in u_list %}
            <tr>
                <td>{{ u.email }}</td>
                <td>{{ u.first_name }} {{ u.last_name }}</td>
                <td>{{ u.created }}</td>
                <td>{{ u.last_login }}</td>
                <td>{{ u.is_admin }}</td>
                <td>
                    <div class="dropdown">
                       <a href="#" class="btn btn-primary dropdown-toggle"
                                   data-bs-toggle="dropdown"><span
                                   class="caret"></span></a>
                       <ul class="dropdown-menu">
                           {% if u.is_admin %}
                           <li class="dropdown-item">Demote Officer</li>
                           {% else %}
                           <li class="dropdown-item">Promote Officer</li>
                           {% endif %}
                           <li class="dropdown-item"><a href="{{
                                                    url_for('admin.officer_positions',
                                                    user_id=u.id)}}">Manage Officer
                                                    Entries</a></li>
                           <li class="dropdown-item">View Event Checkins</li>
                           <li class="dropdown-item">Delete Member</li>
                       </ul>
                    </div>
                </td>
            </tr>
        {% endfor %}
    </tbody>    
</table>

{% endblock app_content %}
