diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java index abe527a8..b9736305 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java @@ -1,8 +1,11 @@ package info.bukova.isspst.ui.main.orders.requirements; +import info.bukova.isspst.data.Limit; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.filters.RequirementFilter; +import info.bukova.isspst.services.invoicing.InvoicingService; +import info.bukova.isspst.services.limits.LimitService; import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.ui.requirement.RequirementSubpage; @@ -25,6 +28,12 @@ public class ReqListMyWorkgroups extends RequirementSubpage @WireVariable protected WorkgroupService workgroupService; + @WireVariable + protected LimitService limitService; + + @WireVariable + protected InvoicingService invoicingService; + public List getCentres() { return workgroupService.getCentres(); @@ -73,10 +82,38 @@ public class ReqListMyWorkgroups extends RequirementSubpage return null; } } - + @Override - @NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount" }) + @NotifyChange({ "dataBean", "ableToDelete", "canApprove", "invoicedAmount", "workgroupLimit", "workgroupInvoiced" }) public void setDataBean(Requirement data) { super.setDataBean(data); } + + public BigDecimal getWorkgroupLimit() { + if (getDataBean() != null && getDataBean().getWorkgroup() != null) { + Limit limit = limitService.getForWorkgroup(getDataBean().getWorkgroup()); + + if (limit == null) { + return null; + } + + return limit.getLimit(); + } + + return null; + } + + public BigDecimal getWorkgroupInvoiced() { + if (getDataBean() != null && getDataBean().getWorkgroup() != null) { + BigDecimal invoiced = invoicingService.totalInvoicedForWorkgroup(getDataBean().getWorkgroup()); + + if (invoiced == null) { + return null; + } + + return invoiced; + } + + return null; + } } diff --git a/src/main/webapp/app/template.zhtml b/src/main/webapp/app/template.zhtml index ed254032..8f424268 100644 --- a/src/main/webapp/app/template.zhtml +++ b/src/main/webapp/app/template.zhtml @@ -51,6 +51,6 @@
- + \ No newline at end of file diff --git a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul index 41b40f48..0660febb 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul @@ -205,7 +205,14 @@