mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-30 22:46:49 +00:00
Refactor part form fields
This commit is contained in:
parent
6d0282519d
commit
a1a07aefd8
@ -137,6 +137,32 @@ class InvenTreePart extends InvenTreeModel {
|
||||
@override
|
||||
String get URL => "part/";
|
||||
|
||||
@override
|
||||
Map<String, dynamic> formFields() {
|
||||
return {
|
||||
"name": {},
|
||||
"description": {},
|
||||
"IPN": {},
|
||||
"revision": {},
|
||||
"keywords": {},
|
||||
"link": {},
|
||||
|
||||
// Parent category
|
||||
"category": {
|
||||
},
|
||||
|
||||
// Checkbox fields
|
||||
"active": {},
|
||||
"assembly": {},
|
||||
"component": {},
|
||||
"purchaseable": {},
|
||||
"salable": {},
|
||||
"trackable": {},
|
||||
"is_template": {},
|
||||
"virtual": {},
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> defaultListFilters() {
|
||||
return {
|
||||
|
@ -226,12 +226,12 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||
onSuccess: (data) async {
|
||||
|
||||
if (data.containsKey("pk")) {
|
||||
var new_cat = InvenTreePartCategory.fromJson(data);
|
||||
var cat = InvenTreePartCategory.fromJson(data);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CategoryDisplayWidget(new_cat)
|
||||
builder: (context) => CategoryDisplayWidget(cat)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
|
@ -100,35 +100,12 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
|
||||
void _editPartDialog(BuildContext context) {
|
||||
|
||||
launchApiForm(
|
||||
context,
|
||||
L10().editPart,
|
||||
part.url,
|
||||
{
|
||||
"name": {},
|
||||
"description": {},
|
||||
"IPN": {},
|
||||
"revision": {},
|
||||
"keywords": {},
|
||||
"link": {},
|
||||
|
||||
"category": {
|
||||
},
|
||||
|
||||
// Checkbox fields
|
||||
"active": {},
|
||||
"assembly": {},
|
||||
"component": {},
|
||||
"purchaseable": {},
|
||||
"salable": {},
|
||||
"trackable": {},
|
||||
"is_template": {},
|
||||
"virtual": {},
|
||||
},
|
||||
modelData: part.jsondata,
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
},
|
||||
part.editForm(
|
||||
context,
|
||||
L10().editPart,
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user