{% extends "part/part_app_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %} {% block sidebar %} {% include 'part/category_sidebar.html' %} {% endblock sidebar %} {% block breadcrumb_tree %} {% endblock breadcrumb_tree %} {% block heading %} {% if category %} {% trans "Part Category" %}: {{ category.name }} {% else %} {% trans "Parts" %} {% endif %} {% endblock heading %} {% block actions %} {% if category %} {% admin_url user "part.partcategory" category.pk as url %} {% include "admin_button.html" with url=url %} {% endif %} {% settings_value "STOCKTAKE_ENABLE" as stocktake_enable %} {% if stocktake_enable and roles.stocktake.add %} {% endif %} {% if category %} {% if starred_directly %} {% elif starred %} {% else %} {% endif %} {% if roles.part_category.change or roles.part_category.delete %}
{% endif %} {% endif %} {% endblock actions %} {% block details_left %} {% if category %} {% if category.description %} {% endif %} {% if category.default_keywords %} {% endif %} {% else %} {% endif %}
{% trans "Description" %} {{ category.description }}
{% trans "Category Path" %} {{ category.pathstring }}
{% trans "Keywords" %} {{ category.default_keywords }}
{% trans "Category Path" %} {% trans "Top level part category" %}
{% endblock details_left %} {% block details_right %} {% if category %} {% if category.default_location %} {% endif %}
{% trans "Default Location" %} {{ category.default_location.pathstring }}
{% trans "Subcategories" %} {{ category.children.count }}
{% trans "Parts (Including subcategories)" %} {{ category.partcount }}
{% else %}
{% trans "Part Categories" %} {{ category_count }}
{% trans "Parts" %} {{ part_count }}
{% endif %} {% endblock details_right %} {% block page_content %} {% if messages %} {% for message in messages %}
{{ message|safe }}
{% endfor %} {% endif %}

{% trans "Parts" %}

{% include "spacer.html" %}
{% if roles.part.add %} {% endif %}
{% include "filter_list.html" with id="parts" %}

{% trans "Stock Items" %}

{% include "stock_table.html" %}

{% trans "Part Parameters" %}

{% include "filter_list.html" with id="parameters" %}

{% trans "Subcategories" %}

{% include "spacer.html" %}
{% if roles.part_category.add %} {% endif %}
{% include "filter_list.html" with id="category" %}
{% endblock page_content %} {% block js_load %} {{ block.super }} {% endblock js_load %} {% block js_ready %} {{ block.super }} loadApiIconPacks().then(() => { $('#category-icon').addClass(getApiIconClass('{{ category.icon }}')); }); {% settings_value "STOCKTAKE_ENABLE" as stocktake_enable %} {% if stocktake_enable and roles.stocktake.add %} $('#category-stocktake').click(function() { generateStocktakeReport({ category: { {% if category %}value: {{ category.pk }},{% endif %} tree_picker: { url: '{% url "api-part-category-tree" %}', }, }, location: { tree_picker: { url: '{% url "api-location-tree" %}', }, }, generate_report: {}, update_parts: {}, }); }); {% endif %} {% if category %} onPanelLoad('stock', function() { loadStockTable( $('#stock-table'), { params: { category: {{ category.pk }}, part_detail: true, location_detail: true, supplier_part_detail: true, } } ); }); $("#toggle-starred").click(function() { toggleStar({ url: '{% url "api-part-category-detail" category.pk %}', button: '#category-star-icon' }); }); {% endif %} onPanelLoad('parameters', function() { loadParametricPartTable( "#parametric-part-table", { params: { {% if category %} category: {{ category.pk }}, {% endif %} }, } ); }); // Enable breadcrumb tree view enableBreadcrumbTree({ label: 'category', url: '{% url "api-part-category-tree" %}', {% if category %} selected: {{ category.pk }}, {% endif %} processNode: function(node) { node.text = node.name; node.href = `/part/category/${node.pk}/`; return node; }, }); onPanelLoad('subcategories', function() { loadPartCategoryTable( $('#subcategory-table'), { params: { {% if category %} parent: {{ category.pk }}, {% else %} top_level: true, {% endif %} }, allowTreeView: true, } ); }); $("#cat-create").click(function() { createPartCategory({ {% if category %}parent: {{ category.pk }},{% endif %} }); }); {% if roles.part.add %} $("#part-create").click(function() { createPart({ {% if category %}category: {{ category.pk }},{% endif %} }); }); {% endif %} {% if category %} $("#cat-edit").click(function () { editCategory({{ category.pk }}); }); $('#cat-delete').click(function() { deletePartCategory({{ category.pk }}, { {% if category.parent %} redirect: "{% url 'category-detail' category.parent.id %}", {% else %} redirect: "{% url 'part-index' %}", {% endif %} }); }); {% endif %} onPanelLoad('parts', function() { loadPartTable( "#part-table", "{% url 'api-part-list' %}", { params: { {% if category %}category: {{ category.id }}, {% else %}category: "null", {% endif %} }, checkbox: true, gridView: true, }, ); }); // Enable left-hand navigation sidebar enableSidebar('category'); {% endblock js_ready %}