Added part API

- Build allocation table now makes use of this API
- Further steps towards allocation table
This commit is contained in:
Oliver 2018-05-12 12:44:29 +10:00
parent 1b9c98ae3e
commit ceea053368
2 changed files with 32 additions and 1 deletions

View File

@ -14,6 +14,12 @@
{% endblock %}
{% block js_load %}
{{ block.super }}
<script src="{% static 'script/inventree/api.js' %}"></script>
<script src="{% static 'script/inventree/part.js' %}"></script>
{% endblock %}
{% block js_ready %}
{{ block.super }}
@ -21,15 +27,21 @@
sortable: true,
columns: [
{
field: 'sub_part.name',
title: 'Part',
},
{
title: 'Source',
},
{
field: 'quantity',
title: 'Quantity',
}
]
],
});
getBomList({part: {{ build.part.id }}}).then(function(response) {
$("#build-table").bootstrapTable('load', response);
});
{% endblock %}

View File

@ -0,0 +1,19 @@
/* Part API functions
* Requires api.js to be loaded first
*/
function getPartCategoryList(filters={}, options={}) {
return inventreeGet('/api/part/category/', filters, options);
}
function getSupplierPartList(filters={}, options={}) {
return inventreeGet('/api/part/supplier/', filters, options);
}
function getPartList(filters={}, options={}) {
return inventreeGet('/api/part/', filters, options);
}
function getBomList(filters={}, options={}) {
return inventreeGet('/api/part/bom/', filters, options);
}