mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Fix display of sales order completion status (#460)
This commit is contained in:
parent
711034f402
commit
eb1be30df4
@ -26,6 +26,10 @@ class InvenTreeOrder extends InvenTreeModel {
|
|||||||
|
|
||||||
int get lineItemCount => getInt("line_items", backup: 0);
|
int get lineItemCount => getInt("line_items", backup: 0);
|
||||||
|
|
||||||
|
int get completedLineItemCount => getInt("completed_lines", backup: 0);
|
||||||
|
|
||||||
|
bool get complete => completedLineItemCount >= lineItemCount;
|
||||||
|
|
||||||
bool get overdue => getBool("overdue");
|
bool get overdue => getBool("overdue");
|
||||||
|
|
||||||
String get reference => getString("reference");
|
String get reference => getString("reference");
|
||||||
|
@ -37,7 +37,6 @@ class _SalesOrderDetailState extends RefreshableState<SalesOrderDetailWidget> {
|
|||||||
List<InvenTreeSOLineItem> lines = [];
|
List<InvenTreeSOLineItem> lines = [];
|
||||||
|
|
||||||
bool supportsProjectCodes = false;
|
bool supportsProjectCodes = false;
|
||||||
int completedLines = 0;
|
|
||||||
int attachmentCount = 0;
|
int attachmentCount = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -114,14 +113,6 @@ class _SalesOrderDetailState extends RefreshableState<SalesOrderDetailWidget> {
|
|||||||
|
|
||||||
supportsProjectCodes = api.supportsProjectCodes && await api.getGlobalBooleanSetting("PROJECT_CODES_ENABLED");
|
supportsProjectCodes = api.supportsProjectCodes && await api.getGlobalBooleanSetting("PROJECT_CODES_ENABLED");
|
||||||
|
|
||||||
completedLines = 0;
|
|
||||||
|
|
||||||
for (var line in lines) {
|
|
||||||
if (line.isComplete) {
|
|
||||||
completedLines += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InvenTreeSalesOrderAttachment().count(filters: {
|
InvenTreeSalesOrderAttachment().count(filters: {
|
||||||
"order": widget.order.pk.toString()
|
"order": widget.order.pk.toString()
|
||||||
}).then((int value) {
|
}).then((int value) {
|
||||||
@ -219,16 +210,16 @@ class _SalesOrderDetailState extends RefreshableState<SalesOrderDetailWidget> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Color lineColor = completedLines < widget.order.lineItemCount ? COLOR_WARNING : COLOR_SUCCESS;
|
Color lineColor = widget.order.complete ? COLOR_WARNING : COLOR_SUCCESS;
|
||||||
|
|
||||||
tiles.add(ListTile(
|
tiles.add(ListTile(
|
||||||
title: Text(L10().lineItems),
|
title: Text(L10().lineItems),
|
||||||
subtitle: ProgressBar(
|
subtitle: ProgressBar(
|
||||||
completedLines.toDouble(),
|
widget.order.completedLineItemCount.toDouble(),
|
||||||
maximum: widget.order.lineItemCount.toDouble()
|
maximum: widget.order.lineItemCount.toDouble()
|
||||||
),
|
),
|
||||||
leading: FaIcon(FontAwesomeIcons.clipboardCheck),
|
leading: FaIcon(FontAwesomeIcons.clipboardCheck),
|
||||||
trailing: Text("${completedLines} / ${widget.order.lineItemCount}", style: TextStyle(color: lineColor)),
|
trailing: Text("${widget.order.completedLineItemCount} / ${widget.order.lineItemCount}", style: TextStyle(color: lineColor)),
|
||||||
));
|
));
|
||||||
|
|
||||||
// TODO: total price
|
// TODO: total price
|
||||||
|
Loading…
x
Reference in New Issue
Block a user