{% extends 'charlink/base_audit.html' %}
{% load charlinkutils %}

{% block page_title %}Charlink Audit{% endblock page_title %}

{% block auditblock %}
    {% if selected %}
        <div class="row col-lg-12">
            <div class="text-center">
                <table class="table">
                        <tr>
                            <td class="text-center col-lg-6 {% if selected.alliance %}{% else %}col-lg-offset-3{% endif %}">
                                    <img class="ra-avatar" src="{{ selected.logo_url_64 }}" alt="{{ selected.corporation_name }}">
                                </td>
                            {% if selected.alliance %}
                                <td class="text-center col-lg-6">
                                    <img class="ra-avatar" src="{{ selected.alliance.logo_url_64 }}" alt="{{ selected.alliance.alliance_name }}">
                                </td>
                            {% endif %}
                        </tr>
                        <tr>
                            <td class="text-center"><h4>{{ selected.corporation_name }}</h4></td>
                            {% if selected.alliance %}
                                <td class="text-center"><h4>{{ selected.alliance.alliance_name }}</h4></td>
                            {% endif %}
                        </tr>
                </table>
            </div>
        </div>
        <div class="row col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ul class="nav nav-pills pull-left">
                        <li class="active"><a href="#characters" data-toggle="pill">Characters</a></li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="panel-body">
                    <div class="tab-pane" id="characters">
                        <div class="table-responsive">
                            <table class="table table-aa table-hover">
                                <thead>
                                    <tr>
                                        <th></th>
                                        <th class="text-center">Character</th>
                                        <th class="text-center">Main Character</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for character in selected|get_corp_members %}
                                        <tr>
                                            <td><img src="{{ character.portrait_url }}" class="img-circle" alt="{{ character }}"></td>
                                            <td class="text-center">{{ character }}</td>
                                            <td class="text-center">
                                                {% if character.character_ownership.user.profile.main_character %}
                                                    <a href="{% url 'charlink:audit_user' character.character_ownership.user_id %}">{{ character.character_ownership.user.profile.main_character }} <i class="fas fa-external-link-alt fa-xs"></i></a>
                                                {% endif %}
                                            </td>
                                        </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
{% endblock auditblock %}