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

{% block content %}

    <ul class="breadcrumbs el">
        <li><a href="/admin/">Admin</a> /</li>
        <li class="end">Bundle Type</li>
    </ul>

    <h1>{{ title }}</h1>

    <ul class="tabnav el">
        <li class="{{ selected_tab == 'manage' ? 'selected' : '' }}">
            <a href="{{ route('admin-bundle-types') }}">All</a>
        </li>
        <li class="{{ selected_tab == 'edit' ? 'selected' : '' }}">
            <a href="">Edit</a>
        </li>
    </ul>

    {% include 'admin/messages.twig' %}

    <form action="" method="POST" class="style">

        <fieldset class="show">
            <h1>
                <a class="show el">
                    Edit
                    <i class="fa fa-caret-right"></i>
                </a>
            </h1>

            {{ form_field({
                'type': 'select',
                'name': 'assessment_form_id',
                'label': 'Assessment form',
                'values': allowed_forms,
                'value': bundle_type.assessment_form_id,
            }) }}

            <button type="submit" name="button_pressed" value="save"  class="btn">
                Save
            </button>

        </fieldset>

        <fieldset class="show">
            <h1><a class="show el">Manage items<i class="fa fa-caret-right"></i></a></h1>

            {{ form_field({
                'type': 'select',
                'name': 'item_id',
                'label': 'Products',
                'values': allowed_items,
            }) }}

            <button type="submit" name="button_pressed" value="add_single_item"  class="btn">
                Add single item
            </button>


            {{ form_field({
                'type': 'select',
                'name': 'category_id',
                'label': 'Categories',
                'values': allowed_categories,
            }) }}

            <button type="submit" name="button_pressed" value="add_category_items" class="btn">
                Add all items from category
            </button>

        </fieldset>


        <fieldset class="show">
            <h1><a class="show el">Items<i class="fa fa-caret-right"></i></a></h1>

            {% include 'admin/bundle_type_edit__items.twig' with {
                'items': bundle_type.items,
                'delete_route_name': 'admin-bundle-types-items-delete',
            } %}

        </fieldset>


    </form>

{% endblock %}
