mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 05:46:34 +00:00
Refactor "CreatePartCategory" form to API
(cherry picked from commit 06ff961564
)
This commit is contained in:
@ -14,6 +14,37 @@ function yesNoLabel(value) {
|
||||
}
|
||||
|
||||
|
||||
function categoryFields() {
|
||||
return {
|
||||
parent: {
|
||||
help_text: '{% trans "Parent part category" %}',
|
||||
},
|
||||
name: {},
|
||||
description: {},
|
||||
default_location: {},
|
||||
default_keywords: {
|
||||
icon: 'fa-key',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Edit a PartCategory via the API
|
||||
function editCategory(pk, options={}) {
|
||||
|
||||
var url = `/api/part/category/${pk}/`;
|
||||
|
||||
var fields = categoryFields();
|
||||
|
||||
constructForm(url, {
|
||||
fields: fields,
|
||||
title: '{% trans "Edit Part Category" %}',
|
||||
reload: true,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function editPart(pk, options={}) {
|
||||
|
||||
var url = `/api/part/${pk}/`;
|
||||
|
Reference in New Issue
Block a user