V dialogu pro zobrazení vyúčtování služební cesty se po otevření přepne záložka na první neschválené vyúčtování.

refs #212
Verze_2.0 2.0
Josef Rokos 10 years ago
parent 04dc8a5587
commit 933f5e784b

@ -1,5 +1,6 @@
package info.bukova.isspst.ui.tripbill; package info.bukova.isspst.ui.tripbill;
import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripBill; import info.bukova.isspst.data.TripBill;
import info.bukova.isspst.data.TripBillApproval; import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.requirement.TripRequirementService;
@ -33,10 +34,12 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
@WireVariable @WireVariable
private TripRequirementService tripRequirementService; private TripRequirementService tripRequirementService;
private TripBill bill; private TripBill bill;
private Map<Integer, Boolean> selTab;
@Init(superclass = true) @Init(superclass = true)
public void initBillSummary(@ExecutionArgParam("bill") TripBill bill) { public void initBillSummary(@ExecutionArgParam("bill") TripBill bill) {
service = tripBillApprovalService; service = tripBillApprovalService;
selTab = new HashMap<Integer, Boolean>();
if (bill.getApproval() != null) { if (bill.getApproval() != null) {
setDataBean(bill.getApproval()); setDataBean(bill.getApproval());
@ -54,17 +57,43 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
public void setBill(@BindingParam("bill") TripBill bill) { public void setBill(@BindingParam("bill") TripBill bill) {
this.bill = bill; this.bill = bill;
setDataBean(bill.getApproval()); setDataBean(bill.getApproval());
for (Integer i : selTab.keySet()) {
selTab.put(i, false);
}
selTab.put(bill.getId(), true);
} }
public List<TripBill> getBills() { public List<TripBill> getBills() {
List<TripBill> bills = new ArrayList<TripBill>(); List<TripBill> bills = new ArrayList<TripBill>();
boolean isSelectedTad = false;
bills.add(this.bill); 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())) { for (TripBill b : tripRequirementService.getBills(bill.getRequirement())) {
if (b.getId() != bill.getId()) { if (b.getId() != bill.getId()) {
tripBillService.loadLazyData(b); tripBillService.loadLazyData(b);
bills.add(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; return bills;
@ -84,4 +113,8 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
public void reload() { public void reload() {
setDataBean(tripBillApprovalService.getById(bill.getApproval().getId())); setDataBean(tripBillApprovalService.getById(bill.getApproval().getId()));
} }
public Map<Integer, Boolean> getSelTab() {
return selTab;
}
} }

@ -21,7 +21,7 @@
<tabbox vflex="1"> <tabbox vflex="1">
<tabs children="@load(vm.bills)"> <tabs children="@load(vm.bills)">
<template name="children"> <template name="children">
<tab label="@load(each.ownedBy)" onClick="@command('setBill', bill=each)"/> <tab label="@load(each.ownedBy)" onSelect="@command('setBill', bill=each)" selected="@load(vm.selTab[each.id])"/>
</template> </template>
</tabs> </tabs>
<tabpanels children="@load(vm.bills)"> <tabpanels children="@load(vm.bills)">

Loading…
Cancel
Save