Fixes Bug #0009744
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@73758 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4b12fcc2a8
commit
b81636efea
|
@ -1,7 +1,6 @@
|
||||||
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@ -13,141 +12,154 @@ import org.zkoss.zhtml.Messagebox;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zul.Combobox;
|
|
||||||
import org.zkoss.zul.Paging;
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
|
||||||
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpleado;
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpleado;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMensagemRecusa;
|
|
||||||
|
|
||||||
@Controller("BusquedaEmpleadoController")
|
@Controller("busquedaEmpleadoController")
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public class BusquedaEmpleadoController extends MyGenericForwardComposer {
|
public class BusquedaEmpleadoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoriaService categoriaService;
|
private transient PagedListWrapper<Empleado> plwEmpleado;
|
||||||
|
private MyListbox empleadoList;
|
||||||
@Autowired
|
private Paging pagingEmpleado;
|
||||||
private transient PagedListWrapper<MensagemRecusa> plwMensagemRecusa;
|
private MyTextbox txtNombEmpleado;
|
||||||
private MyListbox mensagemRecusaList;
|
private MyTextbox txtApelidoPaterno;
|
||||||
private Paging pagingMensagemRecusa;
|
private MyTextbox txtApelidoMaterno;
|
||||||
|
private MyTextbox txtCveEmpleado;
|
||||||
private Combobox cbmCategoria;
|
|
||||||
private List<Categoria> lsCategoria;
|
|
||||||
private MyTextbox txtDescricao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
mensagemRecusaList.setItemRenderer(new RenderMensagemRecusa());
|
|
||||||
lsCategoria = categoriaService.obtenerTodasCategoriasVisibles();
|
empleadoList.setItemRenderer(new RenderEmpleado());
|
||||||
|
empleadoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
mensagemRecusaList.addEventListener("onDoubleClick", new EventListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
MensagemRecusa m = (MensagemRecusa) mensagemRecusaList.getSelected();
|
Empleado e = (Empleado) empleadoList.getSelected();
|
||||||
verMensagemRecusa(m);
|
verEmpleado(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
refreshLista(false);
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnPesquisa(Event ev) {
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
refreshLista(true);
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnRefresh(Event ev) {
|
public void onClick$btnRefresh(Event ev) {
|
||||||
refreshLista(true);
|
refreshLista();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnNovo(Event ev) {
|
public void onClick$btnNovo(Event ev) {
|
||||||
verMensagemRecusa(new MensagemRecusa());
|
verEmpleado(new Empleado());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Empleado> sistemaBusqueda =
|
||||||
|
new HibernateSearchObject<Empleado>(Empleado.class, pagingEmpleado.getPageSize());
|
||||||
|
|
||||||
private void refreshLista(Boolean showmsg) {
|
String cveEmpleado = txtCveEmpleado.getValue();
|
||||||
HibernateSearchObject<MensagemRecusa> sistemaBusqueda = new HibernateSearchObject<MensagemRecusa>(MensagemRecusa.class, pagingMensagemRecusa.getPageSize());
|
if (cveEmpleado != null && StringUtils.isNotBlank(cveEmpleado)) {
|
||||||
|
sistemaBusqueda.addFilterLike("cveEmpleado", "%".concat(cveEmpleado.trim().concat("%")));
|
||||||
String descricao = txtDescricao.getValue();
|
}
|
||||||
if (descricao != null && StringUtils.isNotBlank(descricao)) {
|
|
||||||
sistemaBusqueda.addFilterLike("descricao", "%".concat(descricao.trim().concat("%")));
|
String nombempleado = txtNombEmpleado.getText();
|
||||||
|
if (nombempleado != null && StringUtils.isNotBlank(nombempleado)) {
|
||||||
|
sistemaBusqueda.addFilterLike("nombEmpleado", "%" + nombempleado.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Categoria categoria = cbmCategoria.getSelectedItem() != null ? (Categoria) cbmCategoria.getSelectedItem().getValue() : null;
|
String apellidopaterno = txtApelidoPaterno.getText();
|
||||||
if (categoria != null) {
|
if (apellidopaterno != null && StringUtils.isNotBlank(apellidopaterno)) {
|
||||||
sistemaBusqueda.addFilterEqual("categoria", categoria);
|
sistemaBusqueda.addFilterLike("nombPaterno", "%" + apellidopaterno.trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String apellidomaterno = txtApelidoMaterno.getText();
|
||||||
|
if (apellidomaterno != null && StringUtils.isNotBlank(apellidomaterno)) {
|
||||||
|
sistemaBusqueda.addFilterLike("nombMaterno", "%" + apellidomaterno.trim().concat("%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
sistemaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
sistemaBusqueda.addSortAsc("nombEmpleado");
|
||||||
|
sistemaBusqueda.addFilterNotEqual("empleadoId", -1);
|
||||||
|
|
||||||
plwMensagemRecusa.init(sistemaBusqueda, mensagemRecusaList, pagingMensagemRecusa);
|
plwEmpleado.init(sistemaBusqueda, empleadoList, pagingEmpleado);
|
||||||
|
|
||||||
if (showmsg && mensagemRecusaList.getData().length == 0) {
|
if (empleadoList.getData().length == 0) {
|
||||||
try {
|
try {
|
||||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
Labels.getLabel("busquedaMensagemRecusa.window.title"),
|
Labels.getLabel("busquedaEmpleadoController.window.title"),
|
||||||
Messagebox.OK, Messagebox.INFORMATION);
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
private void verMensagemRecusa(MensagemRecusa m) {
|
private void verEmpleado(Empleado e) {
|
||||||
if (m == null) {
|
if (e == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map args = new HashMap();
|
Map args = new HashMap();
|
||||||
args.put("mensagemRecusa", m);
|
args.put("empleado", e);
|
||||||
args.put("mensagemRecusaList", mensagemRecusaList);
|
args.put("empleadoList", empleadoList);
|
||||||
|
|
||||||
openWindow("/gui/catalogos/editarMensagemRecusa.zul",
|
openWindow("/gui/catalogos/editarEmpleado.zul",
|
||||||
Labels.getLabel("editarMensagemRecusaController.window.title"), args, MODAL);
|
Labels.getLabel("editarEmpleadoController.window.title"), args, MODAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyListbox getMensagemRecusaList() {
|
public MyListbox getEmpleadoList() {
|
||||||
return mensagemRecusaList;
|
return empleadoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMensagemRecusaList(MyListbox mensagemRecusaList) {
|
public void setEmpleadoList(MyListbox empleadoList) {
|
||||||
this.mensagemRecusaList = mensagemRecusaList;
|
this.empleadoList = empleadoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Combobox getCbmCategoria() {
|
public MyTextbox getTxtNombEmpleado() {
|
||||||
return cbmCategoria;
|
return txtNombEmpleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCbmCategoria(Combobox cbmCategoria) {
|
public void setTxtNombEmpleado(MyTextbox txtNombEmpleado) {
|
||||||
this.cbmCategoria = cbmCategoria;
|
this.txtNombEmpleado = txtNombEmpleado;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyTextbox getTxtDescricao() {
|
public MyTextbox getTxtApelidoPaterno() {
|
||||||
return txtDescricao;
|
return txtApelidoPaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTxtDescricao(MyTextbox txtDescricao) {
|
public void setTxtApelidoPaterno(MyTextbox txtApelidoPaterno) {
|
||||||
this.txtDescricao = txtDescricao;
|
this.txtApelidoPaterno = txtApelidoPaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Categoria> getLsCategoria() {
|
public MyTextbox getTxtApelidoMaterno() {
|
||||||
return lsCategoria;
|
return txtApelidoMaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLsCategoria(List<Categoria> lsCategoria) {
|
public void setTxtApelidoMaterno(MyTextbox txtApelidoMaterno) {
|
||||||
this.lsCategoria = lsCategoria;
|
this.txtApelidoMaterno = txtApelidoMaterno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtCveEmpleado() {
|
||||||
|
return txtCveEmpleado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtCveEmpleado(MyTextbox txtCveEmpleado) {
|
||||||
|
this.txtCveEmpleado = txtCveEmpleado;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue