Po otevření dialogu pro zobrazení vyúčtování SC se přepne na první záložku, kterou může schválit aktuálně přihlášený uživatel.
closes #217
This commit is contained in:
@@ -6,6 +6,7 @@ import info.bukova.isspst.data.TripBillApproval;
|
|||||||
import info.bukova.isspst.services.requirement.TripRequirementService;
|
import info.bukova.isspst.services.requirement.TripRequirementService;
|
||||||
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
import info.bukova.isspst.services.tripbill.TripBillApprovalService;
|
||||||
import info.bukova.isspst.services.tripbill.TripBillService;
|
import info.bukova.isspst.services.tripbill.TripBillService;
|
||||||
|
import info.bukova.isspst.services.users.UserService;
|
||||||
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
import info.bukova.isspst.ui.requirement.RequirementSubpage;
|
||||||
import org.zkoss.bind.annotation.BindingParam;
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
import org.zkoss.bind.annotation.Command;
|
import org.zkoss.bind.annotation.Command;
|
||||||
@@ -33,6 +34,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|||||||
private TripBillService tripBillService;
|
private TripBillService tripBillService;
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private TripRequirementService tripRequirementService;
|
private TripRequirementService tripRequirementService;
|
||||||
|
@WireVariable
|
||||||
|
private UserService userService;
|
||||||
private TripBill bill;
|
private TripBill bill;
|
||||||
private Map<Integer, Boolean> selTab;
|
private Map<Integer, Boolean> selTab;
|
||||||
|
|
||||||
@@ -71,11 +74,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|||||||
|
|
||||||
bills.add(this.bill);
|
bills.add(this.bill);
|
||||||
|
|
||||||
if (bill.getApproval() != null && bill.getApproval().getState() != RequirementState.APPROVED) {
|
if (selectTab(bill)) {
|
||||||
isSelectedTad = true;
|
isSelectedTad = true;
|
||||||
selTab.put(bill.getId(), true);
|
|
||||||
} else {
|
|
||||||
selTab.put(bill.getId(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
|
for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
|
||||||
@@ -83,11 +83,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|||||||
tripBillService.loadLazyData(b);
|
tripBillService.loadLazyData(b);
|
||||||
bills.add(b);
|
bills.add(b);
|
||||||
|
|
||||||
if (!isSelectedTad && b.getApproval() != null && b.getApproval().getState() != RequirementState.APPROVED) {
|
if (!isSelectedTad && selectTab(b)) {
|
||||||
setBill(b);
|
|
||||||
isSelectedTad = true;
|
isSelectedTad = true;
|
||||||
} else {
|
|
||||||
selTab.put(b.getId(), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +96,19 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
|
|||||||
return bills;
|
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
|
@Command
|
||||||
public void showBill(@BindingParam("bill") TripBill bill) {
|
public void showBill(@BindingParam("bill") TripBill bill) {
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
|||||||
Reference in New Issue
Block a user