{#
/**
 * Copyright © 2003-2024 The Galette Team
 *
 * This file is part of Galette (https://galette.eu).
 *
 * Galette is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Galette is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
 */
#}
<div class="ui stackable grid align-items-center">
    <div class="eleven wide column">
        <table id="listing" class="select_members ui celled striped table">
            <thead>
                <tr>
                    <th class="listing id_row">#</th>
                    <th class="listing left">
                        {{ _T("Name") }}
                    </th>
                    <th class="listing left">
                        {{ _T("Manager(s)") }}
                    </th>
                    <th class="listing"></th>
                </tr>
            </thead>
            <tbody>
{% for group in groups_list %}
    {% set managers = group.getManagers() %}
                <tr>
                    <td class="right">{{ group.getId() }}</td>
                    <td class="username_row">
                        <a href="{{ url_for('groups', {'id': group.getId()}) }}">{{ group.getName() }}</a>
                    </td>
                    <td class="username_row">
    {% for manager in managers %}
        {% if not loop.first %}, {% endif %}
                        {{ manager.sname }}
    {% endfor %}
                    </td>
                    <td class="right">{{ _T("%membercount members")|replace({'%membercount': group.getMemberCount(true)}) }}</td>
                </tr>
{% else %}
                <tr><td colspan="3" class="emptylist">{{ _T("no group") }}</td></tr>
{% endfor %}
            </tbody>
        </table>
    </div>
    <div class="five wide column">
        <section id="selected_groups" class="ui basic fitted segment">
            <div class="ui top attached accordion-styled header">
                {{ _T("Selected groups") }}
            </div>
            <div class="ui bottom attached accordion-styled segment">
{% for group in selected_groups %}
{% else %}
                <p id="none_selected">{{ _T("No groups has been selected yet.") }}</p>
{% endfor %}
                <ul class="ui middle aligned relaxed divided selection list">
{% for group in selected_groups %}
                    <li id="group_{{ group.id }}" class="item">
                        <i class="icons">
                            <i class="users icon" aria-hidden="true"></i>
                            <i class="top right corner minus icon" aria-hidden="true"></i>
                        </i>
                        {{ group.name }}
                    </li>
{% endfor %}
                </ul>
            </div>
            <div class="ui basic center aligned fitted segment">
                <button class="ui fluid primary button" id="btnvalid">{{ _T("Validate") }}</button>
                {% if the_id is defined %}
                    <input type="hidden" name="the_id" id="the_id" value="{{ the_id }}"/>
                {% endif %}
            </div>
        </section>
    </div>
