2
0
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:
Oliver
2021-08-04 11:33:20 +10:00
parent 8daf601f00
commit 83d8226ad6
5 changed files with 46 additions and 110 deletions

View File

@ -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}/`;