delete sio;
sio = new Object();
if (sio == undefined)
{
sio = new Object();
}
jQuery(document).ready(function()
{
if (sio.ajax == undefined)
{
sio.ajax = new Object();
}
if (sio.form == undefined)
{
sio.form = new Object();
}
sio.form.input = new Array();
sio.reloadweb=function()
{
location.reload();
//redirect_url = encodeURIComponent(window.location.href);
//url = window.location.href + "account/login?redirect_url=" + redirect_url;
//window.location.replace(url);
//.location.href="http://192.168.0.37/passwordtool/jobboards.php";
//window.location.reload();
}
sio.actualizarweb=function(web)
{alert("1111");
location.href = web;
location.reload();
alert("222");
}
sio.form_get_actualizar=function(idformuraio,retaregreso)
{ var esperarrespuesta;
$.ajax({
url: retaregreso,
method: 'GET',
data: $("#"+idformuraio).serialize(),
cache: false,
async: false,
success: function (response) {
//alert('Your form has been sent successfully.');
console.log(response);
if(response.proceso_exito>0)
{
Swal.fire({
position: "top-end",
icon: "success",
title: "Guardodo con exito",
showConfirmButton: false,
timer: 1500,
timerProgressBar: true,
didOpen: () => {
},
willClose: () => {
if(response.proceso_exito>0)
{
sio.reloadweb();
}
}
}).then((result) => {
});
}
esperarrespuesta=response;
},
error: function (xhr, status, error) {
// alert('NO SE LOGRO EJECUTAR LA SOLICITUD');
Swal.fire({
position: "top-end",
icon: "error",
title: "No logro cargar la infomacion",
showConfirmButton: false,
timer: 1500
});
console.error(error);
}
});
return esperarrespuesta;
}
sio.ultimo_proceso=function(informacion)
{
//se recibe un array y lo convertimos en json y de ahi vamos vamos a extraer algunas variables que nos intenresen...
var json = $.parseJSON(informacion);
// para reiniciar la pagina vamos a preguntar por la variable erro de login si ya tiene mas de 3 intentos entonces se reinicia para el proceso
// php muestre lo que tenga que mostrar...
if(json.intentossession>=5)
{sio.reloadweb();
}
}
sio.ajax.reload2=function(dir,div)
{
//alert(div);
if (div)
{
div=div;
}
else
{
div='div_NULL';
}
var destruir_cadena_replace= 'on='+dir;
destruir_cadena_replace=destruir_cadena_replace;
$.ajax({
data: null,
url: 'https://servicioportuario.com/ajax2.php?'+destruir_cadena_replace,
type: 'post',
contentType: false,
processData: false,
beforeSend: function () {
$('#'+div).html('Cargando....');
},
success: function (response) {
$('#'+div).html(response);
}
});
}
sio.ajax.reload3=function(rutaon,dir,div)
{ var valor_tomar;
//alert(div);
if (div)
{
div=div;
}
else
{
div='div_NULL';
}
//alert(div);
//var destruir_cadena_replace= 'on='+dir;
//destruir_cadena_replace=destruir_cadena_replace;
$.ajax({
data: dir,
url: rutaon,
async: false,
type: 'post',
contentType: false,
processData: false,
beforeSend: function () {
$('#'+div).html('');
},
success: function (response) {
$('#'+div).html(response);
//alert("respuesta:"+response);
valor_tomar=response;
}
});
return valor_tomar;
}
/*para realizar multibles id en debug*/
sio.increment_debug=1;
sio.ajax.reload = function(dir,div)
{
if (div)
{
div=div;
}
else
{
div='div_NULL';
}
var destruir_cadena_replace= 'on='+dir;
destruir_cadena_replace=destruir_cadena_replace;
$.ajax({
data: destruir_cadena_replace,
url: 'https://servicioportuario.com/ajax.php',
type: 'post',
beforeSend: function () {
$('#'+div).html('
');
},
success: function (response) {
$('#'+div).html(response);
}
});
};
sio.form.post = function(hId, hDomToLoad)
{
sio.quitar_autoNumeric();
var data = new FormData();
oForm = document.getElementById(hId);
if (oForm)
{
//alert(oForm);
//console.log(oForm);
if (oForm.target)
{
aElements = oForm.elements;
sFormPostValues = '';
for (i=0; i < aElements.length; i++)
{
oElement = aElements[i];
sElementID = oElement.getAttribute("id");
if ((sElementID != null)&&(sElementID != ''))
{
bSendLocal = true;
if (oElement.type == 'file')
{
jQuery.each($('#'+sElementID)[0].files, function(i, file) {
//para array seria algo asi
//data.append('file2-'+i, file);
data.append(sElementID, file);
// alert(file);
});
}
if (oElement.type == 'textarea')
{
// $('#'+sElementID).val($('#'+sElementID).val());
data.append(sElementID, $('#'+sElementID).val());
}
if ((oElement.type == 'text')||(oElement.type == 'password') ||(oElement.type == 'number'))
{
//data.append(sElementID, $('#'+sElementID).val());
data.append(sElementID,oElement.value);
// data.append(sElementID, $('#'+sElementID).attr('value'));
// data.append(sElementID,{key1 : value1 , key2 : value2 });
//jQuery.each($('#'+sElementID), function(key, value) {
// data.append('sElementID['+key+']', value);
//});
// jQuery.each($('#'+sElementID).files, function(i, file) {
// data.append(sElementID+"["+i+"]", file);
// data.append(sElementID, file);
// });
}
//alert(oElement.value);
if((oElement.type =='select-one') )
{
data.append(sElementID,oElement.value);
//alert(sElementID+":::"+oElement.value);
}
if((oElement.type == 'select-multiple'))
{
var value = $('#'+sElementID).val();
var contenedor = value ? ''+value+'' : value;
data.append(sElementID,contenedor);
delete value;
delete contenedor;
}
if((oElement.type == 'checkbox') ||(oElement.type == 'radio') )
{
if(oElement.checked==true)
{
data.append(sElementID,oElement.value);
}
else
{
data.append(sElementID,'');
}
//alert(sElementID+":::"+oElement.checked);
}
}
}
data.append("on", oForm.target);
if(hDomToLoad == undefined)
{
//alert('rrrrrrrrrrrrrrr');
return sio.ajax.reload3(oForm.target,data);
}
else
{
var temx=hDomToLoad.toString();
return sio.ajax.reload3(oForm.target,data,temx);
}
}
}
};
sio.form.post3 = function(hId, hDomToLoad)
{
sio.quitar_autoNumeric();
var data = new FormData();
oForm = document.getElementById(hId);
if (oForm)
{
//alert(oForm);
//console.log(oForm);
if (oForm.target)
{
aElements = oForm.elements;
sFormPostValues = '';
for (i=0; i < aElements.length; i++)
{
oElement = aElements[i];
sElementID = oElement.getAttribute("id");
if ((sElementID != null)&&(sElementID != ''))
{
bSendLocal = true;
if (oElement.type == 'file')
{
//IMPORTANTE este es solo los archivos unicos no esta preparado para los array que no es dificil pero no esta actualmente preparado
jQuery.each($('#'+sElementID)[0].files, function(i, file) {
//para array seria algo asi
//data.append('file2-'+i, file);
data.append(sElementID, file);
// alert(file);
});
}
if (oElement.type == 'textarea')
{
if($('#'+sElementID).hasClass("tinymce"))
{
data.append(sElementID,tinymce.get(sElementID).getContent());
}
else{
// $('#'+sElementID).val($('#'+sElementID).val());
data.append(sElementID, $('#'+sElementID).val());
}
}
if ((oElement.type == 'text')||(oElement.type == 'password') ||(oElement.type == 'number'))
{
//data.append(sElementID, $('#'+sElementID).val());
data.append(sElementID,oElement.value);
// data.append(sElementID, $('#'+sElementID).attr('value'));
// data.append(sElementID,{key1 : value1 , key2 : value2 });
//jQuery.each($('#'+sElementID), function(key, value) {
// data.append('sElementID['+key+']', value);
//});
// jQuery.each($('#'+sElementID).files, function(i, file) {
// data.append(sElementID+"["+i+"]", file);
// data.append(sElementID, file);
// });
}
//alert(oElement.value);
if((oElement.type =='select-one') )
{
data.append(sElementID,oElement.value);
//alert(sElementID+":::"+oElement.value);
}
if((oElement.type == 'select-multiple'))
{
var value = $('#'+sElementID).val();
var contenedor = value ? ''+value+'' : value;
data.append(sElementID,contenedor);
delete value;
delete contenedor;
}
if((oElement.type == 'checkbox') ||(oElement.type == 'radio') )
{
if(oElement.checked==true)
{
data.append(sElementID,oElement.value);
}
else
{
data.append(sElementID,'');
}
//alert(sElementID+":::"+oElement.checked);
}
}
}
data.append("on", oForm.target);
if(hDomToLoad == undefined)
{
//alert('rrrrrrrrrrrrrrr');
return sio.ajax.reload3(oForm.target,data);
}
else
{
var temx=hDomToLoad.toString();
return sio.ajax.reload3(oForm.target,data,temx);
}
}
}
};
aArray_Localx= new Array;
aArray_Localx[0]= new Array;
aArray_Localx[0]["omar"]="omarsillo";
aArray_Localx[0]["aaa"]="jajjajaj";
sio.readyAllArray=function (aArray_Local)
{
var elements="";
//alert( aArray_Local);
$.each(aArray_Local, function(i, n) {
//alert( "Name: " + i + ", Value: " + n );
if(n==Array)
{
elements=elements+"##"+sio_readyAllArray(n);
}
else{
elements=elements+"
-----"+i+":"+n;
}
});
return elements;
}
//alert(sio.readyAllArray(aArray_Localx));
sio.degub_load=function(sNameTitle_Local,sElement_Local)
{
var cadena='---------x--'+sNameTitle_Local+"--"+sio.increment_debug+'
'+sio.readyAllArray(sElement_Local);
cadena=cadena+'
';
$('#debug_dialog #debug_elemet').append(cadena);
sio.increment_debug++;
}
sio.alerta_info=function(stitulo,scadena)
{
var notice = '
'+scadena+'
' + ''+scadena+'
' + ''+scadena+'
' + '