V procesech schválení lze zadat limit pro schválení k dané roli.

closes #107
multitenant
Josef Rokos 11 years ago
parent a637a077c0
commit e26f56fcb9

@ -1,5 +1,7 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.math.BigDecimal;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
@ -21,6 +23,8 @@ public class Workflow extends BaseData {
private Role role; private Role role;
@Column(name = "WORDER") @Column(name = "WORDER")
private Integer wOrder; private Integer wOrder;
@Column(name = "WLIMIT", precision=15, scale=4)
private BigDecimal limit;
public Boolean getCentre() { public Boolean getCentre() {
return centre; return centre;
@ -56,4 +60,12 @@ public class Workflow extends BaseData {
this.wOrder = order; this.wOrder = order;
} }
public BigDecimal getLimit() {
return limit;
}
public void setLimit(BigDecimal limit) {
this.limit = limit;
}
} }

@ -0,0 +1,33 @@
package info.bukova.isspst.ui.requirements;
import info.bukova.isspst.data.Workflow;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.ExecutionArgParam;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zul.Window;
public class LimitVM {
private Workflow workflow;
@Init
public void init(@ExecutionArgParam("workflow") Workflow workflow) {
this.workflow = workflow;
}
public Workflow getWorkflow() {
return workflow;
}
@Command
public void save(@BindingParam("window") Window window) {
window.detach();
}
public boolean isCanSave() {
return true;
}
}

@ -7,16 +7,22 @@ import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirements.RequirementTypeService; import info.bukova.isspst.services.requirements.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Window;
public class RequirementTypesVM { public class RequirementTypesVM {
@ -28,6 +34,8 @@ public class RequirementTypesVM {
private List<Role> centreRoles; private List<Role> centreRoles;
private List<Role> workgroupRoles; private List<Role> workgroupRoles;
private RequirementType selected; private RequirementType selected;
private Workflow wgSelWorkflow;
private Workflow centreSelWorkflow;
@Init @Init
public void init() { public void init() {
@ -199,5 +207,42 @@ public class RequirementTypesVM {
this.selected = selected; this.selected = selected;
} }
@Command
@NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"})
public void overLimit(@BindingParam("workflow") Workflow workflow) {
if (workflow.getLimit() != null && !workflow.getLimit().equals(BigDecimal.ZERO)) {
workflow.setLimit(null);
reqTypeService.update(selected);
return;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("workflow", workflow);
Window win = (Window) Executions.createComponents("/settings/workflow/limit.zul", null, params);
win.doModal();
}
@GlobalCommand
@NotifyChange("selected")
public void refresh() {
reqTypeService.update(selected);
}
public Workflow getWgSelWorkflow() {
return wgSelWorkflow;
}
public void setWgSelWorkflow(Workflow wgSelWorkflow) {
this.wgSelWorkflow = wgSelWorkflow;
}
public Workflow getCentreSelWorkflow() {
return centreSelWorkflow;
}
public void setCentreSelWorkflow(Workflow centreSelWorkflow) {
this.centreSelWorkflow = centreSelWorkflow;
}
} }

@ -104,6 +104,9 @@ CentreRoles=Role středisek
Workflow=Proces schválení Workflow=Proces schválení
WorkgroupWorkflow=Schválení v komisi WorkgroupWorkflow=Schválení v komisi
CentreWorkflow=Schválení ve středisku CentreWorkflow=Schválení ve středisku
LimitFormTitle=Limit pro schválení
Limit=Limit:
OverLimit=Pouze nadlimitní
CentresForRequirements=Střediska, pro která lze vkládat požadavky CentresForRequirements=Střediska, pro která lze vkládat požadavky
WorkgroupMembership=Členství v komisích WorkgroupMembership=Členství v komisích

@ -0,0 +1,15 @@
<?page title="Limit" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirements.LimitVM')">
<caption zclass="form-caption" label="${labels.LimitFormTitle}" />
<vbox>
<hbox>
<label value="${labels.Limit}"/>
<textbox value="@bind(vm.workflow.limit)"/>
</hbox>
<include src="/app/formButtons.zul" />
</vbox>
</window>
</zk>

@ -45,27 +45,45 @@
<caption label="${labels.Workflow}"/> <caption label="${labels.Workflow}"/>
<vbox> <vbox>
<listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup" <listbox id="wgWorkflow" model="@load(vm.selected.workflow)" droppable="workgroup"
onDrop="@command('addRoleWg', event=event)"> onDrop="@command('addRoleWg', event=event)"
selectedItem="@bind(vm.wgSelWorkflow)">
<listhead> <listhead>
<listheader label="${labels.WorkgroupWorkflow}"/> <listheader label="${labels.WorkgroupWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(not each.centre)" <listitem label="@load(each.role.description)" visible="@load(not each.centre)"
onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"/> onDrop="@command('reorderWg', event=event)" draggable="workgroup" droppable="workgroup"
context="limitPopUpWg"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/>
</template> </template>
</listbox> </listbox>
<listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre" <listbox id="centreWorkflow" model="@load(vm.selected.workflow)" droppable="centre"
onDrop="@command('addRoleCentre', event=event)"> onDrop="@command('addRoleCentre', event=event)"
selectedItem="@bind(vm.centreSelWorkflow)">
<listhead> <listhead>
<listheader label="${labels.CentreWorkflow}"/> <listheader label="${labels.CentreWorkflow}"/>
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem label="@load(each.role.description)" visible="@load(each.centre)" <listitem label="@load(each.role.description)" visible="@load(each.centre)"
onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"/> onDrop="@command('reorderCentre', event=event)" draggable="centre" droppable="centre"
context="limitPopUp"
style="@load(empty each.limit ? '' : 'background-color: #e1fdd5')"
tooltiptext="@load(empty each.limit ? '' : labels.Limit.concat(' ').concat(each.limit))"/>
</template> </template>
</listbox> </listbox>
</vbox> </vbox>
</groupbox> </groupbox>
<menupopup id="limitPopUp">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.centreSelWorkflow.limit)"
onClick="@command('overLimit', workflow=centreWorkflow.selectedItem.value)"/>
</menupopup>
<menupopup id="limitPopUpWg">
<menuitem label="${labels.OverLimit}" checkmark="true"
checked="@load(not empty vm.wgSelWorkflow.limit)"
onClick="@command('overLimit', workflow=wgWorkflow.selectedItem.value)"/>
</menupopup>
</div> </div>
</hbox> </hbox>
</vbox> </vbox>

Loading…
Cancel
Save