V agendě Střediska se zobrazují funkce (Příkazce, Správce rozpočtu...).

refs #97
multitenant
Josef Rokos 11 years ago
parent 601e3eedcb
commit dd369c5186

@ -2,6 +2,7 @@ package info.bukova.isspst.dao.jpa;
import java.util.List;
import org.hibernate.NonUniqueObjectException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@ -44,7 +45,11 @@ public abstract class BaseDaoJPA<T> implements BaseDao<T> {
@Override
public void modify(T entity) {
sessionFactory.getCurrentSession().update(entity);
try {
sessionFactory.getCurrentSession().update(entity);
} catch (NonUniqueObjectException e) {
sessionFactory.getCurrentSession().merge(entity);
}
}
@Override

@ -1,5 +1,7 @@
package info.bukova.isspst.ui.workgroups;
import java.util.List;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init;
@ -9,8 +11,10 @@ import org.zkoss.zul.TreeModel;
import org.zkoss.zul.TreeNode;
import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.WorkgroupFilter;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.BoolConverter;
import info.bukova.isspst.ui.ListViewModel;
@ -19,6 +23,8 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
@WireVariable
private WorkgroupService workgroupService;
@WireVariable
private RoleService roleService;
private WorkgroupTreeFactory treeFactory;
private BoolConverter boolConverter;
@ -40,21 +46,21 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
return null;
}
@NotifyChange({"dataBean", "workgroupTreeModel", "ableToDelete"})
@NotifyChange({"dataBean", "workgroupTreeModel", "ableToDelete", "workgroupRoles"})
public void setDataBean(Workgroup data) {
super.setDataBean(data);
}
@Override
@GlobalCommand
@NotifyChange({ "dataList", "dataBean", "workgroupTreeModel", "ableToDelete" })
@NotifyChange({ "dataList", "dataBean", "workgroupTreeModel", "ableToDelete", "workgroupRoles" })
public void refresh() {
super.refresh();
}
@Override
@Command
@NotifyChange({ "filter", "dataList", "dataBean", "workgroupTreeModel" })
@NotifyChange({ "filter", "dataList", "dataBean", "workgroupTreeModel", "workgroupRoles" })
public void filter() {
super.filter();
}
@ -63,4 +69,14 @@ public class WorkgroupList extends ListViewModel<Workgroup> {
return boolConverter;
}
public List<Role> getWorkgroupRoles() {
if (getDataBean() != null && getDataBean().isCentre()) {
return roleService.getCentreRoles();
} else if (getDataBean() != null) {
return roleService.getWorkgroupRoles();
}
return null;
}
}

@ -46,7 +46,7 @@
<tabbox mold="accordion" width="300px">
<tabs children="@load(vm.workgroupRoles)">
<template name="children">
<tab label="@load(each.description)" />
<tab label="@load(each.authority eq 'ROLE_USER' ? 'Členové' : each.description)" />
</template>
</tabs>
<tabpanels children="@load(vm.workgroupRoles)">

@ -57,22 +57,40 @@
</template>
</listbox>
<groupbox mold="3d" closable="false">
<caption label="členové"/>
<tree hflex="1" model="@load(vm.workgroupTreeModel)">
<treecols>
<treecol/>
</treecols>
<template name="model">
<treeitem>
<treerow>
<treecell image="@load(each.data.person ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.data.fullName)"/>
</treerow>
</treeitem>
<vbox>
<vbox children="@load(vm.workgroupRoles)">
<template name="children">
<grid model="@load(vm.dataBean.members)" visible="@load(each.authority ne 'ROLE_USER')">
<columns>
<column label="@load(each.description)"/>
</columns>
<rows>
<template name="model" var="member">
<row visible="@load(member.role eq each)">
<label value="@load(member.member.fullName)"/>
</row>
</template>
</rows>
</grid>
</template>
</tree>
</groupbox>
</vbox>
<groupbox mold="3d" closable="false">
<caption label="členové"/>
<tree hflex="1" model="@load(vm.workgroupTreeModel)">
<treecols>
<treecol/>
</treecols>
<template name="model">
<treeitem>
<treerow>
<treecell image="@load(each.data.person ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.data.fullName)"/>
</treerow>
</treeitem>
</template>
</tree>
</groupbox>
</vbox>
</hbox>
</window>
</zk>
Loading…
Cancel
Save