{% extends "layout-3-col.html" %}

{% block title %}Заказ книг — Яндекс.Библиотека{% endblock %}
{% block l-page %}l-page_add{% endblock %}
{% block rightcolumn %}{% include 'orders/request-help.html' %}{% endblock %}

{% block add_request_link %}<lego:item current=""><lego:text>Заказать книги</lego:text></lego:item>{% endblock %}

{% block content %}
<lego:b-page-title>
    <lego:title>Заказ книг</lego:title>
</lego:b-page-title>

<form class="b-add-request" onclick="return {}" action="{% url add_request %}" method="post">
    {{ request_fset.management_form }}
    {{ book_fset.management_form }}
    {% for rform in request_fset.forms %}
        {% for hidden in rform.hidden_fields %}
            {{ hidden }}
        {% endfor %}
    {% endfor %}
    <div class="books-section">
        {% for book_form in book_fset.forms %}
            {% include 'orders/one-book-request-form.html' %}
        {% endfor %}
    </div>

    <div>
        <a class="b-pseudo-link add-more-books">Добавить ещё книгу в заказ</a>&nbsp;
        {% with request_fset.forms.0 as request_form %}
            <label class="section">
                <span class="label">{{ request_form.delivery_office.label }}:</span>
                {{ request_form.delivery_office }}
                <div class="help-text">{{ request_form.delivery_office.help_text }}</div>
            </label>
            {% if showerrors %}{{ request_form.delivery_office.errors }}{% endif %}

            <label class="section js-owner js-autocomplete_staff" style="display: none;">
                <span class="label">{{ request_form.approve_man.label }}:</span>
                {{ request_form.approve_man }}
                <div class="help-text" style="display: none;">{{ request_form.approve_man.help_text }}</div>
            </label>
        {% endwith %}
        </div>

        <input class="submit" type="submit" value="Заказать" />
    </div>
</form>
{% endblock %}