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:
@ -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 %}
|
Reference in New Issue
Block a user