Resolução de conflitos

master
Fabio Faria 2022-12-22 18:55:57 -03:00
parent fa713ecb7c
commit 0d28dd32de
1 changed files with 67 additions and 15 deletions

View File

@ -247,6 +247,8 @@ public class EditarClienteController extends MyGenericForwardComposer {
private DiagramaAutobusService diagramaAutoBusService;
private Integer numAssentoIntReservaEspecial;
private List<TipoOcupacion> tipoOcupacoesSemValidacaoList;
public void aplicarMascara() {
Clients.evalJavaScript(
@ -297,7 +299,8 @@ public class EditarClienteController extends MyGenericForwardComposer {
lsLinhas = rutaService.obtenerTodos();
lsEmpresas = empresaService.obtenerTodos();
usaCPFComoFidelidade = ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.USA_CPF_COMO_FIDELIDADE.getDescricao());
tipoOcupacoesSemValidacaoList = constanteService.BuscarTipoOcupacaoSemValidacao();
if (usaCPFComoFidelidade) {
txtNumFidelidade.setDisabled(true);
btnAdicionarFidelidade.setDisabled(true);
@ -599,11 +602,21 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
private void setValidadoresCPF() {
if(isNaoValidarCamposOcupacao()) {
return;
}
txtNumRfc.setMaxlength(11);
txtNumRfc.setConstraint("/[0-9]{11}/ : " + Labels.getLabel("editarClienteController.MSG.validacaoCPF"));
}
private void setValidadoresCPF2() {
if(isNaoValidarCamposOcupacao()) {
return;
}
txtNumRfc2.setMaxlength(11);
txtNumRfc2.setConstraint("/[0-9]{11}/ : " + Labels.getLabel("editarClienteController.MSG.validacaoCPF"));
}
@ -631,7 +644,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
public void onClick$btnNovoCurso(Event ev) throws InterruptedException {
novoClienteCurso();
}
public void onSelect$cmbTipoIdentificacion(Event ev) throws InterruptedException {
txtNumRfc.setConstraint("");
txtNumRfc.setValue("");
@ -644,6 +657,21 @@ public class EditarClienteController extends MyGenericForwardComposer {
txtNumFidelidade.setText("");
}
}
public void onSelect$cmbOcupacion(Event ev) throws InterruptedException {
verificarERemoverValidacaoCPF();
}
private void verificarERemoverValidacaoCPF() {
if(isNaoValidarCamposOcupacao()) {
txtNumRfc.setConstraint("");
txtNumRfc.setValue("");
txtNumRfc2.setConstraint("");
txtNumRfc2.setValue("");
}
}
public void onSelect$cmbTipoIdentificacion2(Event ev) throws InterruptedException {
txtNumRfc2.setConstraint("");
@ -944,7 +972,6 @@ public class EditarClienteController extends MyGenericForwardComposer {
cmbMotivacionViaje.getValue();
cmbOcupacion.getValue();
if(!validarCampos()) {
return;
}
@ -1022,9 +1049,40 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
}
private boolean isNaoValidarCamposOcupacao() {
Boolean naoValidaCampos = false;
int ocupacion_id = buscarTipoOcupacionId();
if(tipoOcupacoesSemValidacaoList != null) {
for(TipoOcupacion tipoOcupacao : tipoOcupacoesSemValidacaoList) {
if(tipoOcupacao.getTipoocupacionId() == ocupacion_id) {
naoValidaCampos = true;
break;
}
}
}
return naoValidaCampos;
}
private int buscarTipoOcupacionId() {
int ocupacion_id = -1;
if (cliente != null && cliente.getTipoocupacionId() != null) {
ocupacion_id = cliente.getTipoocupacionId().getTipoocupacionId();
}
return ocupacion_id;
}
private boolean validarCampos() throws InterruptedException {
if (txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) {
Boolean isNaoValidarCampoOcupacao = isNaoValidarCamposOcupacao();
if (!isNaoValidarCampoOcupacao && txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) {
if ( cmbTipoIdentificacion != null
&& cmbTipoIdentificacion.getSelectedItem() != null
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
@ -1040,7 +1098,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
}
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty()) {
if (!isNaoValidarCampoOcupacao && txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty()) {
if ( cmbTipoIdentificacion2 != null
&& cmbTipoIdentificacion2.getSelectedItem() != null
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
@ -1056,7 +1114,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
}
List<Cliente> lsCliente = new ArrayList<Cliente>();
if ((txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) && cmbTipoIdentificacion != null
if (!isNaoValidarCampoOcupacao && (txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) && cmbTipoIdentificacion != null
&& cmbTipoIdentificacion.getSelectedItem() != null
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
&& CPF.equals(cmbTipoIdentificacion.getSelectedItem().getValue().toString())){
@ -1071,7 +1129,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
}
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty() && cmbTipoIdentificacion2 != null
if (!isNaoValidarCampoOcupacao && txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty() && cmbTipoIdentificacion2 != null
&& cmbTipoIdentificacion2.getSelectedItem() != null
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
&& CPF.equals(cmbTipoIdentificacion2.getSelectedItem().getValue().toString())) {
@ -1096,7 +1154,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
boolean isEmailNaoInformado = StringUtils.isBlank(txtDescorreo.getValue());
if(isTelefoneNaoInformado && isEmailNaoInformado) {
if(!isNaoValidarCampoOcupacao && isTelefoneNaoInformado && isEmailNaoInformado) {
Messagebox.show(Labels.getLabel("editarClienteController.MSG.exigeEmailOuTelefone"),
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
Messagebox.EXCLAMATION);
@ -1105,8 +1163,6 @@ public class EditarClienteController extends MyGenericForwardComposer {
}
return true;
}
@ -1353,7 +1409,6 @@ public class EditarClienteController extends MyGenericForwardComposer {
Messagebox.ERROR);
}
}
}
public Boolean getBoolVender1porCorrida() {
@ -1762,7 +1817,7 @@ public class EditarClienteController extends MyGenericForwardComposer {
reservaEspecialCliente.setIndQuarta(indQuartaChk.isChecked());
reservaEspecialCliente.setIndQuinta(indQuintaChk.isChecked());
reservaEspecialCliente.setIndSexta(indSextaChk.isChecked());
reservaEspecialCliente.setIndSabado(indSabadoChk.isChecked());
reservaEspecialCliente.setIndSabado(indSabadoChk.isChecked());
reservaEspecialClienteList.add(reservaEspecialCliente);
cliente.setListReservaEspecialCliente(reservaEspecialClienteList);
reservaEspecialMyListBox.setData(new ArrayList<ReservaEspecialCliente>(reservaEspecialClienteList));
@ -1898,9 +1953,6 @@ public class EditarClienteController extends MyGenericForwardComposer {
txtNumFidelidade.setValue(null);
}
}
private void limparInput() {
cmbLinha.setSelectedItem(null);