{% extends "manage/manage_base.html" %}
{% load i18n %}

{% block section %}factory{% endblock %}

{% block left_slot %}
    <div class="navigation-left-title">
        {% trans "Manufacturer" %}
    </div>
    <div id="selectable-factories-inline">
        {{ selectable_manufacturers_inline|safe }}
    </div>
{% endblock %}

{% block content %}

    <div class="site-actions">
        <a class="add"
           href="{% url lfs_manufacturer_add_manufacturer %}">
           {% trans 'Add Manufacturer' %}</a>


        <a class="delete confirmation-link"
           data="{% trans 'Delete?' %}"
           href="{% url lfs_manufacturer_delete_manufacturer manufacturer_id %}">
           {% trans 'Delete Manufacturer' %}</a>

    </div>

    <div id="manage-tabs">
        <ul>
            <li class="ui-tabs-nav-item"><a href="#data">{% trans 'Manufacturer' %}</a></li>
            <li class="ui-tabs-nav-item"><a href="#products">{% trans 'Product selection' %}</a></li>
        </ul>
        
        <div id="data">
            {{ manufacturer_data_inline|safe }}
        </div>
        
        <div id="products">
            <ul id="factory-tree-root"
                style="list-style-type: none">

                {% for category in categories %}
                    <li class="category {{ category.klass }}"
                        data="{% url lfs_manufacturer_category_state manufacturer_id category.id %}">
                        <input id="factory-category-input-{{ category.id }}"
                               class="export-category-input"
                               type="checkbox"
                               data="{% url lfs_manufacturer_edit_category manufacturer_id category.id %}"
                               {% if category.checked %}checked="checked"{% endif %} />

                        <a class="category-ajax-link collapsed"
                           id="{{ category.id }}"
                           href="{% url lfs_manufacturer_inline manufacturer_id category.id %}">
                            {{ category.name }}
                        </a>
                        <span class="category-state" id="category-state-{{ category.id }}">
                            {% ifequal category.klass "half" %}(1/2){% endifequal %}
                        </span>
                        <div id="sub-categories-{{ category.id }}"></div>
                    </li>
                {% endfor %}
            </ul>
        </div>
{% endblock %}
