Přidaná agenda pro schvalování služebních cest. Interface pro servisní

třídy požadavků (zatím prázdný). 
refs #108 
refs #100
multitenant
Josef Rokos 11 years ago
parent 91fdbd7a9d
commit eade2dd793

@ -8,10 +8,10 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService; import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.reqsubjects.MaterialService; import info.bukova.isspst.services.reqsubjects.MaterialService;
import info.bukova.isspst.services.reqsubjects.ServiceItemService; import info.bukova.isspst.services.reqsubjects.ServiceItemService;
import info.bukova.isspst.services.munits.MUnitService; import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
@ -72,7 +72,7 @@ public class Constants {
new Module(MOD_MATERIAL, "Materiál", MaterialService.class), new Module(MOD_MATERIAL, "Materiál", MaterialService.class),
new Module(MOD_SERVICES, "Služby", ServiceItemService.class), new Module(MOD_SERVICES, "Služby", ServiceItemService.class),
new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class), new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class),
new Module(MOD_REQUIREMENTS, "Požadavky", RequirementService.class), new Module(MOD_REQUIREMENTS, "Požadavky", RequirementBaseService.class),
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class) new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class)
}; };

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.TripRequirement;
public interface TripRequirementDao extends BaseDao<TripRequirement> {
}

@ -0,0 +1,9 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.TripRequirementDao;
import info.bukova.isspst.data.TripRequirement;
public class TripRequirementDaoJPA extends BaseDaoJPA<TripRequirement> implements
TripRequirementDao {
}

@ -86,4 +86,12 @@ public class Permission extends BaseSimpleData implements GrantedAuthority {
} }
} }
public PermissionType getType() {
return type;
}
public void setType(PermissionType type) {
this.type = type;
}
} }

@ -12,6 +12,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity @Entity
@Table(name = "REQUIREMENT") @Table(name = "REQUIREMENT")
public class Requirement extends BaseData implements DataModel public class Requirement extends BaseData implements DataModel
@ -32,8 +35,9 @@ public class Requirement extends BaseData implements DataModel
@Column(name = "DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL) @OneToMany(cascade=CascadeType.ALL)
@JoinColumn(name = "REQUIREMENT_ID") @JoinColumn(name = "REQUIREMENT_ID")
@LazyCollection(LazyCollectionOption.FALSE)
private List<RequirementItem> items; private List<RequirementItem> items;
public List<RequirementItem> getItems() public List<RequirementItem> getItems()

@ -30,10 +30,13 @@ public class RequirementBase extends BaseData {
@Column(name = "DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
@ManyToOne(fetch = FetchType.EAGER) @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CENTRE_ID")
private Workgroup centre;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "WORKGROUP_ID") @JoinColumn(name = "WORKGROUP_ID")
private Workgroup workgroup; private Workgroup workgroup;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@LazyCollection(LazyCollectionOption.FALSE) @LazyCollection(LazyCollectionOption.TRUE)
private List<AuthItem> authorization; private List<AuthItem> authorization;
@Column(name = "STATE") @Column(name = "STATE")
@Enumerated(EnumType.ORDINAL) @Enumerated(EnumType.ORDINAL)
@ -91,4 +94,20 @@ public class RequirementBase extends BaseData {
this.state = state; this.state = state;
} }
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Workgroup getCentre() {
return centre;
}
public void setCentre(Workgroup centre) {
this.centre = centre;
}
} }

