{% load static %}
{% load admin_urls %}
<div class="cell{% if hilight == item.id %} search-hilight{% endif %}">
    {% if item.name %}
        {% if item.metadata.package %}
        <div class="package">{{ item.metadata.package }}</div>
        {% endif %}
        <a href="#" class="title {% if not item.documentation.all %}missing-link{% endif %}" title="{{ item.description }}{% if item.form_factor %}, {{ item.form_factor }}{% endif %}">
            {{ item.name | linebreaksbr }}
        </a>
        <div class="cell-buttons">
            {% if item.documentation.all %}
                <a class="datasheet" href="{{ item.documentation.all.0.file.url }}"><img class="icon" src="{% static "inventory/img/datasheet.svg" %}"></a>
            {% endif %}
            {% if user.is_staff %}
                <a class="edit" href="{% url "admin:inventory_item_change" object_id=item.pk %}"><img class="icon" src="{% static "inventory/img/edit.svg" %}"></a>
            {% endif %}
            <a class="details" href="{% url "item-detail" pk=item.pk %}"><img class="icon" src="{% static "inventory/img/detail.svg" %}"></a>
        </div>

        {% if item.price %}
        <div class="price">{{ item.price | floatformat:2 }} &euro;</div>
        {% endif %}
        {% if item.form_factor %}
        <div class="form_factor">{{ item.form_factor.name }}</div>
        {% endif %}
        {% if item.distributor %}
        <img class="shop" src="{{ item.distributor.icon.url }}" title="{{ item.distributor.name }}">
        {% endif %}
    {% else %}
        <div class="cell-buttons">
            {% if user.is_staff %}
                <a class="edit" href="{% url "admin:inventory_item_add" %}?index={{ item.index }}&container={{ item.container_id }}"><img class="icon" src="{% static "inventory/img/add.svg" %}"></a>
            {% endif %}
        </div>
    {% endif %}
</div>