mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
BOM: Allow multiple BOM items to be selected and deleted
(in editing mode)
This commit is contained in:
parent
7a7db97914
commit
57e395de71
@ -90,6 +90,48 @@
|
||||
location.href = "{% url 'part-bom' part.id %}";
|
||||
});
|
||||
|
||||
$('#bom-item-delete').click(function() {
|
||||
|
||||
// Get a list of the selected BOM items
|
||||
var rows = $("#bom-table").bootstrapTable('getSelections');
|
||||
|
||||
// TODO - In the future, display (in the dialog) which items are going to be deleted
|
||||
|
||||
showQuestionDialog(
|
||||
'{% trans "Delete selected BOM items?" %}',
|
||||
'{% trans "All selected BOM items will be deleted" %}',
|
||||
{
|
||||
accept: function() {
|
||||
|
||||
// Delete each row one at a time!
|
||||
function deleteRow(idx) {
|
||||
|
||||
if (idx >= rows.length) {
|
||||
// All selected rows deleted - reload the table
|
||||
$("#bom-table").bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
var row = rows[idx];
|
||||
|
||||
var url = `/api/bom/${row.pk}/`;
|
||||
|
||||
inventreeDelete(
|
||||
url,
|
||||
{
|
||||
complete: function(xhr, status) {
|
||||
deleteRow(idx + 1);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Start the deletion!
|
||||
deleteRow(0);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('#bom-upload').click(function() {
|
||||
location.href = "{% url 'upload-bom' part.id %}";
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user