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 ('
'+ locationStatus +'
( ' + locationRevievsCounter + ' calificaciones )
'+ locationIcon +'

' + locationTitle + '

' + locationAddress + '
') } // Map Infoboxes ------------------ var locations = []; var destacado = '
Destacado!
'; var favorito = ''; var icono = ''; for(let i = 0; i < serviciosListar.length; i++){ if(serviciosListar[i].destacado == '') { destacado = ''; } if(serviciosListar[i].es_fav == 'no_user') { favorito = ''; } else if(serviciosListar[i].es_fav == 'no') { favorito = ''; } else { favorito = ''; } icono = '
' var servicio = [locationData(serviciosListar[i].link_url, serviciosListar[i].foto_portada, serviciosListar[i].nombre.toUpperCase()+' '+serviciosListar[i].apellido.toUpperCase(), serviciosListar[i].ciudad+', '+serviciosListar[i].pais, icono, serviciosListar[i].prom_estrellas, serviciosListar[i].total_calif, destacado, favorito), serviciosListar[i].lat, serviciosListar[i].lng, i , serviciosListar[i].foto_perfil]; locations.push(servicio); } // Map Infoboxes end ------------------ var zoom; if (usuario.nombre) { zoom = 12; } else { zoom = 7; } var map = new google.maps.Map(document.getElementById('map-main'), { zoom: zoom, scrollwheel: false, center: new google.maps.LatLng(usuario.lat, usuario.lng), mapTypeId: google.maps.MapTypeId.ROADMAP, zoomControl: false, mapTypeControl: false, scaleControl: false, panControl: false, fullscreenControl: true, navigationControl: false, streetViewControl: false, animation: google.maps.Animation.BOUNCE, //gestureHandling: 'cooperative', styles: [{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [{ "color": "#444444" }] }] }); //restringir solamente a UY, sin esto muestra todo el mudno autocomplete.setComponentRestrictions( {'country': ['uy']}); var boxText = document.createElement("div"); boxText.className = 'map-box' var currentInfobox; var boxOptions = { content: boxText, disableAutoPan: true, alignBottom: true, maxWidth: 0, pixelOffset: new google.maps.Size(-150, -55), zIndex: null, boxStyle: { width: "300px" }, closeBoxMargin: "0", closeBoxURL: "", infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: "floatPane", enableEventPropagation: false, }; var markerCluster, overlay, i; var allMarkers = []; var clusterStyles = [ { textColor: 'white', url: '', height: 50, width: 50 } ]; var ib = new InfoBox(); google.maps.event.addListener(ib, "domready", function () { cardRaining(); }); var markerImg; var markerCount; for (i = 0; i < locations.length; i++) { var labels = '123456789'; markerImg = locations[i][4]; markerCount = locations[i][3] + 1; var overlaypositions = new google.maps.LatLng(locations[i][1], locations[i][2]), overlay = new CustomMarker( overlaypositions, map,{ marker_id: i}, markerImg , markerCount ); allMarkers.push(overlay); google.maps.event.addDomListener(overlay, 'click', (function(overlay, i) { return function() { ib.setOptions(boxOptions); boxText.innerHTML = locations[i][0]; ib.close(); ib.open(map, overlay); currentInfobox = locations[i][3]; var latLng = new google.maps.LatLng(locations[i][1], locations[i][2]); map.panTo(latLng); map.panBy(0, -110); google.maps.event.addListener(ib,'domready',function(){ $('.infoBox-close').click(function(e) { e.preventDefault(); ib.close(); $('.map-marker-container').removeClass('clicked infoBox-opened'); }); }); } })(overlay, i)); } var options2 = { imagePath: '', styles: clusterStyles, minClusterSize: 2 }; markerCluster = new MarkerClusterer(map, allMarkers, options2); google.maps.event.addDomListener(window, "resize", function () { var center = map.getCenter(); google.maps.event.trigger(map, "resize"); map.setCenter(center); }); $('.map-item').on("click", function(e){ e.preventDefault(); map.setZoom(15); var index = currentInfobox; var marker_index = parseInt($(this).attr('href').split('#')[1], 10); google.maps.event.trigger(allMarkers[marker_index-1], "click"); if ($(window).width() > 1064) { if ($(".map-container").hasClass("fw-map")) { $('html, body').animate({ scrollTop: $(".map-container").offset().top + "-110px" }, 1000) return false; } } }); $('.nextmap-nav').on("click", function(e){ e.preventDefault(); map.setZoom(15); var index = currentInfobox; if (index + 1 < allMarkers.length) { google.maps.event.trigger(allMarkers[index+ 1], 'click'); } else { google.maps.event.trigger(allMarkers[0], 'click'); } }); $('.prevmap-nav').on("click", function(e){ e.preventDefault(); map.setZoom(15); if (typeof (currentInfobox) == "undefined") { google.maps.event.trigger(allMarkers[allMarkers.length - 1], 'click'); } else { var index = currentInfobox; if (index - 1 < 0) { google.maps.event.trigger(allMarkers[allMarkers.length - 1], 'click'); } else { google.maps.event.trigger(allMarkers[index - 1], 'click'); } } }); // Scroll enabling button var scrollEnabling = $('.scrollContorl'); $(scrollEnabling).click(function(e){ e.preventDefault(); $(this).toggleClass("enabledsroll"); if ( $(this).is(".enabledsroll") ) { map.setOptions({'scrollwheel': true}); } else { map.setOptions({'scrollwheel': false}); } }); var zoomControlDiv = document.createElement('div'); var zoomControl = new ZoomControl(zoomControlDiv, map); function ZoomControl(controlDiv, map) { zoomControlDiv.index = 1; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(zoomControlDiv); controlDiv.style.padding = '5px'; var controlWrapper = document.createElement('div'); controlDiv.appendChild(controlWrapper); var zoomInButton = document.createElement('div'); zoomInButton.className = "mapzoom-in"; controlWrapper.appendChild(zoomInButton); var zoomOutButton = document.createElement('div'); zoomOutButton.className = "mapzoom-out"; controlWrapper.appendChild(zoomOutButton); google.maps.event.addDomListener(zoomInButton, 'click', function () { map.setZoom(map.getZoom() + 1); }); google.maps.event.addDomListener(zoomOutButton, 'click', function () { map.setZoom(map.getZoom() - 1); }); } // Geo Location Button $(".geoLocation, #geoLocation, .input-with-icon.location a").on("click", function (e) { e.preventDefault(); geolocate(); }); function geolocate() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); map.setCenter(pos); map.setZoom(12); buscadorWeb['lat'] = position.coords.latitude; buscadorWeb['lng'] = position.coords.longitude; /* var avrtimg = $(".avatar-img").attr("data-srcav"); var markerIcon3 = { url: avrtimg, } */ var marker = new google.maps.Marker({ position: pos, map: map, //icon: markerIcon3, title: 'Tu Ubicación' }); marker.setMap(map); /* var myoverlay = new google.maps.OverlayView(); myoverlay.draw = function () { // add an id to the layer that includes all the markers so you can use it in CSS this.getPanes().markerLayer.id='markerLayer'; }; myoverlay.setMap(map); */ /* //OBTENER GEO UBICACIÓN EN BUSCADOR var latLng = pos; console.log(latLng); geocoder = new google.maps.Geocoder(); geocoder.geocode( {'latLng': latLng}, function(results) { if(results[0]) { console.log(results[0]['address_components'][1].short_name); geoCiudad = results[0]['address_components'][1].short_name; var x = document.getElementById("autocompleteid3"); x.setAttribute("value", geoCiudad); } else { console.log("Sin Resultados"); } }); */ }); } } } // Custom Map Marker // ----------------------------------------------- // function CustomMarker(latlng,map,args,markerImg,markerCount) { this.latlng = latlng; this.args = args; this.markerImg = markerImg; this.markerCount = markerCount; this.setMap(map); } CustomMarker.prototype = new google.maps.OverlayView(); CustomMarker.prototype.draw = function() { var self = this; var div = this.div; if (!div) { div = this.div = document.createElement('div'); div.className = 'map-marker-container'; div.innerHTML = '
'+ ''+self.markerCount+''+ '
'+ '
'+ '
'+ '
' // Clicked marker highlight google.maps.event.addDomListener(div, "click", function(event) { $('.map-marker-container').removeClass('clicked infoBox-opened'); google.maps.event.trigger(self, "click"); $(this).addClass('clicked infoBox-opened'); }); if (typeof(self.args.marker_id) !== 'undefined') { div.dataset.marker_id = self.args.marker_id; } var panes = this.getPanes(); panes.overlayImage.appendChild(div); } var point = this.getProjection().fromLatLngToDivPixel(this.latlng); if (point) { div.style.left = (point.x) + 'px'; div.style.top = (point.y) + 'px'; } }; CustomMarker.prototype.remove = function() { if (this.div) { this.div.parentNode.removeChild(this.div); this.div = null; $(this).removeClass('clicked'); } }; CustomMarker.prototype.getPosition = function() { return this.latlng; }; // -------------- Custom Map Marker / End -------------- // var head = document.getElementsByTagName( 'head' )[0]; // Save the original method var insertBefore = head.insertBefore; // Replace it! head.insertBefore = function( newElement, referenceElement ) { if ( newElement.href && newElement.href.indexOf( 'https://fonts.googleapis.com/css?family=Roboto' ) === 0 ) { return; } insertBefore.call( head, newElement, referenceElement ); }; //original iniciado updateMap(); /* var map = document.getElementById('map-main'); if (typeof (map) != 'undefined' && map != null) { updateMap(); } */ } //FIN LISTAR SERVICIOS MAPA function eliminarFotoOferta(oid,foto,n){ var val = document.getElementById('agregarFotoPerfil'+n).value; if (val == '') { swal.fire("No hay foto!", "Debes cargar una foto primero para poder eliminarla", "warning") } else { var r = swal.fire({ title: 'Eliminar Foto', text: "¿Seguro que deseas eliminar esta foto?", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Si, Eliminar!' }).then(function(result) { if (result.value) { data['action'] = 'eliminarFotoOferta'; data['oid'] = oid; data['foto'] = foto; $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { swal.fire("Perfecto!", "Foto eliminada correctamente de la oferta!", "success").then(function(result) { $('.profile-pic'+n).attr('src', ''); $('#agregarFotoPerfil'+n).val(''); $('#btn_elminarFoto'+n).hide(); }); } }); } }); } } //FAVORITOS function eliminarFavorito(sid,uid){ var r = swal.fire({ title: 'Eliminar Favorito', text: "¿Seguro que deseas eliminar este servicio de tus favoritos?", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Si, Eliminar!' }).then(function(result) { if (result.value) { favWeb['action'] = 'eliminarFavorito'; favWeb['uid'] = uid; favWeb['sid'] = sid; $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: favWeb, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); swal.fire("Perfecto!", "Servicio eliminado correctamente de tus favoritos!", "success").then(function(result) { if (url == 'usuario-favoritos') { window.location.href = dominio+"escritorio-favoritos"; } else { window.location.reload(); } }); } }); } }); } function agregarFavorito(sid,uid){ if (uid == 'noReg' || uid == 0) { var r = swal.fire({ title: 'No estás Loggeado!', text: "Debes Iniciar Sesión o Registrarte para poder agregar el servicio a tus favoritos.", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Ok, Iniciar Sesión!' }).then(function(result) { if (result.value) { $('.show-reg-form').click(); } }); } else { var r = swal.fire({ title: 'Agregar Favorito', text: "¿Seguro que deseas agregar este servicio a tus favoritos?", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Si, Agregar!' }).then(function(result) { if (result.value) { favWeb['action'] = 'agregarFavorito'; favWeb['uid'] = uid; favWeb['sid'] = sid; $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: favWeb, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); swal.fire("Perfecto!", "Servicio agregado correctamente a tus favoritos!", "success").then(function(result) { if (url == 'usuario-favoritos') { window.location.href = dominio+"escritorio-favoritos"; } else { window.location.reload(); } }); } }); } }); } } //FIN FAVORITOS //CALIFICACIONES function calificarServicio(){ $('#calificarServicio').submit(function(e){ e.preventDefault(); calificarWeb['action'] = 'calificarServicio'; calificarWeb['uid'] = document.getElementById('uid').value; calificarWeb['sid'] = document.getElementById('sid').value; calificarWeb['comentario'] = document.getElementById('comentarioCalificacion').value; calificarWeb['puntaje_global'] = document.getElementById('puntaje_global').value; calificarWeb['puntaje_respuesta'] = document.getElementById('puntaje_respuesta').value; calificarWeb['puntaje_calidad'] = document.getElementById('puntaje_calidad').value; calificarWeb['puntaje_precio'] = document.getElementById('puntaje_precio').value; calificarWeb['puntaje_servicio'] = document.getElementById('puntaje_servicio').value; $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: calificarWeb, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); if(response['error'] == 1){ swal.fire("Upss!", "Debes hacer un comentario para poder calificar!", "warning"); } else if(response['error'] == 2){ swal.fire("Ya calificaste este Servicio!", "No puedes volver a calificar un servicio que ya calificaste.", "error"); } else { swal.fire("Excelente!", "Has calificado correctamente el servicio.", "success").then(function(result) { window.location.reload(); }) } } }); }); } //FIN CALIFICACIONES function updatePerfilTipo(){ var val = $('#perfiltipo').val(); if (usuario.tipo == 5) { if (val == '5' || val == '') { $('#rubroContainer').hide(); } else { $('#rubroContainer').show(); } } else { $('#rubroContainer').hide(); } } function eliminarOferta(id) { var r = swal.fire({ title: 'ELIMINAR OFERTA', icon: 'warning', html: 'Estás a punto de eliminar tu oferta.
' + 'Luego de eliminada ya no se puede recuperar!', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Eliminar Oferta' }).then(function(result) { if (result.value) { data['action'] = 'eliminarOferta'; data['id'] = id; $.ajax({ type: "POST", url: 'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { swal.fire("Excelente!", "Oferta eliminada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-ofertas-inactivas"; }) } }); } }) } function activarOferta(id) { var r = swal.fire({ title: 'ACTIVAR OFERTA', icon: 'warning', html: 'Estás a punto de activar tu oferta.
' + 'Luego de activada debes abonar el plan y enviarnos comprobante de pago para que quede habilitada en la plataforma.', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Activar Oferta' }).then(function(result) { if (result.value) { data['action'] = 'activarOferta'; data['id'] = id; $.ajax({ type: "POST", url: 'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { swal.fire("Excelente!", "Oferta activada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-ofertas-pendientes"; }) } }); } }) } function cancelarOferta(id) { var r = swal.fire({ title: 'CANCELAR OFERTA', icon: 'warning', html: 'Estás a punto de cancelar tu oferta.
' + 'Luego de cancelada puedes volver a solicitar su activación.', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Cancelar Oferta' }).then(function(result) { if (result.value) { data['action'] = 'cancelarOferta'; data['id'] = id; $.ajax({ type: "POST", url: 'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { swal.fire("Excelente!", "Oferta cancelada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-ofertas-inactivas"; }) } }); } }) } function manejarOfertas(){ $('#updateOferta').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: '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 obligatorios marcados con el * rojo!", "warning"); } else { swal.fire("Excelente!", "Oferta actualizada correctamente.", "success").then(function(result) { if (estado_oferta == 'activa') { window.location.href = dominio+"escritorio-ofertas-activas"; } else if (estado_oferta == 'inactiva') { window.location.href = dominio+"escritorio-ofertas-inactivas"; } else { window.location.href = dominio+"escritorio-ofertas-pendientes"; } }) } } }); }); $('#crearOferta').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: '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 obligatorios marcados con el * rojo!", "warning"); } else { swal.fire("Excelente!", "Oferta creada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-ofertas-pendientes"; }) } } }); }); $(".upload-button").on('click', function() { $("#uploadContent").click(); }); $(".upload-button2").on('click', function() { $("#uploadContent2").click(); }); $(".upload-button3").on('click', function() { $("#uploadContent3").click(); }); $(".upload-button4").on('click', function() { $("#uploadContent4").click(); }); $(".upload-button5").on('click', function() { $("#uploadContent5").click(); }); $(".upload-button6").on('click', function() { $("#uploadContent6").click(); }); } function manejarPerfil(){ $('#updatePerfilInfo').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: '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 obligatorios marcados con el * rojo!", "warning"); } else if(response['error'] == 2){ swal.fire("Upss!", "Tu Nº Whatsapp no es válido! Debe tener 9 números y empezar con 0.", "warning"); } else { swal.fire("Excelente!", "Información del perfil actualizada correctamente.", "success").then(function(result) { verPestanaPerfil('usuario-escritorio'); }) } } }); }); $('#updatePerfilEmail').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: 'requests/r-web.php', data: $(this).serialize(), dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { if(response['error'] == 1){ swal.fire("Upss!", "Tu Email no puede ser vacío!", "warning"); } else { swal.fire("Excelente!", "Información del perfil actualizada correctamente.", "success").then(function(result) { window.location.href = dominio+"salir"; }) } } }); }); $('#updatePerfilClave').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: 'requests/r-web.php', data: $(this).serialize(), dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); if(response['error'] == 1){ swal.fire("Upss!", "Debes completar todos los campos!", "warning"); } else if(response['error'] == 2){ swal.fire("Upss!", "Tu clave actual no es correcta. Prueba denuevo!", "warning"); } else if(response['error'] == 3){ swal.fire("Upss!", "Tu nueva clave no coincide con la confirmación. Prueba denuevo!", "warning"); } else { swal.fire("Excelente!", "Información del perfil actualizada correctamente.", "success").then(function(result) { verPestanaPerfil('usuario-escritorio'); }) } } }); }); $('#updatePerfilFotos').submit(function(e){ e.preventDefault(); $.ajax({ type: "POST", url: 'requests/r-web.php', data: $(this).serialize(), dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { swal.fire("Excelente!", "Información del perfil actualizada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-perfil"; }) } }); }); $('#updatePerfilSuscripcion').submit(function(e){ e.preventDefault(); var r = swal.fire({ title: 'Actualizar Suscripción', text: "Al apretar en si, serás dirigido para extender tu suscripción actual.", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Si, Actualizar!' }).then(function(result) { if (result.value) { pagoWeb['action'] = 'updatePerfilSuscripcion'; pagoWeb['usuario'] = document.getElementById('usuario').value; pagoWeb['forma_pago'] = document.getElementById('forma_pago').value; pagoWeb['uid'] = document.getElementById('uid').value; pagoWeb['importe'] = document.getElementById('precio').value; pagoWeb['idtrans'] = document.getElementById('idtrans').value; pagoWeb['suscripcion'] = document.getElementById('suscripcion').value; pagoWeb['aprobado'] = document.getElementById('aprobado').value; pagoWeb['vencimientoActual'] = document.getElementById('vencimientoActual').value; var x = document.getElementById("medio"); x.setAttribute("value", pagoWeb['forma_pago']); var x2 = document.getElementById("importe"); x2.setAttribute("value", pagoWeb['importe']); var x3 = document.getElementById("tiempo"); x3.setAttribute("value", pagoWeb['suscripcion']); var x4 = document.getElementById("suscripcionTiempo"); x4.setAttribute("value", pagoWeb['suscripcion']); $.ajax({ type: "POST", url: 'requests/r-web.php', data: pagoWeb, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { if(response['error'] == 1){ $(".loader-wrap").hide(); swal.fire("Upss!", "Debes elegir una forma de Suscripción!", "warning"); } else if(response['error'] == 2){ $(".loader-wrap").hide(); swal.fire("Upss!", "Debes elegir una forma de Pago!", "warning"); } else if(response['error'] == 3){ $(".loader-wrap").hide(); swal.fire("Upss!", "No puedes pasarte a suscripción gratis hasta finalizar tu suscripción paga actual.", "warning"); }else { if (pagoWeb['suscripcion'] == 'gratis') { $(".loader-wrap").hide(); swal.fire("Perfecto!", "Información del perfil actualizada correctamente.", "success").then(function(result) { window.location.href = dominio+"escritorio-suscripcion"; }); } else { $("#btn_pagar_manuales").click(); } /* swal.fire("Perfecto!", "Una vez realizado el pago debes enviar tu comprobante a pagos@infoservicios.uy para activar tu suscripción.", "success").then(function(result) { window.location.href = dominio+"escritorio-suscripcion"; }); */ } } }); } }); }); //EDITAR FOTO PORTADA $(".upload-button").on('click', function() { $("#uploadContent").click(); }); //EDITAR FOTO PERFIL $(".upload-button2").on('click', function() { $("#uploadContent2").click(); }); } function updateServicioClicContacto(sid){ data['action'] = 'updateServicioClicContacto'; data['sid'] = sid; $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { }, success: function(response) { } }); } function updateMapaPerfil(){ $(".map-container").hide(); } function esconderSnopt(){ $(".show-more-snopt").click(); } function responderCalificacion(uid,sid,cid){ var r = swal.fire({ title: 'RESPONDER', icon: 'info', html: 'Escribe tu respuesta a esta calificación.
' + 'Luego de enviada ya no se puede modificar!', input: 'textarea', inputAttributes: { autocapitalize: 'off' }, showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Enviar Respuesta' }).then(function(result) { if (result.value || result.value == '') { data['action'] = 'responderCalificacion'; data['respuesta'] = 'no'; if(result.value != ''){ data['respuesta'] = result.value; } data['uid'] = uid; data['cid'] = cid; data['sid'] = sid; $.ajax({ type: "POST", url: 'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); if(response['error'] == 1){ swal.fire("Upss!", "Tu respuesta no puede ser vacía, escribe algo!", "warning"); } else { swal.fire("Perfecto!", "Tu respuesta ha sido enviada correctamente!", "success").then(function(result) { verPestanaPerfil('usuario-calificaciones-recibidas'); }); } } }); } }) } function eliminarCuenta(id,usuario){ var r = swal.fire({ title: 'ELIMINAR CUENTA', icon: 'warning', html: 'Estás a punto de eliminar tu cuenta.
' + 'Luego de eliminada ya no se puede recuperar!', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Eliminar Cuenta' }).then(function(result) { if (result.value) { data['action'] = 'eliminarCuenta'; data['id'] = id; data['usuario'] = usuario; $.ajax({ type: "POST", url: 'requests/r-web.php', data: data, dataType: 'JSON', beforeSend: function(response) { $(".loader-wrap").show(); }, success: function(response) { $(".loader-wrap").hide(); swal.fire("Cuenta Eliminada!", "Esperamos volver a verte pronto, puedes volver a registrarte cuando quieras!", "success").then(function(result) { window.location.href = dominio; }); } }); } }) } function testing(){ $(".preloader").show(); } function borrarCatPerfil(id){ var r = swal.fire({ title: 'CATEGORÍAS', text: "¿Seguro quieres eliminar la categoría?", icon: 'warning', showCancelButton: true, cancelButtonText: 'Cancelar', confirmButtonText: 'Si, Eliminar!' }).then(function(result) { if (result.value) { $.ajax({ url: 'requests/r-web.php', data: { action: 'borrarCatPerfil', cat: id, usuario: usuario.usuario }, type: "post", dataType: "json", success: function(response) { swal.fire("Excelente!", "La categoría ha sido eliminada correctamente.", "success").then(function(result) { verPestanaPerfil('usuario-rubro'); }) }, }); } }); } //BUSCAR EN WEB function scrollLoadWeb() { var limit = 20; var start = 0; var action2 = 'inactive'; function load_country_data(limit, start){ $.ajax({ url: dominio+'requests/r-web.php', method:"POST", data:{ action: 'loadMore', limit:limit, start:start }, cache:false, success:function(data){ $('#load_data').append(data); if(data == ''){ $('#load_data_message').html("No Data Found"); action2 = 'active'; } else { $('#load_data_message').html("Please Wait...."); action2 = "inactive"; } } }); } if(action2 == 'inactive'){ action2 = 'active'; load_country_data(limit, start); } $(window).scroll(function(){ if($(window).scrollTop() + $(window).height() > $("#load_data").height() && action2 == 'inactive'){ action2 = 'active'; start = start + limit; setTimeout(function(){ load_country_data(limit, start); }, 1000); } }); } function isotope() { jQuery('.isotope_container').each(function(index) { var $container = jQuery(this); var layoutMode = ($container.hasClass('masonry-layout')) ? 'masonry' : 'fitRows'; $container.isotope({ percentPosition: true, layoutMode: layoutMode, masonry: {} }); var $filters = jQuery(this).attr('data-filters') ? jQuery(jQuery(this).attr('data-filters')) : $container.prev().find('.filters'); // bind filter click if ($filters.length) { $filters.on( 'click', 'a', function( e ) { e.preventDefault(); var filterValue = jQuery( this ).attr('data-filter'); $container.isotope({ filter: filterValue }); jQuery(this).siblings().removeClass('selected active'); jQuery(this).addClass('selected active'); }); } }); } function mostrarDatosVendedor() { $('#Jpills-three-example1-tab').click(); $('#btn_oferta').hide(); $('#datos_vendedor').show(); $('html, body').animate({ scrollTop: $("#Jpills-tabContent").offset().top-110 }, 1000); } // BUSCADOR WEB GLOBAL OK - 19/7 function buscadorWebGlobal(zona){ buscadorWeb['action'] = 'buscadorWebGlobal'; if (zona == 'pc') { buscadorWeb['texto'] = document.getElementById('text_buscar').value; } else { buscadorWeb['texto'] = document.getElementById('text_buscarC').value; } $.ajax({ type: "POST", url: dominio+'requests/r-web.php', data: buscadorWeb, beforeSend:function(){ $('#loading').show(); }, success: function(response) { $('#content-web').html(response); if ($(window).width() < 1064) { $('html, body').animate({ scrollTop: $("#dataResultados").offset().top-90 }, 1000); } else { $('html, body').animate({ scrollTop: $("#dataResultados").offset().top-160 }, 1000); } window.history.pushState('listado', document.title, '/listado'); $('#loading').hide(); }, }); } //FIN BUSCAR EN WEB function codeNbuscador(){ $('select').niceSelect(); /*------------------------------------- Price filtering activation ---------------------------------------*/ $( "#slider-range" ).slider({ range: true, min: 0, max: 50000000, values: [ 10000, 50000 ], slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); } }); $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + " - $" + $( "#slider-range" ).slider( "values", 1 ) ); } function subirFoto(){ //PERFIL USUARIO - PORTADA $("#upload-area").dmUploader({ url: dominio+'assets/sources/upload.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 1000000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
1 Mb.", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress').show(); $('#uploadFoto').css('width',percent+'%'); $('#uploadFotoCompleta').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil').val(file.path); } } }); //PERFIL USUARIO - PERFIL $("#upload-area2").dmUploader({ url: dominio+'assets/sources/upload2.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 500000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
512kb (0.5MB).", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic2').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress2').show(); $('#uploadFoto2').css('width',percent+'%'); $('#uploadFotoCompleta2').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta2').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil2').val(file.path); } } }); //OTRAS FOTOS $("#upload-area3").dmUploader({ url: dominio+'assets/sources/upload3.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 1000000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
1 Mb.", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic3').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress3').show(); $('#uploadFoto3').css('width',percent+'%'); $('#uploadFotoCompleta3').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta3').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil3').val(file.path); } } }); $("#upload-area4").dmUploader({ url: dominio+'assets/sources/upload4.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 1000000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
1 Mb.", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic4').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress4').show(); $('#uploadFoto4').css('width',percent+'%'); $('#uploadFotoCompleta4').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta4').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil4').val(file.path); } } }); $("#upload-area5").dmUploader({ url: dominio+'assets/sources/upload5.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 1000000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
1 Mb.", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic5').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress5').show(); $('#uploadFoto5').css('width',percent+'%'); $('#uploadFotoCompleta5').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta5').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil5').val(file.path); } } }); $("#upload-area6").dmUploader({ url: dominio+'assets/sources/upload6.php', extFilter: ["jpg", "jpeg", "gif", "png"], multiple: false, maxFileSize: 1000000, onFileExtError: function(file){ swal.fire("Upss!", "Tipo de archivo no válido
Sólo puedes cargar imágenes!
(JPG - JPEG - PNG - GIF)", "error"); }, onFileSizeError: function(file){ swal.fire("Upss!", "Imágen demasiado grande!
El tamaño de tu imagen no puede ser superior a
1 Mb.", "error"); }, onNewFile: function(id, file){ var fileUrl = URL.createObjectURL(file); $('.profile-pic6').attr('src', fileUrl); $('#btnPerfilUserGuardar').hide(); }, onUploadProgress: function(id,percent){ $('.progress6').show(); $('#uploadFoto6').css('width',percent+'%'); $('#uploadFotoCompleta6').show(); }, onComplete: function(id){ $('#btnPerfilUserGuardar').show(); $('#uploadFotoCompleta6').text('Carga completa'); }, onUploadSuccess: function(id, file){ if(file.foto_perfil == 1){ $('#agregarFotoPerfil6').val(file.path); } } }); } function load_publicaciones_web() { // Load more data WEB $('.load-more').click(function(e){ e.preventDefault(); var row = Number($('#row').val()); var allcount = Number($('#all').val()); var catpadre = $('#catpadre').val(); var catid = $('#catid').val(); var rowperpage = 8; row = row + rowperpage; if(row <= allcount){ $("#row").val(row); $.ajax({ url: dominio+'requests/r.php', type: 'post', data: { action: 'loadScrollPubliWeb', row: row, rowperpage: rowperpage, padre: catpadre, id: catid }, beforeSend:function(){ $(".load-more").text("Cargando..."); }, success: function(response){ // Setting little delay while displaying new content setTimeout(function() { // appending posts after last post with class="post" $(".post:last").after(response).show().fadeIn("slow"); var rowno = row + rowperpage; // checking row value is greater than allcount or not if(rowno > allcount){ // Change the text and background $('.load-more').text("NO HAY MÁS PUBLICACIONES"); } else { $(".load-more").text("Cargar más.."); } }, 1000); } }); console.log(catpadre); console.log(catid); } }); } function load_videos_web() { // Load more data WEB $('.load-more-videos').click(function(e){ e.preventDefault(); var row = Number($('#row').val()); var allcount = Number($('#all').val()); var catpadre = $('#catpadre').val(); var catid = $('#catid').val(); var rowperpage = 8; row = row + rowperpage; if(row <= allcount){ $("#row").val(row); $.ajax({ url: dominio+'requests/r.php', type: 'post', data: { action: 'loadScrollVideoWeb', row: row, padre: catpadre, id: catid }, beforeSend:function(){ $(".load-more-videos").text("Cargando..."); }, success: function(response){ // Setting little delay while displaying new content setTimeout(function() { // appending posts after last post with class="post" $(".post:last").after(response).show().fadeIn("slow"); var rowno = row + rowperpage; // checking row value is greater than allcount or not if(rowno > allcount){ // Change the text and background $('.load-more-videos').text("NO HAY MÁS PUBLICACIONES"); } else { $(".load-more-videos").text("Cargar más.."); } }, 1000); } }); console.log(catpadre); console.log(catid); } }); } // Init All ------------------ $(document).ready(function () { iniciarSesion(); manejarUsuarios(); load_publicaciones_web(); });