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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Paging;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||
import com.rjconsultores.ventaboletos.entidad.MensagemRecusa;
|
||||
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empleado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpleado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMensagemRecusa;
|
||||
|
||||
@Controller("BusquedaEmpleadoController")
|
||||
@Controller("busquedaEmpleadoController")
|
||||
@Scope("prototype")
|
||||
public class BusquedaEmpleadoController extends MyGenericForwardComposer {
|
||||
|
||||
public class BusquedaEmpleadoController extends MyGenericForwardComposer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@Autowired
|
||||
private CategoriaService categoriaService;
|
||||
|
||||
@Autowired
|
||||
private transient PagedListWrapper<MensagemRecusa> plwMensagemRecusa;
|
||||
private MyListbox mensagemRecusaList;
|
||||
private Paging pagingMensagemRecusa;
|
||||
|
||||
private Combobox cbmCategoria;
|
||||
private List<Categoria> lsCategoria;
|
||||
private MyTextbox txtDescricao;
|
||||
|
||||
private transient PagedListWrapper<Empleado> plwEmpleado;
|
||||
private MyListbox empleadoList;
|
||||
private Paging pagingEmpleado;
|
||||
private MyTextbox txtNombEmpleado;
|
||||
private MyTextbox txtApelidoPaterno;
|
||||
private MyTextbox txtApelidoMaterno;
|
||||
private MyTextbox txtCveEmpleado;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
mensagemRecusaList.setItemRenderer(new RenderMensagemRecusa());
|
||||
lsCategoria = categoriaService.obtenerTodasCategoriasVisibles();
|
||||
|
||||
|
||||
mensagemRecusaList.addEventListener("onDoubleClick", new EventListener() {
|
||||
|
||||
empleadoList.setItemRenderer(new RenderEmpleado());
|
||||
empleadoList.addEventListener("onDoubleClick", new EventListener() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
MensagemRecusa m = (MensagemRecusa) mensagemRecusaList.getSelected();
|
||||
verMensagemRecusa(m);
|
||||
Empleado e = (Empleado) empleadoList.getSelected();
|
||||
verEmpleado(e);
|
||||
}
|
||||
});
|
||||
|
||||
refreshLista(false);
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
public void onClick$btnPesquisa(Event ev) {
|
||||
refreshLista(true);
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
public void onClick$btnRefresh(Event ev) {
|
||||
refreshLista(true);
|
||||
refreshLista();
|
||||
}
|
||||
|
||||
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) {
|
||||
HibernateSearchObject<MensagemRecusa> sistemaBusqueda = new HibernateSearchObject<MensagemRecusa>(MensagemRecusa.class, pagingMensagemRecusa.getPageSize());
|
||||
|
||||
String descricao = txtDescricao.getValue();
|
||||
if (descricao != null && StringUtils.isNotBlank(descricao)) {
|
||||
sistemaBusqueda.addFilterLike("descricao", "%".concat(descricao.trim().concat("%")));
|
||||
String cveEmpleado = txtCveEmpleado.getValue();
|
||||
if (cveEmpleado != null && StringUtils.isNotBlank(cveEmpleado)) {
|
||||
sistemaBusqueda.addFilterLike("cveEmpleado", "%".concat(cveEmpleado.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;
|
||||
if (categoria != null) {
|
||||
sistemaBusqueda.addFilterEqual("categoria", categoria);
|
||||
String apellidopaterno = txtApelidoPaterno.getText();
|
||||
if (apellidopaterno != null && StringUtils.isNotBlank(apellidopaterno)) {
|
||||
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.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 {
|
||||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("busquedaMensagemRecusa.window.title"),
|
||||
Labels.getLabel("busquedaEmpleadoController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private void verMensagemRecusa(MensagemRecusa m) {
|
||||
if (m == null) {
|
||||
private void verEmpleado(Empleado e) {
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map args = new HashMap();
|
||||
args.put("mensagemRecusa", m);
|
||||
args.put("mensagemRecusaList", mensagemRecusaList);
|
||||
args.put("empleado", e);
|
||||
args.put("empleadoList", empleadoList);
|
||||
|
||||
openWindow("/gui/catalogos/editarMensagemRecusa.zul",
|
||||
Labels.getLabel("editarMensagemRecusaController.window.title"), args, MODAL);
|
||||
openWindow("/gui/catalogos/editarEmpleado.zul",
|
||||
Labels.getLabel("editarEmpleadoController.window.title"), args, MODAL);
|
||||
}
|
||||
|
||||
public MyListbox getMensagemRecusaList() {
|
||||
return mensagemRecusaList;
|
||||
public MyListbox getEmpleadoList() {
|
||||
return empleadoList;
|
||||
}
|
||||
|
||||
public void setMensagemRecusaList(MyListbox mensagemRecusaList) {
|
||||
this.mensagemRecusaList = mensagemRecusaList;
|
||||
public void setEmpleadoList(MyListbox empleadoList) {
|
||||
this.empleadoList = empleadoList;
|
||||
}
|
||||
|
||||
public Combobox getCbmCategoria() {
|
||||
return cbmCategoria;
|
||||
public MyTextbox getTxtNombEmpleado() {
|
||||
return txtNombEmpleado;
|
||||
}
|
||||
|
||||
public void setCbmCategoria(Combobox cbmCategoria) {
|
||||
this.cbmCategoria = cbmCategoria;
|
||||
public void setTxtNombEmpleado(MyTextbox txtNombEmpleado) {
|
||||
this.txtNombEmpleado = txtNombEmpleado;
|
||||
}
|
||||
|
||||
public MyTextbox getTxtDescricao() {
|
||||
return txtDescricao;
|
||||
public MyTextbox getTxtApelidoPaterno() {
|
||||
return txtApelidoPaterno;
|
||||
}
|
||||
|
||||
public void setTxtDescricao(MyTextbox txtDescricao) {
|
||||
this.txtDescricao = txtDescricao;
|
||||
public void setTxtApelidoPaterno(MyTextbox txtApelidoPaterno) {
|
||||
this.txtApelidoPaterno = txtApelidoPaterno;
|
||||
}
|
||||
|
||||
public List<Categoria> getLsCategoria() {
|
||||
return lsCategoria;
|
||||
public MyTextbox getTxtApelidoMaterno() {
|
||||
return txtApelidoMaterno;
|
||||
}
|
||||
|
||||
public void setLsCategoria(List<Categoria> lsCategoria) {
|
||||
this.lsCategoria = lsCategoria;
|
||||
public void setTxtApelidoMaterno(MyTextbox txtApelidoMaterno) {
|
||||
this.txtApelidoMaterno = txtApelidoMaterno;
|
||||
}
|
||||
|
||||
public MyTextbox getTxtCveEmpleado() {
|
||||
return txtCveEmpleado;
|
||||
}
|
||||
|
||||
public void setTxtCveEmpleado(MyTextbox txtCveEmpleado) {
|
||||
this.txtCveEmpleado = txtCveEmpleado;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue