mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-01 06:56:50 +00:00
Refactor part form fields
This commit is contained in:
parent
6d0282519d
commit
a1a07aefd8
@ -137,6 +137,32 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
@override
|
@override
|
||||||
String get URL => "part/";
|
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
|
@override
|
||||||
Map<String, String> defaultListFilters() {
|
Map<String, String> defaultListFilters() {
|
||||||
return {
|
return {
|
||||||
|
@ -226,12 +226,12 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
onSuccess: (data) async {
|
onSuccess: (data) async {
|
||||||
|
|
||||||
if (data.containsKey("pk")) {
|
if (data.containsKey("pk")) {
|
||||||
var new_cat = InvenTreePartCategory.fromJson(data);
|
var cat = InvenTreePartCategory.fromJson(data);
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => CategoryDisplayWidget(new_cat)
|
builder: (context) => CategoryDisplayWidget(cat)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,35 +100,12 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
|
|
||||||
void _editPartDialog(BuildContext context) {
|
void _editPartDialog(BuildContext context) {
|
||||||
|
|
||||||
launchApiForm(
|
part.editForm(
|
||||||
context,
|
context,
|
||||||
L10().editPart,
|
L10().editPart,
|
||||||
part.url,
|
onSuccess: (data) async {
|
||||||
{
|
refresh();
|
||||||
"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();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user