diff --git a/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java b/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java new file mode 100644 index 00000000..1ebed322 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java @@ -0,0 +1,39 @@ +package info.bukova.isspst.ui.renderers; + +import info.bukova.isspst.data.Requirement; +import info.bukova.isspst.data.RequirementState; + +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listitem; + +@SuppressWarnings("serial") +public class RequirementsItemRenderer extends GenericListitemRenderer +{ + @Override + protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) + { + Requirement requirement = this.getObjectOfStates(); + RequirementState state = requirement.getState(); + + if (state != null) + { + if (state == RequirementState.PARTIALLY) + { + li.setSclass("req-select-partially"); + } + else if (state == RequirementState.APPROVED) + { + Boolean isProject = requirement.getProject(); + + if ((isProject != null) && (isProject.booleanValue() == true)) + { + li.setSclass("req-select-approved-project"); + } + else + { + li.setSclass("req-select-approved"); + } + } + } + } +} diff --git a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java index 3bc720ec..780b41d8 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java @@ -6,6 +6,7 @@ import info.bukova.isspst.services.requirement.RequirementBaseService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.ListViewModel; +import info.bukova.isspst.ui.renderers.RequirementsItemRenderer; import java.util.List; @@ -20,6 +21,8 @@ public class RequirementSubpage extends ListViewModel @WireVariable protected UserService userService; + protected RequirementsItemRenderer requirementsItemRenderer; + public List getAllUsers() { return userService.getAll(); @@ -41,6 +44,7 @@ public class RequirementSubpage extends ListViewModel public void initRequirementSubpage() { this.bigDecimalConverter = new BigDecimalConverter(); + this.requirementsItemRenderer = new RequirementsItemRenderer(); } private RequirementBaseService getReqService() @@ -69,6 +73,16 @@ public class RequirementSubpage extends ListViewModel return false; } + public RequirementsItemRenderer getRequirementsItemRenderer() + { + return requirementsItemRenderer; + } + + public void setRequirementsItemRenderer(RequirementsItemRenderer requirementsItemRenderer) + { + this.requirementsItemRenderer = requirementsItemRenderer; + } + @Override protected void afterSelect() { BindUtils.postNotifyChange(null, null, this, "canApprove"); diff --git a/src/main/webapp/css/zk-modify.css b/src/main/webapp/css/zk-modify.css index bcd15cd5..bb566f0e 100644 --- a/src/main/webapp/css/zk-modify.css +++ b/src/main/webapp/css/zk-modify.css @@ -76,4 +76,16 @@ .order-select-delivered { background-color: #d19fe8 !important; -} \ No newline at end of file +} + +.req-select-partially { + background-color: #fffb90 !important; +} + +.req-select-approved { + background-color: #afffb5 !important; +} + +.req-select-approved-project { + background-color: #87cefa !important; +} diff --git a/src/main/webapp/main/orders/requirements/reqListMy.zul b/src/main/webapp/main/orders/requirements/reqListMy.zul index f0d39069..7547347c 100644 --- a/src/main/webapp/main/orders/requirements/reqListMy.zul +++ b/src/main/webapp/main/orders/requirements/reqListMy.zul @@ -1,5 +1,6 @@