diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/seguridad/EditarEstacionController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/seguridad/EditarEstacionController.java index c13bd3a47..86e9d409e 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/seguridad/EditarEstacionController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/seguridad/EditarEstacionController.java @@ -116,9 +116,9 @@ public class EditarEstacionController extends MyGenericForwardComposer { private Label lblLibercard; private Checkbox chkUtilizaCartaoLibercard; private Checkbox chkStockCentral; - private Label lblTipoArquivoLayoutInternacional; - private Checkbox chkTipoArquivoLayoutInternacional; - private Listheader colunmTipoArquivoLayout; + private Label lblNomeArquivoLayoutInternacional; + private Textbox txtNomeArquivoLayoutInternacional; + private Listheader colunmNomeArquivoLayoutIternacional; public Estacion getEstacion() { return estacion; @@ -215,7 +215,7 @@ public class EditarEstacionController extends MyGenericForwardComposer { ApplicationProperties instance = ApplicationProperties.getInstance(); validaHabilitacaoCamposRioCard(instance) .validaHabilitacaoCamposCartaoLiberCard(instance) - .validaHabilitacaoTipoArquivoInternacional(instance); + .validaHabilitacaoLayoutInternacional(instance); } private EditarEstacionController validaHabilitacaoCamposRioCard(ApplicationProperties instance) { @@ -233,11 +233,11 @@ public class EditarEstacionController extends MyGenericForwardComposer { return this; } - private void validaHabilitacaoTipoArquivoInternacional(ApplicationProperties instance) { - if (instance.isPermiteVariasImpressorasMesmaEmpresa()) { - lblTipoArquivoLayoutInternacional.setVisible(true); - chkTipoArquivoLayoutInternacional.setVisible(true); - colunmTipoArquivoLayout.setVisible(true); + private void validaHabilitacaoLayoutInternacional(ApplicationProperties instance) { + if (instance.isPermiteLayoutInternacional()) { + lblNomeArquivoLayoutInternacional.setVisible(true); + txtNomeArquivoLayoutInternacional.setVisible(true); + colunmNomeArquivoLayoutIternacional.setVisible(true); } } @@ -541,19 +541,17 @@ public class EditarEstacionController extends MyGenericForwardComposer { } - String nomeArquivoLayout = txtNomeArquivoLayout.getValue(); - EstacionImpresora estacionImpresora = new EstacionImpresora(); estacionImpresora.setEmpresa(empresa); estacionImpresora.setEstacion(estacion); estacionImpresora.setNombImpresora(nomeImpresora); - estacionImpresora.setNombArchivoLayout(nomeArquivoLayout); + estacionImpresora.setNombArchivoLayout(txtNomeArquivoLayout.getValue()); estacionImpresora.setActivo(Boolean.TRUE); estacionImpresora.setFecmodif(Calendar.getInstance().getTime()); estacionImpresora.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); estacionImpresora.setTipoImpressora(getTipoImpressora()); estacionImpresora.setEstacionCentral(estacionCentral); - estacionImpresora.setIndArchivolayoutInternacional(chkTipoArquivoLayoutInternacional.isChecked()); + estacionImpresora.setNombArchivoLayoutIternacional(txtNomeArquivoLayoutInternacional.getValue()); estacionImpresoraList.addItemNovo(estacionImpresora); @@ -636,41 +634,30 @@ public class EditarEstacionController extends MyGenericForwardComposer { cmbEstacion.setModel(dictModelVacio); if (valor.equals(BEMATECH_FISCAL) || valor.equals(BEMATECH_FISCAL_BLINDADA)) { - txtNomImpressora.setText("BEMATECHFISCAL"); - txtNomeArquivoLayout.setText(""); - txtNomImpressora.setDisabled(Boolean.TRUE); - txtNomeArquivoLayout.setDisabled(Boolean.TRUE); - } else if (valor.equals(DARUMA_FISCAL)|| valor.equals(DARUMA_FISCAL_BLINDADA)){ - txtNomImpressora.setText(DARUMA_FISCAL); - txtNomeArquivoLayout.setText(""); - txtNomImpressora.setDisabled(Boolean.TRUE); - txtNomeArquivoLayout.setDisabled(Boolean.TRUE); - } else if (valor.equals(CENTRAL_EMISSAO)){ - txtNomImpressora.setText(CENTRAL_EMISSAO); - txtNomeArquivoLayout.setText(""); - txtNomImpressora.setDisabled(Boolean.TRUE); - txtNomeArquivoLayout.setDisabled(Boolean.TRUE); - }else if (valor.equals(MATRICIAL)) { - txtNomImpressora.setText(""); - txtNomeArquivoLayout.setText(""); - txtNomImpressora.setDisabled(Boolean.FALSE); - txtNomeArquivoLayout.setDisabled(Boolean.FALSE); - }else if (valor.equals(STOCK_CENTRAL)) { + configurarTextBox(txtNomImpressora, Boolean.TRUE, "BEMATECHFISCAL"); + configurarTextBoxComValorLimpo(txtNomeArquivoLayout, Boolean.TRUE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayoutInternacional, Boolean.TRUE); + } else if (valor.equals(DARUMA_FISCAL)|| valor.equals(DARUMA_FISCAL_BLINDADA)) { + configurarTextBox(txtNomImpressora, Boolean.TRUE, DARUMA_FISCAL); + configurarTextBoxComValorLimpo(txtNomeArquivoLayout, Boolean.TRUE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayoutInternacional, Boolean.TRUE); + } else if (valor.equals(CENTRAL_EMISSAO)) { + configurarTextBox(txtNomImpressora, Boolean.TRUE, CENTRAL_EMISSAO); + configurarTextBoxComValorLimpo(txtNomeArquivoLayout, Boolean.TRUE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayoutInternacional, Boolean.TRUE); + } else if (valor.equals(MATRICIAL)) { + configurarTextBoxComValorLimpo(txtNomImpressora, Boolean.FALSE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayout, Boolean.FALSE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayoutInternacional, Boolean.FALSE); + } else if (valor.equals(STOCK_CENTRAL)) { if(estacion == null || estacion.getPuntoVenta() == null){ Clients.alert(Labels.getLabel("editarEstacionController.MSG.sinPuntoVenta"), Labels.getLabel("editarEstacionController.window.title"), org.zkoss.zul.Messagebox.INFORMATION); cmbTipoImpressora.setSelectedItem(null); return; } - txtNomImpressora.setText(""); - txtNomeArquivoLayout.setText(""); - txtNomImpressora.setDisabled(Boolean.FALSE); -// boolean indStockCentral = chkStockCentral.isChecked(); -// if(indStockCentral){ - txtNomeArquivoLayout.setDisabled(Boolean.FALSE); -// }else{ -// txtNomeArquivoLayout.setDisabled(Boolean.TRUE); -// } + configurarTextBoxComValorLimpo(txtNomImpressora, Boolean.FALSE); + configurarTextBoxComValorLimpo(txtNomeArquivoLayout, Boolean.FALSE); cmbEstacion.setSelectedItem(null); List lsEstacion = estacionService.buscarEstacionesStockCentral(estacion.getPuntoVenta()); BindingListModel dictModel = new BindingListModelList(lsEstacion, false); @@ -678,6 +665,20 @@ public class EditarEstacionController extends MyGenericForwardComposer { } } + private void configurarTextBox(Textbox textBox, Boolean desabilitado, String valor) { + configurarTextBoxComValorLimpo(textBox, desabilitado); + textBox.setText(valor); + } + + private void configurarTextBoxComValorLimpo(Textbox textBox, Boolean desabilitado) { + limparTextBox(textBox); + textBox.setDisabled(desabilitado); + } + + private void limparTextBox(Textbox txtBox) { + txtBox.setText(""); + } + public void onChange$cmbEstacion(Event ev) { Comboitem item = (Comboitem) cmbEstacion.getSelectedItem(); diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEstacionImpresora.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEstacionImpresora.java index 904dcc732..7a8b8a1f0 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEstacionImpresora.java +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderEstacionImpresora.java @@ -1,23 +1,14 @@ package com.rjconsultores.ventaboletos.web.utilerias.render; -import org.zkoss.util.resource.Labels; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listitem; import org.zkoss.zul.ListitemRenderer; import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.enums.TipoImpressora; public class RenderEstacionImpresora implements ListitemRenderer { - private static final String MATRICIAL = Labels.getLabel("editarEstacionController.tipoImpressora.matricial"); - private static final String BEMATECH_FISCAL = Labels.getLabel("editarEstacionController.tipoImpressora.bematechFiscal"); - private static final String BEMATECH_FISCAL_BLINDADA = Labels.getLabel("editarEstacionController.tipoImpressora.bematechFiscalBlindada"); - private static final String DARUMA_FISCAL = Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscal"); - private static final String DARUMA_FISCAL_BLINDADA = Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscalBlindada"); - private static final String CENTRAL_EMISSAO = Labels.getLabel("editarEstacionController.tipoImpressora.centralEmissao"); - private static final String STOCK_CENTRAL = Labels.getLabel("editarEstacionController.tipoImpressora.stockCentral"); - private static final String BPE = Labels.getLabel("editarEstacionController.tipoImpressora.bpe"); - public void render(Listitem lstm, Object o) throws Exception { EstacionImpresora estacionImpresora = (EstacionImpresora) o; @@ -25,12 +16,11 @@ public class RenderEstacionImpresora implements ListitemRenderer { return; } - Listcell lc = new Listcell(); - - lc = new Listcell(estacionImpresora.getEmpresa().getNombempresa()); + Listcell lc = new Listcell(estacionImpresora.getEmpresa().getNombempresa()); lc.setParent(lstm); - lc = new Listcell(estacionImpresora.getTipoImpressora() == null ? "" : getTipoImpressora(estacionImpresora)); + TipoImpressora tipo = TipoImpressora.getTipoImpressora(estacionImpresora.getTipoImpressora()); + lc = new Listcell(tipo == null ? "" : tipo.getNome()); lc.setParent(lstm); lc = new Listcell(estacionImpresora.getNombImpresora()); @@ -39,31 +29,10 @@ public class RenderEstacionImpresora implements ListitemRenderer { lc = new Listcell(estacionImpresora.getNombArchivoLayout()); lc.setParent(lstm); - lc = new Listcell(estacionImpresora.getIndArchivolayoutInternacional() ? "Sim" : "Não"); + lc = new Listcell(estacionImpresora.getNombArchivoLayoutIternacional()); lc.setParent(lstm); lstm.setAttribute("data", estacionImpresora); } - private String getTipoImpressora(EstacionImpresora estacionImpresora) { - if (estacionImpresora.getTipoImpressora() == 0) { - return MATRICIAL; - } else if (estacionImpresora.getTipoImpressora() == 1) { - return BEMATECH_FISCAL; - } else if (estacionImpresora.getTipoImpressora() == 2) { - return BEMATECH_FISCAL_BLINDADA; - } else if (estacionImpresora.getTipoImpressora() == 4) { - return DARUMA_FISCAL; - } else if (estacionImpresora.getTipoImpressora() == 5) { - return DARUMA_FISCAL_BLINDADA; - } else if (estacionImpresora.getTipoImpressora() == 3) { - return CENTRAL_EMISSAO; - } else if (estacionImpresora.getTipoImpressora() == 6) { - return STOCK_CENTRAL; - } else if (estacionImpresora.getTipoImpressora() == 7) { - return BPE; - } - return MATRICIAL; - } - } diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index edc1b80bd..e9f6c91b7 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -4115,7 +4115,7 @@ busquedaEstacionController.nomeArquivoLayout.label = Archivo Layout busquedaEstacionController.lhUtilizaCartaoLibercard.label = Utiliza tarjeta Libercard busquedaEstacionController.lhStockCentral.label = Stock Central msg.constraint.cajaObligatorio = Caja obligatoria -busquedaEstacionController.lhTipoArquivoLayoutInternacional.label = Archivo Layout Internacional +busquedaEstacionController.nomeArquivoLayoutInternacional.label = Archivo Layout Internacional # Editar Estacion editarEstacionController.window.title = Estación diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 11f8bcf76..9f7324d9e 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -4323,7 +4323,7 @@ busquedaEstacionController.nomeImpressoraBPe.label = Impressora BPe busquedaEstacionController.nomeImpressoraSeguro.label = Impressora Seguro busquedaEstacionController.nomeArquivoLayout.label = Arquivo Layout msg.constraint.cajaObligatorio = Caixa obligatória -busquedaEstacionController.lhTipoArquivoLayoutInternacional.label = Arquivo Layout Internacional +busquedaEstacionController.nomeArquivoLayoutInternacional.label = Arquivo Layout Internacional # Editar Estacion editarEstacionController.window.title = Estação diff --git a/web/gui/seguridad/editarEstacion.zul b/web/gui/seguridad/editarEstacion.zul index c9959bacd..46564d4e9 100644 --- a/web/gui/seguridad/editarEstacion.zul +++ b/web/gui/seguridad/editarEstacion.zul @@ -331,11 +331,11 @@ @@ -362,8 +362,8 @@ label="${c:l('busquedaEstacionController.nomeImpressora.label')}" /> - +