var environment = "prod";
var populateLookup=true;
var userInSession=true;
var timings = {};
var apiHost="api2.mein.com.mx";
var logsUrl = "//api2.mein.com.mx/api/logs";
var clientHost = "NjMuMTQxLjIzMC45MA==";
var charts={};
var rapidez=200;
var rowsPerPage=[ 50, 100, 250 ];
var datatables=orders={};
var accionesTabla={};
var callbackFn,formBeforeSubmit={}, formFn={}, autocompletes={};
var ajaxCalls=[];
var requeridos=[];
var wWidth,wHeight,maxW,maxH,dialogW,dialogH; //variables para dialogs,etc.
var TOinit={
"ulTabWrap":0,
"logout":0,
"keep-alive":0,
"edad":0,
};
var boton,btnData,tablaAttr;
var dzs={};
var excludeHiddenNames=['ctrl','info','_id','userid'];
var moreNames=[];
var loginCheck = (0 == 1);
if(window["Dropzone"]){
Dropzone.autoDiscover = false;
}
if($.datetimepicker){
$.datetimepicker.setLocale('es');
}
$.extend({
parseParams: function(queryString) {
var params = {};
if (queryString) {
var pairs = queryString.split('&');
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split('=');
var name = decodeURIComponent(pair[0]);
var value = decodeURIComponent(pair[1]);
params[name] = value;
}
}
return params;
}
});
function xhrErr(xhr, ajaxOptions, thrownError){
timeoutRedirect=2000;
$(document).find(".cssloader").hide();
$(document).find("#loading").hide();
notifConfig=false;
switch(xhr.status){
case 200:
case 201:
break;
case 555:
notifConfig ={tipo:"danger",content:"Sesión expirada, inicie sesión de nuevo. Redireccionando..."};
timeoutRedirect=5000;
setTimeout(function(){location.reload();},5000);
break;
case 404:
notifConfig={tipo:"danger",content:"El contenido no existe."};
notificacion(notifConfig);
break;
case 301:
case 302:
notifConfig ={tipo:"warning",content:"El contenido ha sido movido a otra dirección. Redireccionando..."};
timeoutRedirect=5000;
setTimeout(function(){location.reload();},5000);
break;
default:
notifConfig={tipo:"danger",content:"Error "+xhr.status+" "+thrownError};
break;
}
notifConfig && notificacion(notifConfig);
return true;
}
$.ajaxSetup({
headers: {
'X-MEIN-USERID': '',
'X-Requested-With': 'XMLHttpRequest',
},
error: xhrErr,
beforeSend: function(jqXHR, settings) {
settings.startTime = new Date().getTime(); // set start time before sending the request
},
complete: function(jqXHR, textStatus) {
if (this.url.includes('/logs')) return true;
var endTime = new Date().getTime();
var ajaxData = new URLSearchParams("?"+this.data);
// send the data to the server using an AJAX call
var elapsedTime = endTime - this.startTime;
$.ajax({
type: 'POST',
url: logsUrl,
cache: false,
data: {
tipo: 'xhr',
status: textStatus,
user: '',
url: this.url,
time: elapsedTime,
client: clientHost,
environment: environment,
ctrl: ajaxData.get('ctrl') || ''
},
dataType: 'json'
});
},
});