2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-08 04:40:57 +00:00

Created js function to load stock table

- Avoid duplication of code
This commit is contained in:
Oliver Walters
2019-04-17 22:59:52 +10:00
parent 0dc26eec82
commit ba1b8d9181
3 changed files with 71 additions and 104 deletions

View File

@@ -45,50 +45,11 @@
});
});
$("#stock-table").bootstrapTable({
sortable: true,
search: true,
pagination: true,
queryParams: function(p) {
return {
part: {{ part.id }},
in_stock: true,
}
loadStockTable($("#stock-table"), {
params: {
part: {{ part.id }},
},
columns: [
{
field: 'pk',
title: 'ID',
visible: false,
},
{
checkbox: true,
},
{
field: 'location',
title: 'Location',
sortable: true,
formatter: function(value, row, index, field){
return renderLink(value.pathstring, value.url);
}
},
{
field: 'quantity',
title: 'Stock',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
var text = renderLink(value, row.url)
text = text + "<span class='badge'>" + row.status + "</span>";
return text;
}
},
{
field: 'notes',
title: 'Notes',
},
],
url: "{% url 'api-stock-list' %}"
url: "{% url 'api-stock-list' %}",
});
function selectedStock() {