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

{% block left_slot %}
    <h2 class="navigation-title">
        {% trans "Properties" %}
    </h2>
    <div class="navigation-body">
        {% for property in properties %}
            <div>
                <a href="{% url lfs_manage_shop_property property.id %}"
                   class="selectable {% ifequal property.id current_id %}selected{% endifequal %}">
                    {{ property.name }}
                </a>
            </div>
        {% endfor %}
    </div>
{% endblock %}

{% block content %}
    <div class="site-actions">
        <a class="add"
           href="{% url lfs_add_shop_property %}">{% trans 'Add Property' %}</a>
        <a class="delete delete-link"
           dialog_message="{% trans 'Do you really want to delete this property?' %}"
           href="{% url lfs_delete_shop_property property.id %}">{% trans 'Delete Property' %}</a>
    </div>

    <div id="manage-tabs">
        <ul>
            <li class="ui-tabs-nav-item"><a href="#data">{% trans 'Property' %}</a></li>
        </ul>

        <div id="data">
            <h2>{% trans 'Property data' %}</h2>

            <form action="{% url lfs_manage_shop_property property.id %}"
                  method="post">
                {% csrf_token %}
                {% include "manage/lfs_form.html" %}

                <div class="buttons">
                    <input type="submit"
                           class="button"
                           value="{% trans 'Save property' %}">
                </div>
            </form>

            <h2 class="heading-middle">{% trans 'Field type' %}</h2>
            <form action="{% url lfs_update_shop_property_type property.id %}"
                  method="post">
                {% csrf_token %}
                {{ type_form.type }}
                <input type="submit"
                       class="button"
                       value="{% trans 'Save property type' %}">
            </form>
            {% if property.is_select_field %}
                <div id="select_field">
                    {{ select_field|safe }}
                </div>

                <div id="options">
                    {{ options|safe }}
                </div>
            {% endif %}
            {% if display_step_form %}
                <div id="steps">
                    {{ steps|safe }}
                </div>
            {% endif %}
            {% if property.is_number_field %}
                <div id="number_field">
                    {{ number_field|safe }}
                </div>
            {% endif %}
        </div>
    </div>
{% endblock %}