mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Adds attachment support for purchase orders
This commit is contained in:
parent
ada64f3971
commit
0237e9c819
2 changed files with 50 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import "package:inventree/app_colors.dart";
|
|||
import "package:inventree/helpers.dart";
|
||||
import "package:inventree/inventree/company.dart";
|
||||
import "package:inventree/inventree/purchase_order.dart";
|
||||
import "package:inventree/widget/attachment_widget.dart";
|
||||
import "package:inventree/widget/company_detail.dart";
|
||||
import "package:inventree/widget/refreshable_state.dart";
|
||||
import "package:inventree/l10.dart";
|
||||
|
|
@ -37,6 +38,8 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
|
|||
|
||||
int completedLines = 0;
|
||||
|
||||
int attachmentCount = 0;
|
||||
|
||||
String _poPrefix = "";
|
||||
|
||||
@override
|
||||
|
|
@ -77,6 +80,12 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
|
|||
completedLines += 1;
|
||||
}
|
||||
}
|
||||
|
||||
attachmentCount = await InvenTreePurchaseOrderAttachment().count(
|
||||
filters: {
|
||||
"order": order.pk.toString()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Future <void> editOrder(BuildContext context) async {
|
||||
|
|
@ -177,6 +186,26 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
|
|||
));
|
||||
}
|
||||
|
||||
// Attachments
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().attachments),
|
||||
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
||||
trailing: attachmentCount > 0 ? Text(attachmentCount.toString()) : null,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AttachmentWidget(
|
||||
InvenTreePurchaseOrderAttachment(),
|
||||
order.pk,
|
||||
InvenTreeAPI().checkPermission("purchase_order", "change"))
|
||||
)
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
return tiles;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue