mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 21:46:46 +00:00
Display number of attachments on part view
This commit is contained in:
parent
10783cd1c4
commit
fcfda4ebff
@ -39,6 +39,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
|
|
||||||
InvenTreePart? parentPart;
|
InvenTreePart? parentPart;
|
||||||
|
|
||||||
|
int attachmentCount = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
||||||
|
|
||||||
@ -110,6 +112,12 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await part.getTestTemplates();
|
await part.getTestTemplates();
|
||||||
|
|
||||||
|
attachmentCount = await InvenTreePartAttachment().count(
|
||||||
|
filters: {
|
||||||
|
"part": part.pk.toString()
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future <void> _toggleStar() async {
|
Future <void> _toggleStar() async {
|
||||||
@ -405,7 +413,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
title: Text(L10().attachments),
|
title: Text(L10().attachments),
|
||||||
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
||||||
trailing: Text(""),
|
trailing: attachmentCount > 0 ? Text(attachmentCount.toString()) : null,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user