{% extends 'commands.html' %}
{% import "bootstrap/wtf.html" as wtf %}

{% set sidebar_state = 'disabled' %}
{% set btn_back = true %}

{% block nav_client %} active{% endblock %}
{% block nav_client_session %} active{% endblock %}
{% block content %}

{% set ip_list = form.ips.data.split(' ') %}
{% set ip_count = ip_list | length %}
<h2 class="mx-5 subhead-heading">
  {{ _('Boot %(ip_count)d client(s) OS', ip_count=ip_count) }}
</h2>

{{ macros.cmd_selected_clients(selected_clients) }}

<p>
{% if os_groups|length > 1 %}
The selected clients have different installed OS:
{% endif %}
</p>

<form class="form-inline" method="POST" id="sessionForm">
    <table class="table table-hover">
        <thead class="thead-light">
            <tr>
                <th>{{ _('Operating System') }}</th>
                <th>{{ _('Clients') }}</th>
            </tr>
        </thead>

        <tbody data-target="partitons-fieldset" id="partitionsTable" class="text-left">
                {{ form.hidden_tag() }}
                {% for os_choice in form.os %}
                    <tr data-toggle="fieldset-entry">
                        <td class="radio-container">
                            {{ os_choice(class_="form-control", required=True) }}
                            <b>{{ os_choice.label.text }}</b>
                        </td>
                        <td>
                            {% for ip in os_groups[os_choice.data] %}<div class="card d-inline-block" style="padding: 5px; margin: 3px;">{{ ip }}</div>{% endfor %}
                        </td>
                    </tr>
                {% endfor %}
        </tbody>
    </table>
    <button class="btn btn-success" form="sessionForm">
        {{ _('Boot') }}
    </button>
</form>

{% endblock %}
