mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-05 16:58:55 +00:00
Create new part from category
This commit is contained in:
parent
a1a07aefd8
commit
ed94d4eb96
@ -243,6 +243,28 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
|
|
||||||
Future<void> _newPart() async {
|
Future<void> _newPart() async {
|
||||||
|
|
||||||
|
int pk = category?.pk ?? -1;
|
||||||
|
|
||||||
|
InvenTreePart().createForm(
|
||||||
|
context,
|
||||||
|
L10().partCreate,
|
||||||
|
data: {
|
||||||
|
"category": (pk > 0) ? pk : null
|
||||||
|
},
|
||||||
|
onSuccess: (data) async {
|
||||||
|
|
||||||
|
if (data.containsKey("pk")) {
|
||||||
|
var part = InvenTreePart.fromJson(data);
|
||||||
|
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => PartDetailWidget(part)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> actionTiles(BuildContext context) {
|
List<Widget> actionTiles(BuildContext context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user