diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index 75d0f42a..b6b40b6a 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -1,9 +1,12 @@ package info.bukova.isspst.services.requirement; +import info.bukova.isspst.Constants; import info.bukova.isspst.data.Requirement; +import info.bukova.isspst.data.RequirementState; import java.util.Date; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; @@ -11,11 +14,16 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl implements RequirementService, RequirementBaseService { + @Autowired + private RequirementTypeService reqTypeService; + @Override protected Requirement createEntity() { Requirement entity = new Requirement(); entity.setReqDate(new Date()); + entity.setType(reqTypeService.getTypeById(Constants.REQTYPE_ORDER)); + entity.setState(RequirementState.NEW); return entity; } diff --git a/src/main/java/info/bukova/isspst/ui/MainMenu.java b/src/main/java/info/bukova/isspst/ui/MainMenu.java new file mode 100644 index 00000000..5b710e25 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/MainMenu.java @@ -0,0 +1,51 @@ +package info.bukova.isspst.ui; + +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zul.Window; + +public class MainMenu +{ + private String contextPath; + + private String moduleUrl; + + @Init + public void init() + { + this.contextPath = Executions.getCurrent().getContextPath(); + this.moduleUrl = Executions.getCurrent().getDesktop().getRequestPath(); + } + + public String getContextPath() + { + return this.contextPath; + } + + public String getModuleUrl() + { + return this.moduleUrl; + } + + @Command + public void passwd() + { + Window window = (Window) Executions.createComponents("/app/passwd.zul", null, null); + window.doModal(); + } + + @Command + public void numSeries() + { + Window window = (Window) Executions.createComponents("/settings/numberSeries.zul", null, null); + window.doModal(); + } + + @Command + public void globalSettings() + { + Window window = (Window) Executions.createComponents("/settings/globalSettings.zul", null, null); + window.doModal(); + } +} diff --git a/src/main/java/info/bukova/isspst/ui/NavigationVM.java b/src/main/java/info/bukova/isspst/ui/NavigationVM.java deleted file mode 100644 index ccd34470..00000000 --- a/src/main/java/info/bukova/isspst/ui/NavigationVM.java +++ /dev/null @@ -1,72 +0,0 @@ -package info.bukova.isspst.ui; - -import org.zkoss.bind.annotation.Command; -import org.zkoss.bind.annotation.Init; -import org.zkoss.zk.ui.Executions; -import org.zkoss.zul.Window; - -public class NavigationVM { - - private String contextPath; - private String moduleUrl; - - @Init - public void init() { - contextPath = Executions.getCurrent().getContextPath(); - moduleUrl = Executions.getCurrent().getDesktop().getRequestPath(); - } - - @Command - public void passwd() { - Window window = (Window)Executions.createComponents("/app/passwd.zul", null, null); - window.doModal(); - } - - @Command - public void numSeries() { - Window window = (Window)Executions.createComponents("/settings/numberSeries.zul", null, null); - window.doModal(); - } - - @Command - public void globalSettings() { - Window window = (Window)Executions.createComponents("/settings/globalSettings.zul", null, null); - window.doModal(); - } - - public String getContextPath() { - return contextPath; - } - - public String getModuleUrl() { - return moduleUrl; - } - - public boolean isOrders() { - return moduleUrl.contains("orders"); - } - - public boolean isTrips() { - return moduleUrl.contains("trips"); - } - - public boolean isSettings() { - return moduleUrl.contains("settings"); - } - - public boolean isAdmin() { - return moduleUrl.contains("admin"); - } - - public boolean isUser() { - return moduleUrl.contains("passwd"); - } - - public boolean isLists() { - return moduleUrl.contains("lists"); - } - - public boolean isRequirements() { - return moduleUrl.contains("requirements"); - } -} 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 907c003f..7cbed31f 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java @@ -9,22 +9,21 @@ import org.zkoss.bind.annotation.NotifyChange; public class RequirementSubpage extends ListViewModel { - protected RequirementBaseService reqService; - @SuppressWarnings("unchecked") - public void init() { - reqService = (RequirementBaseService) service; + private RequirementBaseService getReqService() + { + return (RequirementBaseService) service; } @Override protected void loadLazyData(T data) { - reqService.loadAuthItems(data); + this.getReqService().loadAuthItems(data); } @Command @NotifyChange({"dataBean", "canApprove"}) public void approve() { - reqService.approve(getDataBean()); + this.getReqService().approve(getDataBean()); } @Override @@ -35,11 +34,9 @@ public class RequirementSubpage extends ListViewModel public boolean isCanApprove() { if (getDataBean() != null) { - return reqService.canApprove(getDataBean()); + return this.getReqService().canApprove(getDataBean()); } return false; } - - } diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java index 0d1262ee..3d527af2 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java @@ -32,7 +32,6 @@ public class TripRequirementListAll extends RequirementSubpage allCentres = workgroupService.getCentres(); allWorkgroups = workgroupService.getWorkgroups(); - super.init(); } @Override diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java index f8833c8a..2304a186 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java @@ -33,7 +33,6 @@ public class TripRequirementListCentre extends RequirementSubpage