2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 11:40:58 +00:00

Converting more forms to the API (#3181)

* Delete category via the API

* Delete StockLocation via the API

* Delete StockItem via the API

- Removes the final instance of AjaxDelete

* Remove URL path

* Add missing code
This commit is contained in:
Oliver
2022-06-11 21:53:26 +10:00
committed by GitHub
parent 63f1e58ca9
commit 090f4f4387
14 changed files with 100 additions and 249 deletions

View File

@ -21,6 +21,7 @@
/* exported
deletePart,
deletePartCategory,
duplicateBom,
duplicatePart,
editCategory,
@ -317,7 +318,31 @@ function editCategory(pk) {
title: '{% trans "Edit Part Category" %}',
reload: true,
});
}
/*
* Delete a PartCategory via the API
*/
function deletePartCategory(pk, options={}) {
var url = `/api/part/category/${pk}/`;
var html = `
<div class='alert alert-block alert-danger'>
{% trans "Are you sure you want to delete this part category?" %}
<ul>
<li>{% trans "Any child categories will be moved to the parent of this category" %}</li>
<li>{% trans "Any parts in this category will be moved to the parent of this category" %}</li>
</ul>
</div>`;
constructForm(url, {
title: '{% trans "Delete Part Category" %}',
method: 'DELETE',
preFormContent: html,
onSuccess: function(response) {
handleFormSuccess(response, options);
}
});
}