mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Building context menu for purchase order line item
This commit is contained in:
parent
d433e6327b
commit
86584b366f
@ -244,6 +244,12 @@ class InvenTreeAPI {
|
|||||||
// Ensure we only ever create a single instance of the API class
|
// Ensure we only ever create a single instance of the API class
|
||||||
static final InvenTreeAPI _api = InvenTreeAPI._internal();
|
static final InvenTreeAPI _api = InvenTreeAPI._internal();
|
||||||
|
|
||||||
|
bool supportPoReceive() {
|
||||||
|
|
||||||
|
// API endpoint for receiving purchase order line items was introduced in v12
|
||||||
|
return _apiVersion >= 12;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to the remote InvenTree server:
|
* Connect to the remote InvenTree server:
|
||||||
*
|
*
|
||||||
|
2
lib/l10n
2
lib/l10n
@ -1 +1 @@
|
|||||||
Subproject commit ed69d6efe7672770ee27f4d1b4fc8ab7793266da
|
Subproject commit bdaf7a516cc40caf6ee1110fea6af073a61d7829
|
@ -246,11 +246,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
_showPurchaseOrders(context);
|
_showPurchaseOrders(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
/*
|
||||||
_iconButton(
|
_iconButton(
|
||||||
context,
|
context,
|
||||||
L10().salesOrders,
|
L10().salesOrders,
|
||||||
FontAwesomeIcons.truck,
|
FontAwesomeIcons.truck,
|
||||||
),
|
),
|
||||||
|
*/
|
||||||
_iconButton(
|
_iconButton(
|
||||||
context,
|
context,
|
||||||
L10().suppliers,
|
L10().suppliers,
|
||||||
|
@ -172,6 +172,43 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lineItemMenu(BuildContext context, InvenTreePOLineItem lineItem) {
|
||||||
|
|
||||||
|
List<Widget> children = [];
|
||||||
|
|
||||||
|
if (InvenTreeAPI().supportPoReceive()) {
|
||||||
|
children.add(
|
||||||
|
SimpleDialogOption(
|
||||||
|
onPressed: () {
|
||||||
|
|
||||||
|
},
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(L10().receiveItem),
|
||||||
|
leading: FaIcon(FontAwesomeIcons.signInAlt),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// No valid actions available
|
||||||
|
if (children.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
children.insert(0, Divider());
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return SimpleDialog(
|
||||||
|
title: Text(L10().lineItem),
|
||||||
|
children: children,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> lineTiles(BuildContext context) {
|
List<Widget> lineTiles(BuildContext context) {
|
||||||
|
|
||||||
List<Widget> tiles = [];
|
List<Widget> tiles = [];
|
||||||
@ -190,7 +227,10 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
|
|||||||
title: Text(supplierPart.SKU),
|
title: Text(supplierPart.SKU),
|
||||||
subtitle: Text(supplierPart.partName),
|
subtitle: Text(supplierPart.partName),
|
||||||
leading: InvenTreeAPI().getImage(supplierPart.partImage, width: 40, height: 40),
|
leading: InvenTreeAPI().getImage(supplierPart.partImage, width: 40, height: 40),
|
||||||
trailing: Text("${line.quantity}"),
|
trailing: Text("${line.outstanding}"),
|
||||||
|
onLongPress: () {
|
||||||
|
lineItemMenu(context, line);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user