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

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

{% block content %}
<div class="col-lg-12">
    {% include "fleetup/menu.html" %}
    <div class="tab-content">
        <div id="fit" class="tab-pane fade in active">
            <div class="col-lg-3">
                {% for x, y in fitting_data.items %}
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">{% trans "This fit is part of a doctrine" %}</h3>
                    </div>
                    <div class="panel-body">
                        {% for doctrin in y.Doctrines %}
                        <h4>{{ doctrin.Name }}</h4>
                        <div class="col-lg-12">
                            <p>{% trans "Role in doctrine:" %} {{ doctrin.Role }}</p>
                        </div>
                        <div class="col-lg-4">
                            <p>{% trans "Priority:" %}</p>
                        </div>
                        <div class="col-lg-8">
                            <div class="progress">
                                <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="{{ doctrin.Priority }}" aria-valuemin="0" aria-valuemax="5" style="width: {% widthratio doctrin.Priority 5 100 %}%;">
                                    {{ doctrin.Priority }}/5
                                </div>
                            </div>
                        </div>
                        <div class="pull-right">
                            <a class="btn btn-primary" href="{% url 'fleetup:doctrine' doctrin.DoctrineId %}">{% trans "See doctrine" %}</a>
                        </div>
                        {% endfor %}
                    </div>
                </div>
                <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">{% trans "Fit categories" %}</h3>
                        </div>
                        <div class="panel-body">
                            {% for category in y.Categories %}
                            <span class="label label-success">{{ category }}</span>
                            {% endfor %}
                        </div>
                </div>
                {% endfor %}
                <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">{% trans "All fits in this Doctrine" %}</h3>
                        </div>
                        <div class="panel-body">
                            <div class="list-group">
                            {% for arbit, orbit in doctrines_list.items %}
                              
                                {% for fitting in orbit.Data %}
                                <a href="{% url 'fleetup:fitting' fitting.FittingId %}" class="list-group-item">
                                
                                <h4 class="list-group-item-heading">{{ fitting.Name }}<span class="pull-right"><img src="https://image.eveonline.com/InventoryType/{{ fitting.EveTypeId }}_32.png" class="img-circle"></span></h4>
                                <p class="list-group-item-heading">{{ fitting.Role }} - {{ fitting.ShipType }}</p>
                                </a>
                            {% endfor %}
                            {% endfor %}
                            </div>
                        </div>
                </div>
            </div>
            <div class="col-lg-4">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        {% for a, j in fitting_data.items %}
                        <h3 class="panel-title">{{ j.Name }}</h3>
                    </div>
                    <div class="panel-body">
                        <div class="col-lg-3">
                            <img src="https://image.eveonline.com/InventoryType/{{ j.EveTypeId }}_64.png" class="img-responsive">
                        </div>
                        <div class="col-lg-9">
                            <p>{% trans "Hull:" %} <b>{{ j.HullType }}</b></p>
                            <p>{% trans "Ship:" %} <b>{{ j.ShipType }}</b></p>
                            {% load humanize %}
                            <p>{% trans "Estimated price:" %} <b>{{ j.EstPrice|intword }} ISK</b></p>
                        </div>
                        {% regroup j.FittingData by Slot as fitting_list %}
                    <table class="table table-condensed table-hover">
                        <tr>
                            <th class="col-lg-1"></th>
                            <th class="col-lg-11"></th>
                        </tr>
                        {% for Slot in fitting_list %}
                        <tr class="info">
                            <td></td><td><b>{{ Slot.grouper }}</b></td>
                        </tr>
                            {% for item in Slot.list %}
                        <tr>
                            <td><img src="https://image.eveonline.com/InventoryType/{{ item.TypeId }}_32.png" class="img-responsive"></td>
                            <td> {{ item.Quantity }}x {{ item.TypeName }}</td>
                        </tr>
                            {% endfor %}
                        {% endfor %}
                    </table>
                    </div>
                        {% endfor %}
                </div>
            </div>
            
            <div class="col-lg-3">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">{% trans "EFT/Export" %}</h3>
                    </div>
                    <div class="panel-body">
                    {% for data in fitting_eft.items %}
                    {% autoescape off %}
                    <textarea class="form-control" rows="25" spellcheck="false" onclick="this.focus();this.select()" readonly>{{ fitting_eft.fitting_eft }}</textarea>
                    {% endautoescape %}
                    {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock content %}
