'use strict';IoTService.controller("Menu",["$scope","api","$timeout","Usuario","ModalService","$interval","$localStorage",function(a,c,b,d,k,l,e){a.pass={};var f,m=void 0!==e.login&&e.login.time?e.login.time:7200;d.get().then(function(g){a.usuario=g.usuario;f=new Date(g.usuario.inicio)});a.ingresoAut=void 0!==e.login&&e.login.user?!0:!1;a.ingresoAutomatico=function(g=!0){g?c.post("ingreso_automatico").then(function(h){h.data.estado&&(e.login={user:h.data.user,pass:h.data.pass,time:h.data.time},a.ingresoAut= !0)}):(e.login="",a.ingresoAut=!1)};a.prelogout=function(){a.loginout=!0;b(function(){a.loginout=!1},5E3)};a.logout=function(){c.post("logout")};a.cerrarSesion=function(){k.open(a,"cerrarSesion","","sm").result.then(function(g){c.post("logout")},function(g){})};a.extenderSesion=function(){c.post("sesion").then(function(g){f=new Date(g.data.inicio)})};l(function(){a.restanteSesion=m-(new Date-f)/1E3;0>a.restanteSesion&&c.post("logout")},1E3);a.modificarPass=function(){a.pass.activo=!1;k.open(a,"modificarPass", "","sm").result.then(function(){},function(g){})};a.cambiarPass=function(g){a.pass.activo=!1;c.post("pass/modificar",g).then(function(h){a.pass.activo=!0;a.pass.valido=h.data.estado;a.pass.msg=h.data.msg})}}]); IoTService.controller("Contacto",["$scope","api",function(a,c){a.envio={estado:!1,enviando:!1,error:!1};a.enviarMensaje=function(b){a.envio={estado:!1,enviando:!0,error:!1};c.post("contacto_web",{contacto:b}).then(function(d){a.envio.enviando=!1;1==d.data.estado?a.envio.estado=!0:(a.envio.error=!0,a.envio.msg=d.data.msg)})}}]); IoTService.controller("Login",["$scope","api","$window","$localStorage","$timeout","Modal",function(a,c,b,d,k,l){a.error=!1;a.loginnbr=0;a.login={};c.get("informacion/tipo_documento").then(function(e){a.tiposDocumento=e.data;a.login.tipoDocumento=e.data[0].id});void 0!==d.login&&""!==d.login&&(a.loginAutomatico=!0,k(function(){$http.post("api/autologin",d.login).then(function(e){data=e.data;data.login?b.location.href="/":(a.loginnbr+=1,a.error=!0,a.errorData=data.exp)})},3E3));a.ingresarSistema= function(e){c.post("login",e).then(function(f){f=f.data;f.login?b.location.href="/":(a.loginnbr+=1,a.estado={error:!0,msg:f.exp})})};$("#name").focus();a.restablecerPass=function(){a.restablecer={tipoDocumento:a.tiposDocumento[0].id};a.estadoRestablecimiento={estado:!1,enviando:!1,error:!1};l.open(a,"restablecer_pass","","md").result.then(function(e){},function(e){})};a.enviarRestablecimiento=function(e){a.estadoRestablecimiento={estado:!1,enviando:!0,error:!1};c.post("pass/restablecer",e).then(function(f){a.estadoRestablecimiento.enviando= !1;f.data.estado?(a.estadoRestablecimiento.estado=!0,a.estadoRestablecimiento.email=f.data.email):(a.estadoRestablecimiento.error=!0,a.estadoRestablecimiento.msg=f.data.msg)})}}]); IoTService.controller("Registro",["$scope","api",function(a,c){a.datos={};a.envio={estado:!1,enviando:!1,error:!1};c.get("inscripcion/activa").then(function(b){a.ediciones_congreso=b.data});c.get("datos/congreso/categorias").then(function(b){a.datos.categoriasCongreso=b.data});a.buscarInstitucion=function(b){return c.get("datos/buscar_institucion/"+b).then(function(d){return d.data})};a.buscarFacultad=function(b,d){if(void 0!==d)return c.get("datos/buscar_facultad/"+b+"/"+d).then(function(k){return k.data})}; a.registrar=function(b){a.envio={estado:!1,enviando:!0,error:!1};c.post("inscripcion/basica",{trabajo:b}).then(function(d){a.envio.enviando=!1;!0===d.data.estado?a.envio.estado=!0:(a.envio.error=!0,a.envio.msg=d.data.msg)})}}]);IoTService.controller("Verificacion",["$scope","api","$routeParams",function(a,c,b){b=b.hash;a.envio={estado:!1,enviando:!0,error:!1};c.post("vfs",{hash:b}).then(function(d){a.envio.enviando=!1;!0===d.data.estado?a.envio.estado=!0:a.envio.error=!0;a.envio.msg=d.data.msg})}]); IoTService.controller("Error",["$scope","api","$routeParams",function(a,c,b){a.mensaje={cert_vencido:"En enlace al que intenta acceder se encuentra vencido. Por favor solicite uno nuevo.",link:"La p\u00e1gina que intenta acceder no existe. Verifique e intente de nuevo."}[b.tipo]}]);IoTService.controller("Modal",["$uibModalInstance","$scope","data",function(a,c,b){c.data=b;this.ok=function(d){a.close(d)};this.cerrar=function(d="cerrar"){a.close(d)};this.cancel=function(){a.dismiss("cancelar")}}]);