2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 05:46:34 +00:00

Add detail pane to top-level part view

This commit is contained in:
Oliver Walters
2019-09-27 10:04:20 +10:00
parent 3e2a5263a5
commit 427f47310b
5 changed files with 183 additions and 36 deletions

View File

@ -1,5 +1,6 @@
{% extends "part/part_app_base.html" %}
{% load static %}
{% load i18n %}
{% block content %}
@ -9,8 +10,8 @@
<h3>{{ category.name }}</h3>
<p>{{ category.description }}</p>
{% else %}
<h3>Part Categories</h3>
<p>All parts</p>
<h3>{% trans "Part Categories" %}</h3>
<p>{% trans "All parts" %}</p>
{% endif %}
<p>
<div class='btn-group'>
@ -30,37 +31,49 @@
</div>
<div class='col-sm-6'>
{% if category %}
<h3>Category Details</h3>
<h3>{% trans "Category Details" %}</h3>
<table class='table table-condensed table-striped'>
<tr>
<td>Category Path</td>
<td>{% trans "Category Path" %}</td>
<td>{{ category.pathstring }}</td>
</tr>
<tr>
<td>Category Description</td>
<td>{% trans "Category Description" %}</td>
<td>{{ category.description }}</td>
</tr>
{% if category.default_location %}
<tr>
<td>Default Location</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>Keywords</td>
<td>{% trans "Keywords" %}</td>
<td>{{ category.default_keywords }}</td>
</tr>
{% endif %}
<tr>
<td>Subcategories</td>
<td>{% trans "Subcategories" %}</td>
<td>{{ category.children.count }}</td>
</tr>
<tr>
<td>Parts (Including subcategories)</td>
<td>{% trans "Parts (Including subcategories)" %}</td>
<td>{{ category.partcount }}</td>
</tr>
</table>
{% else %}
<h3>{% trans "Part Details" %}</h3>
<table class='table table-striped table-condensed'>
<tr>
<td>{% trans "Part Categories" %}</td>
<td>{{ category_count }}</td>
</tr>
<tr>
<td>{% trans "Parts" %}</td>
<td>{{ part_count }}</td>
</tr>
</table>
{% endif %}
</div>
</div>

View File

@ -56,6 +56,8 @@ class PartIndex(ListView):
children = PartCategory.objects.filter(parent=None)
context['children'] = children
context['category_count'] = PartCategory.objects.count()
context['part_count'] = Part.objects.count()
return context