{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block javascript %}
{{ super() }}
<script type="text/javascript">
    $(function () {
        $('#formtabs a:first').tab('show');
    });
</script>
{% endblock %}

{% block content %}
<div>
    <h3>Client Configuration</h3>

    <p>
        You can use the tabs below to customize your new Client configuration. When you're done,
        click on the generate button.
    </p>
</div>

<form action="" method="post" class="form form-horizontal">
    {{ form.hidden_tag() }}
    {{ macros.form_errors(form, 'only') }}
    <div class="tabbable tabs-left">
        <ul class="nav nav-tabs" id="formtabs">
            <li><a href="#general" data-toggle="tab">General</a></li>
            <li><a href="#http" data-toggle="tab">HTTP</a></li>
            <li><a href="#https" data-toggle="tab">HTTPs</a></li>
            <li><a href="#ftp" data-toggle="tab">FTP</a></li>
            <li><a href="#smtp" data-toggle="tab">SMTP</a></li>
            <li><a href="#vnc" data-toggle="tab">VNC</a></li>
            <li><a href="#telnet" data-toggle="tab">Telnet</a></li>
            <li><a href="#pop3" data-toggle="tab">POP3</a></li>
            <li><a href="#pop3" data-toggle="tab">POP3s</a></li>
            <li><a href="#ssh" data-toggle="tab">SSH</a></li>
        </ul>

        <div class="tab-content">
            <div id="general" class="tab-pane">
                <fieldset>
                    <legend>General Options</legend>
                    {% for field in [form.general__name] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="http" class="tab-pane">
                <fieldset>
                    <legend>HTTP Options</legend>
                    {% for field in [form.bait_timings__http__active_range, form.bait_timings__http__sleep_interval,
                    form.bait_timings__http__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="https" class="tab-pane">
                <fieldset>
                    <legend>HTTPs Options</legend>
                    {% for field in [form.bait_timings__https__active_range, form.bait_timings__https__sleep_interval,
                    form.bait_timings__https__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="ftp" class="tab-pane">
                <fieldset>
                    <legend>FTP Options</legend>
                    {% for field in [form.bait_timings__ftp__active_range, form.bait_timings__ftp__sleep_interval,
                    form.bait_timings__ftp__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="smtp" class="tab-pane">
                <fieldset>
                    <legend>SMTP Options</legend>
                    {% for field in [form.bait_timings__smtp__active_range, form.bait_timings__smtp__sleep_interval,
                    form.bait_timings__smtp__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="vnc" class="tab-pane">
                <fieldset>
                    <legend>VNC Options</legend>
                    {% for field in [form.bait_timings__vnc__active_range, form.bait_timings__vnc__sleep_interval,
                    form.bait_timings__vnc__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="telnet" class="tab-pane">
                <fieldset>
                    <legend>Telnet Options</legend>
                    {% for field in [form.bait_timings__telnet__active_range, form.bait_timings__telnet__sleep_interval,
                    form.bait_timings__telnet__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="pop3" class="tab-pane">
                <fieldset>
                    <legend>POP3 Options</legend>
                    {% for field in [form.bait_timings__pop3__active_range, form.bait_timings__pop3__sleep_interval,
                    form.bait_timings__pop3__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="pop3s" class="tab-pane">
                <fieldset>
                    <legend>POP3s Options</legend>
                    {% for field in [form.bait_timings__pop3s__active_range, form.bait_timings__pop3s__sleep_interval,
                    form.bait_timings__pop3s__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>

            <div id="ssh" class="tab-pane">
                <fieldset>
                    <legend>SSH Options</legend>
                    {% for field in [form.bait_timings__ssh__active_range, form.bait_timings__ssh__sleep_interval,
                    form.bait_timings__ssh__activation_probability] %}
                    {% if not field|bootstrap_is_hidden_field %}
                    {{ macros.horizontal_field(field) }}
                    {%- endif %}
                    {% endfor %}
                </fieldset>
            </div>
        </div>
    </div>
    <hr>
    <div class="controls">
        <button name="submit" type="submit" class="btn btn-primary">Generate</button>
    </div>
</form>
{% endblock content %}
