2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

API endpoint for build list

- Changed part/build table to bootstrap table (ajax)
This commit is contained in:
Oliver Walters
2019-04-16 08:31:43 +10:00
parent 94b280eed3
commit 338a30b50e
4 changed files with 103 additions and 25 deletions

View File

@ -6,34 +6,13 @@
<h3>Part Builds</h3>
<table class='table table-striped'>
<tr>
<th>Title</th>
<th>Quantity</th>
<th>Status</th>
<th>Completion Date</th>
</tr>
{% if part.active_builds|length > 0 %}
<tr>
<td colspan="4"><b>Active Builds</b></td>
</tr>
{% include "part/build_list.html" with builds=part.active_builds %}
{% endif %}
{% if part.inactive_builds|length > 0 %}
<tr><td colspan="4"></td></tr>
<tr>
<td colspan="4"><b>Inactive Builds</b></td>
</tr>
{% include "part/build_list.html" with builds=part.inactive_builds %}
{% endif %}
<div id='button-toolbar'>
<button class="btn btn-success" id='start-build'>Start New Build</button>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='build-table'>
</table>
<div class='container-fluid'>
<button class="btn btn-success" id='start-build'>Start New Build</button>
</div>
{% endblock %}
@ -49,4 +28,43 @@
}
});
});
$("#build-table").bootstrapTable({
sortable: true,
search: true,
pagination: true,
queryParams: function(p) {
return {
part: {{ part.id }},
}
},
columns: [
{
field: 'pk',
title: 'ID',
visible: false,
},
{
field: 'title',
title: 'Title',
formatter: function(value, row, index, field) {
return renderLink(value, row.url);
}
},
{
field: 'quantity',
title: 'Quantity',
},
{
field: 'status',
title: 'Status',
},
{
field: 'completion_date',
title: 'Completed'
}
],
url: "{% url 'api-build-list' %}",
});
{% endblock %}