{% extends "base.html.j2" %}

{% block content %}
    <h1 class="h2 mt-3">Groups</h1>
    <a href="{{ url_for("portal.new_group") }}" class="btn btn-success">Create new group</a>
    <div class="table-responsive">
        <table class="table table-striped table-sm">
            <thead>
            <tr>
                <th scope="col">Name</th>
                <th scope="col">Description</th>
                <th scope="col">EOTK</th>
                <th scope="col">Sites</th>
                <th scope="col">Actions</th>
            </tr>
            </thead>
            <tbody>
            {% for group in groups %}
                <tr>
                    <td>{{ group.group_name }}</td>
                    <td>{{ group.description }}</td>
                    <td>{% if group.eotk %}✅{% else %}❌{% endif %}</td>
                    <td>{{ group.origins | length }}</td>
                    <td><a href="{{ url_for("portal.edit_group", group_id=group.id) }}" class="btn btn-primary btn-sm">View/Edit</a></td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}