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

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

{% block extra_css %}
    <style>
        .glyphicon-ok {
            color: green;
        }

        .glyphicon-remove {
            color: red;
        }
    </style>
{% endblock extra_css %}

{% block charlink_page_header %}<h1 class="page-header text-center">Links Audit</h1>{% endblock charlink_page_header %}

{% block charlink_content %}
    <div class="panel panel-default text-center">
        <div class="panel-heading">
            <h3 class="panel-title text-center">Linked Characters</h3>
        </div>
        <div class="panel-body">
            <table class="table table-aa">
                <thead>
                    <tr>
                        <th></th>
                        <th class="text-center">Character</th>
                        {% for import_data in characters_added.apps.values %}
                            {% for login_data in import_data.imports %}
                                <th scope="row" class="text-center">{{ login_data.field_label }}</th>
                            {% endfor %}
                        {% endfor %}
                    </tr>
                </thead>
                <tbody>
                    {% for char in characters_added.characters %}
                        <tr>
                            <td><img src="{{ char.portrait_url }}" class="img-circle" alt="{{ char }}"></td>
                            <td>{{ char }}</td>
                            {% for import_data in characters_added.apps.values %}
                                {% for login_data in import_data.imports %}
                                    {% with is_added=char|get_char_attr:login_data.get_query_id %}
                                        {% if is_added %}
                                            <td><span class="glyphicon glyphicon-ok"></span></td>
                                        {% else %}
                                            <td><span class="glyphicon glyphicon-remove"></span></td>
                                        {% endif %}
                                    {% endwith %}
                                {% endfor %}
                            {% endfor %}
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock charlink_content %}