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