Filtrování požadavků přihlášeného uživatele. Refresh tabů v požadavcích
na služební cesty. refs #108 refs #100
This commit is contained in:
+6
-3
@@ -52,8 +52,9 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
@Transactional
|
||||
@PreAuthorize("hasPermission(this, 'PERM_READ')")
|
||||
public List<TripRequirement> getAll() {
|
||||
Query q = dao.getQuery("from TripRequirement where ownedBy = :owner");
|
||||
Query q = dao.getQuery("from TripRequirement where ownedBy = :owner and state != :state");
|
||||
q.setParameter("owner", getLoggedInUser());
|
||||
q.setParameter("state", RequirementState.APPROVED);
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@@ -64,8 +65,9 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
@PostFilter("hasPermission(filterObject, 'PERM_SHOW_CENTRE_REQ')")
|
||||
public List<TripRequirement> getCentreReq() {
|
||||
List<Workgroup> wgList = workgroupService.getUserCentres(getLoggedInUser());
|
||||
Query q = dao.getQuery("select tr from TripRequirement tr join tr.centre c where c in (:wgList)");
|
||||
Query q = dao.getQuery("select tr from TripRequirement tr join tr.centre c where tr.state != :state and c in (:wgList)");
|
||||
q.setParameterList("wgList", wgList);
|
||||
q.setParameter("state", RequirementState.APPROVED);
|
||||
return q.list();
|
||||
}
|
||||
|
||||
@@ -76,8 +78,9 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
||||
@PostFilter("hasPermission(filterObject, 'PERM_SHOW_WORKGROUP_REQ')")
|
||||
public List<TripRequirement> getWorkgroupReq() {
|
||||
List<Workgroup> wgList = workgroupService.getUserWorkgroups(getLoggedInUser());
|
||||
Query q = dao.getQuery("select tr from TripRequirement tr join tr.workgroup w where w in (:wgList)");
|
||||
Query q = dao.getQuery("select tr from TripRequirement tr join tr.workgroup w where tr.state != :state and w in (:wgList)");
|
||||
q.setParameterList("wgList", wgList);
|
||||
q.setParameter("state", RequirementState.APPROVED);
|
||||
return q.list();
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,10 @@ public class ListViewModel<T extends DataModel> {
|
||||
if (!newRec && editBean != null) {
|
||||
dataList.set(selIndex, editBean);
|
||||
}
|
||||
|
||||
if (newRec) {
|
||||
BindUtils.postGlobalCommand(null, null, "reloadRelated", null);
|
||||
}
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@@ -242,7 +246,7 @@ public class ListViewModel<T extends DataModel> {
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("selIndex")
|
||||
@NotifyChange({"selIndex", "dataBean"})
|
||||
public void afterRender() {
|
||||
if (editBean != null && !editBean.isValid()) {
|
||||
return;
|
||||
@@ -256,6 +260,10 @@ public class ListViewModel<T extends DataModel> {
|
||||
selIndex = dataList.size() - 1;
|
||||
newRec = false;
|
||||
}
|
||||
|
||||
if (selIndex > -1) {
|
||||
this.setDataBean(dataList.get(selIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@Command
|
||||
@@ -272,6 +280,10 @@ public class ListViewModel<T extends DataModel> {
|
||||
public int getSelIndex() {
|
||||
return this.selIndex;
|
||||
}
|
||||
|
||||
public void setSelIndex(int selIndex) {
|
||||
this.selIndex = selIndex;
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({ "dataList", "fullFill" })
|
||||
|
||||
@@ -4,6 +4,7 @@ import info.bukova.isspst.data.RequirementBase;
|
||||
import info.bukova.isspst.services.requirement.RequirementBaseService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
|
||||
@@ -24,6 +25,7 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
|
||||
@NotifyChange({"dataBean", "canApprove"})
|
||||
public void approve() {
|
||||
this.getReqService().approve(getDataBean());
|
||||
BindUtils.postGlobalCommand(null, null, "reload", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,9 @@ import java.util.List;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.GlobalCommand;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class TripRequirementListAll extends RequirementSubpage<TripRequirement> {
|
||||
@@ -51,5 +53,11 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
|
||||
public List<Workgroup> getAllWorkgroups() {
|
||||
return allWorkgroups;
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange({ "dataList", "dataBean", "fullFill" })
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.List;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.GlobalCommand;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class TripRequirementListCentre extends RequirementSubpage<TripRequirement> {
|
||||
@@ -49,6 +51,10 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
|
||||
return myCentres;
|
||||
}
|
||||
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange({ "dataList", "dataBean", "fullFill" })
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.List;
|
||||
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.BindUtils;
|
||||
import org.zkoss.bind.annotation.GlobalCommand;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequirement> {
|
||||
@@ -54,5 +56,11 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
|
||||
public List<Workgroup> getMyWorkgroups() {
|
||||
return myWorkgroups;
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange({ "dataList", "dataBean", "fullFill" })
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,28 +22,30 @@
|
||||
<include src="/app/toolbar.zul" />
|
||||
<listbox
|
||||
model="@load(vm.dataList)"
|
||||
selectedItem="@bind(vm.dataBean)">
|
||||
<listhead menupopup="auto">
|
||||
selectedItem="@bind(vm.dataBean)"
|
||||
onAfterRender="@command('afterRender')"
|
||||
selectedIndex="@bind(vm.selIndex)">
|
||||
<listhead menupopup="auto" sizable="true">
|
||||
<listheader
|
||||
label="${labels.RequirementsGridNumberSerie}"
|
||||
sort="czech(numser)"
|
||||
width="10%" />
|
||||
width="180px" />
|
||||
<listheader
|
||||
label="${labels.RequirementsGridReqDate}"
|
||||
sort="auto(reqDate)"
|
||||
width="13%" />
|
||||
width="200px" />
|
||||
<listheader
|
||||
label="${labels.RequirementsGridCenter}"
|
||||
sort="auto(centre)"
|
||||
width="10%" />
|
||||
/>
|
||||
<listheader
|
||||
label="${labels.RequirementsGridFrom}"
|
||||
sort="czech(from)"
|
||||
width="40%" />
|
||||
/>
|
||||
<listheader
|
||||
label="${labels.RequirementsGridTo}"
|
||||
sort="czech(to)"
|
||||
width="40%" />
|
||||
/>
|
||||
</listhead>
|
||||
<auxhead
|
||||
sclass="category-center"
|
||||
@@ -126,7 +128,7 @@
|
||||
</auxheader>
|
||||
</auxhead>
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
|
||||
<listcell label="@load(each.numser)" />
|
||||
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||
<listcell label="@load(each.centre.fullName)" />
|
||||
@@ -145,7 +147,9 @@
|
||||
<listbox
|
||||
model="@load(vmSub.dataList)"
|
||||
selectedItem="@bind(vmSub.dataBean)"
|
||||
hflex="7">
|
||||
hflex="7"
|
||||
onAfterRender="@command('afterRender')"
|
||||
selectedIndex="@bind(vmSub.selIndex)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader
|
||||
label="${labels.RequirementsGridNumberSerie}"
|
||||
@@ -293,7 +297,9 @@
|
||||
<listbox
|
||||
model="@load(vmSub.dataList)"
|
||||
selectedItem="@bind(vmSub.dataBean)"
|
||||
hflex="7">
|
||||
hflex="7"
|
||||
onAfterRender="@command('afterRender')"
|
||||
selectedIndex="@bind(vmSub.selIndex)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader
|
||||
label="${labels.RequirementsGridNumberSerie}"
|
||||
@@ -437,7 +443,7 @@
|
||||
</auxheader>
|
||||
</auxhead>
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
|
||||
<listcell label="@load(each.numser)" />
|
||||
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||
<listcell label="@load(each.centre.fullName)" />
|
||||
@@ -463,7 +469,9 @@
|
||||
<listbox
|
||||
model="@load(vmSub.dataList)"
|
||||
selectedItem="@bind(vmSub.dataBean)"
|
||||
hflex="7">
|
||||
hflex="7"
|
||||
onAfterRender="@command('afterRender')"
|
||||
selectedIndex="@bind(vmSub.selIndex)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader
|
||||
label="${labels.RequirementsGridNumberSerie}"
|
||||
@@ -607,7 +615,7 @@
|
||||
</auxheader>
|
||||
</auxhead>
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))">
|
||||
<listcell label="@load(each.numser)" />
|
||||
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||
<listcell label="@load(each.centre.fullName)" />
|
||||
|
||||
Reference in New Issue
Block a user