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

{% block title %}{% trans "Manage Product" %}{% endblock %}
{% block section %}manage-product{% endblock %}

{% block left_slot %}
    <form action="{% url lfs_set_product_name_filter %}"
          method="post">

        <input type="text"
               name="name"
               class="refresh-on-keyup"
               style="width:100%"
               onKeyPress="return disable_enter_key()"
               value="{{ name_filter_value }}" />

        <input type="hidden"
               name="product-id"
               value="{{ product.id }}" />
    </form>

    <div id="pages-inline">
        {{ pages_inline|safe }}
    </div>

    <div class="navigation-body"
         id="selectable-products-inline">
        {{ selectable_products }}
    </div>
{% endblock %}

{% block content %}
    <div id="product">
        <div class="site-actions">
            {% if product.is_variant %}
                <a class="overview"
                   href="{% url lfs_manage_product product.parent.id %}">
                    {% trans "Base Article" %}
                </a>
            {% endif %}

            <a class="add"
               href="{% url lfs_manage_add_product %}">
                {% trans 'Add Product' %}
            </a>

            <a class="delete delete-link"
               href="{% url lfs_manage_delete_product product.id %}"
               dialog_message='{% trans "Do you really want to delete this product?" %}'>
               {% trans 'Delete Product' %}
            </a>

            <a class="view popup-link"
               href="{% url lfs.manage.views.product_by_id product.id %}">
               {% trans 'View Product' %}
            </a>

            <a class="goto"
               href="{% url lfs.manage.views.product_by_id product.id %}">
               {% trans 'Goto Product' %}
            </a>


            {% if not product.is_variant %}
                <form style="display:inline; padding-left:15px"
                      action="{% url lfs_change_product_subtype product.id %}"
                      method="post">

                    {% csrf_token %}
                    {{ form.sub_type }}

                    <input type="submit"
                           value="{% trans 'Change' %}" />
                </form>

            <img class="ajax-loading" src="{{ STATIC_URL }}img/ajax-loader.gif" alt="" style="padding:0; margin:0" />

            {% endif %}
        </div>
        <div id="product-tabs">
            <ul>
                <li>
                    {% if product.get_name %}
                        <a href="#data">{{ product.get_name }}</a>
                    {% else %}
                        <a href="#data">{% trans "Product" %}</a>
                    {% endif %}
                </li>

                {% if not product.is_variant %}
                    <li><a href="{% url lfs_product_categories_tab product.id %}">{% trans 'Categories' %}</a></li>
                {% endif %}

                <li><a href="#images">{% trans 'Images' %}</a></li>

                {% if product.is_product_with_variants %}
                    <li class="ui-tabs-nav-item"><a href="{% url lfs_manage_product_variants_tab product.id %}">{% trans 'Variants' %}</a></li>
                {% endif %}

                <li><a href="{% url lfs_manage_product_accessories_tab product.id %}">{% trans 'Accessories' %}</a></li>
                <li><a href="{% url lfs_manage_product_related_products_tab product.id %}">{% trans 'Related Products' %}</a></li>
                <li><a href="#stock">{% trans 'Stock' %}</a></li>
                <li><a href="#seo">{% trans 'SEO' %}</a></li>
                <li><a href="#portlets">{% trans 'Portlets' %}</a></li>
                <li><a href="#properties">{% trans 'Properties' %}</a></li>
            </ul>

            <div id="data">
                {{ product_data|safe }}
            </div>

            <div id="images">
                {{ images|safe }}
            </div>

            <div id="stock">
                {{ stock|safe }}
            </div>

            <div id="seo">
                {{ seo|safe }}
            </div>

            <div id="properties">
                {{ properties|safe }}
            </div>

            <div id="portlets">
                {{ portlets|safe }}
            </div>

        </div>
    </div>
{% endblock %}