{% extends "multitenancy/admin/base.html" %}

{% load static %}
{% load bootstrap4 %}
{% load thumbnail %}

{% block head_title %}Manage {{ team.name }}{% endblock %}
{% block page_title %}Manage {{ team.name }}{% endblock %}
{%block breadcrumbs%}
<li class="breadcrumb-item " ><a href="{% url 'pinax_teams:team_list' %}">Teams</a></li>

<li class="breadcrumb-item "><a href="{% url 'pinax_teams:team_detail' slug=team.slug %}">{{team.name}}</a></li>
<li class="breadcrumb-item active">Create Teams</li>
{% endblock%}


{% block main_content %}
<div class="container">
    <div class="row p-2 text-dark">
        <div class="col-md-4">
            {% if team.avatar %}
                <img class="img-polaroid avatar hidden-phone" src="{% thumbnail team.avatar 160x160 crop %}" alt="{{ team.name }}">
            {% else %}
                <div class="default-avatar-big">
                    <i class="fa fa-group fa-5x"></i>
                </div>
            {% endif %}

            <h2>{{ team.name }}</h2>
            {% if role %}<p><span class="label label-default">{{ role }}</span></p>{% endif %}

            {% if team.description %}<p>{{ team.description }}</p>{% endif %}

            <a class="btn btn-default btn-xs" href="{% url 'pinax_teams:team_detail' team.slug %}">back to team</a>
        </div>
        <div class="col-md-8">
            {% if user.is_staff or role == "manager" or role == "owner" %}
                {% if team.owners %}
                    <h2>Owners</h2>
                    <table class="table table-striped owners">
                        {% for membership in team.owners %}
                            {% include "pinax/teams/_membership.html" %}
                        {% endfor %}
                    </table>
                {% endif %}
                {% if team.managers %}
                    <h2>Managers</h2>
                    <table class="table table-striped managers">
                        {% for membership in team.managers %}
                            {% include "pinax/teams/_membership.html" %}
                        {% endfor %}
                    </table>
                {% endif %}
                {% if team.members %}
                    <h2>Members</h2>
                    <table class="table table-striped members">
                        {% for membership in team.members %}
                            {% include "pinax/teams/_membership.html" %}
                        {% endfor %}
                    </table>
                {% endif %}
                {% if team.applicants and team.member_access == "application" %}
                    <h2>Applicants</h2>
                    <table class="table table-striped applicants">
                        {% for membership in team.applicants %}
                            {% include "pinax/teams/_membership.html" %}
                        {% endfor %}
                    </table>
                {% endif %}
                <h2>Invitees</h2>
                <table class="table table-striped invitees">
                    {% for membership in team.invitees %}
                        {% include "pinax/teams/_membership.html" %}
                    {% endfor %}
                </table>
                {% if invite_form %}
                    {% include "pinax/teams/_invite_form.html" %}
                {% endif %}
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}