19 package org.turro.crm.command;
21 import java.util.Collection;
22 import org.turro.annotation.ElephantPlugin;
23 import org.turro.auth.Authentication;
24 import org.turro.crm.db.CrmPU;
25 import org.turro.crm.entity.VendorProspect;
26 import org.turro.crm.zul.menu.CrmMenu;
27 import org.turro.elephant.context.Application;
28 import org.turro.elephant.db.WhereClause;
29 import org.turro.elephant.util.Images;
30 import org.turro.i18n.I_;
31 import org.turro.jpa.Dao;
32 import org.turro.plugin.command.SelfSummaryPlugin;
33 import org.turro.zkoss.label.LabelTypes;
34 import org.turro.zkoss.layout.GroupboxArrow;
35 import org.zkoss.zk.ui.event.Event;
36 import org.zkoss.zk.ui.event.EventListener;
37 import org.zkoss.zk.ui.event.Events;
38 import org.zkoss.zul.Button;
39 import org.zkoss.zul.Hlayout;
40 import org.zkoss.zul.Image;
41 import org.zkoss.zul.Include;
42 import org.zkoss.zul.Space;
51 private Collection<VendorProspect> assigned;
57 if(!assigned.isEmpty()) {
60 protected void doFillContent() {
63 Hlayout hbox =
new Hlayout();
65 hbox.setSclass(
"z-valign-middle");
66 hbox.setValign(
"middle");
70 hbox.appendChild(
new Space());
71 Button visit =
new Button(
I_.
get(
"Sale actions"));
72 visit.addEventListener(Events.ON_CLICK,
new EventListener<Event>() {
74 public void onEvent(Event event) throws Exception {
75 CrmMenu.showSaleActions(null, null);
78 hbox.appendChild(visit);
79 Include report =
new Include(
"/WEB-INF/_zul/crm/crmSummary.zul");
80 report.setDynamicProperty(
"assigned", assigned);
81 gba.appendChild(report);
87 private void assignedSales() {
88 Dao dao =
new CrmPU();
89 WhereClause wc =
new WhereClause();
90 wc.addClause(
"select distinct vendorp from VendorProspect as vendorp");
91 wc.addClause(
"where vendorp.vendor.idContact = :contact");
92 wc.addClause(
"and vendorp.saleProspect.closingDate is null");
93 wc.addNamedValue(
"contact", Authentication.getIContact().getId());
94 assigned = dao.getResultList(wc);
Object addResult(String key, Object value)
static Application getApplication()
static String getImage(String image)
static String get(String msg)
static Label getPreLabel(String value)
static Label getSoftLabel(String value)
void setCaption(Component comp)