|
|
|
@ -10,6 +10,7 @@ import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Map.Entry;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
@ -26,6 +27,7 @@ import org.zkoss.zul.Combobox;
|
|
|
|
|
import org.zkoss.zul.Comboitem;
|
|
|
|
|
import org.zkoss.zul.Paging;
|
|
|
|
|
import org.zkoss.zul.Spinner;
|
|
|
|
|
import org.zkoss.zul.Textbox;
|
|
|
|
|
|
|
|
|
|
import com.rjconsultores.ventaboletos.entidad.ConfTotem;
|
|
|
|
|
import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida;
|
|
|
|
@ -67,6 +69,7 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
private Checkbox chkImprimeComprovanteCartaoEmpresaCorrida;
|
|
|
|
|
private Checkbox chktListarPassageiroUltimaPoltrona;
|
|
|
|
|
private Checkbox chkPermitirVendaRapida;
|
|
|
|
|
private Checkbox chkIndImprime2Via;
|
|
|
|
|
private static Logger log = Logger.getLogger(BusquedaConfTotemController.class);
|
|
|
|
|
private MyListbox empresaList;
|
|
|
|
|
private MyListbox bandeirasList;
|
|
|
|
@ -98,6 +101,47 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
refreshLista();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adicione ao <tt>Map</tt> o nome customizado do componente e o componente para
|
|
|
|
|
* preencher os valores na hora de salvar e carregar a tela.
|
|
|
|
|
*
|
|
|
|
|
* Tipos desenvolvidos:
|
|
|
|
|
* <p>
|
|
|
|
|
* {@link Checkbox}
|
|
|
|
|
* <p>
|
|
|
|
|
* <p>
|
|
|
|
|
* {@link Textbox}
|
|
|
|
|
* <p>
|
|
|
|
|
* <p>
|
|
|
|
|
* {@link MyTextboxDecimal}
|
|
|
|
|
* <p>
|
|
|
|
|
* <p>
|
|
|
|
|
* {@link Spinner}
|
|
|
|
|
* <p>
|
|
|
|
|
*/
|
|
|
|
|
private Map<String, Object> preencheComponentesComValores() {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
map.put("isAlphaNumericKeyboard", chkPermitirTecladoAlfaNumerico);
|
|
|
|
|
map.put("isVendaHabilitado", chkPermitirVenda);
|
|
|
|
|
map.put("isImpressaoHabilitado", chkPermitirImpressao);
|
|
|
|
|
map.put("isReservaHabilitado", chkPermitirReserva);
|
|
|
|
|
map.put("isTituloInicialDesabilitado", chkTituloInicial);
|
|
|
|
|
map.put("isSeguroTabelaViraOpcional", chkSeguroTabela);
|
|
|
|
|
map.put("isPagamentoMultiempresaBPe", chkPagamentoMultiempresaBPe);
|
|
|
|
|
map.put("isImprimeComprovanteCartaoEmpresaCorrida", chkImprimeComprovanteCartaoEmpresaCorrida);
|
|
|
|
|
map.put("trabalhaComParcelamentoCartaoCredito", chktrabalhaComParcelamento);
|
|
|
|
|
map.put("listarPassageiro", chktListarPassageiroUltimaPoltrona);
|
|
|
|
|
map.put("isVendaRapidaHabilitado", chkPermitirVendaRapida);
|
|
|
|
|
map.put("valorParcelaMinima", txtPrecioParcelaMinima);
|
|
|
|
|
map.put("indEmiteSegundaVia", chkIndImprime2Via);
|
|
|
|
|
// map.put("cantCorrida", cantCorrida);
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void refreshLista() {
|
|
|
|
|
|
|
|
|
|
List<ConfTotem> lista = confTotemService.obtenerTodos();
|
|
|
|
@ -134,19 +178,11 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chkPermitirTecladoAlfaNumerico.setChecked(StringUtils.isBlank(map.get("isAlphaNumericKeyboard")) ? false : Boolean.parseBoolean(map.get("isAlphaNumericKeyboard")));
|
|
|
|
|
chkPermitirVenda.setChecked(StringUtils.isBlank(map.get("isVendaHabilitado")) ? false : Boolean.parseBoolean(map.get("isVendaHabilitado")));
|
|
|
|
|
chkPermitirImpressao.setChecked(StringUtils.isBlank(map.get("isImpressaoHabilitado")) ? false : Boolean.parseBoolean(map.get("isImpressaoHabilitado")));
|
|
|
|
|
chkPermitirReserva.setChecked(StringUtils.isBlank(map.get("isReservaHabilitado")) ? false : Boolean.parseBoolean(map.get("isReservaHabilitado")));
|
|
|
|
|
chkTituloInicial.setChecked(StringUtils.isBlank(map.get("isTituloInicialDesabilitado")) ? false : Boolean.parseBoolean(map.get("isTituloInicialDesabilitado")));
|
|
|
|
|
chkSeguroTabela.setChecked(StringUtils.isBlank(map.get("isSeguroTabelaViraOpcional")) ? false : Boolean.parseBoolean(map.get("isSeguroTabelaViraOpcional")));
|
|
|
|
|
chkPagamentoMultiempresaBPe.setChecked(StringUtils.isBlank(map.get("isPagamentoMultiempresaBPe")) ? false : Boolean.parseBoolean(map.get("isPagamentoMultiempresaBPe")));
|
|
|
|
|
chkImprimeComprovanteCartaoEmpresaCorrida.setChecked(StringUtils.isBlank(map.get("isImprimeComprovanteCartaoEmpresaCorrida")) ? false : Boolean.parseBoolean(map.get("isImprimeComprovanteCartaoEmpresaCorrida")));
|
|
|
|
|
chktrabalhaComParcelamento.setChecked(StringUtils.isBlank(map.get("trabalhaComParcelamentoCartaoCredito")) ? false : Boolean.parseBoolean(map.get("trabalhaComParcelamentoCartaoCredito")));
|
|
|
|
|
chktListarPassageiroUltimaPoltrona.setChecked(StringUtils.isBlank(map.get("listarPassageiro")) ? false : Boolean.parseBoolean(map.get("listarPassageiro")));
|
|
|
|
|
chkPermitirVendaRapida.setChecked(StringUtils.isBlank(map.get("isVendaRapidaHabilitado")) ? false : Boolean.parseBoolean(map.get("isVendaRapidaHabilitado")));
|
|
|
|
|
// cantCorrida.setValue(StringUtils.isBlank(map.get("cantCorrida")) ? 0 : Integer.parseInt(map.get("cantCorrida")));
|
|
|
|
|
txtPrecioParcelaMinima.setValue(StringUtils.isBlank(map.get("valorParcelaMinima")) ? "0" : map.get("valorParcelaMinima"));
|
|
|
|
|
for (Entry<String, Object> entry : this.preencheComponentesComValores().entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
Object value = entry.getValue();
|
|
|
|
|
setarValoresComponentes(map, key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
empresaList.setData(lsEmpresas);
|
|
|
|
|
bandeirasList.setData(lsBandeirasCartao);
|
|
|
|
@ -214,10 +250,6 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// cantCorrida.getValue();
|
|
|
|
|
ConfTotem novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setActivo(Boolean.TRUE);
|
|
|
|
|
novoItem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
novoItem.setFecmodif(new Date());
|
|
|
|
|
|
|
|
|
|
List<ConfTotem> lista = confTotemService.obtenerTodos();
|
|
|
|
|
|
|
|
|
@ -226,150 +258,26 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
map.put(confTotem.getChave(), confTotem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfTotem confTotem = map.get("isAlphaNumericKeyboard");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPermitirTecladoAlfaNumerico.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isAlphaNumericKeyboard");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPermitirTecladoAlfaNumerico.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
|
|
|
|
|
for (Entry<String, Object> entry : this.preencheComponentesComValores().entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
Object value = entry.getValue();
|
|
|
|
|
salvarValoresComponentes(map, key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isVendaHabilitado");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPermitirVenda.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isVendaHabilitado");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPermitirVenda.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
ConfTotem novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setActivo(Boolean.TRUE);
|
|
|
|
|
novoItem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
novoItem.setFecmodif(new Date());
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isImpressaoHabilitado");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPermitirImpressao.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isImpressaoHabilitado");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPermitirImpressao.isChecked()));
|
|
|
|
|
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isReservaHabilitado");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPermitirReserva.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isReservaHabilitado");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPermitirReserva.isChecked()));
|
|
|
|
|
novoItem.setFecmodif(new Date());
|
|
|
|
|
novoItem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isTituloInicialDesabilitado");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkTituloInicial.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isTituloInicialDesabilitado");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkTituloInicial.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isSeguroTabelaViraOpcional");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkSeguroTabela.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("chkSeguroTabela");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkSeguroTabela.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isPagamentoMultiempresaBPe");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPagamentoMultiempresaBPe.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isPagamentoMultiempresaBPe");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPagamentoMultiempresaBPe.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isImprimeComprovanteCartaoEmpresaCorrida");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkImprimeComprovanteCartaoEmpresaCorrida.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isImprimeComprovanteCartaoEmpresaCorrida");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkImprimeComprovanteCartaoEmpresaCorrida.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("trabalhaComParcelamentoCartaoCredito");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chktrabalhaComParcelamento.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("trabalhaComParcelamentoCartaoCredito");
|
|
|
|
|
novoItem.setValor(String.valueOf(chktrabalhaComParcelamento.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("listarPassageiro");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chktListarPassageiroUltimaPoltrona.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("listarPassageiro");
|
|
|
|
|
novoItem.setValor(String.valueOf(chktListarPassageiroUltimaPoltrona.isChecked()));
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("empresasParaVenda");
|
|
|
|
|
ConfTotem confTotem = map.get("empresasParaVenda");
|
|
|
|
|
List<Empresa> lsEmpresas = empresaList.getListData();
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
for (Empresa empresa : lsEmpresas) {
|
|
|
|
|
sb.append(empresa.getEmpresaId()).append(",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!sb.toString().isEmpty()) {
|
|
|
|
|
sb.delete(sb.length()-1, sb.length());
|
|
|
|
|
if (!sb.toString().isEmpty()) {
|
|
|
|
|
sb.delete(sb.length() - 1, sb.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
@ -384,14 +292,14 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("bandeirasCartao");
|
|
|
|
|
List<String> lsBandeirasCartao= bandeirasList.getListData();
|
|
|
|
|
List<String> lsBandeirasCartao = bandeirasList.getListData();
|
|
|
|
|
sb = new StringBuilder();
|
|
|
|
|
for (String bandeira : lsBandeirasCartao) {
|
|
|
|
|
sb.append(bandeira).append(",");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!sb.toString().isEmpty()) {
|
|
|
|
|
sb.delete(sb.length()-1, sb.length());
|
|
|
|
|
if (!sb.toString().isEmpty()) {
|
|
|
|
|
sb.delete(sb.length() - 1, sb.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
@ -405,56 +313,61 @@ public class BusquedaConfTotemController extends MyGenericForwardComposer {
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// confTotem = map.get("cantCorrida");
|
|
|
|
|
// if (confTotem != null) {
|
|
|
|
|
// confTotem.setValor(String.valueOf(cantCorrida.getValue()));
|
|
|
|
|
// confTotem.setFecmodif(new Date());
|
|
|
|
|
// confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
// confTotemService.actualizacion(confTotem);
|
|
|
|
|
// } else {
|
|
|
|
|
// novoItem = new ConfTotem();
|
|
|
|
|
// novoItem.setChave("cantCorrida");
|
|
|
|
|
// novoItem.setValor(String.valueOf(cantCorrida.getValue()));
|
|
|
|
|
// confTotemService.suscribir(novoItem);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("isVendaRapidaHabilitado");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(String.valueOf(chkPermitirVendaRapida.isChecked()));
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("isVendaRapidaHabilitado");
|
|
|
|
|
novoItem.setValor(String.valueOf(chkPermitirVendaRapida.isChecked()));
|
|
|
|
|
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confTotem = map.get("valorParcelaMinima");
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(txtPrecioParcelaMinima.getValue());
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setChave("valorParcelaMinima");
|
|
|
|
|
novoItem.setValor(txtPrecioParcelaMinima.getValue());
|
|
|
|
|
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Messagebox.show(
|
|
|
|
|
Labels.getLabel("busquedaConfTotemController.MSG.suscribirOK"),
|
|
|
|
|
Labels.getLabel("busquedaConfTotemController.window.title"),
|
|
|
|
|
Messagebox.OK, Messagebox.INFORMATION);
|
|
|
|
|
Messagebox.show(Labels.getLabel("busquedaConfTotemController.MSG.suscribirOK"),
|
|
|
|
|
Labels.getLabel("busquedaConfTotemController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
|
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("", ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void salvarValoresComponentes(Map<String, ConfTotem> mapTodos, String nomeComponente, Object componente) {
|
|
|
|
|
|
|
|
|
|
ConfTotem confTotem = mapTodos.get(nomeComponente);
|
|
|
|
|
|
|
|
|
|
String valueComponent = null;
|
|
|
|
|
|
|
|
|
|
if (componente instanceof Checkbox) {
|
|
|
|
|
valueComponent = String.valueOf(((Checkbox) componente).isChecked());
|
|
|
|
|
} else if (componente instanceof Textbox) {
|
|
|
|
|
valueComponent = ((Textbox) componente).getValue();
|
|
|
|
|
} else if (componente instanceof MyTextboxDecimal) {
|
|
|
|
|
valueComponent = ((MyTextboxDecimal) componente).getValue();
|
|
|
|
|
} else if (componente instanceof Spinner) {
|
|
|
|
|
valueComponent = String.valueOf(((Spinner) componente).getValue());
|
|
|
|
|
} else {
|
|
|
|
|
valueComponent = (componente != null ? componente.toString() : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (confTotem != null) {
|
|
|
|
|
confTotem.setValor(valueComponent);
|
|
|
|
|
confTotem.setFecmodif(new Date());
|
|
|
|
|
confTotem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
confTotemService.actualizacion(confTotem);
|
|
|
|
|
} else {
|
|
|
|
|
ConfTotem novoItem = new ConfTotem();
|
|
|
|
|
novoItem.setActivo(Boolean.TRUE);
|
|
|
|
|
novoItem.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
|
|
|
|
novoItem.setFecmodif(new Date());
|
|
|
|
|
novoItem.setChave(nomeComponente);
|
|
|
|
|
novoItem.setValor(valueComponent);
|
|
|
|
|
confTotemService.suscribir(novoItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setarValoresComponentes(Map<String, String> mapTodos, String nomeComponente, Object componente) {
|
|
|
|
|
if (componente instanceof Checkbox) {
|
|
|
|
|
((Checkbox) componente).setChecked(StringUtils.isBlank(mapTodos.get(nomeComponente)) ? false : Boolean.parseBoolean(mapTodos.get(nomeComponente)));
|
|
|
|
|
} else if (componente instanceof Textbox) {
|
|
|
|
|
((Textbox) componente).setValue(StringUtils.isBlank(mapTodos.get(nomeComponente)) ? null : mapTodos.get(nomeComponente));
|
|
|
|
|
} else if (componente instanceof MyTextboxDecimal) {
|
|
|
|
|
((MyTextboxDecimal) componente).setValue(StringUtils.isBlank(mapTodos.get(nomeComponente)) ? "0" : mapTodos.get(nomeComponente));
|
|
|
|
|
} else if (componente instanceof Spinner) {
|
|
|
|
|
((Spinner) componente).setValue(StringUtils.isBlank(mapTodos.get(nomeComponente)) ? 0 : Integer.parseInt(mapTodos.get(nomeComponente)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onClick$btnAddEmpresa(Event ev) {
|
|
|
|
|
|
|
|
|
|
Comboitem cbiEmpresa = cmbEmpresa.getSelectedItem();
|
|
|
|
|