{% load i18n %}

<ul class='nav nav-tabs'>
    <li{% ifequal tab 'tracking' %} class='active'{% endifequal %}>
        <a href="{% url 'stock-item-detail' item.id %}">
            {% trans "Tracking" %}
            {% if item.tracking_info.count > 0 %}<span class='badge'>{{ item.tracking_info.count }}</span>{% endif %}
        </a>
    </li>
    {% if item.part.trackable %}
    <li{% if tab == 'tests' %} class='active'{% endif %}>
        <a href="{% url 'stock-item-test-results' item.id %}">
            {% trans "Test Data" %}
            {% if item.test_results.count > 0 %}<span class='badge'>{{ item.test_results.count }}</span>{% endif %}
        </a>
    </li>
    {% endif %}
    {% if 0 %}
    <!-- These tabs are to be implemented in the future -->
    <li{% ifequal tab 'builds' %} class='active'{% endifequal %}>
        <a href='#'>{% trans "Builds" %}</a>
    </li>
    {% endif %}
    <li{% ifequal tab 'notes' %} class='active'{% endifequal %}>
        <a href="{% url 'stock-item-notes' item.id %}">
            {% trans "Notes" %}
            {% if item.notes %} <span class='fas fa-info-circle'></span>{% endif %}
        </a>
    </li>
    <li{% if tab == 'attachments' %} class='active'{% endif %}>
        <a href="{% url 'stock-item-attachments' item.id %}">
            {% trans "Attachments" %}
            {% if item.attachments.count > 0 %}<span class='badge'>{{ item.attachments.count }}</span>{% endif %}
        </a>
    </li>
    {% if item.child_count > 0 %}
    <li{% ifequal tab 'children' %} class='active'{% endifequal %}>
        <a href="{% url 'stock-item-children' item.id %}">{% trans "Children" %}{% if item.child_count > 0 %}<span class='badge'>{{ item.child_count }}</span>{% endif %}</a>
    </li>
    {% endif %}
    {% if item.part.assembly or item.installedItemCount > 0 %}
    <li {% if tab == 'installed' %} class='active'{% endif %}>
        <a href="{% url 'stock-item-installed' item.id %}">
            {% trans "Installed Items" %}
            {% if item.installedItemCount > 0 %}<span class='badge'>{{ item.installedItemCount }}</span>{% endif %}
        </a>
    </li>
    {% endif %}
</ul>
