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

{% block detail_content %}
    <h2>Gruppe anlegen</h2>
    {% if extra_error %}
        <div class="alert alert-warning">{{ extra_error }}</div>
    {% endif %}
    <form action="{{ url('realm-group-add', args=[realm.id]) }}" method="post">
        <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
        {{ mform.text_input(form.name) }}
        {{ mform.textarea_input(form.description) }}
        {{ form.members.label }}
        {{ uform.get_data_table_search_field() }}
        {{ mform.user_select_table_input(users, field=form.members) }}
        <div class="d-flex mt-4">
            <button type="submit" class="btn btn-primary mr-auto p-2">Speichern</button>
            <a href="{{ url('realm-group-list', args = [realm.id]) }}"
               class="btn btn-secondary p-2">Abbrechen</a>
        </div>
    </form>
{% endblock %}