{% extends 'realm/realm_detailed.jinja2' %}
{% import 'macros/form_macros.jinja2' as mform %}

{% block detail_content %}
    <h2>Nutzer löschen</h2>
    <div class="form-group w-25 float-right">
        <input type="text"
               class="form-control"
               placeholder="Personen Suche"
               id="data-table-search-input">
        <label for="data-table-search-input">Suche</label>
    </div>
    <form action="{{ url('realm-multiple-user-delete', args=[realm.id]) }}" method="post">
        <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
{#        {{ form.as_p() }}#}
        <table class="table table-hover table-striped table-inverse table-bordered data-table">
            <thead>
            <tr>
                <th scope="col" class="text-center">
                    <input type="checkbox"
                           class="table-checkbox-control-input"
                           id="delete-all-checkbox"
                    ><label class="table-checkbox-control-label" for="delete-all-checkbox"></label>
                </th>
                <th scope="col">Nutzername</th>
                <th scope="col">E-Mail</th>
                <th scope="col">Vorname</th>
                <th scope="col">Nachname</th>
            </tr>
            </thead>
            <tbody>
            {% for user in users %}
                <tr>
                    <td class="text-center">
                        <input type="checkbox"
                               class="table-checkbox-control-input delete-checkbox"
                               id="user_{{ loop.index }}"
                               value="{{ user.username }}"
                               name="ldap_users"
                        ><label class="table-checkbox-control-label" for="user_{{ loop.index }}"></label>
                    </td>
                    <td>{{ user.username }}</td>
                    <td>{{ user.email }}</td>
                    <td>{{ user.first_name }}</td>
                    <td>{{ user.last_name }}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
        <div class="d-flex mt-4">
            <button type="submit" class="btn btn-danger mr-auto p-2">Ausführen</button>
            <a href="{{ url('realm-user-list', args = [realm.id]) }}"
               class="btn btn-secondary p-2">Abbrechen</a>
        </div>
    </form>
{% endblock %}