bruno.neves 2017-07-07 22:40:22 +00:00
parent 43c8c68a1f
commit a689834eaf
8 changed files with 478 additions and 2 deletions

View File

@ -0,0 +1,139 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
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 org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMotivoDevolucaoBilhete;
/**
*
* @author Bruno Neves
*/
@Controller("busquedaMotivoDevolucaoBilheteController")
@Scope("prototype")
public class BusquedaMotivoDevolucaoBilheteController extends MyGenericForwardComposer {
@Autowired
private transient PagedListWrapper<MotivoDevolucaoBilhete> plwMotivoDevolucaoBilhete;
private MyListbox motivoDevolucaoBilheteList;
private Paging pagingMotivoDevolucaoBilhete;
private Textbox txtNombre;
private Combobox cmbTipoMotivo;
public Combobox getCmbTipoMotivo() {
return cmbTipoMotivo;
}
public void setCmbTipoMotivo(Combobox cmbTipoMotivo) {
this.cmbTipoMotivo = cmbTipoMotivo;
}
public Paging getPagingMotivoDevolucaoBilhete() {
return pagingMotivoDevolucaoBilhete;
}
public void setPagingMotivoDevolucaoBilhete(Paging pagingMotivoDevolucaoBilhete) {
this.pagingMotivoDevolucaoBilhete = pagingMotivoDevolucaoBilhete;
}
public MyListbox getMotivoDevolucaoBilheteList() {
return motivoDevolucaoBilheteList;
}
public void setMotivoDevolucaoBilheteList(MyListbox motivoDevolucaoBilheteList) {
this.motivoDevolucaoBilheteList = motivoDevolucaoBilheteList;
}
public PagedListWrapper<MotivoDevolucaoBilhete> getPlwMotivoDevolucaoBilhete() {
return plwMotivoDevolucaoBilhete;
}
public void setPlwMotivoDevolucaoBilhete(PagedListWrapper<MotivoDevolucaoBilhete> plwMotivoDevolucaoBilhete) {
this.plwMotivoDevolucaoBilhete = plwMotivoDevolucaoBilhete;
}
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
refreshLista();
}
public void onClick$btnRefresh(Event ev) {
refreshLista();
}
public void onClick$btnNovo(Event ev) {
verPeriodo(new MotivoDevolucaoBilhete());
}
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
motivoDevolucaoBilheteList.setItemRenderer(new RenderMotivoDevolucaoBilhete());
motivoDevolucaoBilheteList.addEventListener("onDoubleClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
MotivoDevolucaoBilhete mc = (MotivoDevolucaoBilhete) motivoDevolucaoBilheteList.getSelected();
verPeriodo(mc);
}
});
refreshLista();
txtNombre.focus();
}
private void verPeriodo(MotivoDevolucaoBilhete mc) {
if (mc == null) {
return;
}
Map args = new HashMap();
args.put("motivoDevolucaoBilhete", mc);
args.put("motivoDevolucaoBilheteList", motivoDevolucaoBilheteList);
openWindow("/gui/configuraciones_comerciales/editarMotivoDevolucaoBilhete.zul",
Labels.getLabel("editarMotivoDevolucaoBilheteController.window.title"), args, MODAL);
}
private void refreshLista() {
HibernateSearchObject<MotivoDevolucaoBilhete> claseServicioBusqueda =
new HibernateSearchObject<MotivoDevolucaoBilhete>(MotivoDevolucaoBilhete.class, pagingMotivoDevolucaoBilhete.getPageSize());
claseServicioBusqueda.addFilterLike("descmotivo", "%" + txtNombre.getText().trim().concat("%"));
claseServicioBusqueda.addFilterEqual("activo", true);
claseServicioBusqueda.addSortAsc("descmotivo");
plwMotivoDevolucaoBilhete.init(claseServicioBusqueda, motivoDevolucaoBilheteList, pagingMotivoDevolucaoBilhete);
if (motivoDevolucaoBilheteList.getData().length == 0) {
try {
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
Labels.getLabel("busquedaMotivoDevolucaoBilheteController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
} catch (InterruptedException ex) {
}
}
}
}

View File

