{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load i18n %}
{% load evelinks %}

{% block page_title %}{% trans "Group Members" %}{% endblock page_title %}
{% block extra_css %}{% endblock extra_css %}

{% block content %}
    <div class="col-lg-12">
        <br>
        {% include 'groupmanagement/menu.html' %}
        
        <div class="panel panel-default">
            <div class="panel-heading">
                {{ group.name }} - {% trans 'Members' %}
            </div>
            <div class="panel-body">
                <div id="list" class="">
                    {% if group.user_set %}
                    <table class="table">
                        <tr>                    
                            <th class="text-center">{% trans "Leader" %}</th>
                            <th class="text-center">{% trans "Portrait" %}</th>
                            <th class="text-center">{% trans "Character" %}</th>
                            <th class="text-center">{% trans "Corporation" %}</th>
                            <th class="text-center">{% trans "Alliance" %}</th>
                            <th class="text-center">{% trans "Action" %}</th>
                        </tr>
                        {% for member in members %}
                            <tr>                        
                                <td class="text-center">
                                    {% if member.is_leader %}
                                    <i class="fa fa-star"></i>
                                    {% endif %}
                                </td>
                                <td class="text-center">
                                    <img src="{{ member.main_char|character_portrait_url:32 }}" class="img-circle">
                                </td>
                                <td class="text-center">
                                    <a href="{{ member.main_char|evewho_character_url }}" target="_blank">
                                        {{ member.main_char.character_name }}
                                    </a>
                                </td>
                                <td class="text-center">
                                    <a href="{{ member.main_char|dotlan_corporation_url }}" target="_blank">
                                        {{ member.main_char.corporation_name }}
                                    </a>
                                </td>                        
                                <td class="text-center">
                                    <a href="{{ member.main_char|dotlan_alliance_url }}" target="_blank">
                                        {{ member.main_char.alliance_name|default_if_none:"" }}
                                    </a>
                                </td>
                                <td class="text-center">
                                    <a href="{% url 'groupmanagement:membership_remove' group.id member.user.id %}" class="btn btn-danger"
                                        title="{% trans "Remove from group" %}">
                                            <i class="glyphicon glyphicon-remove"></i>
                                    </a>
                                </td>
                            </tr>
                        {% endfor %}
                    </table>
                    {% else %}
                        <div class="alert alert-warning text-center">{% trans "No group members to list." %}</div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
{% endblock content %}
