2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

Move javascript for Build allocation to build.js

This commit is contained in:
Oliver Walters
2019-04-30 14:42:48 +10:00
parent a3d4c81939
commit aa491e336d
2 changed files with 112 additions and 48 deletions

View File

@ -24,53 +24,11 @@
{% block js_ready %}
{{ block.super }}
function makeInnerTable(pk) {
var table = "<table class='table table-striped' id='part-table-" + pk + "'></table>";
return table;
}
$('#build-table').bootstrapTable({
sortable: true,
detailView: true,
detailFormatter: function(index, row, element) {
return makeInnerTable(row.pk);
},
onExpandRow: function(index, row, $detail) {
$('#part-table-' + row.pk).bootstrapTable({
columns: [
{
field: 'stock_item_detail.location_name',
title: 'Location',
},
{
field: 'stock_item_detail.quantity',
title: 'Available',
},
{
field: 'quantity',
title: 'Allocated',
},
],
url: "/api/build/item/?build={{ build.pk }}&part=" + row.sub_part,
});
},
columns: [
{
field: 'sub_part_detail.name',
title: 'Part',
},
{
title: 'Source',
},
{
field: 'quantity',
title: 'Quantity',
},
],
});
getBomList({part: {{ build.part.id }}}).then(function(response) {
$("#build-table").bootstrapTable('load', response);
});
makeBuildTable($('#build-table'),
{
build: {{ build.pk }},
part: {{ build.part.pk }},
}
);
{% endblock %}