From e26f56fcb9c44feaaaec718553af253b37872943 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 1 Jul 2014 22:46:33 +0200 Subject: [PATCH] =?UTF-8?q?V=20procesech=20schv=C3=A1len=C3=AD=20lze=20zad?= =?UTF-8?q?at=20limit=20pro=20schv=C3=A1len=C3=AD=20k=20dan=C3=A9=20roli.?= =?UTF-8?q?=20closes=20#107?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info/bukova/isspst/data/Workflow.java | 12 +++++ .../isspst/ui/requirements/LimitVM.java | 33 ++++++++++++++ .../ui/requirements/RequirementTypesVM.java | 45 +++++++++++++++++++ .../WEB-INF/locales/zk-label.properties | 3 ++ src/main/webapp/settings/workflow/limit.zul | 15 +++++++ .../webapp/settings/workflow/workflow.zul | 26 +++++++++-- 6 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java create mode 100644 src/main/webapp/settings/workflow/limit.zul diff --git a/src/main/java/info/bukova/isspst/data/Workflow.java b/src/main/java/info/bukova/isspst/data/Workflow.java index a5d839cd..ac489428 100644 --- a/src/main/java/info/bukova/isspst/data/Workflow.java +++ b/src/main/java/info/bukova/isspst/data/Workflow.java @@ -1,5 +1,7 @@ package info.bukova.isspst.data; +import java.math.BigDecimal; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; @@ -21,6 +23,8 @@ public class Workflow extends BaseData { private Role role; @Column(name = "WORDER") private Integer wOrder; + @Column(name = "WLIMIT", precision=15, scale=4) + private BigDecimal limit; public Boolean getCentre() { return centre; @@ -56,4 +60,12 @@ public class Workflow extends BaseData { this.wOrder = order; } + public BigDecimal getLimit() { + return limit; + } + + public void setLimit(BigDecimal limit) { + this.limit = limit; + } + } diff --git a/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java b/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java new file mode 100644 index 00000000..45597f4c --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java @@ -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; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/requirements/RequirementTypesVM.java b/src/main/java/info/bukova/isspst/ui/requirements/RequirementTypesVM.java index 0b6807a9..6d7340e6 100644 --- a/src/main/java/info/bukova/isspst/ui/requirements/RequirementTypesVM.java +++ b/src/main/java/info/bukova/isspst/ui/requirements/RequirementTypesVM.java @@ -7,16 +7,22 @@ import info.bukova.isspst.data.Workflow; import info.bukova.isspst.services.requirements.RequirementTypeService; import info.bukova.isspst.services.users.RoleService; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.NotifyChange; +import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zul.Listitem; +import org.zkoss.zul.Window; public class RequirementTypesVM { @@ -28,6 +34,8 @@ public class RequirementTypesVM { private List centreRoles; private List workgroupRoles; private RequirementType selected; + private Workflow wgSelWorkflow; + private Workflow centreSelWorkflow; @Init public void init() { @@ -199,5 +207,42 @@ public class RequirementTypesVM { 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 params = new HashMap(); + 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; + } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 946c81e4..9aeb2b18 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -104,6 +104,9 @@ CentreRoles=Role středisek Workflow=Proces schválení WorkgroupWorkflow=Schválení v komisi 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 WorkgroupMembership=Členství v komisích diff --git a/src/main/webapp/settings/workflow/limit.zul b/src/main/webapp/settings/workflow/limit.zul new file mode 100644 index 00000000..1a2b8990 --- /dev/null +++ b/src/main/webapp/settings/workflow/limit.zul @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/settings/workflow/workflow.zul b/src/main/webapp/settings/workflow/workflow.zul index e38ab85d..7c13f256 100644 --- a/src/main/webapp/settings/workflow/workflow.zul +++ b/src/main/webapp/settings/workflow/workflow.zul @@ -45,27 +45,45 @@ + onDrop="@command('addRoleWg', event=event)" + selectedItem="@bind(vm.wgSelWorkflow)"> + onDrop="@command('addRoleCentre', event=event)" + selectedItem="@bind(vm.centreSelWorkflow)"> + + + + + +