var arrSexo=[['H','Hombre'],['M','Mujer']];
Ext.onReady(inicializar);
function inicializar()
{
var objConf={
id:'datosBase',
renderTo: 'tblDatosInicio',
totalColumna: 4,
anchoTabla:800,
arrElementos:[
{
id:'primerNombre',
numColumna:1,
titulo: 'Primer Nombre *',
thCls:'letraNombreTablero',
longitudMaxima:40,
validacion:'obl',
convertirMayusculas:true,
evitarAcentos:true,
caracteresPermitidos:/[a-zA-ZÀ-ÿ\u00f1\u00d1\s]/,
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'segundoNombre',
numColumna:1,
titulo: 'Segundo Nombre',
longitudMaxima:30,
caracteresPermitidos:/[a-zA-ZÀ-ÿ\u00f1\u00d1\s]/,
thCls:'letraNombreTablero',
convertirMayusculas:true,
evitarAcentos:true,
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'apPaterno',
numColumna:1,
validacion:'obl',
titulo: 'Apellido Paterno *',
longitudMaxima:30,
caracteresPermitidos:/[a-zA-ZÀ-ÿ\u00f1\u00d1\s]/,
evitarAcentos:true,
thCls:'letraNombreTablero',
tdCls:'FONACOT_Etiqueta',
convertirMayusculas:true,
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'apMaterno',
numColumna:1,
titulo: 'Apellido Materno',
longitudMaxima:30,
convertirMayusculas:true,
caracteresPermitidos:/[a-zA-ZÀ-ÿ\u00f1\u00d1\s]/,
evitarAcentos:true,
thCls:'letraNombreTablero',
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'noImss',
numColumna:1,
titulo: 'No. de Seguro Social',
longitudMaxima:11,
caracteresPermitidos:/[0-9]/,
thCls:'letraNombreTablero',
convertirMayusculas:true,
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'curp',
numColumna:1,
titulo: 'CURP *',
longitudMaxima:18,
validacion:'obl',
convertirMayusculas:true,
caracteresPermitidos:/[0-9a-zA-ZÀ-ÿ\u00f1\u00d1]/,
thCls:'letraNombreTablero',
tdCls:'FONACOT_Etiqueta',
ancho:'220',
control:{
tipo:'TextField',
eventos: {
change:function(ctrl,nValor,vValor)
{
gEx('idCtrl_rfc').setValue(gEx('idCtrl_curp').getValue().substr(0,10));
}
},
propiedades: {
width:220,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'rfc',
numColumna:1,
titulo: 'RFC *',
longitudMaxima:10,
validacion:'obl',
convertirMayusculas:true,
caracteresPermitidos:/[0-9a-zA-ZÀ-ÿ\u00f1\u00d1]/,
thCls:'letraNombreTablero',
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:200,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'homoclave',
numColumna:1,
titulo: 'Homoclave *',
longitudMaxima:3,
validacion:'obl',
convertirMayusculas:true,
caracteresPermitidos:/[0-9a-zA-Z]/,
thCls:'letraNombreTablero',
tdCls:'FONACOT_Etiqueta',
ancho:'200',
control:{
tipo:'TextField',
propiedades: {
width:100,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'correo1',
numColumna:2,
convertirMayusculas:true,
titulo: 'Correo electrónico *',
thCls:'letraNombreTablero',
longitudMaxima:40,
validacion:'obl|mail',
tdCls:'FONACOT_Etiqueta',
ancho:'390',
control:{
tipo:'TextField',
propiedades: {
width:390,
//disabled:true,
cls:'FONACOT_Control'
}
}
},
{
id:'correo2',
numColumna:2,
titulo: 'Confirme correo electrónico *',
thCls:'letraNombreTablero',
longitudMaxima:40,
validacion:'obl|mail',
convertirMayusculas:true,
tdCls:'FONACOT_Etiqueta',
ancho:'390',
control:{
tipo:'TextField',
propiedades: {
width:390,
//disabled:true,
cls:'FONACOT_Control'
}
}
}
]
};
crearTabla(objConf);
new Ext.Button(
{
cls:'btnSIUGJ',
text:'Continuar',
renderTo:'btnContinuar',
handler:function()
{
buscarRegistro()
}
}
)
}
function buscarRegistro()
{
var idCtrl_primerNombre=gEx('idCtrl_primerNombre');
var idCtrl_apPaterno=gEx('idCtrl_apPaterno');
var idCtrl_curp=gEx('idCtrl_curp');
var idCtrl_rfc=gEx('idCtrl_rfc');
var idCtrl_homoclave=gEx('idCtrl_homoclave');
var idCtrl_correo1=gEx('idCtrl_correo1');
var idCtrl_correo2=gEx('idCtrl_correo2');
if(validarControles('datosBase'))
{
if(idCtrl_curp.getValue().length!=18)
{
function resp1()
{
idCtrl_curp.focus();
}
msgBox('La longitud de la CURP debe ser de 18 caracteres',resp1);
return;
}
if(!validaCURP(idCtrl_curp.getValue()))
{
function resp3()
{
idCtrl_curp.focus();
}
msgBox('El formato de CURP ingresado NO es válido',resp3);
return;
}
if(idCtrl_rfc.getValue().length!=10)
{
function resp2()
{
idCtrl_rfc.focus();
}
msgBox('La longitud del RFC debe ser de 10 caracteres',resp2);
return;
}
if(idCtrl_homoclave.getValue().length!=3)
{
function resp20()
{
idCtrl_homoclave.focus();
}
msgBox('La longitud de la homoclave debe ser de 3 caracteres',resp20);
return;
}
if(idCtrl_correo1.getValue().toUpperCase()!=idCtrl_correo2.getValue().toUpperCase())
{
function resp3()
{
idCtrl_correo2.focus();
}
msgBox('El correo electrónico ingresado no coincide',resp3);
return;
}
var cadObj=obtenerValores('datosBase');
function funcAjax()
{
var resp=peticion_http.responseText;
arrResp=resp.split('|');
if(arrResp[0]=='1')
{
var obj=eval('['+arrResp[2]+']')[0];
switch(arrResp[1])
{
case '0':
function resp(btn)
{
if(btn=='yes')
{
function funcAjax()
{
var resp=peticion_http.responseText;
arrResp=resp.split('|');
if(arrResp[0]=='1')
{
var lblMail=obj.mail;
var arrMail=lblMail.split('.');
lblMail=lblMail.substr(0,1)+'**********.'+arrMail[arrMail.length-1];
mostrarVentanaConfirmaTrabajador(lblMail,obj);
}
else
{
msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]);
}
}
obtenerDatosWeb('../modulosEspeciales_FONACOT/paginasFunciones/funcionesProcesosAdicionales.php',funcAjax, 'POST','funcion=11&iF='+obj.idRegistro+'&iM='+obj.mail,true);
}
}
msgConfirm('Se ha detectado que existe un proceso de pre registro activo, ¿Desea retomarlo?',resp);//con número de folio: '+obj.idRegistro+'
break;
case '1':
aperturarPreRegistro(obj.idRegistro);
break;
case '2':
msgBox('Se ha detectado que ya cuenta con un número de cliente FONACOT a nombre de '+obj.nombreTrabajador); //: '+obj.noCliente+'
break;
case '3':
msgBox('No se ha podido encontrar el número de seguro social (NSS) ingresado');
break;
}
}
else
{
msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]);
}
}
obtenerDatosWeb('../modulosEspeciales_FONACOT/paginasFunciones/funcionesProcesosAdicionales.php',funcAjax, 'POST','funcion=1&cadObj='+cadObj,true);
}
}
function validaCURP(curp)
{
var regex = "[A-Z]{1}[AEIOU]{1}[A-Z]{2}[0-9]{2}" +
"(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])" +
"[HM]{1}" +
"(AS|BC|BS|CC|CS|CH|CL|CM|DF|DG|GT|GR|HG|JC|MC|MN|MS|NT|NL|OC|PL|QT|QR|SP|SL|SR|TC|TS|TL|VZ|YN|ZS|NE)" +
"[B-DF-HJ-NP-TV-Z]{3}" +
"[0-9A-Z]{1}[0-9]{1}$";
var filter=new RegExp(regex);
if (filter.test(curp))
{
return true;
}
return true;
}
function aperturarPreRegistro(iR)
{
//limpiarControles('datosBase');
var objConf={};
objConf.ancho='100%';
objConf.alto='100%';
objConf.modal=true;
objConf.paramCodec=true;
objConf.params=[['idSolicitud',iR]];
objConf.url='../modulosEspeciales_FONACOT/tblExpedientePrerequisito.php';
abrirVentanaFancySuperior(objConf);
}
function mostrarVentanaConfirmaTrabajador(lblCorreo,obj)
{
var form = new Ext.form.FormPanel(
{
baseCls: 'x-plain',
layout:'absolute',
cls:'panelSiugj',
defaultType: 'label',
items: [
{
x:10,
y:10,
cls:'letraTituloCampoRegistro',
html:'Para confirmar su identidad, ingrese el código enviado al correo:
'+lblCorreo
},
{
x:100,
y:120,
cls:'FONACOT_Control',
xtype:'textfield',
width:200,
id:'txtConfirma'
}
]
}
);
var ventanaAM = new Ext.Window(
{
title: 'Confirmación de trabajador',
width: 400,
height:290,
layout: 'fit',
plain:true,
modal:true,
closable:false,
cls:'msgHistorialSIUGJ',
bodyStyle:'padding:5px;',
buttonAlign:'center',
items: form,
listeners : {
show : {
buffer : 10,
fn : function()
{
gEx('txtConfirma').focus(false,500);
}
}
},
buttons: [
{
text: 'Cancelar',
cls:'btnSIUGJCancel',
width:140,
handler:function()
{
ventanaAM.close();
}
},
{
text: 'Aceptar',
cls:'btnSIUGJ',
width:140,
handler: function()
{
var txtConfirma=gEx('txtConfirma');
if(txtConfirma.getValue()=='')
{
function resp()
{
txtConfirma.focus();
}
msgBox('Debe ingresar el código de verificación enviado a su correo electrónico',resp);
return;
}
function funcAjax()
{
var resp=peticion_http.responseText;
arrResp=resp.split('|');
if(arrResp[0]=='1')
{
if(arrResp[1]=='1')
{
ventanaAM.close();
aperturarPreRegistro(obj.idRegistro);
}
else
{
function respAux()
{
txtConfirma.focus();
}
msgBox('El código de verificación ingresado es incorrecto',respAux);
}
}
else
{
msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]);
}
}
obtenerDatosWeb('../modulosEspeciales_FONACOT/paginasFunciones/funcionesProcesosAdicionales.php',funcAjax, 'POST','funcion=12&iF='+obj.idRegistro+'&cV='+txtConfirma.getValue(),true);
}
}
]
}
);
ventanaAM.show();
}