@ -0,0 +1,170 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
import java.util.Calendar;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Button;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete;
import com.rjconsultores.ventaboletos.service.MotivoDevolucaoBilheteService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
/**
*
* @author Bruno Neves
*/
@Controller("editarMotivoDevolucaoBilheteController")
@Scope("prototype")
public class EditarMotivoDevolucaoBilheteController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
@Autowired
private MotivoDevolucaoBilheteService motivoDevolucaoBilheteService;
private MotivoDevolucaoBilhete motivoDevolucaoBilhete;
private MyListbox motivoDevolucaoBilheteList;
private static Logger log = Logger.getLogger(EditarMotivoDevolucaoBilheteController.class);
private Textbox txtNome;
private Button btnApagar;
public Button getBtnApagar() {
return btnApagar;
}
public void setBtnApagar(Button btnApagar) {
this.btnApagar = btnApagar;
}
public Textbox getTxtNome() {
return txtNome;
}
public void setTxtNome(Textbox txtNome) {
this.txtNome = txtNome;
}
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
motivoDevolucaoBilhete = (MotivoDevolucaoBilhete) Executions.getCurrent().getArg().get("motivoDevolucaoBilhete");
motivoDevolucaoBilheteList = (MyListbox) Executions.getCurrent().getArg().get("motivoDevolucaoBilheteList");
if (motivoDevolucaoBilhete.getMotivodevolucaobilheteId() == null) {
btnApagar.setVisible(Boolean.FALSE);
} else {
if (motivoDevolucaoBilheteService.validaMotivoDevolucaoBilheteConstante(motivoDevolucaoBilhete)) {
btnApagar.setVisible(false);
txtNome.setDisabled(true);
Messagebox.show(
Labels.getLabel("MSG.noEditabled"),
Labels.getLabel("editarMotivoDevolucaoBilheteController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
}
}
if (motivoDevolucaoBilhete.getMotivodevolucaobilheteId() == 1 ) {
btnApagar.setVisible(Boolean.FALSE);
txtNome.setDisabled(Boolean.TRUE);
Messagebox.show(
Labels.getLabel("MSG.noEditabled"),
Labels.getLabel("editarFormaPagoController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
}
txtNome.focus();
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
txtNome.getValue();
try {
motivoDevolucaoBilhete.setDescmotivo(txtNome.getValue());
motivoDevolucaoBilhete.setActivo(true);
motivoDevolucaoBilhete.setFecmodif(Calendar.getInstance().getTime());
motivoDevolucaoBilhete.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
if (motivoDevolucaoBilhete.getMotivodevolucaobilheteId() == null) {
motivoDevolucaoBilhete = motivoDevolucaoBilheteService.suscribir(motivoDevolucaoBilhete);
motivoDevolucaoBilheteList.addItem(motivoDevolucaoBilhete);
}else{
motivoDevolucaoBilhete = motivoDevolucaoBilheteService.actualizacion(motivoDevolucaoBilhete);
motivoDevolucaoBilheteList.updateItem(motivoDevolucaoBilhete);;
}
closeWindow();
} catch (Exception ex) {
log.error("editarMotivoDevolucaoBilheteController: " + ex);
Messagebox.show(
Labels.getLabel("MSG.Error"),
Labels.getLabel("editarMotivoDevolucaoBilheteController.window.title"),
Messagebox.OK, Messagebox.ERROR);
}
}
public void onClick$btnApagar(Event ev) {
try {
int resp = Messagebox.show(
Labels.getLabel("editarMotivoDevolucaoBilheteController.MSG.borrarPergunta"),
Labels.getLabel("editarMotivoDevolucaoBilheteController.window.title"),
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
if (resp == Messagebox.YES) {
motivoDevolucaoBilheteService.borrar(motivoDevolucaoBilhete);
Messagebox.show(
Labels.getLabel("editarMotivoDevolucaoBilheteController.MSG.borrarOK"),
Labels.getLabel("editarMotivoDevolucaoBilheteController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
motivoDevolucaoBilheteList.removeItem(motivoDevolucaoBilhete);
closeWindow();
}
} catch (Exception ex) {
log.error(ex);
}
}
public MotivoDevolucaoBilhete getMotivoDevolucaoBilhete() {
return motivoDevolucaoBilhete;
}
public void setMotivoDevolucaoBilhete(MotivoDevolucaoBilhete motivoDevolucaoBilhete) {
this.motivoDevolucaoBilhete = motivoDevolucaoBilhete;
}
public MyListbox getMotivoDevolucaoBilheteList() {
return motivoDevolucaoBilheteList;
}
public void setMotivoDevolucaoBilheteList(MyListbox motivoDevolucaoBilheteList) {
this.motivoDevolucaoBilheteList = motivoDevolucaoBilheteList;
}
public MotivoDevolucaoBilheteService getMotivoDevolucaoBilheteService() {
return motivoDevolucaoBilheteService;
}
public void setMotivoDevolucaoBilheteService(MotivoDevolucaoBilheteService motivoDevolucaoBilheteService) {
this.motivoDevolucaoBilheteService = motivoDevolucaoBilheteService;
}
}

View File

@ -0,0 +1,26 @@
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales;
import org.zkoss.util.resource.Labels;
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
public class ItemMenuMotivoDevolucaoBilhete extends DefaultItemMenuSistema {
public ItemMenuMotivoDevolucaoBilhete() {
super("indexController.mniMotivoDevolucaoBilhete.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.CATALOGO.MENU.MOTIVOSDELADEVOLUCAOBILHETE";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/configuraciones_comerciales/busquedaMotivoDevolucaoBilhete.zul",
Labels.getLabel("busquedaMotivoDevolucaoBilheteController.window.title"), getArgs(), desktop);
}
}

View File

@ -43,6 +43,7 @@ confComerciales.secretaria=com.rjconsultores.ventaboletos.web.utilerias.menu.ite
confComerciales.convenio=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuConvenio
confComerciales.tipoCambioCiudad=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuTipoCambioCiudad
confComerciales.motivoCancelacion=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuMotivoCancelacion
confComerciales.motivoDevolucaoBilhete=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuMotivoDevolucaoBilhete
confComerciales.configuracionCancelacion=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuConfiguracionCancelacion
confComerciales.configuracionCategorias=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuConfiguracionCategorias
confComerciales.configuracionReservacion=com.rjconsultores.ventaboletos.web.utilerias.menu.item.confcomerciales.ItemMenuConfiguracionReservacion

View File

@ -0,0 +1,29 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.utilerias.render;
import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
/**
*
* @author Bruno Neves
*/
public class RenderMotivoDevolucaoBilhete implements ListitemRenderer {
public void render(Listitem lstm, Object o) throws Exception {
MotivoDevolucaoBilhete motivoDevolucaoBilhete = (MotivoDevolucaoBilhete) o;
Listcell lc = new Listcell(motivoDevolucaoBilhete.getMotivodevolucaobilheteId().toString());
lc.setParent(lstm);
lc = new Listcell(motivoDevolucaoBilhete.getDescmotivo());
lc.setParent(lstm);
lstm.setAttribute("data", motivoDevolucaoBilhete);
}
}

View File

@ -12,9 +12,9 @@ public class RenderPrecoFixoPedagio implements ListitemRenderer {
PrecioFixoPedagio cp = (PrecioFixoPedagio) o;
if (cp != null) {
Listcell lc = new Listcell(cp.getOrgaoConcedenteId().toString());
Listcell lc = new Listcell(cp.getOrgaoConcedenteId() == null ? "": cp.getOrgaoConcedenteId().toString());
lc.setParent(lstm);
lc = new Listcell(cp.getClasseId().toString());
lc = new Listcell(cp.getClasseId() == null ? "": cp.getClasseId().toString());
lc.setParent(lstm);
lc = new Listcell(cp.getValorFixo().toString());
lc.setParent(lstm);

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winBusquedaMotivoDevolucaoBilhete"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winBusquedaMotivoDevolucaoBilhete" title="${c:l('busquedaMotivoDevolucaoBilheteController.window.title')}"
apply="${busquedaMotivoDevolucaoBilheteController}" contentStyle="overflow:auto"
height="400px" width="600px" border="normal" >
<toolbar>
<button id="btnRefresh" image="/gui/img/refresh.png" width="35px"
tooltiptext="${c:l('busquedaMotivoDevolucaoBilheteController.btnRefresh.tooltiptext')}" />
<separator orient="vertical" />
<button id="btnNovo" image="/gui/img/add.png" width="35px"
tooltiptext="${c:l('busquedaMotivoDevolucaoBilheteController.btnNovo.tooltiptext')}" />
<separator orient="vertical" />
<button id="btnCerrar" onClick="winBusquedaMotivoDevolucaoBilhete.detach()" image="/gui/img/exit.png" width="35px"
tooltiptext="${c:l('busquedaMotivoDevolucaoBilheteController.btnCerrar.tooltiptext')}"/>
</toolbar>
<grid fixedLayout="true">
<columns>
<column width="40%" />
<column width="60%" />
</columns>
<rows>
<row>
<label value="${c:l('busquedaMotivoDevolucaoBilheteController.txtNombre.label')}"/>
<textbox id="txtNombre" width="300px" use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
</row>
<row>
<label value="${c:l('editarMotivoDevolucaoBilheteController.lbtipomotivo.value')}"/>
<combobox id="cmbTipoMotivo" width="90%" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar" mold="rounded" buttonVisible="true">
<comboitem value="B" label="Boletos" />
<comboitem value="C" label="Corridas" />
</combobox>
</row>
</rows>
</grid>
<toolbar>
<button id="btnPesquisa" image="/gui/img/find.png"
label="${c:l('busquedaMotivoDevolucaoBilheteController.btnPesquisa.label')}"/>
</toolbar>
<paging id="pagingMotivoDevolucaoBilhete" pageSize="20" />
<listbox id="motivoDevolucaoBilheteList" use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="false">
<listhead sizable="true">
<listheader id="lhId" width="15%" image="/gui/img/builder.gif"
label="${c:l('busquedaMotivoDevolucaoBilheteController.lhId.label')}"
sort="auto(motivocancelacionId)"/>
<listheader id="lhDesc" image="/gui/img/create_doc.gif"
label="${c:l('busquedaMotivoDevolucaoBilheteController.lhDesc.label')}"
sort="auto(descmotivo)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('editarMotivoDevolucaoBilheteController.lbtipomotivo.value')}"
sort="auto(tipomotivo)"/>
</listhead>
</listbox>
</window>
</zk>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winEditarMotivoDevolucaoBilhete"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winEditarMotivoDevolucaoBilhete" border="normal"
apply="${editarMotivoDevolucaoBilheteController}"
width="400px" height="457x" contentStyle="overflow:auto"
title="${c:l('editarMotivoDevolucaoBilheteController.window.title')}">
<toolbar>
<hbox spacing="5px" style="padding:1px" align="right">
<button id="btnApagar" height="20"
image="/gui/img/remove.png" width="35px"
tooltiptext="${c:l('editarMotivoDevolucaoBilheteController.btnApagar.tooltiptext')}"/>
<button id="btnSalvar" height="20"
image="/gui/img/save.png" width="35px"
tooltiptext="${c:l('editarMotivoDevolucaoBilheteController.btnSalvar.tooltiptext')}"/>
<button id="btnFechar" height="20"
image="/gui/img/exit.png" width="35px"
onClick="winEditarMotivoDevolucaoBilhete.detach()"
tooltiptext="${c:l('editarMotivoDevolucaoBilheteController.btnFechar.tooltiptext')}"/>
</hbox>
</toolbar>
<grid fixedLayout="true">
<columns>
<column width="40%" />
<column width="60%" />
</columns>
<rows>
<row>
<label id="lbNome" value="${c:l('editarMotivoDevolucaoBilheteController.lbNome.value')}"/>
<textbox id="txtNome" constraint="no empty" width="90%" maxlength="30"
value="@{winEditarMotivoDevolucaoBilhete$composer.motivoDevolucaoBilhete.descmotivo}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
</row>
<row>
<label value="${c:l('editarMotivoDevolucaoBilheteController.lbttextoVenda.value')}"/>
<textbox rows="5" maxlength="100"
width="90%" tabindex="50" value="@{winEditarMotivoCancelacion$composer.motivoDevolucaoBilhete.txtRelatorio}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"/>
</row>
</rows>
</grid>
</window>
</zk>