function delay(callback, ms) {
var timer = 0;
return function() {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
callback.apply(context, args);
}, ms || 0);
};
}
function SetCookie(c_name,value,expiredays){
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
var url;
var url_actual;
var buscadorWeb = {};
var data = {};
var reportarPerfil = {};
var olvidoClave = {};
var enviarMailS = {};
var estado_oferta = '';
function test(){
$('#loading').show();
}
function link_landing(link){
$('html, body').animate({
scrollTop: $("#"+link).offset().top-50
}, 400);
}
//USUARIOS
//INICIAR SESIÓN
function iniciarSesion(){
$('#iniciar').submit(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: $(this).serialize(),
dataType: 'JSON',
beforeSend: function(response) {
},
success: function(response) {
if(response['error'] == 1){
swal.fire("Usuario Inexistente", "El usuario no existe!", "error");
} else if(response['error'] == 2){
swal.fire("Clave Incorrecta", "La contraseña ingresada no es correcta!", "error");
} else {
swal.fire({
title: 'Iniciando..',
text: 'Sólo tomará un segundo',
timer: 2000,
onOpen: function() {
swal.showLoading()
}
}).then(function(result) {
window.location.href = dominio+'panel';
})
}
}
});
});
}
function manejarUsuarios(){
$('#agregarUsuario').submit(function(e){
e.preventDefault();
console.log($(this).serialize());
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: $(this).serialize(),
dataType: 'JSON',
beforeSend: function(response) {
},
success: function(response) {
if(response['error'] == 1){
swal.fire("Upss!", "Debes completar todos los campos!", "warning");
} else if(response['error'] == 2){
swal.fire("Claves no conciden", "Debes volver a confirmar tu clave.", "error");
} else if(response['error'] == 3){
swal.fire("Email Ya Registrado", "Este email ya está registrado como usuario.", "error");
} else if(response['error'] == 5){
swal.fire("Políticas y Privacidad", "Debes aceptar nuestras políticas del sitio para poder registrarte.", "info");
} else {
swal.fire("Perfecto!", "Te has registrado correctamente.", "success").then(function(result) {
window.location.href = dominio;
});
}
}
});
});
$('#usuarioPerfilUpdate').submit(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: $(this).serialize(),
dataType: 'JSON',
beforeSend: function(response) {
},
success: function(response) {
if(response['error'] == 1){
swal.fire("Upss!", "Debes completar todos los campos!", "warning");
} else if(response['error'] == 2){
swal.fire("Email Ya Registrado", "Este email ya está registrado como usuario.", "error");
} else {
swal.fire("Perfecto!", "Datos actualizados correctamente.", "success").then(function(result) {
window.location.href = dominio+'mi-perfil';
});
}
}
});
});
}
//FIN USUARIOS
function checkUsuario(){
$('#usuario').keyup(delay(function(){
if( ($(this).val().length > 3)){
var usuario = $('#usuario').val();
var letters = /^[0-9a-zA-Z]+$/;
if(usuario.match(letters)) {
$.ajax({
type: 'POST',
url: 'requests/r-web.php',
dataType: 'JSON',
data: {
action: 'checkUsuario',
usuario: usuario
},
beforeSend: function(response) {
},
success: function(response) {
if(response['error'] == 0){
$('#textoRegistroUsuario').text("El nombre de usuario está libre!");
var text = document.getElementById("textoRegistroUsuario");
text.style.color = 'green';
checkRegUser = true;
} else {
$('#textoRegistroUsuario').text("El nombre de usuario ya existe!");
var text = document.getElementById("textoRegistroUsuario");
text.style.color = 'red';
checkRegUser = false;
}
}
})
} else {
$('#textoRegistroUsuario').text("El nombre de usuario no puede tener espacios y sólo se permiten letras y números!");
var text = document.getElementById("textoRegistroUsuario");
text.style.color = 'red';
checkRegUser = false;
}
} else {
$('#textoRegistroUsuario').text("El nombre de usuario no puede tener menos de 4 letras.");
var text = document.getElementById("textoRegistroUsuario");
text.style.color = 'red';
checkRegUser = false;
}
}, 450));
}
function checkPassword(){
$('#password').keyup(delay(function(){
if( ($(this).val().length > 7)) {
$('#textoRegistroPassword').text("Tu contraseña es buena!");
var text = document.getElementById("textoRegistroPassword");
text.style.color = 'green';
checkRegPass = true;
$('#textoRegistroPassword2').text("Debes confirmar tu contraseña.");
var text2 = document.getElementById("textoRegistroPassword2");
text2.style.color = 'red';
checkRegPass2 = false;
} else {
$('#textoRegistroPassword').text("La contraseña no puede tener menos de 8 caracteres.");
var text = document.getElementById("textoRegistroPassword");
text.style.color = 'red';
checkRegPass = false;
$('#textoRegistroPassword2').text("Debes confirmar tu contraseña.");
var text2 = document.getElementById("textoRegistroPassword2");
text2.style.color = 'red';
checkRegPass2 = false;
}
}, 450));
}
function checkPassword2(){
$('#password2').keyup(delay(function(){
var password = $('#password').val();
var password2 = $('#password2').val();
if(password == password2) {
$('#textoRegistroPassword2').text("Perfecto! Las contraseñas coinciden!");
var text2 = document.getElementById("textoRegistroPassword2");
text2.style.color = 'green';
checkRegPass2 = true;
} else {
$('#textoRegistroPassword2').text("Las contraseñas no coinciden!");
var text2 = document.getElementById("textoRegistroPassword2");
text2.style.color = 'red';
checkRegPass2 = false;
}
}, 450));
}
function verPasswordActual() {
var x = document.getElementById("passActual");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
function verPasswordNuevo() {
var x2 = document.getElementById("password");
if (x2.type === "password") {
x2.type = "text";
} else {
x2.type = "password";
}
}
function verPasswordNuevo2() {
var x3 = document.getElementById("password2");
if (x3.type === "password") {
x3.type = "text";
} else {
x3.type = "password";
}
}
function seleccionarSuscripcion(){
var val = $('#suscripcion').val();
if (val == '') {
$('#pagosContainer').hide();
$('#costosContainer').hide();
registroWeb['suscripcion'] = '';
} else if (val == 'gratis') {
$('#pagosContainer').hide();
$('#costosContainer').hide();
registroWeb['suscripcion'] = 'gratis';
} else {
$('#pagosContainer').show();
$('#costosContainer').show();
if (val == 'mensual') {
var x = document.getElementById("precio");
x.setAttribute("value", configSitio['precio_mensual']);
var x2 = document.getElementById("precio2");
x2.setAttribute("value", configSitio['precio_mensual']);
var x3 = document.getElementById("suscripcion2");
x3.setAttribute("value", val);
registroWeb['suscripcion'] = 'mensual';
}
if (val == 'trimestral') {
var x = document.getElementById("precio");
x.setAttribute("value", configSitio['precio_trimestral']);
var x2 = document.getElementById("precio2");
x2.setAttribute("value", configSitio['precio_trimestral']);
var x3 = document.getElementById("suscripcion2");
x3.setAttribute("value", val);
registroWeb['suscripcion'] = 'trimestral';
}
if (val == 'anual') {
var x = document.getElementById("precio");
x.setAttribute("value", configSitio['precio_anual']);
var x2 = document.getElementById("precio2");
x2.setAttribute("value", configSitio['precio_anual']);
var x3 = document.getElementById("suscripcion2");
x3.setAttribute("value", val);
registroWeb['suscripcion'] = 'anual';
}
}
}
function seleccionarFormaPago(){
var val = $('#forma_pago').val();
var sus = $('#suscripcion').val();
if (val == '') {
registroWeb['forma_pago'] = '';
$('#pago_mercadopago').hide();
$('#btn_actualizar_forma_pago').show();
}
if (val == 'pp') {
registroWeb['forma_pago'] = 'pp';
$('#pago_mercadopago').hide();
$('#btn_actualizar_forma_pago').hide();
}
if (val == 'mp') {
if (sus !== '' && sus !== 'gratis') {
registroWeb['forma_pago'] = 'mp';
$('#pago_mercadopago').show();
$('#btn_actualizar_forma_pago').hide();
}
}
if (val == 'abitab') {
if (sus !== '' && sus !== 'gratis') {
registroWeb['forma_pago'] = 'abitab';
$('#pago_mercadopago').hide();
$('#btn_actualizar_forma_pago').show();
}
}
if (val == 'brou') {
if (sus !== '' && sus !== 'gratis') {
registroWeb['forma_pago'] = 'brou';
$('#pago_mercadopago').hide();
$('#btn_actualizar_forma_pago').show();
}
}
}
function updatePrecioOferta(){
var tipo = $('#tipo').val();
if (tipo == 1) {
$('#foto3').hide();
$('#foto4').hide();
$('#foto5').hide();
$('#foto6').hide();
}
if (tipo == 2) {
$('#foto3').show();
$('#foto4').hide();
$('#foto5').hide();
$('#foto6').hide();
}
if (tipo == 3) {
$('#foto3').show();
$('#foto4').show();
$('#foto5').hide();
$('#foto6').hide();
}
if (tipo == 4) {
$('#foto3').show();
$('#foto4').show();
$('#foto5').show();
$('#foto6').show();
}
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: {
action: 'precioByOferta',
tipo: tipo
},
success: function(response) {
$('#precio_oferta').text('$'+response);
}
});
}
function updateCatRubro(el){
var val = $(el).val();
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: {
action: 'categoriaByRubros',
rub: val
},
success: function(response) {
$('#categoria').html(response);
cat = $('#categoria').val();
if (cat == 'nocat') {
$('#categoria').attr('disabled',true);
$('#categoria').niceSelect('update');
} else if (cat == '') {
$('#categoria').attr('disabled',true);
$('#categoria').niceSelect('update');
} else {
$('#categoria').attr('disabled',false);
$('#categoria').niceSelect('update');
$('#textoRegCategoria').text("Podrás agregar más categorias a tu Rubro desde tu perfil luego de registrarte!");
}
}
});
}
function updateCiudadBuscador(el){
var val = $(el).val();
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: {
action: 'ciudadByDepartamento',
departamento: val
},
success: function(response) {
$('#ciudad').html(response);
}
});
}
function updateCiudadBuscadorM(el){
var val = $(el).val();
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: {
action: 'ciudadByDepartamento',
departamento: val
},
success: function(response) {
$('#ciudadM').html(response);
}
});
}
function updateNombresBuscador(el){
var val = $(el).val();
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: {
action: 'nombresByTipos',
tipo: val
},
success: function(response) {
$('#nombre').html(response);
nombres = $('#nombre').val();
$('#nombre').niceSelect('update');
}
});
}
function updateRegPerfil(){
var val = $('#perfil').val();
if (val == '5') {
$('#rubroContainer').hide();
$('#categoriaContainer').hide();
$('#suscripcionContainer').hide();
registroWeb['rubro'] = '';
registroWeb['categoria'] = '';
registroWeb['suscripcion'] = '';
registroWeb['forma_pago'] = '';
} else {
$('#rubroContainer').show();
$('#categoriaContainer').show();
$('#suscripcionContainer').show();
}
}
//FIN REGISTRO
function verDatosOferta(url,id){
var action = url;
$('#escritorio-content').css("opacity","0.5");
$.ajax({
url: dominio+'requests/r-web.php',
data: {
action: action,
id: id
},
type: "post",
success: function(response) {
$('#escritorio-content').html(response);
window.history.pushState('escritorio', document.title, '/escritorio');
$('#escritorio-content').css("opacity","1");
if(url == 'usuario-ofertas-editar'){
$('html, body').animate({
scrollTop: $("#escritorioOfertas").offset().top-120
}, 1000);
manejarOfertas();
$('.dropdown-select').selectpicker();
}
updatePrecioOferta();
},
});
}
function verPestanaPerfil(url){
var action = url;
$('#escritorio-content').css("opacity","0.5");
$.ajax({
url: dominio+'requests/r-web.php',
data: {
action: action
},
type: "post",
success: function(response) {
$('#escritorio-content').html(response);
window.history.pushState('escritorio', document.title, '/escritorio');
$('#escritorio-content').css("opacity","1");
if(url == 'usuario-escritorio'){
$('html, body').animate({
scrollTop: $("#escritorioInicio").offset().top-120
}, 1000);
manejarPerfil();
}
if(url == 'usuario-ofertas-activas'){
$('html, body').animate({
scrollTop: $("#escritorioOfertas").offset().top-120
}, 1000);
manejarPerfil();
}
if(url == 'usuario-ofertas-inactivas'){
$('html, body').animate({
scrollTop: $("#escritorioOfertas").offset().top-120
}, 1000);
manejarPerfil();
}
if(url == 'usuario-ofertas-pendientes'){
$('html, body').animate({
scrollTop: $("#escritorioOfertas").offset().top-120
}, 1000);
manejarPerfil();
}
if(url == 'usuario-ofertas-crear'){
$('html, body').animate({
scrollTop: $("#escritorioOfertas").offset().top-120
}, 1000);
manejarOfertas();
$('.dropdown-select').selectpicker();
updatePrecioOferta();
}
if(url == 'usuario-password'){
$('html, body').animate({
scrollTop: $("#escritorioPassword").offset().top-120
}, 1000);
checkPassword();
checkPassword2();
manejarPerfil();
}
if(url == 'usuario-transacciones'){
$('html, body').animate({
scrollTop: $("#escritorioTransacciones").offset().top-120
}, 1000);
manejarPerfil();
}
if(url == 'usuario-perfil'){
$('html, body').animate({
scrollTop: $("#escritorioPerfil").offset().top-120
}, 1000);
manejarPerfil();
}
},
});
}
//REPORTES
function denunciarPerfil(uid,sid){
if (uid == 'noReg' || uid == 0) {
var r = swal.fire({
title: 'No estás Loggeado!',
text: "Debes Iniciar Sesión o Registrarte para poder denunciar este servicio.",
icon: 'warning',
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Ok, Iniciar Sesión!'
}).then(function(result) {
if (result.value) {
esconderSnopt();
$('.show-reg-form').click();
}
});
} else {
var r = swal.fire({
title: 'Denunciar Perfil',
icon: 'info',
html:
'Estás por denunciar este perfil de servicio.
'+
'Escribe el motivo por el cual estás denunciando.
' +
'Lo revisaremos y evaluaremos lo antes posible.',
input: 'textarea',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Enviar Denuncia'
}).then(function(result) {
if (result.value || result.value == '') {
reportarPerfil['action'] = 'denunciarPerfil';
reportarPerfil['denuncia'] = 'no';
if(result.value != ''){
reportarPerfil['denuncia'] = result.value;
}
reportarPerfil['uid'] = uid;
reportarPerfil['sid'] = sid;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: reportarPerfil,
dataType: 'JSON',
beforeSend: function(response) {
esconderSnopt();
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
if (response['error'] == 1){
swal.fire("Upss!", "Tu denuncia no puede estar vacía, escribe algo!", "warning").then(function(result) {
denunciarPerfil(uid,sid);
})
} else if (response['error'] == 2){
swal.fire("Upss!", "Ya denunciaste este servicio!, debes esperar a que se evalúe la denuncia actual para volver a denunciar.", "error");
} else {
swal.fire("Perfecto!", "Tu denuncia ha sido enviada correctamente!", "success");
}
}
});
}
})
}
}
function denunciarCalificacion(uid,sid){
var r = swal.fire({
title: 'Denunciar Calificación',
icon: 'info',
html:
'Estás por denunciar esta calificación a tu servicio.
'+
'Escribe el motivo por el cual estás denunciando.
' +
'Lo revisaremos y evaluaremos lo antes posible.',
input: 'textarea',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Enviar Denuncia'
}).then(function(result) {
if (result.value || result.value == '') {
reportarCalificacion['action'] = 'denunciarCalificacion';
reportarCalificacion['denuncia'] = 'no';
if(result.value != ''){
reportarCalificacion['denuncia'] = result.value;
}
reportarCalificacion['uid'] = uid;
reportarCalificacion['sid'] = sid;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: reportarCalificacion,
dataType: 'JSON',
beforeSend: function(response) {
esconderSnopt();
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
if (response['error'] == 1){
swal.fire("Upss!", "Tu denuncia no puede estar vacía, escribe algo!", "warning").then(function(result) {
denunciarCalificacion(uid,sid);
})
} else if (response['error'] == 2){
swal.fire("Upss!", "Ya denunciaste esta calificación!, debes esperar a que se evalúe la denuncia actual para volver a denunciar.", "error");
} else {
swal.fire("Perfecto!", "Tu denuncia ha sido enviada correctamente!", "success");
}
}
});
}
})
}
function denunciarCalificacionR(uid,sid){
var r = swal.fire({
title: 'Denunciar Respuesta',
icon: 'info',
html:
'Estás por denunciar esta respuesta a tu calificación.
'+
'Escribe el motivo por el cual estás denunciando.
' +
'Lo revisaremos y evaluaremos lo antes posible.',
input: 'textarea',
inputAttributes: {
autocapitalize: 'off'
},
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Enviar Denuncia'
}).then(function(result) {
if (result.value || result.value == '') {
reportarCalificacionR['action'] = 'denunciarCalificacionR';
reportarCalificacionR['denuncia'] = 'no';
if(result.value != ''){
reportarCalificacionR['denuncia'] = result.value;
}
reportarCalificacionR['uid'] = uid;
reportarCalificacionR['sid'] = sid;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: reportarCalificacionR,
dataType: 'JSON',
beforeSend: function(response) {
esconderSnopt();
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
if (response['error'] == 1){
swal.fire("Upss!", "Tu denuncia no puede estar vacía, escribe algo!", "warning").then(function(result) {
denunciarCalificacionR(uid,sid);
})
} else if (response['error'] == 2){
swal.fire("Upss!", "Ya denunciaste esta respuesta!, debes esperar a que se evalúe la denuncia actual para volver a denunciar.", "error");
} else {
swal.fire("Perfecto!", "Tu denuncia ha sido enviada correctamente!", "success");
}
}
});
}
})
}
//FIN REPORTES
function recuperarClave(){
olvidoClave['action'] = 'recuperarClave';
olvidoClave['email'] = document.getElementById('email_clave').value;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: olvidoClave,
dataType: 'JSON',
beforeSend: function(response) {
},
success: function(response) {
if (response['error'] == 1){
//swal.fire("Upss!", "No existe ninguna cuenta con ese Email!", "warning");
alert('No existe ninguna cuenta con ese Email!');
} else {
swal.fire("Perfecto!", "Tu clave ha sido enviada a tu correo!", "success");
}
}
});
}
function enviarMailServicio(){
enviarMailS['action'] = 'enviarMailServicio';
//datos usuario
enviarMailS['nombre'] = document.getElementById('nombre2').value;
enviarMailS['email'] = document.getElementById('email2').value;
enviarMailS['tel'] = document.getElementById('tel').value;
enviarMailS['mensaje'] = document.getElementById('mensaje').value;
//datos servicio
enviarMailS['email_servicio'] = document.getElementById('email_servicio').value;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: enviarMailS,
dataType: 'JSON',
beforeSend: function(response) {
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
if (response['error'] == 1){
swal.fire("Upss!", "Todos los campos son obligatorios, debes completarlos!", "warning");
} else {
swal.fire("Enviado!", "Tu consulta ha sido enviada al servicio correctamente!", "success").then(function(result) {
window.location.reload();
});
}
}
});
}
function enviarMensajeSitio(){
data['action'] = 'enviarMensajeSitio';
data['nombre'] = document.getElementById('nombre').value;
data['email'] = document.getElementById('email').value;
data['telefono'] = document.getElementById('telefono').value;
data['asunto'] = document.getElementById('asunto').value;
data['consulta'] = document.getElementById('consulta').value;
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: data,
dataType: 'JSON',
beforeSend: function(response) {
$('#textoEnviar').text('Enviando...');
},
success: function(response) {
//$(".loader-wrap").hide();
if(response['error'] == 1){
//swal.fire("Upss!", "Todos los campos son obligatorios!", "warning");
alert('Todos los campos son obligatorios!');
$('#textoEnviar').text('Enviar');
} else {
/*
swal.fire("Excelente!", "Mensaje recibido correctamente, te responderemos a la brevedad!.", "success").then(function(result) {
window.location.href = dominio+"inicio";
}) */
alert('Mensaje recibido correctamente, te responderemos a la brevedad!');
window.location.href = dominio;
}
}
});
}
//PAGOS
function cancelarPago(id){
var r = swal.fire({
title: 'Cancelar Pago',
text: "¿Seguro que deseas cancelar este pago?",
icon: 'warning',
showCancelButton: true,
cancelButtonText: 'No cancelar',
confirmButtonText: 'Si, voy a cancelar!'
}).then(function(result) {
if (result.value) {
pagoWeb['action'] = 'cancelarPago';
pagoWeb['id'] = id;
$.ajax({
type: "POST",
url: dominio+'requests/r-web.php',
data: pagoWeb,
dataType: 'JSON',
beforeSend: function(response) {
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
swal.fire("Cancelado!", "Tu pago ha sido cancelado correctamente!", "success").then(function(result) {
if (usuario.tipo == 1) {
window.location.href = dominio+"transacciones";
} else {
verPestanaPerfil('usuario-transacciones');
}
});
}
});
}
});
}
function ingresarPagos(){
pagoWeb['uid'] = document.getElementById('uid').value;
pagoWeb['medio'] = document.getElementById('medio').value;
pagoWeb['importe'] = document.getElementById('importe').value;
pagoWeb['tiempo'] = document.getElementById('tiempo').value;
pagoWeb['idtrans'] = document.getElementById('idtrans').value;
pagoWeb['aprobado'] = document.getElementById('aprobado').value;
pagoWeb['suscripcion'] = document.getElementById('suscripcionTiempo').value;
pagoWeb['vencimientoActual'] = document.getElementById('vencimientoActual').value;
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: pagoWeb,
dataType: 'JSON',
beforeSend: function(response) {
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
swal.fire("Perfecto!", "A continuación verás la info para poder realizar tu pago.", "success").then(function(result) {
$("#info_pago").show();
$("#btn_generar_pago").hide();
$("#texto_pago").hide();
});
}
});
}
function manejarPagos(){
var r = swal.fire({
title: 'Extender Suscripción',
text: "Al apretar en si, serás dirigido para extender tu suscripción actual.",
icon: 'warning',
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Si, Extender!'
}).then(function(result) {
if (result.value) {
if (medio == 'mp') {
pagoWeb['importe'] = document.getElementById('importe').value;
pagoWeb['tiempo'] = document.getElementById('tiempo').value;
var x = document.getElementById("precio2");
x.setAttribute("value", pagoWeb['importe']);
var x2 = document.getElementById("suscripcion2");
x2.setAttribute("value", pagoWeb['tiempo']);
$("#btn_pagar_mercadopago").click();
} else {
var x = document.getElementById("medio");
x.setAttribute("value", medio);
$("#btn_pagar_manuales").click();
}
}
});
}
/*
function manejarPagos(medio){
var r = swal.fire({
title: 'Pagar Suscripción',
text: "Al apretar en si, serás dirigido al medio de pago que elegiste para realizarlo.",
icon: 'warning',
showCancelButton: true,
cancelButtonText: 'Cancelar',
confirmButtonText: 'Si, Pagar!'
}).then(function(result) {
if (result.value) {
pagoWeb['uid'] = document.getElementById('uid').value;
pagoWeb['medio'] = medio;
pagoWeb['importe'] = document.getElementById('importe').value;
pagoWeb['idtrans'] = document.getElementById('idtrans').value;
pagoWeb['tiempo'] = document.getElementById('tiempo').value;
pagoWeb['aprobado'] = document.getElementById('aprobado').value;
pagoWeb['suscripcion'] = document.getElementById('suscripcionTiempo').value;
pagoWeb['vencimientoActual'] = document.getElementById('vencimientoActual').value;
$.ajax({
type: "POST",
url: 'requests/r-web.php',
data: pagoWeb,
dataType: 'JSON',
beforeSend: function(response) {
$(".loader-wrap").show();
},
success: function(response) {
$(".loader-wrap").hide();
swal.fire("Perfecto!", "Tu pago ha sido recibido correctamente!", "success").then(function(result) {
verPestanaPerfil('usuario-suscripcion');
});
}
});
}
});
}
*/
//FIN PAGOS
//LISTAR SERVICIOS MAPA
function loadListadoMapa(){
function updateMap(){
function locationData(locationURL, locationImg, locationTitle, locationAddress, locationIcon, locationStarRating, locationRevievsCounter, locationStatus, favorito) {
return ('