wilian 2016-02-04 17:09:49 +00:00
parent 6fd1e7440b
commit e67fe0a0aa
6 changed files with 173 additions and 24 deletions

View File

@ -4,26 +4,6 @@
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.Marca;
import com.rjconsultores.ventaboletos.entidad.Moneda;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.Plaza;
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.MarcaService;
import com.rjconsultores.ventaboletos.service.MonedaService;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.ParadaService;
import com.rjconsultores.ventaboletos.service.PlazaService;
import com.rjconsultores.ventaboletos.service.TarifaMinimaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
import java.util.Calendar;
import java.util.List;
@ -39,6 +19,30 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Button;
import org.zkoss.zul.Combobox;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
import com.rjconsultores.ventaboletos.entidad.Marca;
import com.rjconsultores.ventaboletos.entidad.Moneda;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Plaza;
import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
import com.rjconsultores.ventaboletos.service.CategoriaService;
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
import com.rjconsultores.ventaboletos.service.MarcaService;
import com.rjconsultores.ventaboletos.service.MonedaService;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.ParadaService;
import com.rjconsultores.ventaboletos.service.PlazaService;
import com.rjconsultores.ventaboletos.service.TarifaMinimaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTarifaMinimaCategoria;
/**
*
* @author rodrigo
@ -47,7 +51,9 @@ import org.zkoss.zul.Combobox;
@Scope("prototype")
public class EditarTarifaMinimaController extends MyGenericForwardComposer {
@Autowired
private static final long serialVersionUID = 1L;
@Autowired
private TarifaMinimaService tarifaMinimaService;
@Autowired
private MarcaService marcaService;
@ -61,6 +67,9 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
private MonedaService monedaService;
@Autowired
private OrgaoConcedenteService orgaoConcedenteService;
@Autowired
private CategoriaService categoriaService;
private List<Moneda> lsMoneda;
private List<Marca> lsMarcas;
private List<ClaseServicio> lsClaseServico;
@ -79,6 +88,10 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
private List<OrgaoConcedente> lsOrgaoConcedente;
private static Logger log = Logger.getLogger(EditarTarifaMinimaController.class);
private List<Categoria> lsCategorias;
private MyComboboxEstandar cmbCategorias;
private MyListbox tarifaMinimaCategoriaList;
public List<Moneda> getLsMoneda() {
return lsMoneda;
}
@ -214,6 +227,7 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
tarifaMinima = (TarifaMinima) Executions.getCurrent().getArg().get("tarifaMinima");
tarifaMinimaList = (MyListbox) Executions.getCurrent().getArg().get("tarifaMinimaList");
lsCategorias = categoriaService.obtenerTodasCategoriasVisibles();
lsOrgaoConcedente = orgaoConcedenteService.obtenerTodos();
lsMoneda = monedaService.obtenerTodos();
lsMarcas = marcaService.buscarMarcaPorEmpresa(UsuarioLogado.getUsuarioLogado().getEmpresa());
@ -222,8 +236,13 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
if (tarifaMinima.getTarifaminimaId() == null) {
btnApagar.setVisible(Boolean.FALSE);
} else {
tarifaMinima = tarifaMinimaService.obtenerID(tarifaMinima.getTarifaminimaId());
}
txtImportancia.focus();
tarifaMinimaCategoriaList.setItemRenderer(new RenderTarifaMinimaCategoria());
tarifaMinimaCategoriaList.setData(tarifaMinima.getTarifaMinimaCategorias());
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
@ -356,6 +375,62 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
}
}
public void onClick$btnAdicionarCategoria(Event ev) throws InterruptedException {
try {
Categoria categoria = (Categoria) cmbCategorias.getSelectedItem().getValue();
if(categoria != null) {
TarifaMinimaCategoria tarifaMinimaCategoria = new TarifaMinimaCategoria();
tarifaMinimaCategoria.setCategoria(categoria);
tarifaMinimaCategoria.setTarifaMinima(tarifaMinima);
tarifaMinimaCategoria = tarifaMinimaService.adicionarTarifaMinimaCategoria(tarifaMinimaCategoria);
tarifaMinimaCategoriaList.updateItem(tarifaMinimaCategoria);
Messagebox.show(Labels.getLabel("editarTarifaMinimaController.msg.adicionarTarifaMinimaCategoria"),
Labels.getLabel("editarTarifaMinimaController.window.title"),
Messagebox.OK,Messagebox.INFORMATION);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
Messagebox.show(Labels.getLabel("MSG.Error"),
Labels.getLabel("editarTarifaMinimaController.window.title"),
Messagebox.OK,Messagebox.ERROR);
}
}
public void onClick$btnRemoverCategoria(Event ev) throws InterruptedException {
try {
if(tarifaMinimaCategoriaList.getSelected() != null) {
int resp = Messagebox.show(
Labels.getLabel("editarTarifaMinimaController.msg.removerTarifaMinimaCategoriaPergunta"),
Labels.getLabel("editarTarifaMinimaController.window.title"),
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
if (resp == Messagebox.YES) {
TarifaMinimaCategoria tarifaMinimaCategoria = (TarifaMinimaCategoria) tarifaMinimaCategoriaList.getSelected();
tarifaMinimaService.removerTarifaMinimaCategoria(tarifaMinimaCategoria);
tarifaMinimaCategoriaList.removeItem(tarifaMinimaCategoria);
Messagebox.show(Labels.getLabel("editarTarifaMinimaController.msg.removerTarifaMinimaCategoria"),
Labels.getLabel("editarTarifaMinimaController.window.title"),
Messagebox.OK,Messagebox.INFORMATION);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
Messagebox.show(Labels.getLabel("MSG.Error"),
Labels.getLabel("editarTarifaMinimaController.window.title"),
Messagebox.OK,Messagebox.ERROR);
}
}
public List<OrgaoConcedente> getLsOrgaoConcedente() {
return lsOrgaoConcedente;
}
@ -363,4 +438,12 @@ public class EditarTarifaMinimaController extends MyGenericForwardComposer {
public void setLsOrgaoConcedente(List<OrgaoConcedente> lsOrgaoConcedente) {
this.lsOrgaoConcedente = lsOrgaoConcedente;
}
public List<Categoria> getLsCategorias() {
return lsCategorias;
}
public void setLsCategorias(List<Categoria> lsCategorias) {
this.lsCategorias = lsCategorias;
}
}

View File

@ -0,0 +1,25 @@
package com.rjconsultores.ventaboletos.web.utilerias.render;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria;
public class RenderTarifaMinimaCategoria implements ListitemRenderer {
@Override
public void render(Listitem lstm, Object o) throws Exception {
TarifaMinimaCategoria tarifaMinimaCategoria = (TarifaMinimaCategoria) o;
Listcell lc = new Listcell();
lc = new Listcell(tarifaMinimaCategoria.getCategoria().getDesccategoria());
lc.setParent(lstm);
lstm.setAttribute("data", tarifaMinimaCategoria);
}
}

View File

@ -413,6 +413,7 @@
<value>com.rjconsultores.ventaboletos.entidad.ComEmpCategoria</value>
<value>com.rjconsultores.ventaboletos.entidad.ComEmpFormapago</value>
<value>com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra</value>
<value>com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria</value>
</list>
</property>

View File

@ -2025,6 +2025,11 @@ editarTarifaMinimaController.btnFechar.MSG.origen = Necesita informar un origen
editarTarifaMinimaController.btnFechar.MSG.destino = Necesita informar un destino
editarTarifaMinimaController.btnFechar.MSG.orgao = Necessita informar una instituición Concedente
editarTarifaMinimaController.btnFechar.MSG.tipo = Necesita informar un tipo de clase
editarTarifaMinimaController.btnAdicionarCategoria.tooltiptext = Incluir Tipo Pasaje
editarTarifaMinimaController.btnRemoverCategoria.tooltiptext = Borrar Tipo Pasaje
editarTarifaMinimaController.msg.adicionarTarifaMinimaCategoria = Tipo Pasaje añadido con éxito
editarTarifaMinimaController.msg.removerTarifaMinimaCategoriaPergunta = Desea borrar el tipo de pasaje seleccionado?
editarTarifaMinimaController.msg.removerTarifaMinimaCategoria = Tipo Pasaje se eliminó exitosamente
# Búsqueda de Tarifas:
busquedaTarifaController.window.title = Cambio de tarifa

View File

@ -2069,6 +2069,11 @@ editarTarifaMinimaController.btnFechar.MSG.origen = Necessita informar um origem
editarTarifaMinimaController.btnFechar.MSG.destino = Necessita informar um destino
editarTarifaMinimaController.btnFechar.MSG.orgao = Necessita informar um Órgão Concedente
editarTarifaMinimaController.btnFechar.MSG.tipo = Necessita informar um tipo de classe
editarTarifaMinimaController.btnAdicionarCategoria.tooltiptext = Adicionar Tipo Passagem
editarTarifaMinimaController.btnRemoverCategoria.tooltiptext = Remover Tipo Passagem
editarTarifaMinimaController.msg.adicionarTarifaMinimaCategoria = Tipo Passagem adicionada com sucesso
editarTarifaMinimaController.msg.removerTarifaMinimaCategoriaPergunta = Deseja remover o tipo de passagem selecionado?
editarTarifaMinimaController.msg.removerTarifaMinimaCategoria = Tipo Passagem removida com sucesso
# Pesquisa de Tarifas:
busquedaTarifaController.window.title = Alteração de Preço

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winEditarTarifaMinima" border="normal"
apply="${editarTarifaMinimaController}"
width="500px" height="300px" contentStyle="overflow:auto"
width="500px" height="480px" contentStyle="overflow:auto"
title="${c:l('editarTarifaMinimaController.window.title')}">
<toolbar>
<hbox spacing="5px" style="padding:1px" align="right">
@ -95,8 +95,38 @@
selectedItem="@{winEditarTarifaMinima$composer.tarifaMinima.claseServicio}"/>
</row>
</rows>
</grid>
<row>
<label id="lblCategorias"
value="${c:l('editarConfiguracionCategoriaController.lblCategorias.value')}" />
<combobox id="cmbCategorias"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true" width="50%"
model="@{winEditarTarifaMinima$composer.lsCategorias}" />
</row>
</rows>
</grid>
<button id="btnAdicionarCategoria"
height="20"
image="/gui/img/add.png"
width="35px"
tooltiptext="${c:l('editarTarifaMinimaController.btnAdicionarCategoria.tooltiptext')}" />
<button id="btnRemoverCategoria"
height="20"
image="/gui/img/remove.png"
width="35px"
tooltiptext="${c:l('editarTarifaMinimaController.btnRemoverCategoria.tooltiptext')}" />
<listbox id="tarifaMinimaCategoriaList"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true"
multiple="false"
height="150px">
<listhead sizable="true">
<listheader image="/gui/img/create_doc.gif"
label="${c:l('editarConfiguracionCategoriaController.lblCategorias.value')}" />
</listhead>
</listbox>
</window>
</zk>