18 package org.turro.erp.menu;
20 import java.util.HashMap;
21 import org.turro.annotation.ExternalMenu;
22 import org.turro.elephant.context.Application;
23 import org.turro.elephant.zkoss.RoleMap;
24 import org.turro.erp.db.ErpPU;
25 import org.turro.erp.entity.RequiredUsage;
26 import org.turro.erp.entity.Task;
27 import org.turro.erp.entity.WorkOrder;
28 import org.turro.zkoss.menu.ElephantMenu;
29 import org.turro.zkoss.menu.ElephantMenuBar;
30 import org.turro.elephant.zkoss.ElLabel;
31 import org.zkoss.zk.ui.event.Event;
32 import org.zkoss.zk.ui.event.EventListener;
33 import org.zkoss.zul.Menu;
34 import org.zkoss.zul.Menupopup;
41 public class ErpMenu extends ElephantMenu {
44 public void addMenus(
final ElephantMenuBar bar) {
46 if(rm.containsKey(
"erp-purchase,erp-sales")) {
49 Menupopup mp = bar.addMenupopup(m);
51 if(rm.get(
"erp-purchase:new")) {
53 Menupopup mip = bar.addMenupopup(mm);
54 bar.addMenuitem(mip,
Application.
getString(
"lOrders"),
"/_zul/images/orders.png",
"/WEB-INF/_zul/erp/purchase/orders.zul",
false);
55 bar.addMenuitem(mip,
Application.
getString(
"lHoursOrder"),
null,
"/WEB-INF/_zul/erp/purchase/hoursOrder.zul",
false);
56 bar.addMenuitem(mip,
Application.
getString(
"lProductsOrder"),
null,
"/WEB-INF/_zul/erp/purchase/productsOrder.zul",
false);
57 bar.addMenuSeparator(mp);
58 bar.addMenuitem(mip,
Application.
getString(
"lReceipts"),
"/_zul/images/receipts.png",
"/WEB-INF/_zul/erp/purchase/receipts.zul",
false);
59 bar.addMenuitem(mip,
Application.
getString(
"lHoursReceipt"),
null,
"/WEB-INF/_zul/erp/purchase/hoursReceipt.zul",
false);
60 bar.addMenuitem(mip,
Application.
getString(
"lProductsReceipt"),
null,
"/WEB-INF/_zul/erp/purchase/productsReceipt.zul",
false);
63 if(rm.get(
"erp-sales:new")) {
65 Menupopup mip = bar.addMenupopup(mm);
66 bar.addMenuitem(mip,
Application.
getString(
"lCustomerOrders"),
"/_zul/images/orders.png",
"/WEB-INF/_zul/erp/sales/orders.zul",
false);
67 bar.addMenuitem(mip,
Application.
getString(
"lNewCustomerOrder"),
"/_zul/images/order_new.png",
new EventListener() {
69 public void onEvent(Event event)
throws Exception {
75 if(rm.containsKey(
"erp-workorder,erp-task,erp-reference")) {
78 Menupopup mp = bar.addMenupopup(m);
79 if(rm.get(
"erp-task:list")) {
80 bar.addMenuitem(mp,
Application.
getString(
"lPendingTasks"),
"/_zul/images/task_pending.png",
"/WEB-INF/_zul/erp/task/pendingTasks.zul",
true);
81 bar.addMenuitem(mp,
Application.
getString(
"lWorkload"),
"/_zul/images/workload.png",
"/WEB-INF/_zul/erp/task/workloads.zul",
true);
83 bar.addMenuitem(mp,
Application.
getString(
"lTimeControl"),
null,
"/WEB-INF/_zul/erp/resource/timeControl.zul",
false);
84 if(rm.get(
"erp-workorder:list") || rm.get(
"erp-reference:list") || rm.get(
"erp-task:list")) {
86 Menupopup mip = bar.addMenupopup(mm);
87 if(rm.get(
"erp-workorder:list")) {
88 bar.addMenuitem(mip,
Application.
getString(
"lWorkOrders"),
"/_zul/images/workorder.png",
"/WEB-INF/_zul/erp/workorder/workorders.zul",
true);
90 if(rm.get(
"erp-task:list")) {
91 bar.addMenuitem(mip,
Application.
getString(
"lTasks"),
"/_zul/images/task.png",
"/WEB-INF/_zul/erp/task/tasks.zul",
false);
93 bar.addToolbarSeparator(
true);
94 bar.addMenuSeparator(mip);
95 if(rm.get(
"erp-workorder:new")) {
96 bar.addMenuitem(mip,
Application.
getString(
"lNewWorkOrder"),
"/_zul/images/workorder_new.png",
new EventListener() {
98 public void onEvent(Event event)
throws Exception {
99 showModalZulFile(
"lNewWorkOrder",
"/WEB-INF/_zul/erp/workorder/newWorkorder.zul",
null);
103 if(rm.get(
"erp-workorder:new")) {
104 bar.addMenuitem(mip,
Application.
getString(
"lNewProductOrder"),
"/_zul/images/productorder_new.png",
new EventListener() {
106 public void onEvent(Event event)
throws Exception {
107 showModalZulFile(
"lNewProductOrder",
"/WEB-INF/_zul/erp/workorder/newProductorder.zul",
null);
111 bar.addToolbarSeparator(
true);
113 if(rm.get(
"erp-config:list")) {
115 Menupopup mip = bar.addMenupopup(mm);
116 bar.addMenuitem(mip,
Application.
getString(
"lHumanResources"),
"/_zul/images/operator.png",
"/WEB-INF/_zul/erp/config/humanResources.zul");
117 bar.addMenuitem(mip,
Application.
getString(
"lAptitudes"),
"/_zul/images/aptitude.png",
"/WEB-INF/_zul/erp/config/aptitudes.zul");
118 bar.addMenuitem(mip,
Application.
getString(
"lResources"),
"/_zul/images/resource.png",
"/WEB-INF/_zul/erp/config/resources.zul");
124 HashMap<String, Object> map =
new HashMap<String, Object>();
125 map.put(
"workOrderGenerated", workOrder);
126 showEntity(workOrder.
getId(),
"workOrderId",
"lWorkOrder",
"/WEB-INF/_zul/erp/workorder/workorder.zul", map);
130 showEntity(
id,
"workOrderId",
"lWorkOrder",
"/WEB-INF/_zul/erp/workorder/workorder.zul");
134 HashMap<String, Object> map =
new HashMap<String, Object>();
135 map.put(
"taskGenerated", task);
136 showEntity(task.
getId(),
"taskId",
"lTask",
"/WEB-INF/_zul/erp/task/task.zul", map);
147 HashMap<String, Object> map =
new HashMap<String, Object>();
148 map.put(
"task", task);
149 map.put(
"view", view);
150 showPopupZulFile(
"@" + task.
getFullDescription(),
"/WEB-INF/_zul/erp/task/detail.zul", map);
155 if(requiredUsage !=
null) {
161 HashMap<String, Object> map =
new HashMap<String, Object>();
162 map.put(
"requiredUsage", requiredUsage);
167 showEntity(
id,
"taskId",
"lTask",
"/WEB-INF/_zul/erp/task/task.zul");
171 showEntity(
id,
"aptitudeId",
"lAptitude",
"/WEB-INF/_zul/erp/config/aptitude.zul");
175 showEntity(
id,
"resourceId",
"lResource",
"/WEB-INF/_zul/erp/config/resource.zul");
179 showEntity(
id,
"humanResourceId",
"lHumanResource",
"/WEB-INF/_zul/erp/config/humanResource.zul");
183 showEntity(
id,
"customerOrderId",
"lCustomerOrder",
"/WEB-INF/_zul/erp/sales/order.zul");
static Application getApplication()
static String getString(String key)
String getFullDescription()