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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user