{% extends "telemeta/mediaitem_detail.html" %}
{% load i18n %}
{% load telemeta_utils %}

{% block title %}
<img src="{% url telemeta-images "item.png" %}" style="vertical-align:middle" /> Item : {{ item }}
{% endblock %}

{% block title_buttons %}
<a href="{% url telemeta-item-detail item.public_id %}" class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
{% endblock %}

{% block infos %}    
<div class="infos">
    <form enctype="multipart/form-data" id="_editItemForm" method="post" action="">{% csrf_token %}   
    <table>
    <tr><td colspan="2">{% for error in form.non_field_errors %}<li class="error">{{ error }}</li>{% endfor %}</td></tr>
    {% for field in form %}
    <tr>
    {% if field.html_name == "copied_from_item" %}
        <td>{{ field.label_tag.as_hidden }}{{ field.as_hidden }}</td>
    {% else %}
        <tr><td class="error">{{ field.errors }}</td></tr>
        <td>{{ field.label_tag }}:</td>
            {% if field.html_name == "collection" %}
            <td>&nbsp;{% trans "Title" %} : {{ item.collection.title }}<br />
                &nbsp;{% trans "Code" %} : {{ item.collection.code }}<br />
                {{ field }}</td>
            {% else %}
            <td>{{ field }}</td>
            {% endif %}
    {% endif %}
    </tr>
    {% endfor %}
    </table>
    <div align="center" style="margin-top:3ex;">
    <a href="{% url telemeta-item-detail item.public_id %}"
        class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
    <a href="#" class="component_icon button icon_save" 
onclick="var d=document; d.getElementById('wait-img').style.display='inline'; setTimeout(function(){d.getElementById('_editItemForm').submit();},300); return false;">{% trans "Save" %}</a>
           <img id="wait-img" style="display:none" style="vertical-align:middle" alt="wait" src="{% url telemeta-images  "wait.gif" %}" />
    </div>
    </form>
</div>
{% endblock infos %}

{% block related %} 
{% endblock %}

{% block delete %}
{% endblock %}
