2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 05:46:34 +00:00

Refactor SupplierPartEdit and SupplierPartDelete forms

This commit is contained in:
Oliver Walters
2021-07-18 22:46:23 +10:00
parent 29d7cb40e1
commit 0c91691ed2
11 changed files with 69 additions and 313 deletions

View File

@ -817,18 +817,25 @@
var selections = $("#supplier-part-table").bootstrapTable("getSelections");
var parts = [];
var requests = [];
selections.forEach(function(item) {
parts.push(item.pk);
});
launchModalForm("{% url 'supplier-part-delete' %}", {
data: {
parts: parts,
},
reload: true,
});
showQuestionDialog(
'{% trans "Delete Supplier Parts?" %}',
'{% trans "All selected supplier parts will be deleted" %}',
{
accept: function() {
selections.forEach(function(part) {
var url = `/api/company/part/${part.pk}/`;
requests.push(inventreeDelete(url));
});
$.when.apply($, requests).then(function() {
reloadSupplierPartTable();
});
}
}
);
});
loadSupplierPartTable(