mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
API forms return the JSON data to the onSuccess function
This commit is contained in:
parent
67ccbf64b5
commit
6d0282519d
9 changed files with 107 additions and 31 deletions
|
|
@ -67,7 +67,13 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||
return;
|
||||
}
|
||||
|
||||
_cat.editForm(context, L10().editCategory, onSuccess: refresh);
|
||||
_cat.editForm(
|
||||
context,
|
||||
L10().editCategory,
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
_CategoryDisplayState(this.category);
|
||||
|
|
@ -211,14 +217,27 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||
|
||||
int pk = category?.pk ?? -1;
|
||||
|
||||
launchApiForm(
|
||||
context,
|
||||
L10().categoryCreate,
|
||||
InvenTreePartCategory().URL,
|
||||
InvenTreePartCategory().formFields(),
|
||||
modelData: {
|
||||
"parent": (pk > 0) ? pk : null,
|
||||
InvenTreePartCategory().createForm(
|
||||
context,
|
||||
L10().categoryCreate,
|
||||
data: {
|
||||
"parent": (pk > 0) ? pk : null,
|
||||
},
|
||||
onSuccess: (data) async {
|
||||
|
||||
if (data.containsKey("pk")) {
|
||||
var new_cat = InvenTreePartCategory.fromJson(data);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CategoryDisplayWidget(new_cat)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,9 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||
"currency": {},
|
||||
},
|
||||
modelData: company.jsondata,
|
||||
onSuccess: refresh
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||
"parent": {},
|
||||
},
|
||||
modelData: _loc.jsondata,
|
||||
onSuccess: refresh
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,9 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||
"virtual": {},
|
||||
},
|
||||
modelData: part.jsondata,
|
||||
onSuccess: refresh,
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class _PartNotesState extends RefreshableState<PartNotesWidget> {
|
|||
}
|
||||
},
|
||||
modelData: part.jsondata,
|
||||
onSuccess: () async {
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||
"link": {},
|
||||
},
|
||||
modelData: item.jsondata,
|
||||
onSuccess: refresh
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class _StockNotesState extends RefreshableState<StockNotesWidget> {
|
|||
}
|
||||
},
|
||||
modelData: item.jsondata,
|
||||
onSuccess: () {
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue