{% extends "base.html" %}
{% block content %}

    <div class="card">
        <h2>Users</h2>

        <a class="btn btn-primary" href="{{ url_for('users.new_user') }}">+ New User</a>

        <table class="table table-dark">
            <tr>
                <th>Name</th>
                <th>Email</th>
                <th>Role</th>
                <th>Active</th>
                <th></th>
            </tr>

            {% for u in users %}
                <tr>
                    <td>{{ u.name }}</td>
                    <td>{{ u.email }}</td>
                    <td>{{ u.role }}</td>
                    <td>{{ "Yes" if u.active else "No" }}</td>
                    <td>
                        <a href="{{ url_for('users.edit_user', user_id=u.id) }}">Edit</a> |
                        <a href="{{ url_for('users.delete_user', user_id=u.id) }}">Delete</a>
                    </td>
                </tr>
            {% endfor %}
        </table>
    </div>

{% endblock %}