2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Part Category now uses menubar display

This commit is contained in:
Oliver Walters 2021-02-24 21:39:45 +11:00
parent a0eec930bb
commit 48d2a395de
5 changed files with 162 additions and 118 deletions

View File

@ -4,107 +4,109 @@
{% block content %} {% block content %}
<div class='row'> <div class='panel panel-default panel-inventree'>
<div class='col-sm-6'> <div class='row'>
{% if category %} <div class='col-sm-6'>
<h3> {% if category %}
{{ category.name }} <h3>
{% if user.is_staff and roles.part_category.change %} {{ category.name }}
<a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a> {% if user.is_staff and roles.part_category.change %}
<a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ category.description }}</p>
{% else %}
<h3>{% trans "Part Categories" %}</h3>
<p>{% trans "All parts" %}</p>
{% endif %} {% endif %}
</h3> <p>
<p>{{ category.description }}</p> <div class='btn-group action-buttons'>
{% else %} {% if roles.part_category.add %}
<h3>{% trans "Part Categories" %}</h3> <button class='btn btn-default' id='cat-create' title='{% trans "Create new part category" %}'>
<p>{% trans "All parts" %}</p> <span class='fas fa-plus-circle icon-green'/>
{% endif %} </button>
<p> {% endif %}
<div class='btn-group action-buttons'> {% if category %}
{% if roles.part_category.add %} {% if roles.part_category.change %}
<button class='btn btn-default' id='cat-create' title='{% trans "Create new part category" %}'> <button class='btn btn-default' id='cat-edit' title='{% trans "Edit part category" %}'>
<span class='fas fa-plus-circle icon-green'/> <span class='fas fa-edit icon-blue'/>
</button> </button>
{% endif %}
{% if roles.part_category.delete %}
<button class='btn btn-default' id='cat-delete' title='{% trans "Delete part category" %}'>
<span class='fas fa-trash-alt icon-red'/>
</button>
{% endif %}
{% endif %}
</div>
</p>
</div>
<div class='col-sm-6'>
{% if category %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Category Path" %}</td>
<td>{{ category.pathstring }}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Category Description" %}</td>
<td>{{ category.description }}</td>
</tr>
{% if category.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "Default Location" %}</td>
<td><a href="{% url 'stock-location-detail' category.default_location.pk %}">{{ category.default_location.pathstring }}</a></td>
</tr>
{% endif %} {% endif %}
{% if category %} {% if category.default_keywords %}
{% if roles.part_category.change %} <tr>
<button class='btn btn-default' id='cat-edit' title='{% trans "Edit part category" %}'> <td><span class='fas fa-key'></span></td>
<span class='fas fa-edit icon-blue'/> <td>{% trans "Keywords" %}</td>
</button> <td>{{ category.default_keywords }}</td>
</tr>
{% endif %} {% endif %}
{% if roles.part_category.delete %} <tr>
<button class='btn btn-default' id='cat-delete' title='{% trans "Delete part category" %}'> <td><span class='fas fa-sitemap'></span></td>
<span class='fas fa-trash-alt icon-red'/> <td>{% trans "Subcategories" %}</td>
</button> <td>{{ category.children.count }}</td>
{% endif %} </tr>
{% endif %} <tr>
</div> <td><span class='fas fa-shapes'></span></td>
</p> <td>{% trans "Parts (Including subcategories)" %}</td>
<td>{{ category.partcount }}</td>
</tr>
</table>
{% else %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Part Categories" %}</td>
<td>{{ category_count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts" %}</td>
<td>{{ part_count }}</td>
</tr>
</table>
{% endif %}
</div>
</div> </div>
<div class='col-sm-6'>
{% if category %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Category Path" %}</td>
<td>{{ category.pathstring }}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Category Description" %}</td>
<td>{{ category.description }}</td>
</tr>
{% if category.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "Default Location" %}</td>
<td><a href="{% url 'stock-location-detail' category.default_location.pk %}">{{ category.default_location.pathstring }}</a></td>
</tr>
{% endif %}
{% if category.default_keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td>{% trans "Keywords" %}</td>
<td>{{ category.default_keywords }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Subcategories" %}</td>
<td>{{ category.children.count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts (Including subcategories)" %}</td>
<td>{{ category.partcount }}</td>
</tr>
</table>
{% else %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Part Categories" %}</td>
<td>{{ category_count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts" %}</td>
<td>{{ part_count }}</td>
</tr>
</table>
{% endif %}
</div>
</div>
{% if category and category.children.all|length > 0 %} {% if category and category.children.all|length > 0 %}
{% include "part/subcategories.html" with children=category.children.all collapse_id="categories" %} {% include "part/subcategories.html" with children=category.children.all collapse_id="categories" %}
{% elif children|length > 0 %} {% elif children|length > 0 %}
{% include "part/subcategories.html" with children=children collapse_id="categories" %} {% include "part/subcategories.html" with children=children collapse_id="categories" %}
{% endif %} {% endif %}
<hr>
</div>
<div id='button-toolbar'> <div id='button-toolbar'>
<div class='btn-group'> <div class='btn-group'>
@ -132,19 +134,38 @@
</div> </div>
</div> </div>
<div class='panel panel-default panel-inventree'>
<div class='panel-heading'>
<h4>
{% block heading %}
<!-- Heading goes here -->
{% endblock %}
</h4>
</div>
<div class='panel-content'>
{% block details %}
<!-- Content goes here -->
{% endblock %}
</div>
</div>
{% block category_tables %} {% block category_tables %}
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'>
</table>
{% endblock category_tables %} {% endblock category_tables %}
{% endblock %} {% endblock %}
{% block js_load %} {% block js_load %}
{{ block.super }} {{ block.super }}
{% endblock %} {% endblock %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
enableRightNavbar({
minWidth: '50px',
});
if (inventreeLoadInt("show-part-cats") == 1) { if (inventreeLoadInt("show-part-cats") == 1) {
$("#collapse-item-categories").collapse('show'); $("#collapse-item-categories").collapse('show');
} }

View File

@ -0,0 +1,24 @@
{% load i18n %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='category-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<li class='list-group-item {% if tab == "parts" %}active{% endif %}' title='{% trans "Parts" %}'>
<a href='{% url "category-detail" category.id %}'>
<span class='fas fa-shapes'></span>
{% trans "Parts" %}
</a>
</li>
<li class='list-group-item {% if tab == "parameters" %}active{% endif %}' title='{% trans "Parameters" %}'>
<a href='{% url "category-parametric" category.id %}'>
<span class='fas fa-tasks'></span>
{% trans "Parameters" %}
</a>
</li>
</ul>

View File

@ -2,9 +2,15 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% block category_tables %} {% block menubar %}
{% include 'part/category_navbar.html' with tab='parameters' %}
{% endblock %}
{% include 'part/category_tabs.html' with tab='parametric-table' %} {% block heading %}
{% trans "Part Parameters" %}
{% endblock %}
{% block details %}
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='parametric-part-table'> <table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='parametric-part-table'>
</table> </table>

View File

@ -2,11 +2,15 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% block category_tables %} {% block menubar %}
{% include 'part/category_navbar.html' with tab='parts' %}
{% include 'part/category_tabs.html' with tab='part-list' %} {% endblock %}
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'> {% block heading %}
</table> {% trans "Parts" %}
{% endblock %}
{% block details %}
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'>
</table>
{% endblock %} {% endblock %}

View File

@ -1,11 +0,0 @@
{% load i18n %}
{% load inventree_extras %}
<ul class="nav nav-tabs">
<li{% ifequal tab 'part-list' %} class="active"{% endifequal %}>
<a href="{% url 'category-detail' category.id %}">{% trans "Parts" %} <span class="badge">{% decimal part_count %}</span></a>
</li>
<li{% ifequal tab 'parametric-table' %} class='active'{% endifequal %}>
<a href="{% url 'category-parametric' category.id %}">{% trans "Parametric Table" %}</a>
</li>
</ul>