@ -0,0 +1,48 @@
package info.bukova.isspst.data;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "TRIPREQUIREMENT")
public class TripRequirement extends RequirementBase {
@Column(name = "TRIP_FROM")
private String from;
@Column(name = "TRIP_TO")
private String to;
@Column(name = "TRIP_DATE")
private Date tripDate;
public TripRequirement() {
this.setOwnedBy(new User());
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public Date getTripDate() {
return tripDate;
}
public void setTripDate(Date tripDate) {
this.tripDate = tripDate;
}
}

@ -0,0 +1,71 @@
package info.bukova.isspst.filters;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.TripRequirement;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class TripRequirementFilter implements Filter<TripRequirement>
{
private TripRequirement condition;
public TripRequirementFilter(TripRequirement cond)
{
this.condition = cond;
}
private static class TripRequirementMatcher extends TypeSafeMatcher<TripRequirement>
{
private TripRequirement condition;
public TripRequirementMatcher(TripRequirement cond)
{
this.condition = cond;
}
@Override
public void describeTo(Description desc)
{
desc.appendText("requirement matches");
}
@Override
public boolean matchesSafely(TripRequirement item)
{
boolean foundNumser = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getReqDate(), condition.getReqDate());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundFrom = StringUtils.isEqualForFilter(item.getFrom(), condition.getFrom());
boolean foundTo = StringUtils.isEqualForFilter(item.getTo(), condition.getTo());
boolean foundWorkgroup = (condition.getWorkgroup() == null ||(item.getWorkgroup() != null && item.getWorkgroup().equals(condition.getWorkgroup())));
boolean foundCentre = (condition.getCentre() == null || (item.getCentre() != null && item.getCentre().equals(condition.getCentre())));
boolean foundOwner = StringUtils.isEqualForFilter(item.getOwnedBy().getLastName(), condition.getOwnedBy().getLastName());
return foundNumser && foundReqDate && foundDescription && foundFrom && foundTo && foundWorkgroup && foundCentre && foundOwner;
}
@Factory
public static Matcher<TripRequirement> matchTripRequirement(TripRequirement building)
{
return new TripRequirementMatcher(building);
}
}
@Override
public TripRequirementMatcher matcher()
{
return new TripRequirementMatcher(condition);
}
@Override
public String queryString()
{
return "";
}
}

