{% extends "base.html" %}
{% load static %}

{% block page_title %}
{% if item %}
InvenTree | Stock Item - {{ item }}
{% elif location %}
InvenTree | Stock Location - {{ location }}
{% else %}
InvenTree | Stock
{% endif %}
{% endblock %}

{% block sidenav %}
<div id='stock-tree'></div>
{% endblock %}

{% block pre_content %}
{% if item %}
{% include 'stock/loc_link.html' with location=item.location %}
{% else %}
{% include 'stock/loc_link.html' with location=location %}
{% endif %}
{% endblock %}

{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
{% endblock %}

{% block js_ready %}
    initSideNav();
{{ block.super }}
    loadTree("{% url 'api-stock-tree' %}",
            "#stock-tree",
            {
                name: 'stock',
            }
    );

    $("#toggle-stock-tree").click(function() {
        toggleSideNav("#sidenav");
        return false;
    })

{% endblock %}