mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
BOM table fixes
- Reorder columns - Allow proper part name filtering
This commit is contained in:
parent
df227a375c
commit
74c8b6768d
@ -89,11 +89,11 @@ function loadBomTable(table, options) {
|
|||||||
// Part column
|
// Part column
|
||||||
cols.push(
|
cols.push(
|
||||||
{
|
{
|
||||||
field: 'sub_part_detail',
|
field: 'sub_part_detail.full_name',
|
||||||
title: 'Part',
|
title: 'Part',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
return imageHoverIcon(value.image_url) + renderLink(value.full_name, value.url);
|
return imageHoverIcon(row.sub_part_detail.image_url) + renderLink(row.sub_part_detail.full_name, row.sub_part_detail.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -116,28 +116,7 @@ function loadBomTable(table, options) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Part notes
|
if (!options.editable) {
|
||||||
cols.push(
|
|
||||||
{
|
|
||||||
field: 'note',
|
|
||||||
title: 'Notes',
|
|
||||||
searchable: true,
|
|
||||||
sortable: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (options.editable) {
|
|
||||||
cols.push({
|
|
||||||
formatter: function(value, row, index, field) {
|
|
||||||
var bEdit = "<button title='Edit BOM Item' class='btn btn-primary bom-edit-button btn-sm' type='button' url='/part/bom/" + row.pk + "/edit'><span class='glyphicon glyphicon-small glyphicon-pencil'></span></button>";
|
|
||||||
var bDelt = "<button title='Delete BOM Item' class='btn btn-danger bom-delete-button btn-sm' type='button' url='/part/bom/" + row.pk + "/delete'><span class='glyphicon glyphicon-small glyphicon-trash'></span></button>";
|
|
||||||
|
|
||||||
return "<div class='btn-group'>" + bEdit + bDelt + "</div>";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
cols.push(
|
cols.push(
|
||||||
{
|
{
|
||||||
field: 'sub_part_detail.available_stock',
|
field: 'sub_part_detail.available_stock',
|
||||||
@ -162,6 +141,27 @@ function loadBomTable(table, options) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Part notes
|
||||||
|
cols.push(
|
||||||
|
{
|
||||||
|
field: 'note',
|
||||||
|
title: 'Notes',
|
||||||
|
searchable: true,
|
||||||
|
sortable: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (options.editable) {
|
||||||
|
cols.push({
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
var bEdit = "<button title='Edit BOM Item' class='btn btn-primary bom-edit-button btn-sm' type='button' url='/part/bom/" + row.pk + "/edit'><span class='glyphicon glyphicon-small glyphicon-pencil'></span></button>";
|
||||||
|
var bDelt = "<button title='Delete BOM Item' class='btn btn-danger bom-delete-button btn-sm' type='button' url='/part/bom/" + row.pk + "/delete'><span class='glyphicon glyphicon-small glyphicon-trash'></span></button>";
|
||||||
|
|
||||||
|
return "<div class='btn-group'>" + bEdit + bDelt + "</div>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Configure the table (bootstrap-table)
|
// Configure the table (bootstrap-table)
|
||||||
|
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
@ -172,6 +172,7 @@ function loadBomTable(table, options) {
|
|||||||
queryParams: function(p) {
|
queryParams: function(p) {
|
||||||
return {
|
return {
|
||||||
part: options.parent_id,
|
part: options.parent_id,
|
||||||
|
ordering: 'name',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
columns: cols,
|
columns: cols,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user