|
|
|
@ -6,6 +6,7 @@ import info.bukova.isspst.data.TripBillApproval;
|
|
|
|
|
import info.bukova.isspst.services.requirement.TripRequirementService;
|
|
|
|
|
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
|
|
|
|
import info.bukova.isspst.services.tripbill.TripBillService;
|
|
|
|
|
import info.bukova.isspst.services.users.UserService;
|
|
|
|
|
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
|
|
|
|
import org.zkoss.bind.annotation.BindingParam;
|
|
|
|
|
import org.zkoss.bind.annotation.Command;
|
|
|
|
@ -33,6 +34,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|
|
|
|
private TripBillService tripBillService;
|
|
|
|
|
@WireVariable
|
|
|
|
|
private TripRequirementService tripRequirementService;
|
|
|
|
|
@WireVariable
|
|
|
|
|
private UserService userService;
|
|
|
|
|
private TripBill bill;
|
|
|
|
|
private Map<Integer, Boolean> selTab;
|
|
|
|
|
|
|
|
|
@ -71,11 +74,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|
|
|
|
|
|
|
|
|
bills.add(this.bill);
|
|
|
|
|
|
|
|
|
|
if (bill.getApproval() != null && bill.getApproval().getState() != RequirementState.APPROVED) {
|
|
|
|
|
if (selectTab(bill)) {
|
|
|
|
|
isSelectedTad = true;
|
|
|
|
|
selTab.put(bill.getId(), true);
|
|
|
|
|
} else {
|
|
|
|
|
selTab.put(bill.getId(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
|
|
|
|
@ -83,11 +83,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|
|
|
|
tripBillService.loadLazyData(b);
|
|
|
|
|
bills.add(b);
|
|
|
|
|
|
|
|
|
|
if (!isSelectedTad && b.getApproval() != null && b.getApproval().getState() != RequirementState.APPROVED) {
|
|
|
|
|
setBill(b);
|
|
|
|
|
if (!isSelectedTad && selectTab(b)) {
|
|
|
|
|
isSelectedTad = true;
|
|
|
|
|
} else {
|
|
|
|
|
selTab.put(b.getId(), false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -99,6 +96,19 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|
|
|
|
return bills;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean selectTab(TripBill bill) {
|
|
|
|
|
if (bill.getApproval() != null
|
|
|
|
|
&& bill.getApproval().getState() != RequirementState.APPROVED
|
|
|
|
|
&& tripBillApprovalService.getNextApprover(bill.getApproval()).contains(userService.getCurrent())) {
|
|
|
|
|
setBill(bill);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
selTab.put(bill.getId(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Command
|
|
|
|
|
public void showBill(@BindingParam("bill") TripBill bill) {
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
|
|