@ -2,31 +2,115 @@ package info.bukova.isspst.security;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.Module; import info.bukova.isspst.Module;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.Permission;
import info.bukova.isspst.data.PermissionType;
import info.bukova.isspst.data.RequirementBase;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.springframework.security.access.PermissionEvaluator; import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public class IsspstPermissionEvaluator implements PermissionEvaluator { public class IsspstPermissionEvaluator implements PermissionEvaluator {
private WorkgroupService wgService;
public void setWorkgroupService(WorkgroupService wgService) {
this.wgService = wgService;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean hasPermission(Authentication authentication, public boolean hasPermission(Authentication authentication,
Object targetDomainObject, Object permission) { Object targetDomainObject, Object permission) {
List<Role> perms = (List<Role>) authentication.getAuthorities();
String perm = ""; String perm = "";
if (permission instanceof String) { if (permission instanceof String) {
perm = (String) permission; perm = (String) permission;
} }
if (targetDomainObject instanceof Service<?>) Permission appPermission = null;
for (Permission p : Constants.SPECIAL_PERMISSIONS) {
if (p.getAuthority().equals(perm)) {
appPermission = p;
}
}
if ((targetDomainObject instanceof Service<?>) && (appPermission == null || appPermission.getType() == PermissionType.GLOBAL))
{ {
List<Role> perms = (List<Role>) authentication.getAuthorities();
return evaluateGlobal((Service<?>) targetDomainObject, perm, perms); return evaluateGlobal((Service<?>) targetDomainObject, perm, perms);
} else {
return evaluateSpecial(authentication, targetDomainObject, appPermission);
}
}
private boolean evaluateSpecial(Authentication auth, Object domainObject, Permission permission) {
List<Workgroup> userWorkgroups;
if (!(auth.getPrincipal() instanceof User)) {
return false;
}
User user = (User)auth.getPrincipal();
if (domainObject instanceof DataModel) {
return filterDomainObject(user, (DataModel)domainObject, permission);
}
if (permission.getType() == PermissionType.CENTRE) {
userWorkgroups = wgService.getUserCentres((User)auth.getPrincipal());
} else {
userWorkgroups = wgService.getUserWorkgroups((User)auth.getPrincipal());
}
for (Workgroup wg : userWorkgroups) {
List<Role> wgRoles = wgService.getUserWorkgroupRoles(wg, user);
for (Role r : wgRoles) {
for (Permission p : r.getPermissions()) {
if (p.getAuthority().equals(permission.getAuthority())) {
return true;
}
}
}
}
return false;
}
private boolean filterDomainObject(User user, DataModel domainObject, Permission permission) {
if (!(domainObject instanceof RequirementBase)) {
return false;
}
RequirementBase req = (RequirementBase) domainObject;
Workgroup reqWg;
if (permission.getType() == PermissionType.CENTRE) {
reqWg = req.getCentre();
} else {
reqWg = req.getWorkgroup();
}
if (wgService.isMember(reqWg, user)) {
List<Role> roles = wgService.getUserWorkgroupRoles(reqWg, user);
for (Role r : roles) {
for (Permission p : r.getPermissions()) {
if (p.getAuthority().equals(permission.getAuthority())) {
return true;
}
}
}
} }
return false; return false;

@ -0,0 +1,5 @@
package info.bukova.isspst.services.requirement;
public interface RequirementBaseService {
}

@ -8,7 +8,7 @@ import java.util.Date;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
public class RequirementServiceImpl extends AbstractOwnedService<Requirement> implements RequirementService public class RequirementServiceImpl extends AbstractOwnedService<Requirement> implements RequirementService, RequirementBaseService
{ {
@Override @Override
protected Requirement createEntity() protected Requirement createEntity()

@ -4,5 +4,7 @@ import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
public interface RequirementTypeService extends Service<RequirementType> { public interface RequirementTypeService extends Service<RequirementType> {
public RequirementType getTypeById(String id);
} }

@ -1,8 +1,16 @@
package info.bukova.isspst.services.requirement; package info.bukova.isspst.services.requirement;
import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.RequirementType; import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
public class RequirementTypeServiceImpl extends AbstractOwnedService<RequirementType> implements RequirementTypeService { public class RequirementTypeServiceImpl extends AbstractOwnedService<RequirementType> implements RequirementTypeService {
@Override
@Transactional
public RequirementType getTypeById(String id) {
return selectSingle("from RequirementType where type = '" + id + "'");
}
} }

@ -0,0 +1,14 @@
package info.bukova.isspst.services.requirement;
import java.util.List;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.services.Service;
public interface TripRequirementService extends Service<TripRequirement> {
public List<TripRequirement> getCentreReq();
public List<TripRequirement> getWorkgroupReq();
public List<TripRequirement> getFromAll();
}

@ -0,0 +1,92 @@
package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.AbstractOwnedService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import java.util.Date;
import java.util.List;
import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
public class TripRequirementServiceImpl extends AbstractOwnedService<TripRequirement>
implements TripRequirementService, RequirementBaseService {
@Autowired
private RequirementTypeService reqTypeService;
@Autowired
private WorkgroupService workgroupService;
@Override
protected TripRequirement createEntity() {
TripRequirement tr = new TripRequirement();
tr.setReqDate(new Date());
tr.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
tr.setState(RequirementState.NEW);
return tr;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(TripRequirement entity) {
Workgroup reqWorkgroup = null;
for (Workgroup w : workgroupService.getUserWorkgroups(getLoggedInUser())) {
if (workgroupService.getMembers(entity.getCentre()).contains(w)) {
reqWorkgroup = w;
}
}
entity.setWorkgroup(reqWorkgroup);
entity.setNumser(getNumberSerie());
super.add(entity);
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_READ')")
public List<TripRequirement> getAll() {
Query q = dao.getQuery("from TripRequirement where ownedBy = :owner");
q.setParameter("owner", getLoggedInUser());
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_SHOW_CENTRE_REQ')")
@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)");
q.setParameterList("wgList", wgList);
return q.list();
}
@SuppressWarnings("unchecked")
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_SHOW_WORKGROUP_REQ')")
@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)");
q.setParameterList("wgList", wgList);
return q.list();
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_SHOW_ALL_REQ')")
public List<TripRequirement> getFromAll() {
return super.getAll();
}
}

@ -1,21 +1,17 @@
package info.bukova.isspst.services.users; package info.bukova.isspst.services.users;
import info.bukova.isspst.data.Permission;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.services.AbstractService;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.hibernate.Query; import org.hibernate.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.Permission;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.services.AbstractService;
public class RoleServiceImpl extends AbstractService<Role> implements RoleService { public class RoleServiceImpl extends AbstractService<Role> implements RoleService {
@Autowired
private PermissionService permService;
@Override @Override
@Transactional @Transactional
@ -55,7 +51,8 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
@Override @Override
@Transactional @Transactional
public List<Role> getRolesWithPermission(String authority, boolean centre) { public List<Role> getRolesWithPermission(String authority, boolean centre) {
Permission p = permService.selectSingle("from Permission where authority = '" + authority + "'"); Query q = dao.getQuery("from Permission where authority = '" + authority + "'");
Permission p = (Permission) q.uniqueResult();
return getRolesWithPermission(p, centre); return getRolesWithPermission(p, centre);
} }

@ -19,5 +19,6 @@ public interface WorkgroupService extends Service<Workgroup> {
public List<Workgroup> getUserCentres(User user); public List<Workgroup> getUserCentres(User user);
public List<Workgroup> getUserWorkgroups(User user); public List<Workgroup> getUserWorkgroups(User user);
public List<Role> getUserWorkgroupRoles(Workgroup workgroup, User user); public List<Role> getUserWorkgroupRoles(Workgroup workgroup, User user);
public List<Member> getMembers(Workgroup workgroup);
} }

@ -11,6 +11,7 @@ import info.bukova.isspst.services.AbstractOwnedService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hibernate.Query;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -95,12 +96,16 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
} }
@Override @Override
@Transactional
public List<Workgroup> getUserCentres(User user) { public List<Workgroup> getUserCentres(User user) {
if (user.getParents() == null) { List<Workgroup> parents = getParents(user);
if (parents == null) {
return null; return null;
} }
List<Workgroup> centres = new ArrayList<Workgroup>(); List<Workgroup> centres = new ArrayList<Workgroup>();
for (Workgroup w : user.getParents()) { for (Workgroup w : parents) {
if (w.isCentre()) { if (w.isCentre()) {
centres.add(w); centres.add(w);
} }
@ -117,12 +122,16 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
} }
@Override @Override
@Transactional
public List<Workgroup> getUserWorkgroups(User user) { public List<Workgroup> getUserWorkgroups(User user) {
if (user.getParents() == null) { List<Workgroup> parents = getParents(user);
if (parents == null) {
return null; return null;
} }
List<Workgroup> wg = new ArrayList<Workgroup>(); List<Workgroup> wg = new ArrayList<Workgroup>();
for (Workgroup w: user.getParents()) { for (Workgroup w: parents) {
if (!w.isCentre()) { if (!w.isCentre()) {
wg.add(w); wg.add(w);
} }
@ -130,6 +139,23 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
return wg; return wg;
} }
private List<Workgroup> getParents(User user) {
List<Workgroup> parents;
if (user.getParents() == null) {
parents = loadUser(user).getParents();
} else {
parents = user.getParents();
}
return parents;
}
private User loadUser(User user) {
Query q = dao.getQuery("from User where username = '" + user.getUsername() + "'");
return (User) q.uniqueResult();
}
@Override @Override
@Transactional @Transactional
@ -158,15 +184,23 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
} }
@Override @Override
@Transactional
public List<Role> getUserWorkgroupRoles(Workgroup workgroup, User user) { public List<Role> getUserWorkgroupRoles(Workgroup workgroup, User user) {
List<Role> roles = new ArrayList<Role>(); List<Role> roles = new ArrayList<Role>();
User u;
if (user.getId() == 0) {
u = loadUser(user);
} else {
u = user;
}
if (!isMember(workgroup, user)) { if (!isMember(workgroup, u)) {
return null; return null;
} }
for (JobMapping jm : workgroup.getMembers()) { for (JobMapping jm : workgroup.getMembers()) {
if (jm.getMember().equals(user)) { if (jm.getMember().equals(u)) {
roles.add(jm.getRole()); roles.add(jm.getRole());
} }
} }
@ -185,4 +219,16 @@ public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implem
super.delete(entity); super.delete(entity);
} }
@Override
public List<Member> getMembers(Workgroup workgroup) {
List<JobMapping> jmList = workgroup.getMembers();
List<Member> members = new ArrayList<Member>();
for (JobMapping jm : jmList) {
members.add(jm.getMember());
}
return members;
}
} }

@ -308,9 +308,13 @@ public class ListViewModel<T extends DataModel> {
} }
private void loadFromDbSync() { private void loadFromDbSync() {
dataList.addAll(service.getAll()); dataList.addAll(getListFromService());
fullList = dataList; fullList = dataList;
} }
protected List<T> getListFromService() {
return service.getAll();
}
protected void showForm() { protected void showForm() {
Map<String, Object> arg = new HashMap<String, Object>(); Map<String, Object> arg = new HashMap<String, Object>();

@ -46,6 +46,10 @@ public class NavigationVM {
return moduleUrl.contains("orders"); return moduleUrl.contains("orders");
} }
public boolean isTrips() {
return moduleUrl.contains("trips");
}
public boolean isSettings() { public boolean isSettings() {
return moduleUrl.contains("settings"); return moduleUrl.contains("settings");
} }

@ -0,0 +1,33 @@
package info.bukova.isspst.ui.requirement;
import java.util.List;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.FormViewModel;
public class TripRequirementForm extends FormViewModel<TripRequirement> {
@WireVariable
private UserService userService;
@WireVariable
private WorkgroupService workgroupService;
private List<Workgroup> centres;
@Init(superclass = true)
public void init() {
centres = workgroupService.getUserCentres(userService.getCurrent());
}
public List<Workgroup> getCentres() {
return centres;
}
}

@ -0,0 +1,79 @@
package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
import java.util.List;
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 TripRequirementList extends ListViewModel<TripRequirement> {
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> myCentres;
private boolean showCentre;
private boolean showWorkgroup;
private boolean showAll;
@Init
public void init() {
service = tripRequirementService;
dataClass = TripRequirement.class;
formZul = "requirementsForm.zul";
showCentre = true;
showWorkgroup = true;
showAll = true;
dataFilter = new TripRequirementFilter(getFilterTemplate());
myCentres = workgroupService.getUserCentres(userService.getCurrent());
}
@GlobalCommand
@NotifyChange("showCentre")
public void disableCentre() {
showCentre = false;
}
@GlobalCommand
@NotifyChange("showWorkgroup")
public void disableWorkgroup() {
showWorkgroup = false;
}
@GlobalCommand
@NotifyChange("showAll")
public void disableAll() {
showAll = false;
}
public boolean isShowCentre() {
return showCentre;
}
public boolean isShowWorkgroup() {
return showWorkgroup;
}
public boolean isShowAll() {
return showAll;
}
public List<Workgroup> getMyCentres() {
return myCentres;
}
}

@ -0,0 +1,59 @@
package info.bukova.isspst.ui.requirement;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
public class TripRequirementListAll extends ListViewModel<TripRequirement> {
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> allCentres;
private List<Workgroup> allWorkgroups;
@Init
public void init() {
service = tripRequirementService;
dataClass = TripRequirement.class;
formZul = "requirementsForm.zul";
dataFilter = new TripRequirementFilter(getFilterTemplate());
allCentres = workgroupService.getCentres();
allWorkgroups = workgroupService.getWorkgroups();
}
@Override
protected List<TripRequirement> getListFromService() {
try {
return tripRequirementService.getFromAll();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableAll", null);
return new ArrayList<TripRequirement>();
}
}
public List<Workgroup> getAllCentres() {
return allCentres;
}
public List<Workgroup> getAllWorkgroups() {
return allWorkgroups;
}
}

@ -0,0 +1,53 @@
package info.bukova.isspst.ui.requirement;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
public class TripRequirementListCentre extends ListViewModel<TripRequirement> {
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> myCentres;
@Init
public void init() {
service = tripRequirementService;
dataClass = TripRequirement.class;
formZul = "requirementsForm.zul";
dataFilter = new TripRequirementFilter(getFilterTemplate());
myCentres = workgroupService.getUserCentres(userService.getCurrent());
}
@Override
protected List<TripRequirement> getListFromService() {
try {
return tripRequirementService.getCentreReq();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableCentre", null);
return new ArrayList<TripRequirement>();
}
}
public List<Workgroup> getMyCentres() {
return myCentres;
}
}

@ -0,0 +1,59 @@
package info.bukova.isspst.ui.requirement;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.BindUtils;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.TripRequirementFilter;
import info.bukova.isspst.services.requirement.TripRequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
public class TripRequirementListWorkgroup extends ListViewModel<TripRequirement> {
@WireVariable
private TripRequirementService tripRequirementService;
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private UserService userService;
private List<Workgroup> myCentres;
private List<Workgroup> myWorkgroups;
@Init
public void init() {
service = tripRequirementService;
dataClass = TripRequirement.class;
formZul = "requirementsForm.zul";
dataFilter = new TripRequirementFilter(getFilterTemplate());
myCentres = workgroupService.getUserCentres(userService.getCurrent());
myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent());
}
@Override
protected List<TripRequirement> getListFromService() {
try {
return tripRequirementService.getWorkgroupReq();
} catch (AccessDeniedException e) {
BindUtils.postGlobalCommand(null, null, "disableWorkgroup", null);
return new ArrayList<TripRequirement>();
}
}
public List<Workgroup> getMyCentres() {
return myCentres;
}
public List<Workgroup> getMyWorkgroups() {
return myWorkgroups;
}
}

@ -20,6 +20,7 @@
<mapping class="info.bukova.isspst.data.NumberSeries"></mapping> <mapping class="info.bukova.isspst.data.NumberSeries"></mapping>
<mapping class="info.bukova.isspst.data.Requirement"></mapping> <mapping class="info.bukova.isspst.data.Requirement"></mapping>
<mapping class="info.bukova.isspst.data.RequirementItem"></mapping> <mapping class="info.bukova.isspst.data.RequirementItem"></mapping>
<mapping class="info.bukova.isspst.data.TripRequirement"></mapping>
<mapping class="info.bukova.isspst.data.AuthItem"></mapping> <mapping class="info.bukova.isspst.data.AuthItem"></mapping>
<mapping class="info.bukova.isspst.data.Workflow"></mapping> <mapping class="info.bukova.isspst.data.Workflow"></mapping>
<mapping class="info.bukova.isspst.data.RequirementType"></mapping> <mapping class="info.bukova.isspst.data.RequirementType"></mapping>

@ -16,11 +16,22 @@ RequirementsFormReqDate=Datum požadavku
RequirementsFormCenter=Středisko RequirementsFormCenter=Středisko
RequirementsFormDescription=Popis RequirementsFormDescription=Popis
RequirementsFormDeliveryDate=Datum dodání RequirementsFormDeliveryDate=Datum dodání
RequirementsFormFrom=Z
RequirementsFormTo=Do
RequirementsFormPurpose=Účel cesty
RequirementsGridNumberSerie=Číslo RequirementsGridNumberSerie=Číslo
RequirementsGridReqDate=Datum požadavku RequirementsGridReqDate=Datum požadavku
RequirementsGridCenter=Středisko RequirementsGridCenter=Středisko
RequirementsGridDescription=Popis RequirementsGridDescription=Popis
RequirementsGridDeliveryDate=Datum dodání RequirementsGridDeliveryDate=Datum dodání
RequirementsGridFrom=Z
RequirementsGridTo=Do
RequirementsGridWorkgroup=Komise
RequirementsGridOwnedBy=Vytvořil
RequirementsGridMy=Moje
RequirementsGridMyCentres=Má střediska
RequirementsGridMyWorkgroups=Mé komise
RequirementsGridAll=Vše
RequirementItemCode=Kód RequirementItemCode=Kód
RequirementItemName=Text RequirementItemName=Text

@ -70,7 +70,9 @@
<property name="permissionEvaluator" ref="permissionEvaluator" /> <property name="permissionEvaluator" ref="permissionEvaluator" />
</bean> </bean>
<bean id="permissionEvaluator" class="info.bukova.isspst.security.IsspstPermissionEvaluator"/> <bean id="permissionEvaluator" class="info.bukova.isspst.security.IsspstPermissionEvaluator">
<property name="workgroupService" ref="workgroupServiceNoTx"/>
</bean>
<security:http auto-config="true" use-expressions="true"> <security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/app/**" access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')"/> <security:intercept-url pattern="/app/**" access="hasAnyRole('ROLE_USER', 'ROLE_ADMIN')"/>
@ -161,6 +163,10 @@
<property name="sessionFactory" ref="sessionFactory"/> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="tripReqDao" class="info.bukova.isspst.dao.jpa.TripRequirementDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic --> <!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@ -223,6 +229,10 @@
<property name="validator" ref="validator"/> <property name="validator" ref="validator"/>
</bean> </bean>
<bean id="workgroupServiceNoTx" class="info.bukova.isspst.services.workgroups.WorkgroupServiceImpl">
<property name="dao" ref="commissionDao"/>
</bean>
<bean id="reqTypeService" class="info.bukova.isspst.services.requirement.RequirementTypeServiceImpl"> <bean id="reqTypeService" class="info.bukova.isspst.services.requirement.RequirementTypeServiceImpl">
<property name="dao" ref="reqTypeDao"/> <property name="dao" ref="reqTypeDao"/>
<property name="validator" ref="validator"/> <property name="validator" ref="validator"/>
@ -266,4 +276,10 @@
<property name="xmlContext" ref="xmlCtxSettings" /> <property name="xmlContext" ref="xmlCtxSettings" />
</bean> </bean>
<bean id="tripRequirementService" class="info.bukova.isspst.services.requirement.TripRequirementServiceImpl">
<property name="dao" ref="tripReqDao"/>
<property name="validator" ref="validator"/>
<property name="numberSeriesService" ref="numericSeriesService"/>
</bean>
</beans> </beans>

@ -8,6 +8,7 @@
<tabs> <tabs>
<tab id="requirements" label="${labels.MenuRequirements}" selected="@load(vm.requirements)"/> <tab id="requirements" label="${labels.MenuRequirements}" selected="@load(vm.requirements)"/>
<tab id="orders" label="${labels.MenuOrders}" selected="@load(vm.orders)"/> <tab id="orders" label="${labels.MenuOrders}" selected="@load(vm.orders)"/>
<tab id="trips" label="Služební cesty" selected="@load(vm.trips)"/>
<tab id="lists" label="${labels.MenuLists}" selected="@load(vm.lists)"/> <tab id="lists" label="${labels.MenuLists}" selected="@load(vm.lists)"/>
<tab id="settings" label="${labels.MenuSettings}" selected="@load(vm.settings)"/> <tab id="settings" label="${labels.MenuSettings}" selected="@load(vm.settings)"/>
<tab id="admin" label="${labels.MenuAdministration}" selected="@load(vm.admin)"/> <tab id="admin" label="${labels.MenuAdministration}" selected="@load(vm.admin)"/>
@ -26,6 +27,12 @@
<menuitem label="${labels.AgendaOrdersHistory}" href="/orders/history" /> <menuitem label="${labels.AgendaOrdersHistory}" href="/orders/history" />
</menubar> </menubar>
</tabpanel> </tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="Požadavky" href="/trips/requirement" />
<menuitem label="${labels.AgendaOrdersHistory}"/>
</menubar>
</tabpanel>
<tabpanel> <tabpanel>
<menubar orient="vertical"> <menubar orient="vertical">
<menuitem label="${labels.AgendaSuppliers}" href="/lists/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/> <menuitem label="${labels.AgendaSuppliers}" href="/lists/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>

@ -0,0 +1,8 @@
<?page title="req toolbar" contentType="text/html;charset=UTF-8"?>
<zk>
<toolbar>
<toolbarbutton image="/img/edit.png" tooltiptext="${labels.ToolbarRecEdit}" id="btnEdit" onClick="@command('edit')" disabled="@load(empty vmSub.dataBean ? 'true' : 'false')"/>
<toolbarbutton image="/img/funnel.png" tooltiptext="${labels.ToolbarRecFilter}" id="btnFilter" onClick="@command('filter')" />
<toolbarbutton image="/img/print.png" tooltiptext="${labels.ToolbarPrint}" id="btnPrint" onClick="@command('onPrint')" />
</toolbar>
</zk>

@ -0,0 +1,10 @@
<?page title="${labels.AgendaActRequirements}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "requirements.zul";
</zscript>
<include src="../../app/template.zhtml"/>
</zk>

@ -0,0 +1,610 @@
<?page title="${labels.AgendaActRequirements}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window
border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.TripRequirementList')">
<caption
zclass="form-caption"
label="${labels.AgendaActRequirements}" />
<tabbox>
<tabs>
<tab label="${labels.RequirementsGridMy}"/>
<tab label="${labels.RequirementsGridMyCentres}" disabled="@load(not vm.showCentre)"/>
<tab label="${labels.RequirementsGridMyWorkgroups}" disabled="@load(not vm.showWorkgroup)"/>
<tab label="${labels.RequirementsGridAll}" disabled="@load(not vm.showAll)"/>
</tabs>
<tabpanels>
<tabpanel>
<include src="/app/toolbar.zul" />
<listbox
model="@load(vm.dataList)"
selectedItem="@bind(vm.dataBean)">
<listhead menupopup="auto">
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="10%" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
<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"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vm.filterTemplate.reqDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.centre)"
model="@load(vm.myCentres)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.from)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.to)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />
<listcell label="@load(each.from)" />
<listcell label="@load(each.to)"/>
</listitem>
</template>
</listbox>
</tabpanel>
<tabpanel apply="org.zkoss.bind.BindComposer"
viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListCentre')">
<include src="/requirements/toolbar.zul"/>
<listbox
model="@load(vmSub.dataList)"
selectedItem="@bind(vmSub.dataBean)">
<listhead menupopup="auto">
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="10%" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="auto(centre)"
width="10%" />
<listheader
label="${labels.RequirementsGridFrom}"
sort="auto(from)"
width="40%" />
<listheader
label="${labels.RequirementsGridTo}"
sort="czech(to)"
width="40%" />
<listheader
label="${labels.RequirementsGridOwnedBy}"
sort="auto(ownedBy)"
width="20%" />
</listhead>
<auxhead
sclass="category-center"
visible="@load(vmSub.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vmSub.filterTemplate.reqDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vmSub.filterTemplate.centre)"
model="@load(vmSub.myCentres)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.from)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.to)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />
<listcell label="@load(each.from)" />
<listcell label="@load(each.to)"/>
<listcell label="@load(each.ownedBy)"/>
</listitem>
</template>
</listbox>
</tabpanel>
<tabpanel apply="org.zkoss.bind.BindComposer"
viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListWorkgroup')">
<include src="/requirements/toolbar.zul"/>
<listbox
model="@load(vmSub.dataList)"
selectedItem="@bind(vmSub.dataBean)">
<listhead menupopup="auto">
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="10%" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="auto(centre)"
width="10%" />
<listheader
label="${labels.RequirementsGridWorkgroup}"
sort="auto(workgroup)"
width="10%" />
<listheader
label="${labels.RequirementsGridFrom}"
sort="czech(from)"
width="30%" />
<listheader
label="${labels.RequirementsGridTo}"
sort="czech(to)"
width="30%" />
<listheader
label="${labels.RequirementsGridOwnedBy}"
sort="auto(ownedBy)"
width="20%" />
</listhead>
<auxhead
sclass="category-center"
visible="@load(vmSub.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vmSub.filterTemplate.reqDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vmSub.filterTemplate.centre)"
model="@load(vmSub.myCentres)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vmSub.filterTemplate.workgroup)"
model="@load(vmSub.myWorkgroups)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.from)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.to)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />
<listcell label="@load(each.workgroup.fullName)"/>
<listcell label="@load(each.from)" />
<listcell label="@load(each.to)"/>
<listcell label="@load(each.ownedBy)"/>
</listitem>
</template>
</listbox>
</tabpanel>
<tabpanel apply="org.zkoss.bind.BindComposer"
viewModel="@id('vmSub') @init('info.bukova.isspst.ui.requirement.TripRequirementListAll')">
<include src="/requirements/toolbar.zul"/>
<listbox
model="@load(vmSub.dataList)"
selectedItem="@bind(vmSub.dataBean)">
<listhead menupopup="auto">
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="10%" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="auto(centre)"
width="10%" />
<listheader
label="${labels.RequirementsGridWorkgroup}"
sort="auto(workgroup)"
width="10%" />
<listheader
label="${labels.RequirementsGridFrom}"
sort="czech(from)"
width="30%" />
<listheader
label="${labels.RequirementsGridTo}"
sort="czech(to)"
width="30%" />
<listheader
label="${labels.RequirementsGridOwnedBy}"
sort="auto(ownedBy)"
width="20%" />
</listhead>
<auxhead
sclass="category-center"
visible="@load(vmSub.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox
value="@bind(vmSub.filterTemplate.reqDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vmSub.filterTemplate.centre)"
model="@load(vmSub.allCentres)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vmSub.filterTemplate.workgroup)"
model="@load(vmSub.allWorkgroups)"
onChange="@command('doFilter')">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.from)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.to)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vmSub.filterTemplate.ownedBy.lastName)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.centre.fullName)" />
<listcell label="@load(each.workgroup.fullName)"/>
<listcell label="@load(each.from)" />
<listcell label="@load(each.to)"/>
<listcell label="@load(each.ownedBy)"/>
</listitem>
</template>
</listbox>
</tabpanel>
</tabpanels>
</tabbox>
</window>
</zk>

@ -0,0 +1,90 @@
<?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window
id="editWin"
closable="true"
border="normal"
position="center"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.TripRequirementForm')">
<caption
src="/img/reqact.png"
zclass="form-caption"
label="${labels.RequirementsFormTitle}" />
<vlayout>
<grid hflex="min">
<columns>
<column
align="right"
hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
<cell>
<textbox
id="numser"
constraint="@load(vm.constriant)"
width="200px"
value="@bind(vm.dataBean.numser)"
readonly="true" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormReqDate} :</cell>
<cell>
<datebox
id="reqDate"
width="200px"
value="@bind(vm.dataBean.reqDate)"
format="${labels.DateFormat}" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormCenter} :</cell>
<cell>
<combobox
model="@load(vm.centres)"
readonly="true"
selectedItem="@bind(vm.dataBean.centre)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormFrom} :</cell>
<cell>
<textbox
id="from"
width="300px"
value="@bind(vm.dataBean.from)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormTo} :</cell>
<cell>
<textbox
id="to"
width="300px"
value="@bind(vm.dataBean.to)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormPurpose} :</cell>
<cell>
<textbox
id="description"
width="300px"
value="@bind(vm.dataBean.description)" />
</cell>
</row>
</rows>
</grid>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>
Loading…
Cancel
Save