mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-05 23:08:48 +00:00
Part 'used-in' view now uses API
- Ajax calls to JSON API - BootstrapTable
This commit is contained in:
parent
0f3150c705
commit
49287c0c61
@ -6,19 +6,58 @@
|
|||||||
|
|
||||||
<h3>Used In</h3>
|
<h3>Used In</h3>
|
||||||
|
|
||||||
<table class="table table-striped">
|
{% if part.used_in_count > 0 %}
|
||||||
<tr>
|
|
||||||
<th>Part</th>
|
<p>
|
||||||
<th>Uses</th>
|
<b>{{ part.name }}</b> is used to make {{ part.used_in_count }} other parts.
|
||||||
<th>Description</th>
|
</p>
|
||||||
</tr>
|
|
||||||
{% for item in part.used_in.all %}
|
<table class="table table-striped table-condensed" id='used-table'>
|
||||||
<tr>
|
|
||||||
<td><a href="{% url 'part-bom' item.part.id %}">{{ item.part.name }}</a></td>
|
|
||||||
<td>{{ item.quantity }}</td>
|
|
||||||
<td>{{ item.part.description }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<p>
|
||||||
|
{{ part.name }} is not used to make any other parts.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js_ready %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
$("#used-table").bootstrapTable({
|
||||||
|
sortable: true,
|
||||||
|
search: true,
|
||||||
|
queryParams: function(p) {
|
||||||
|
return {
|
||||||
|
sub_part: {{ part.id }}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'pk',
|
||||||
|
title: 'ID',
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'part',
|
||||||
|
title: 'Part',
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
return renderLink(value.name, value.url);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'part.description',
|
||||||
|
title: 'Description',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'quantity',
|
||||||
|
title: 'Uses',
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
url: "{% url 'api-bom-list' %}"
|
||||||
|
})
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user