mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Part Category now uses menubar display
This commit is contained in:
parent
a0eec930bb
commit
48d2a395de
@ -4,107 +4,109 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
{% if category %}
|
||||
<h3>
|
||||
{{ category.name }}
|
||||
{% 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>
|
||||
<div class='panel panel-default panel-inventree'>
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
{% if category %}
|
||||
<h3>
|
||||
{{ category.name }}
|
||||
{% 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 %}
|
||||
</h3>
|
||||
<p>{{ category.description }}</p>
|
||||
{% else %}
|
||||
<h3>{% trans "Part Categories" %}</h3>
|
||||
<p>{% trans "All parts" %}</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<div class='btn-group action-buttons'>
|
||||
{% if roles.part_category.add %}
|
||||
<button class='btn btn-default' id='cat-create' title='{% trans "Create new part category" %}'>
|
||||
<span class='fas fa-plus-circle icon-green'/>
|
||||
</button>
|
||||
<p>
|
||||
<div class='btn-group action-buttons'>
|
||||
{% if roles.part_category.add %}
|
||||
<button class='btn btn-default' id='cat-create' title='{% trans "Create new part category" %}'>
|
||||
<span class='fas fa-plus-circle icon-green'/>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if category %}
|
||||
{% if roles.part_category.change %}
|
||||
<button class='btn btn-default' id='cat-edit' title='{% trans "Edit part category" %}'>
|
||||
<span class='fas fa-edit icon-blue'/>
|
||||
</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 %}
|
||||
{% if category %}
|
||||
{% if roles.part_category.change %}
|
||||
<button class='btn btn-default' id='cat-edit' title='{% trans "Edit part category" %}'>
|
||||
<span class='fas fa-edit icon-blue'/>
|
||||
</button>
|
||||
{% if category.default_keywords %}
|
||||
<tr>
|
||||
<td><span class='fas fa-key'></span></td>
|
||||
<td>{% trans "Keywords" %}</td>
|
||||
<td>{{ category.default_keywords }}</td>
|
||||
</tr>
|
||||
{% 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>
|
||||
<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>
|
||||
<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 %}
|
||||
{% include "part/subcategories.html" with children=category.children.all collapse_id="categories" %}
|
||||
{% elif children|length > 0 %}
|
||||
{% include "part/subcategories.html" with children=children collapse_id="categories" %}
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% if category and category.children.all|length > 0 %}
|
||||
{% include "part/subcategories.html" with children=category.children.all collapse_id="categories" %}
|
||||
{% elif children|length > 0 %}
|
||||
{% include "part/subcategories.html" with children=children collapse_id="categories" %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div id='button-toolbar'>
|
||||
<div class='btn-group'>
|
||||
@ -132,19 +134,38 @@
|
||||
</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 %}
|
||||
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'>
|
||||
</table>
|
||||
{% endblock category_tables %}
|
||||
|
||||
{% endblock %}
|
||||
{% block js_load %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
enableRightNavbar({
|
||||
minWidth: '50px',
|
||||
});
|
||||
|
||||
|
||||
if (inventreeLoadInt("show-part-cats") == 1) {
|
||||
$("#collapse-item-categories").collapse('show');
|
||||
}
|
||||
|
24
InvenTree/part/templates/part/category_navbar.html
Normal file
24
InvenTree/part/templates/part/category_navbar.html
Normal 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>
|
@ -2,9 +2,15 @@
|
||||
{% load static %}
|
||||
{% 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>
|
||||
|
@ -2,11 +2,15 @@
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block category_tables %}
|
||||
|
||||
{% include 'part/category_tabs.html' with tab='part-list' %}
|
||||
|
||||
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'>
|
||||
</table>
|
||||
|
||||
{% block menubar %}
|
||||
{% include 'part/category_navbar.html' with tab='parts' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
{% trans "Parts" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block details %}
|
||||
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='part-table'>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user