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

{% block page_title %}Doctrine - FleetUp{% endblock page_title %}

{% block content %}
<div class="col-lg-12">
    {% include "fleetup/menu.html" %}
    <div>
        {% for a, j in doctrine.items %}
        {% regroup j.Data|dictsort:"Role" by Role as role_list %}

            {% for Role in role_list %}

            <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title"><b>{{ Role.grouper }}</b></h3>
                        </div>
                        <div class="panel-body">
                            <table class="table table-condensed table-hover table-striped">
                                <tr>
                                    <th class="col-md-1"></th>
                                    <th class="col-md-1">{% trans "Name" %}</th>
                                    <th class="col-md-1">{% trans "Role" %}</th>
                                    <th class="col-md-1">{% trans "Hull type" %}</th>
                                    <th class="col-md-1">{% trans "Ship type" %}</th>
                                    <th class="col-md-1">{% trans "Estimated ISK" %}</th>
                                    <th class="col-md-2">{% trans "Categories" %}</th>
                                </tr>
                                {% for item in Role.list %}
                                <tr>
                                    <td>
                                       <a href="{% url 'fleetup:fitting' item.FittingId %}"><img src="https://image.eveonline.com/InventoryType/{{ item.EveTypeId }}_32.png"></a>
                                    </td>
                                    <td>
                                        {{ item.Name }}
                                    </td>
                                    <td>
                                        {{ item.Role }}
                                    </td>
                                    <td>
                                        {{ item.HullType }}
                                    </td>
                                    <td>
                                        {{ item.ShipType }}
                                    </td>
                                    <td>
                                        {% load humanize %}{{ item.EstPrice|intword }}
                                    </td>
                                    <td>
                                        {% for categories in item.Categories %}
                                        {{ categories }},
                                        {% endfor %}
                                    </td>
                                </tr>
                               {% endfor %}
                            </table>
                       </div>
            </div>
        {% endfor %}
    </div>
   {% endfor %}
</div>

{% endblock content %}
