var nIntervId;
function mainLoadingOn(){
//console.log('Loading ON');
$('#mainLoading').css("z-index", "99");
$("#mainLoading").css("display", "block");
}
function mainLoadingOff(){
//console.log('Loading OFF');
$('#mainLoading').css("z-index", "-1");
$("#mainLoading").css("display", "none");
}
var urlTarget = "";
function closeDiv(){
$("#Avisos").css("display", "none");
}
function checkSessionExpire(){
//console.log('checkSessionExpire');
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/sessionExpiredCheck.php',
success: function (res) {
if (res.status === '0') {
clearInterval(nIntervId);
alert(res.message.replace("\\n", "\n"));
loadMenu();
showLogin();
}
if (res.status === '1') {
var d = new Date();
var n = d.toString();
//console.log('Valid Session, Time ="' + n + '", ' + res.message);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadTournament(Season, Category){
//console.log('loadTournament Season = ' + Season + ', Category = ' + Category);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Top/changeTournament.php',
data: {Season: Season, Category: Category},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#categorysel").html(res.dataCategories);
loadCategory(Season, Category);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadCategory(Season, Category){
//console.log('loadCategory Season = ' + Season + ', Category = ' + Category);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Top/changeCategory.php',
data: {Season: Season, Category: Category},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#teamLogos").html(res.dataLogos);
loadWeeks();
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadLanguage(language, url){
//console.log('loadLanguage language = ' + language);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Top/changeLanguage.php',
data: {language: language},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
window.location.href=url;
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadMenu(){
//console.log('loadMenu');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Top/reloadMenu.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#cssmenu0").html(res.dataMenu);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeeks(){
//console.log('loadWeeks');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Content/changeWeeks.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataWeeks);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeek(Week){
//console.log('loadWeek week = ' + Week);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Content/changeWeek.php',
data: {Week: Week},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#weekContent").html(res.dataWeek);
$("#weekTabContent").html(res.dataWeekTab);
}else{
console.log(res);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function showLogin(){
//console.log('showLogin');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Top/showLogin.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataLogin);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function login(user, password, CSRFtoken){
//console.log('login user = ' + user + ', password = ' + password + ', CSRFtoken = ' + CSRFtoken);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Login/login.php',
data: {username: user, password: password, CSRFtoken: CSRFtoken},
success: function (res) {
mainLoadingOff()
if (res.status == '0') {
$("#errorLoginL").html(res.dataError);
}
if (res.status == '1') {
nIntervId = setInterval(checkSessionExpire, 60000);
loadMenu();
loadWeeks();
}
},
error: function(jqxhr, status, exception) {
console.log('Status: ' + status);
console.log('Exception: ' + exception);
console.log('jqxhr: ' + jqxhr);
}
});
}
function logout(){
//console.log('logout');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Login/logout.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
clearInterval(nIntervId);
loadMenu();
loadWeeks();
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function showBrowserRegister(){
//console.log('showBrowserRegister');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Login/showBrowserReg.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataBrowserReg);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function browserRegister(email){
//console.log('browserRegister');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Login/browserReg.php',
data: {email: email},
success: function (res) {
mainLoadingOff()
if (res.status == '0') {
$("#errorLoginL").html(res.dataError);
}
if (res.status == '1') {
showLogin();
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function onChangeWeek(Week){
loadWeek(Week);
}
function loadTeam(team,season){
//console.log('loadTeam team = ' + team + ', season = ' + season);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Content/changeTeam.php',
data: {team: team, season:season},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataTeam);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function changeTeamTab(id){
var currentAttrValue = id;
// Show/Hide Tabs
jQuery(currentAttrValue).siblings().slideUp(800);
jQuery(currentAttrValue).delay(800).slideDown(800);
// Change/remove current tab to active
$(id+'li').addClass('active').siblings().removeClass('active');
}
function changeStatusTab(id){
var currentAttrValue = id;
// Show/Hide Tabs
jQuery(currentAttrValue).siblings().slideUp(800);
jQuery(currentAttrValue).delay(800).slideDown(800);
// Change/remove current tab to active
$(id+'li').addClass('active').siblings().removeClass('active');
}
function changeTeamRosterTab(id){
var currentAttrValue = id;
// Show/Hide Tabs
jQuery(currentAttrValue).siblings().slideUp(800);
jQuery(currentAttrValue).delay(800).slideDown(800);
// Change/remove current tab to active
$(id+'li').addClass('active').siblings().removeClass('active');
}
function fixListSchedule(id){
//console.log("fixListSchedule() => " + id);
var index = 1;
$('#'+id+'').find('.tWrap__body').find('thead').find('tr:first').find('th').each(function(){
$('#'+id+' .tWrap__head').find('thead').find('tr:first').find('th:nth-child('+index+')').css( "width" ,$(this).get(0).getBoundingClientRect().width + "px");
index = index +1;
});
var index = 1;
$('#'+id+'').find('.tWrap__body').find('thead').find('tr:nth-child(2)').find('th').each(function(){
$('#'+id+' .tWrap__head').find('thead').find('tr:nth-child(2)').find('th:nth-child('+index+')').css( "width" ,$(this).get(0).getBoundingClientRect().width + "px");
index = index +1;
});
index = 1;
$('#'+id+'').find('.tWrap__body').find('tbody').find('tr:nth-child(1)').find('td').each(function(){
$(this).css( "width" , $('#'+id+' .tWrap__body').find('tbody').find('tr').find('td:nth-child('+index+')').get(0).getBoundingClientRect().width + "px");
index = index +1;
});
$('#'+id+'').find('.tWrap__body').find('thead').toggle();
$('#'+id+'').find('.tWrap__head').find('tbody').toggle();
}
function fixListScheduleWeek(id){
//console.log("fixListSchedule() => " + id);
var index = 1;
$('#'+id+'').find('.tWrap__body').find('thead').find('tr:first').find('th').each(function(){
$('#'+id+' .tWrap__head').find('thead').find('tr:first').find('th:nth-child('+index+')').css( "width" ,$(this).get(0).getBoundingClientRect().width + "px");
index = index +1;
});
$('#'+id+'').find('.tWrap__body').find('thead').toggle();
}
function fixList(id){
//console.log("fixList() => " + id);
var index = 1;
$('#'+id+'').find('.tWrap__body').find('thead').find('tr').find('th').each(function(){
$('#'+id+' .tWrap__head').find('thead').find('tr').find('th:nth-child('+index+')').css( "width" ,$(this).get(0).getBoundingClientRect().width + "px");
//console.log($(this)[0].getBoundingClientRect().width + ' vs '+ $('.tWrap__head').find('thead').find('tr').find('th:nth-child('+index+')')[0].getBoundingClientRect().width);
index = index +1;
});
$('#'+id+'').find('.tWrap__body').find('thead').toggle();
index = 1;
$('#'+id+'').find('.tWrap__head').find('thead').find('tr').find('th').each(function(){
$('#'+id+' .tWrap__body').find('tbody').find('tr').find('td:nth-child('+index+')').css( "width" ,$(this).get(0).getBoundingClientRect().width + "px");
//console.log($(this)[0].getBoundingClientRect().width + ' vs '+ $('.tWrap__head').find('thead').find('tr').find('th:nth-child('+index+')')[0].getBoundingClientRect().width);
index = index +1;
});
}
function previewPlayerShow(playerID){
//console.log('previewPlayerShow playerID = ' + playerID + ', season = ' + season);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Content/team-PlayersPlayerPreview.php',
data: {playerID: playerID},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#jugador").css("display", "block");
$("#teamPlayerPreview").html(res.dataTeamPlayerPreview);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function previewPlayerHide(){
$("#jugador").css("display", "none");
}
function loadAlert(){
//console.log('loadAlert');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Alert/loadAlert.php',
data: {playerID: playerID},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#jugador").css("display", "block");
$("#teamPlayerPreview").html(res.dataTeamPlayerPreview);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function abrirFicha(id, week, game, gamedesc, lgoals, vgoals){
//console.log('abrirFicha');
var attr = $('#'+id).attr('style');
$('.juego').css('display', 'none');
$('#expandir'+id).attr('src', './imagenes/expandir.png');
$('.expandirButton').attr('src', './imagenes/expandir.png');
// For some browsers, `attr` is undefined; for others,
// `attr` is false. Check for both.
if (typeof attr == typeof undefined) {
$('#'+id).css('display', 'none');
$('#expandir'+id).attr('src', './imagenes/expandir.png');
$("#content" + id).html('');
}else{
$('#'+id).removeAttr('style');
$('#expandir'+id).attr('src', './imagenes/colapsar.png');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Content/week-ScheduleScoresGameDetail.php',
data: {week: week, game: game, gamedesc: gamedesc, lgoals: lgoals, vgoals: vgoals},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#content" + id).html(res.dataWeekGameDetail);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
}
function userManagementShow(){
//console.log('loadUsersAdmin');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagement.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementLoadImage(id, idl, logo){
var index = document.getElementById(id).selectedIndex;
var optionsl = document.getElementById(idl).options;
document.getElementById(logo).src = "imagenes/"+optionsl[index].text+".png";
}
function userManagementLimpiarCreateUser(image){
document.getElementById("equipo").selectedIndex = 0;
document.getElementById("logoE").src = "imagenes/" + image + ".png";
document.getElementById("error").innerHTML = "";
document.getElementById("nombre").disabled = false;
document.getElementById("apellidop").disabled = false;
document.getElementById("apellidom").disabled = false;
document.getElementById("telefono").disabled = false;
document.getElementById("email").disabled = false;
document.getElementById("equipo").disabled = false;
document.getElementById("usuario").disabled = false;
document.getElementById("password_id").disabled = false;
document.getElementById("register_email_errorloc").innerHTML = "";
document.getElementById("register_nombre_errorloc").innerHTML = "";
document.getElementById("register_apellidop_errorloc").innerHTML = "";
document.getElementById("register_apellidom_errorloc").innerHTML = "";
document.getElementById("register_telefono_errorloc").innerHTML = "";
document.getElementById("nombre").value = "";
document.getElementById("apellidop").value = "";
document.getElementById("apellidom").value = "";
document.getElementById("telefono").value = "";
document.getElementById("email").value = "";
document.getElementById("usuario").value = "";
document.getElementById("password_id").value = "";
$("#register_errorloc").html("");
$('#userManagementCreate').toggle();
$('#userManagementList').toggle();
}
function userManagementLimpiarEditUser(){
$("#userManagementEdit").html("");
$('#userManagementEdit').toggle();
$('#userManagementList').toggle();
}
function userManagementCreateUser(name, lastname, lastname2, phone, email, team, user, password, salt){
//console.log('userManagementCreateUser name = ' + name + ', lastname = ' + lastname + ', lastname2 = ' + lastname2 + ', phone = ' + phone + ', email = ' + email + ', team = ' + team + ', user = ' + user + ', password = ' + password + ', salt = ' + salt);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementCreateSave.php',
data: {nombre: name, apellidop: lastname, apellidom: lastname2, telefono: phone, email: email, equipo: team, username: user, password: password, salt: salt},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataUser);
userManagementShow();
}
if (res.status === '0') {
$("#register_errorloc").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementDeleteUser(id){
//console.log('userManagementDeleteUser id = ' + id);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementDelete.php',
data: {id: id},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
//$("#register_errorloc").html(res.dataUser);
alert(res.dataUser);
userManagementShow();
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementShowEdit(id){
//console.log('userManagementShowEdit id = ' + id);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementEdit.php',
data: {id: id},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#userManagementEdit").html(res.dataUser);
$('#userManagementEdit').toggle();
$('#userManagementList').toggle();
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementEditUser(userid, name, lastname, lastname2, phone, email, team, active){
console.log('userManagementEditUser name = ' + name + ', lastname = ' + lastname + ', lastname2 = ' + lastname2 + ', phone = ' + phone + ', team = ' + team + ', active = ' + active);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementEditSave.php',
data: {userid: userid, nombre: name, apellidop: lastname, apellidom: lastname2, telefono: phone, email: email, equipo: team, active: active},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataUser);
userManagementShow();
}
if (res.status === '0') {
$("#register_errorloca").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementShowResetPassword(){
//console.log('userManagementShowResetPAssword');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementResetPassword.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementShowResetPasswordEnterConfirmCode(email){
//console.log('userManagementShowResetPasswordEnterConfirmCode');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementResetPasswordEnterConfirmCode.php',
data: {email: email},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataUser);
}else{
$("#resetreq_email_errorlocels").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementResetPasswordEnterConfirmCodeSend(code, email){
//console.log('userManagementResetPasswordEnterConfirmCodeSend');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementResetPasswordShowChangePassword.php',
data: {code: code, email: email},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataUser);
}else{
$("#register_code_error_reset_pwd").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function userManagementResetPasswordChangePassword(code, password, salt){
//console.log('userManagementResetPasswordEnterConfirmCodeSend code = ' + code + ', password = ' + password + ', salt = ' + salt);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Login/userManagementResetPasswordChangePassword.php',
data: {code: code, password: password, salt: salt},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataUser);
}else{
$("#register_code_error_reset_pwd").html(res.dataUser);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementAdminCategoryShow(){
//console.log('playersManagementAdminCategoryShow');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementChangeCategories.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataCategory);
playersManagementAdminCategoryTeamShow(res.category);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementAdminCategoryTeamShow(Category){
//console.log('playersManagementAdminCategoryTeamShow Category = ' + Category);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementChangeTeams.php',
data: {Category: Category},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#teamsContent").html(res.dataTeam);
playersManagementAdminShow(res.team);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementAdminShow(Team){
//console.log('playersManagementAdminShow Team = ' + Team);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagement.php',
data: {Team: Team},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#teamContent").html(res.dataPlayer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function disableButton(btn){
document.getElementsByName(btn).disabled = true;
}
function fireEvent(element,event) {
if (document.createEvent) {
return !element.click();
} else {
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
}
};
function readURL(input, foto) {
$("#previewMyFoto").html('');
$("#previewMyFoto").html('
');
$("#image_upload_form").ajaxForm({
dataType: 'json',
success: showResponseMyFoto
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + foto)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + foto).show();
}
}
function readIDURL11(input, identificacion) {
$("#previewMyID11").html('');
$("#previewMyID11").html('
');
$("#image_upload_form_ID1").ajaxForm({
dataType: 'json',
success: showResponseMyID11
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + identificacion)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + identificacion).show();
}
}
function readIDURL12(input, identificacion) {
$("#previewMyID12").html('');
$("#previewMyID12").html('
');
$("#image_upload_form_ID2").ajaxForm({
dataType: 'json',
success: showResponseMyID12
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + identificacion)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + identificacion).show();
}
}
function readFirmaURL(input, firma) {
$("#previewMyFirma").html('');
$("#previewMyFirma").html('
');
$("#image_upload_form_firma").ajaxForm({
dataType: 'json',
success: showResponseMyFirma
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + firma)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + firma).show();
}
}
function playerManagementLoadImage(id, idl, logo){
var index = document.getElementById(id).selectedIndex;
var optionsl = document.getElementById(idl).options;
document.getElementById(logo).src = "imagenes/"+optionsl[index].text+".png";
}
function playersManagementAdminCreatePlayer(name, lastname, lastname2, nickname, birthdate, playernumber, phone, sex, email, id, comments, valid, status, team, picture, idf, idb, signature){
//console.log('playersManagementAdminCreatePlayer name = ' + name + ', lastname = ' + lastname + ', lastname2 = ' + lastname2 + ', nickname = ' + nickname + ', birthdate = ' + birthdate + ', playernumber = ' + playernumber + ', phone = ' + phone + ', sex = ' + sex + ', email = ' + email + ', id = ' + id + ', comments = ' + comments + ', valid = ' + valid + ', status = ' + status + ', team = ' + team + ', picture = ' + picture + ', idf = ' + idf + ', idb = ' + idb + ', signature = ' + signature);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementCreateSave.php',
data: {name: name, lastname: lastname, lastname2: lastname2, nickname: nickname, birthdate: birthdate, playernumber: playernumber, phone: phone, sex: sex, email: email, id: id, comments: comments, valid: valid, status: status, team: team, picture: picture, idf: idf, idb: idb, signature: signature},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataPlayerMessage);
playersManagementAdminShow(team);
}else{
alert(res.dataPlayerMessage);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementTeamCreatePlayer(name, lastname, lastname2, nickname, birthdate, playernumber, phone, sex, email, id, comments, valid, status, team, picture, idf, idb, signature){
//console.log('playersManagementAdminCreatePlayer name = ' + name + ', lastname = ' + lastname + ', lastname2 = ' + lastname2 + ', nickname = ' + nickname + ', birthdate = ' + birthdate + ', playernumber = ' + playernumber + ', phone = ' + phone + ', sex = ' + sex + ', email = ' + email + ', id = ' + id + ', comments = ' + comments + ', valid = ' + valid + ', status = ' + status + ', team = ' + team + ', picture = ' + picture + ', idf = ' + idf + ', idb = ' + idb + ', signature = ' + signature);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Team/playersManagementCreateSave.php',
data: {name: name, lastname: lastname, lastname2: lastname2, nickname: nickname, birthdate: birthdate, playernumber: playernumber, phone: phone, sex: sex, email: email, id: id, comments: comments, valid: valid, status: status, team: team, picture: picture, idf: idf, idb: idb, signature: signature},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataPlayerMessage);
playersManagementTeamShow(team);
}else{
alert(res.dataPlayerMessage);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementAdminShowEdit(player){
//console.log('playersManagementAdminShowEdit player = ' + player);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementEdit.php',
data: {player: player},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#playersManagementEdit").toggle();
$("#playersManagementList").toggle();
$("#playersManagementEdit").html(res.dataPlayerEdit);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementTeamShowEdit(player){
//console.log('playersManagementAdminShowEdit player = ' + player);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Team/playersManagementEdit.php',
data: {player: player},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#playersManagementEdit").toggle();
$("#playersManagementList").toggle();
$("#playersManagementEdit").html(res.dataPlayerEdit);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementAdminEditPlayer(playerid, name, lastname, lastname2, nickname, birthdate, playernumber, phone, sex, email, id, comments, valid, status, team, picture, idf, idb, signature, steam){
//console.log('playersManagementAdminEditPlayer playerid = ' + playerid + ', name = ' + name + ', lastname = ' + lastname + ', lastname2 = ' + lastname2 + ', nickname = ' + nickname + ', birthdate = ' + birthdate + ', playernumber = ' + playernumber + ', phone = ' + phone + ', sex = ' + sex + ', email = ' + email + ', id = ' + id + ', comments = ' + comments + ', valid = ' + valid + ', status = ' + status + ', team = ' + team + ', picture = ' + picture + ', idf = ' + idf + ', idb = ' + idb + ', signature = ' + signature);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementEditSave.php',
data: {playerid: playerid, name: name, lastname: lastname, lastname2: lastname2, nickname: nickname, birthdate: birthdate, playernumber: playernumber, phone: phone, sex: sex, email: email, id: id, comments: comments, valid: valid, status: status, team: team, picture: picture, idf: idf, idb: idb, signature: signature},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataPlayerMessage);
playersManagementAdminShow(steam);
}else{
alert(res.dataPlayerMessage);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementTeamEditPlayer(playerid, nickname, playernumber, phone, email, comments, valid, status, team, picture, idf, idb, signature, steam){
//console.log('playersManagementAdminEditPlayer nickname = ' + nickname + ', playernumber = ' + playernumber + ', phone = ' + phone + ', email = ' + email + ', comments = ' + comments + ', valid = ' + valid + ', status = ' + status + ', team = ' + team + ', picture = ' + picture + ', idf = ' + idf + ', idb = ' + idb + ', signature = ' + signature);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Team/playersManagementEditSave.php',
data: {playerid: playerid, nickname: nickname, playernumber: playernumber, phone: phone, email: email, comments: comments, valid: valid, status: status, team: team, picture: picture, idf: idf, idb: idb, signature: signature},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataPlayerMessage);
playersManagementTeamShow(steam);
}else{
alert(res.dataPlayerMessage);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function readURLE(input, foto) {
$("#previewMyFotoE").html('');
$("#previewMyFotoE").html('
');
$("#image_upload_formE").ajaxForm({
dataType: 'json',
success: showResponseMyFotoE
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + foto)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + foto).show();
}
}
function readIDURL11E(input, identificacion) {
$("#previewMyID11E").html('');
$("#previewMyID11E").html('
');
$("#image_upload_form_ID1E").ajaxForm({
dataType: 'json',
success: showResponseMyID11E
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + identificacion)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + identificacion).show();
}
}
function readIDURL12E(input, identificacion) {
$("#previewMyID12E").html('');
$("#previewMyID12E").html('
');
$("#image_upload_form_ID2E").ajaxForm({
dataType: 'json',
success: showResponseMyID12E
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + identificacion)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + identificacion).show();
}
}
function readFirmaURLE(input, firma) {
$("#previewMyFirmaE").html('');
$("#previewMyFirmaE").html('
');
$("#image_upload_form_firmaE").ajaxForm({
dataType: 'json',
success: showResponseMyFirmaE
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + firma)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + firma).show();
}
}
function playersManagementAdminShowPrintList(){
//console.log('playersManagementAdminShowPrintList player = ' + player);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Admin/playersManagementGeneratePrintListShow.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataPrintList);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function playersManagementTeamShow(Team){
//console.log('playersManagementTeamShow Team = ' + Team);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Players/Team/playersManagement.php',
data: {Team: Team},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataPlayer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function configManagementShow(){
//console.log('configManagementShow Team = ' + Team);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Config/configManagementShow.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataConfig);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function readURLLogo(input, logoImage) {
$("#previewMyLogo").html('');
$("#previewMyLogo").html('
');
$("#image_upload_form_logo").ajaxForm({
dataType: 'json',
success: showResponseMyLogo
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + logoImage)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + logoImage).show();
}
}
function configManagementInfoSave(leagueName, latitude, longitude, logo, logox, logoy, logoFileName, colorHeader, colorBody, colorFooter){
//console.log('configManagementInfoSave leagueName = ' + leagueName + ', latitude = ' + latitude + ', longitude = ' + longitude + ', logo = ' + logo + ', logox = ' + logox + ', logoy = ' + logoy + ', logoFileName = ' + logoFileName + ', colorHeader = ' + colorHeader + ', colorBody = ' + colorBody + ', colorFooter = ' + colorFooter);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Config/configManagementInfoSave.php',
data: {leagueName: leagueName, latitude: latitude, longitude: longitude, logo: logo, logox: logox, logoy: logoy, logoFileName: logoFileName, colorHeader: colorHeader, colorBody: colorBody, colorFooter: colorFooter},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataConfigAnswer);
}else{
alert(res.dataConfigAnswer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function configManagementAlertSave(Alert){
//console.log('configManagementAlertSave Alert = ' + Alert);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Config/configManagementAlertSave.php',
data: {Alert: Alert},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataConfigAnswer);
}else{
alert(res.dataConfigAnswer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function configManagementGeneralSave(lenguaje, EmpatesPenales, JugadorJugado, JuegoCedulas, MarcadorArbitro, MarcadorFecha, MarcadorDiaDefault, JornadaCedulas, columnid, ByeWeekPoints, ByeWeekPointsGoals){
//console.log('configManagementAlertSave');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Config/configManagementGeneralSave.php',
data: {EmpatesPenales: EmpatesPenales, JugadorJugado: JugadorJugado, JuegoCedulas: JuegoCedulas, MarcadorArbitro: MarcadorArbitro, MarcadorFecha: MarcadorFecha, JornadaCedulas: JornadaCedulas, columnid: columnid, MarcadorDiaDefault: MarcadorDiaDefault, lenguaje: lenguaje, ByeWeekPoints: ByeWeekPoints, ByeWeekPointsGoals: ByeWeekPointsGoals},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataConfigAnswer);
}else{
alert(res.dataConfigAnswer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function colorManagementShow(){
//console.log('colorManagementShow');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Colors/colorsManagement.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataColor);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function colorsManagementCreateSave(colorName, colorHEX){
//console.log('colorsManagementCreateSave colorName = ' + colorName + ', colorHEX = ' + colorHEX');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Colors/colorsManagementNewSave.php',
data: {colorName: colorName, colorHEX: colorHEX},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataColorAnswer);
colorManagementShow();
}else{
alert(res.dataColorAnswer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function colorsManagementShowEdit(color){
//console.log('colorsManagementShowEdit color = ' + color);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Colors/colorsManagementEdit.php',
data: {color: color},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#colorsManagementEdit").toggle();
$("#colorsManagementList").toggle();
$("#colorsManagementEdit").html(res.dataColorEdit);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function colorsManagementUpdateSave(colorID, colorName, colorHEX){
//console.log('colorsManagementUpdateSave colorName = ' + colorName + ', colorHEX = ' + colorHEX');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Colors/colorsManagementUpdateSave.php',
data: {colorName: colorName, colorHEX: colorHEX, colorID: colorID},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
alert(res.dataColorAnswer);
colorManagementShow();
}else{
alert(res.dataColorAnswer);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeeksAdmin(){
//console.log('loadWeeksAdmin');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/changeWeeksAdmin.php',
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#body").html(res.dataWeeksAdmin);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeekAdmin(Week){
//console.log('loadWeekAdmin week = ' + Week);
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/changeWeekAdmin.php',
data: {Week: Week},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#weekAdminContent").html(res.dataWeekAdmin);
}else{
console.log(res);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeekAdminGameComments(Comment, GameID){
//console.log('loadWeekAdminGameComments');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/weekAdmin-ScheduleScores-Comment.php',
data: {GameID: GameID, Comment: Comment},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#comentarioInput").html(res.dataWeekAdminGameComment);
$("#comentarioInput").toggle();
}else{
console.log(res);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function abrirFichaEdit(id, week, game, gamedesc, lgoals, vgoals){
//console.log('abrirFichaEdit');
var attr = $('#edit'+id).attr('style');
$('.juego').css('display', 'none');
$('#expandir'+id).attr('src', './imagenes/expandir.png');
$('.expandirButton').attr('src', './imagenes/expandir.png');
// For some browsers, `attr` is undefined; for others,
// `attr` is false. Check for both.
if (typeof attr == typeof undefined) {
$('#edit'+id).css('display', 'none');
$('#expandir'+id).attr('src', './imagenes/expandir.png');
$("#content" + id).html('');
}else{
$('#edit'+id).removeAttr('style');
$('#expandir'+id).attr('src', './imagenes/colapsar.png');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/weekAdmin-ScheduleScoresGameDetail.php',
data: {week: week, game: game, gamedesc: gamedesc, lgoals: lgoals, vgoals: vgoals},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#content" + id).html(res.dataWeekGameDetail);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
}
function loadWeekAdminGameDetailRoja(redComment, playerID, redDays, redFee, redPaid){
//console.log('loadWeekAdminGameDetailRoja');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/weekAdmin-ScheduleScores-RedComment.php',
data: {RedComment: redComment, PlayerID: playerID, RedDays: redDays, RedFee: redFee, RedPaid: redPaid},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#rojaInput").html(res.dataWeekAdminGameRedComment);
$("#rojaInput").toggle();
}else{
console.log(res);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function loadWeekAdminGameDetailDocs(Season, Week, Game){
//console.log('loadWeekAdminGameDetailDocs');
mainLoadingOn();
$.ajax({
type: 'POST',
dataType: 'json',
url: 'ajax/Admin/Games/weekAdmin-ScheduleScores-GameDocuments.php',
data: {Week: Week, Game: Game},
success: function (res) {
mainLoadingOff()
if (res.status === '1') {
$("#gameDocInput").html(res.dataWeekAdminGameDocs);
$("#gameDocInput").toggle();
}else{
console.log(res);
}
},
error: function(jqxhr, status, exception) {
console.log('Exception:' + exception);
}
});
}
function readURLCF(input, CedulaF) {
$("#previewMyCedulaF").html('');
$("#previewMyCedulaF").html('
');
$("#cedulaF_upload_form").ajaxForm({
dataType: 'json',
success: showResponseMyCedulaF
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + CedulaF)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + CedulaF).show();
$('#' + CedulaF).height(225).width(300);
}
}
function readURLA1(input, Anexo1) {
$("#previewMyAnexo1").html('');
$("#previewMyAnexo1").html('
');
$("#anexo1_upload_form").ajaxForm({
dataType: 'json',
success: showResponseMyAnexo1
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + Anexo1)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + Anexo1).show();
$('#' + Anexo1).height(225).width(300);
}
}
function readURLA2(input, Anexo2) {
$("#previewMyAnexo2").html('');
$("#previewMyAnexo2").html('
');
$("#anexo2_upload_form").ajaxForm({
dataType: 'json',
success: showResponseMyAnexo2
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + Anexo2)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + Anexo2).show();
$('#' + Anexo2).height(225).width(300);
}
}
function readURLA3(input, Anexo3) {
$("#previewMyAnexo3").html('');
$("#previewMyAnexo3").html('
');
$("#anexo3_upload_form").ajaxForm({
dataType: 'json',
success: showResponseMyAnexo3
}).submit();
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#' + Anexo3)
.attr('src', e.target.result)
};
reader.readAsDataURL(input.files[0]);
$('#' + Anexo3).show();
$('#' + Anexo3).height(225).width(300);
}
}