{% extends 'base.jinja.html' %}

{% block page_title %}
    {{ l.fleet_node_player_group_page_title }}
{% endblock %}

{% block add_css %}
    {{ HOOK(H_FLEET_NODE_PLAYER_GROUP_CSS) }}
        <link rel="stylesheet" href="{{ STATIC_PREFIX }}css/lib/jquery-explr-1.4.css"/>

{% endblock %}

{% block add_js %}
    <script src="{{ STATIC_PREFIX }}js/lib/jquery-explr-1.4.js"></script>
    <script src="{{ STATIC_PREFIX }}js/fleet/node-player-groups.js"></script>
    <script src="{{ STATIC_PREFIX }}js/explorer.js"></script>
    {{ HOOK(H_FLEET_NODE_PLAYER_GROUP_JAVASCRIPT) }}
{% endblock %}

{% block body_class %}view-player-group-list{% endblock %}

{% block page %}
    <div class="top-content">
        <div class="top-actions">
            {{ HOOK(H_FLEET_NODE_PLAYER_GROUP_TOOLBAR_ACTIONS_START) }}

            <button type="button" class="btn btn-info node-player-group-add item-add">
                <i class="fa fa-layer-group icon-left"></i>
                {{ l.fleet_node_player_group_button_add }}
            </button>

            {% if current_player_group %}
                <a href="{{ url_for('fleet_node_player_group_delete', player_group_id=current_player_group.id) }}"
                   class="btn btn-danger-alt protected">
                    <i class="fa fa-trash"></i>
                </a>
            {% endif %}

            {{ HOOK(H_FLEET_NODE_PLAYER_GROUP_TOOLBAR_ACTIONS_END) }}
        </div>
    </div>

    <div class="alert alert-info tiles-empty empty-flag {% if node_player_groups|length != 0 %}hidden{% endif %}">
        {{ l.node_player_group_panel_empty|replace(
            '%link%',
            ('<a href="javascript:void(0);" class="item-add node-player-group-add">'~l.fleet_node_player_group_button_add~'</a>')|safe
        ) }}
    </div>

    {% if error %}
        <div class="alert alert-danger">
            {{ l[error] }}
        </div>
    {% endif %}

    <div class="bottom-content">
        <div class="page-panel left-panel">
            {% with node_player_groups=node_player_groups %}
                {% include 'fleet/player-group/component/table.jinja.html' %}
            {% endwith %}
        </div>

        <div class="page-content">
            <div class="inner">
                {% if current_player_group %}
                    {% with node_player_groups=node_player_groups %}
                        {% include 'fleet/player-group/component/edit.jinja.html' %}
                    {% endwith %}
                {% else %}
                    <div class="inner-empty empty-flag ">
                        <i class="fa fa-layer-group"></i>
                    </div>
                {% endif %}
            </div>
        </div>
    </div>

    <div class="modals hidden">
        <div class="modals-outer">
            <div class="modals-inner">
                {% include 'fleet/player-group/modal/add.jinja.html' %}
            </div>
        </div>
    </div>

    <div class="pickers hidden">
        <div class="modals-outer">
            <div class="modals-inner">
                {% include 'fleet/node-players/modal/explr-picker.jinja.html' %}
            </div>
        </div>
    </div>
{% endblock %}
