<main>
    <h2>Ajouter un utilisateur</h2>
    <table class="table table-sm">
    <tbody>
        {% for user in users %}
            <tr>
                <td>
                        {{ user.username }}
                    <br>
                    <span style="font-size: small">
                        {% if user.last_name or user.first_name %}
                            {{ user.first_name }} {{ user.last_name }}
                        {% endif %}
                        {% if user.email %}
                            - <a href="mailto:{{ user.email }}">{{ user.email }}</a>
                        {% endif %}
                    </span>
                </td>
                <td class="text-end">
                    <form style="display: inline;" method="post"
                          action="{% url "nui:add_user_to_project" project.pk %}"
                          up-submit>
                        {% csrf_token %}
                        <input type="hidden" name="user" value="{{ user.pk }}">
                        <input type="hidden" name="access" value="ro">
                        <input type="hidden" name="project" value="{{ project.pk }}">
                        <button type="submit" class="btn btn-outline-secondary btn-sm">
                            <i class="bi bi-person-add"></i>
                            lecture seule</button>
                    </form>
                    <form style="display: inline;" method="post"
                          action="{% url "nui:add_user_to_project" project.pk %}"
                          up-submit>
                        {% csrf_token %}
                        <input type="hidden" name="user" value="{{ user.pk }}">
                        <input type="hidden" name="access" value="rw">
                        <input type="hidden" name="project" value="{{ project.pk }}">
                        <button type="submit" class="btn btn-outline-secondary btn-sm">
                            <i class="bi bi-person-add"></i>
                            lecture / écriture</button>
                    </form>
                </td>
            </tr>
        {% endfor %}
    </tbody>
    </table>
</main>