{% extends 'base.html' %}
{% block header %}
    {% include 'header.html' %}
{% endblock %}
{% block content %}
<div id='content' class='container'>
    <ul class='nav nav-tabs mt-2'>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/') }}'>ホーム</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link active' href='{{ url('/groups') }}'>グループ</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/users') }}'>ユーザー</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/apps') }}'>アプリ</a>
        </li>
    </ul>
    <div class='container'>
        {% if permission("create_group", request.user) %}
        <div class='mb-3 mt-3'>
            <a href='{{ url('/groups/create') }}'><button class='btn btn-primary'>チームを作成</button></a>
        </div>
        {% endif %}
        <div class="inner">
            <div class='group-list'>
            {% if groups|length %}
            {% for group in groups recursive %}
                {{ lists.groupItem(group, link=url("/groups/" + group.screen_name), tree=loop) }}
            {% endfor %}
            {% else%}
                <div class='no-item'>グループは存在しません</div>
            {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %}
