diff --git a/src/main/java/info/bukova/isspst/ui/tripbill/TripBillSummaryVM.java b/src/main/java/info/bukova/isspst/ui/tripbill/TripBillSummaryVM.java index c2a01d9d..12aca4c8 100644 --- a/src/main/java/info/bukova/isspst/ui/tripbill/TripBillSummaryVM.java +++ b/src/main/java/info/bukova/isspst/ui/tripbill/TripBillSummaryVM.java @@ -1,5 +1,6 @@ package info.bukova.isspst.ui.tripbill; +import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.services.requirement.TripRequirementService; @@ -33,10 +34,12 @@ public class TripBillSummaryVM extends RequirementSubpage { @WireVariable private TripRequirementService tripRequirementService; private TripBill bill; + private Map selTab; @Init(superclass = true) public void initBillSummary(@ExecutionArgParam("bill") TripBill bill) { service = tripBillApprovalService; + selTab = new HashMap(); if (bill.getApproval() != null) { setDataBean(bill.getApproval()); @@ -54,19 +57,45 @@ public class TripBillSummaryVM extends RequirementSubpage { public void setBill(@BindingParam("bill") TripBill bill) { this.bill = bill; setDataBean(bill.getApproval()); + + for (Integer i : selTab.keySet()) { + selTab.put(i, false); + } + + selTab.put(bill.getId(), true); } public List getBills() { List bills = new ArrayList(); + boolean isSelectedTad = false; bills.add(this.bill); + + if (bill.getApproval().getState() != RequirementState.APPROVED) { + isSelectedTad = true; + selTab.put(bill.getId(), true); + } else { + selTab.put(bill.getId(), false); + } + for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) { if (b.getId() != bill.getId()) { tripBillService.loadLazyData(b); bills.add(b); + + if (!isSelectedTad && b.getApproval().getState() != RequirementState.APPROVED) { + setBill(b); + isSelectedTad = true; + } else { + selTab.put(b.getId(), false); + } } } + if (!isSelectedTad) { + selTab.put(bill.getId(), true); + } + return bills; } @@ -84,4 +113,8 @@ public class TripBillSummaryVM extends RequirementSubpage { public void reload() { setDataBean(tripBillApprovalService.getById(bill.getApproval().getId())); } + + public Map getSelTab() { + return selTab; + } } diff --git a/src/main/webapp/main/trips/requirements/tripBillSummaryMaster.zul b/src/main/webapp/main/trips/requirements/tripBillSummaryMaster.zul index 5534ce2f..109c6eca 100644 --- a/src/main/webapp/main/trips/requirements/tripBillSummaryMaster.zul +++ b/src/main/webapp/main/trips/requirements/tripBillSummaryMaster.zul @@ -21,7 +21,7 @@