{% extends 'layouts/admin.twig' %}

{% block content %}
<style>
    .categoriesTable {
        width: auto;
    }
    .categoriesTable td {
        padding-right: 20px;
    }
    form .row .categoriesTable label {
        display: inline;
        float: none;
        width: auto;
        font-weight: normal;
    }
</style>
    <ul class="breadcrumbs el">
        <li><a href="/admin/">Admin</a> /</li>
        <li class="end">{{ title }}</li>
    </ul>

    <h1>{{ title }}</h1>
    {% if success is not empty %}
    <div class="success">
        {{ success }}
    </div>
    {% endif %}

    <form action="" method="POST" class="style">
        <fieldset class="">
            <h1>
                <a class="show el">
                    Settings <i class="fa fa-caret-right"></i>
                </a>
            </h1>
            {% for key, value in wisebeeSettings %}
            <div class="row">
                <label for="setting_{{ key }}">
                    {{ wisebeeSettingsDefaults[key].title }}
                </label>
                <input type="checkbox"
                       value="1"
                       name="settings[{{ key }}]"
                       id="setting_{{ key }}"
                       {{ value == 1 ? 'checked' : '' }}
                />
            </div>
            {% endfor %}
        </fieldset>
        <fieldset class="">
            <h1>
                <a class="el">
                    Categories with consultation <i class="fa fa-caret-right"></i>
                </a>
            </h1>
            <div class="row">
                <table class="categoriesTable">
                    <tr>
                        <th>
                            Category
                        </th>
                        <th>
                            Consultation required
                        </th>
                    </tr>
                    {% for category in categories %}
                        <tr>
                            <td>
                                <label for="category_{{ category.id }}">
                                    {{ category.intended_name }}
                                </label>
                            </td>
                            <td>
                                <input type="checkbox"
                                       value="{{ category.id }}"
                                       id="category_{{ category.id }}"
                                       name="categories[]"
                                       {{ category.required ? 'checked' : '' }}
                                />
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>

            <div class="search-button">
                <input type="submit" value="Save" class="BUTTON"/>
            </div>
        </fieldset>
    </form>

{% endblock %}