{% extends 'base.html' %}
{% load i18n staticfiles tz stats %}
{% block title %}{{ squad.name }} / {{ block.super }}{% endblock title %}

{% block nav_tabs %}
    {% include 'inline/squad_tabs.html' %}
{% endblock nav_tabs %}

{% block content %}
    <section id="player">
        <div class="wrapper">
            <div class="profile_name">
                {{ squad.name }} ({{ squad.tag }})
            </div>
            <div class="profile_head">
                <div class="head_left">
                    {% if squad.coal_pref == 1 %}
                        <img src="{% static 'img/flag/allies.png' %}" width="140" height="70" class="coal_flag"
                             title="{% trans 'Allies' context 'coalition' %}" alt="{% trans 'Allies' context 'coalition' %}" align="left">
                        <div class="coalition">{% trans 'favorite coalition' %}: <span>{% trans 'Allies' context 'coalition' %}</span></div>
                    {% elif squad.coal_pref == 2 %}
                        <img src="{% static 'img/flag/axis.png' %}" width="140" height="70" class="coal_flag"
                             title="{% trans 'Axis' context 'coalition' %}" alt="{% trans 'Axis' context 'coalition' %}" align="left">
                        <div class="coalition">{% trans 'favorite coalition' %}: <span>{% trans 'Axis' context 'coalition' %}</div>
                    {% else %}
                        <img src="{% static 'img/flag/neutral.png' %}" width="140" height="70" class="coal_flag"
                             title="{% trans 'No' context 'favorite_coalition' %}" alt="{% trans 'No' context 'favorite_coalition' %}" align="left">
                        <div class="coalition">{% trans 'favorite coalition' %}: <span>{% trans 'No' context 'favorite_coalition' %}</span></div>
                    {% endif %}
                        <div class="squad_about">
                            {% if squad.profile.website %}
                            <div class="squad_site"><a href="{{ squad.profile.website }}" target="_blank">
                                {% trans 'Go to the website of the squad' %}</a></div>
                            {% endif %}
                            {{ squad.profile.about }}
                        </div>
                </div>
                <div class="head_right">
                    {% if squad.profile.logo %}
                    <div class="squad_logo">
                        <img src="{{ squad.profile.logo.url }}?{{ squad.profile.logo.size }}" align="right" alt="" title="">
                    </div>
                    {% endif %}
                </div>
            </div>

            <div class="profile_main_stats">
                <div class="item">
                    <img src="{% static 'img/icons/big/human.png' %}" width="" height="" title="" alt="">
                    <div class="text">{% trans 'Number of pilots' %}</div>
                    {% if squad.num_members < SQUAD_MEMBERS_MINIMUM %}
                        <div class="num" style="color: #C72B11;" title="{% trans 'Not enough pilots to participate in the rating' %}">
                            {{ squad.num_members }}
                        </div>
                    {% else %}
                        <div class="num">{{ squad.num_members }}</div>
                    {% endif %}
                </div>
                <div class="item">
                    <img src="{% static 'img/icons/big/ak.png' %}" width="" height="" title="" alt="">
                    <div class="text">{% trans 'Aerial victories' %}</div>
                    <div class="num">{{ squad.ak_total }}</div>
                </div>
                <div class="item">
                    <img src="{% static 'img/icons/big/gk.png' %}" width="" height="" title="" alt="">
                    <div class="text">{% trans 'Destroyed on Ground' %}</div>
                    <div class="num">{{ squad.gk_total }}</div>
                </div>
                <div class="item">
                    <img src="{% static 'img/icons/big/ft.png' %}" width="" height="" title="" alt="">
                    <div class="text">{% trans 'Flight Time' %}</div>
                    <div class="num">{{ squad.flight_time|seconds_to_time }}</div>
                </div>
                <div class="item">
                    <img src="{% static 'img/icons/big/rating.png' %}" width="" height="" title="" alt="">
                    <div class="text">{% trans 'Position in Rating' %}</div>
                    <div class="num" title="{{ squad.rating }}">
                        {% if rating_position %}
                            <a href="{% url 'stats:squads' %}?page={{ page_position }}&tour={{ squad.tour_id }}">{{ rating_position }}</a>
                        {% else %}
                            <span title="">?</span>
                        {% endif %}
                    </div>
                </div>
            </div>

            <div class="player_detailed" style="float: left;">
                <div class="title">
                    {% trans 'Detailed combat results' %}
                </div>
                <div class="item">
                    <div class="name">{% trans 'Total Aircraft' context 'total' %}</div>
                    <div class="num">{{ squad.ak_total }}</div>
                </div>

                {% if squad.killboard_pvp.aircraft_light %}
                <div class="sub_item">
                    <div class="name">{% trans 'Fighters' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pvp.aircraft_light }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pvp.aircraft_medium %}
                <div class="sub_item">
                    <div class="name">{% trans 'Attacker' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pvp.aircraft_medium }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pvp.aircraft_heavy %}
                <div class="sub_item">
                    <div class="name">{% trans 'Bombers' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pvp.aircraft_heavy }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pvp.aircraft_transport %}
                <div class="sub_item">
                    <div class="name">{% trans 'Transport' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pvp.aircraft_transport }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aircraft_light %}
                <div class="sub_item">
                    <div class="name">{% trans 'Fighters' context 'total' %} ({% trans 'AI' context 'total' %})</div>
                    <div class="num">{{ squad.killboard_pve.aircraft_light }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aircraft_medium %}
                <div class="sub_item">
                    <div class="name">{% trans 'Attacker' context 'total' %} ({% trans 'AI' context 'total' %})</div>
                    <div class="num">{{ squad.killboard_pve.aircraft_medium }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aircraft_heavy %}
                <div class="sub_item">
                    <div class="name">{% trans 'Bombers' context 'total' %} ({% trans 'AI' context 'total' %})</div>
                    <div class="num">{{ squad.killboard_pve.aircraft_heavy }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aircraft_transport %}
                <div class="sub_item">
                    <div class="name">{% trans 'Transport' context 'total' %} ({% trans 'AI' context 'total' %})</div>
                    <div class="num">{{ squad.killboard_pve.aircraft_transport }}</div>
                </div>
                {% endif %}

                {% if squad.ak_assist %}
                <div class="item">
                    <div class="name">{% trans 'Assisted' context 'total' %}</div>
                    <div class="num">{{ squad.ak_assist }}</div>
                </div>
                {% endif %}

                <div class="item">
                    <div class="name">{% trans 'Destroyed ground targets' context 'total' %}</div>
                    <div class="num">{{ squad.gk_total }}</div>
                </div>

                {% if squad.killboard_pve.tank_heavy %}
                <div class="sub_item">
                    <div class="name">{% trans 'Heavy Tanks' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.tank_heavy }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.tank_medium %}
                <div class="sub_item">
                    <div class="name">{% trans 'Medium Tanks' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.tank_medium }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.tank_light %}
                <div class="sub_item">
                    <div class="name">{% trans 'Light Tanks' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.tank_light }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.armoured_vehicle %}
                <div class="sub_item">
                    <div class="name">{% trans 'Armored vehicles' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.armoured_vehicle }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.car %}
                <div class="sub_item">
                    <div class="name">{% trans 'Cars' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.car }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.truck %}
                <div class="sub_item">
                    <div class="name">{% trans 'Trucks' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.truck }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aaa_heavy %}
                <div class="sub_item">
                    <div class="name">{% trans 'Large-caliber AA guns' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.aaa_heavy }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aaa_light %}
                <div class="sub_item">
                    <div class="name">{% trans 'Medium-caliber AA guns' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.aaa_light }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aaa_mg %}
                <div class="sub_item">
                    <div class="name">{% trans 'Small-caliber AA guns' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.aaa_mg }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.searchlight %}
                <div class="sub_item">
                    <div class="name">{% trans 'Searchlights' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.searchlight }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.locomotive %}
                <div class="sub_item">
                    <div class="name">{% trans 'Locomotives' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.locomotive }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.wagon %}
                <div class="sub_item">
                    <div class="name">{% trans 'Wagons' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.wagon }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.artillery_field %}
                <div class="sub_item">
                    <div class="name">{% trans 'Field Artillery' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.artillery_field }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.artillery_howitzer %}
                <div class="sub_item">
                    <div class="name">{% trans 'Howitzers' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.artillery_howitzer }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.artillery_rocket %}
                <div class="sub_item">
                    <div class="name">{% trans 'Rocket Artillery' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.artillery_rocket }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.ship %}
                <div class="sub_item">
                    <div class="name">{% trans 'Ships' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.ship }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.aircraft_static %}
                <div class="sub_item">
                    <div class="name">{% trans 'Static Aircraft' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.aircraft_static }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.vehicle_static %}
                <div class="sub_item">
                    <div class="name">{% trans 'Static Vehicles' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.vehicle_static }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.airfield %}
                <div class="sub_item">
                    <div class="name">{% trans 'Airfield Objects' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.airfield }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.bridge %}
                <div class="sub_item">
                    <div class="name">{% trans 'Bridges' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.bridge }}</div>
                </div>
                {% endif %}

                {% if squad.killboard_pve.industrial %}
                <div class="sub_item">
                    <div class="name">{% trans 'Industrial Objects' context 'total' %}</div>
                    <div class="num">{{ squad.killboard_pve.industrial }}</div>
                </div>
                {% endif %}

            </div>

            <div class="player_detailed" style="float: right;">
                <div class="title">
                    {% trans 'Detailed sorties results' %}
                </div>
                <div class="item">
                    <div class="name">{% trans 'Score' context 'total' %}</div>
                    <div class="num">{{ squad.score }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Sorties' context 'total' %}</div>
                    <div class="num">{{ squad.sorties_total }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Lost aircraft' context 'total' %}</div>
                    <div class="num">{{ squad.lost_aircraft }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Bailout' context 'total' %}</div>
                    <div class="num">{{ squad.bailout }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Dead' context 'total' %}</div>
                    <div class="num">{{ squad.dead }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Captured' context 'total' %}</div>
                    <div class="num">{{ squad.captured }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Disco' context 'total' %}</div>
                    <div class="num">{{ squad.disco }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Shotdown Friendly Aircraft' context 'total' %}</div>
                    <div class="num">{{ squad.fak_total }}</div>
                </div>
                <div class="item">
                    <div class="name">{% trans 'Destroyed Friendly Ground Targets' context 'total' %}</div>
                    <div class="num">{{ squad.fgk_total }}</div>
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="player_bars" style="float: left;">
                <div class="title">
                    {% trans 'Coalitions' %}
                </div>
                <div class="block_wrapper">
                    {% if squad.sorties_coal.1 %}
                        <div class="item">
                            <div class="name">{% trans 'Allies' context 'coalition' %}</div>
                            <div class="desc">{% trans 'number of sorties' %}: {{ squad.sorties_coal.1 }}</div>
                            {% widthratio squad.sorties_coal.1 squad.sorties_total 100 as width %}
                            <div class="pct">{{ width|floatformat:'0' }}%</div>
                            <div class="bar">
                                <div class="progress red" style="width: {{ width }}%;"></div>
                            </div>
                        </div>
                    {% endif %}
                    {% if squad.sorties_coal.2 %}
                        <div class="item">
                            <div class="name">{% trans 'Axis' context 'coalition' %}</div>
                            <div class="desc">{% trans 'number of sorties' %}: {{ squad.sorties_coal.2 }}</div>
                            {% widthratio squad.sorties_coal.2 squad.sorties_total 100 as width %}
                            <div class="pct">{{ width|floatformat:'0' }}%</div>
                            <div class="bar">
                                <div class="progress blue" style="width: {{ width }}%;"></div>
                            </div>
                        </div>
                    {% endif %}
                </div>
            </div>

            <div class="player_bars" style="float: right;">
                <div class="title">
                    {% trans 'Specialty' %}
                </div>
                <div class="block_wrapper">
                    {% if squad.sorties_cls.aircraft_light %}
                        <div class="item">
                            <div class="name">{% trans 'Fighters' context 'specialty' %}</div>
                            <div class="desc">{% trans 'number of sorties' %}: {{ squad.sorties_cls.aircraft_light }}</div>
                            {% widthratio squad.sorties_cls.aircraft_light squad.sorties_total 100 as width %}
                            <div class="pct">{{ width|floatformat:'0' }}%</div>
                            <div class="bar">
                                <div class="progress yellow" style="width: {{ width }}%;"></div>
                            </div>
                        </div>
                    {% endif %}
                    {% if squad.sorties_cls.aircraft_medium %}
                        <div class="item">
                            <div class="name">{% trans 'Attackers' context 'specialty' %}</div>
                            <div class="desc">{% trans 'number of sorties' %}: {{ squad.sorties_cls.aircraft_medium }}</div>
                            {% widthratio squad.sorties_cls.aircraft_medium squad.sorties_total 100 as width %}
                            <div class="pct">{{ width|floatformat:'0' }}%</div>
                            <div class="bar">
                                <div class="progress yellow" style="width: {{ width }}%;"></div>
                            </div>
                        </div>
                    {% endif %}
                    {% if squad.sorties_cls.aircraft_heavy %}
                        <div class="item">
                            <div class="name">{% trans 'Bombers' context 'specialty' %}</div>
                            <div class="desc">{% trans 'number of sorties' %}: {{ squad.sorties_cls.aircraft_heavy }}</div>
                            {% widthratio squad.sorties_cls.aircraft_heavy squad.sorties_total 100 as width %}
                            <div class="pct">{{ width|floatformat:'0' }}%</div>
                            <div class="bar">
                                <div class="progress yellow" style="width: {{ width }}%;"></div>
                            </div>
                        </div>
                    {% endif %}
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="player_analytics">

                <div class="left_block">
                    <div class="item">
                        <div class="text">
                            {% trans 'W/L - Win/Loss' %}
                        </div>
                        <div class="num">
                            {{ squad.wl }}
                        </div>
                    </div>
                </div>
                <div class="center_block">
                    <div class="item">
                        <div class="text">
                            {% trans 'K/D - Kills per Death' %}
                        </div>
                        <div class="num">
                            {{ squad.kd }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'K/L - Kills per Aircraft Lost' %}
                        </div>
                        <div class="num">
                            {{ squad.kl }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'K/S - Kills per Sortie' %}
                        </div>
                        <div class="num">
                            {{ squad.ks }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'K/H - Kills per Hour of Flight' %}
                        </div>
                        <div class="num">
                            {{ squad.khr }}
                        </div>
                    </div>
                </div>
                <div class="right_block">
                    <div class="item">
                        <div class="text">
                            {% trans 'GK/D - G.Kills per Death' %}
                        </div>
                        <div class="num">
                            {{ squad.gkd }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'GK/L - G.Kills per Aircraft Lost' %}
                        </div>
                        <div class="num">
                            {{ squad.gkl }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'GK/S - G.Kills per Sortie' %}
                        </div>
                        <div class="num">
                            {{ squad.gks }}
                        </div>
                    </div>
                    <div class="item">
                        <div class="text">
                            {% trans 'GK/H - G.Kills per Hour of Flight' %}
                        </div>
                        <div class="num">
                            {{ squad.gkhr }}
                        </div>
                    </div>
                </div>

            </div>

            <div class="clearfix"></div>

            <div class="info">
                <div>
                    {% blocktrans trimmed %}
                        <strong>Attention!</strong> Statistics squad - accumulative.
                        When a player joins to squad, his past statistics does not affect the current squad statistics.
                        Only new sorties will be added in the squad statistics.
                    {% endblocktrans %}
                </div>
            </div>
            </div>
        </div>
    </section>
{% endblock content %}
