|
|
|
@ -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<TripBillApproval> {
|
|
|
|
|
@WireVariable
|
|
|
|
|
private TripRequirementService tripRequirementService;
|
|
|
|
|
private TripBill bill;
|
|
|
|
|
private Map<Integer, Boolean> selTab;
|
|
|
|
|
|
|
|
|
|
@Init(superclass = true)
|
|
|
|
|
public void initBillSummary(@ExecutionArgParam("bill") TripBill bill) {
|
|
|
|
|
service = tripBillApprovalService;
|
|
|
|
|
selTab = new HashMap<Integer, Boolean>();
|
|
|
|
|
|
|
|
|
|
if (bill.getApproval() != null) {
|
|
|
|
|
setDataBean(bill.getApproval());
|
|
|
|
@ -54,19 +57,45 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|
|
|
|
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<TripBill> getBills() {
|
|
|
|
|
List<TripBill> bills = new ArrayList<TripBill>();
|
|
|
|
|
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<TripBillApproval> {
|
|
|
|
|
public void reload() {
|
|
|
|
|
setDataBean(tripBillApprovalService.getById(bill.getApproval().getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<Integer, Boolean> getSelTab() {
|
|
|
|
|
return selTab;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|