2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 07:31:10 +00:00

Begin to add views for part models

- List BOM items
- Show category listing as linked items
- Fix some pathing issues with InvenTreeTree class
This commit is contained in:
Oliver
2018-04-13 22:36:59 +10:00
parent 77fe0dc542
commit bd46f66d6b
15 changed files with 182 additions and 25 deletions

View File

@@ -0,0 +1,7 @@
<div id="category-path" background="#99F">
<a href="/part/list/">All</a> >
{% for path_item in category.parentpath %}
<a href="/part/list/?category={{ path_item.id }}">{{ path_item.name }}</a> >
{% endfor %}
<a href="/part/list/?category={{ category.id }}">{{ category.name }}</a>
</div>

View File

@@ -0,0 +1,30 @@
<h1>Part details for {{ part.name }}</h1>
{% include "cat_link.html" with category=part.category %}
<br>
Part name: {{ part.name }}
<br>
Description: {{ part.description }}
<br>
IPN: {% if part.IPN %}{{ part.IPN }}{% else %}N/A{% endif %}
<br>
Stock: {{ part.stock }}
<br><br>
BOM items: {{ part.bomItemCount }}<br>
Used in {{ part.usedInCount }} other parts.<br>
<h2>BOM</h2>
<ul>
{% for bom in part.bom_items.all %}
<li><a href="{% url 'detail' bom.sub_part.id %}">{{ bom.sub_part.name }}</a> ({{ bom.quantity }})</li>
{% endfor %}
</ul>
<h2>Used to make</h2>
<ul>
{% for p in part.used_in.all %}
<li><a href="{% url 'detail' p.part.id %}">{{ p.part.name }}</a></li>
{% endfor %}
</ul>

View File

@@ -0,0 +1,27 @@
<h1>Parts page!</h1>
{% if category %}
{% include "cat_link.html" with category=category %}
<h3>Child categories</h3>
<ul>
{% for child in category.children.all %}
<li><a href="/part/list?category={{ child.id }}">{{ child.name }}</a></li>
{% endfor %}
</ul>
{% else %}
No category!
{% endif %}
<b>Here is a list of all the parts:</b>
<table>
{% for part in parts %}
<tr>
<td><a href="{% url 'detail' part.id %}">{{ part.name }}</a></td>
<td>{{ part.description }}</td>
</tr>
{% endfor %}
</table>