{% extends "base.html" %}

{% load static %}

{% block page_title %}
{% if part %}
InvenTree | Part - {{ part.full_name }}
{% elif category %}
InvenTree | Part Category - {{ category }}
{% else %}
InvenTree | Part List
{% endif %}
{% endblock %}

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

{% block pre_content %}

{% if part %}
{% include "part/cat_link.html" with category=part.category %}
{% else %}
{% include 'part/cat_link.html' with category=category %}
{% endif %}

{% endblock %}

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

{% block js_ready %}
{{ block.super }}

    loadTree("{% url 'api-part-tree' %}",
            "#part-tree",
            {
                name: 'part',
            }
    );

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

    initSideNav();
{% endblock %}