SistemaCTyP.controller("Menu",["$scope","api","$timeout","Usuario","ModalService","$interval","$localStorage","$window",function(o,n,t,e,i,a,s,r){var c;o.pass={},o.tiempoRol=0;var u=void 0!==s.login&&s.login.time?s.login.time:7200;e.get().then((function(n){o.usuario=n.usuario,c=new Date(n.usuario.inicio)})),o.ingresoAut=!(void 0===s.login||!s.login.user),o.ingresoAutomatico=function(t=!0){t?n.post("ingreso_automatico").then((function(n){n.data.estado&&(s.login={user:n.data.user,pass:n.data.pass,time:n.data.time},o.ingresoAut=!0)})):(s.login="",o.ingresoAut=!1)},o.prelogout=function(){o.loginout=!0,t((function(){o.loginout=!1}),5e3)},o.logout=function(){n.post("logout")},o.cerrarSesion=function(){i.open(o,"cerrarSesion","","sm").result.then((function(o){n.post("logout")}),(function(o){}))},o.extenderSesion=function(){n.post("sesion").then((function(o){c=new Date(o.data.inicio)}))},a((function(){o.restanteSesion=u-(new Date-c)/1e3,o.restanteSesion<0&&n.post("logout")}),1e3),o.modificarPass=function(){o.pass={activo:!1},i.open(o,"modificarPass","","sm").result.then((function(){}),(function(o){}))},o.cambiarPass=function(t){o.pass.activo=!1,n.post("pass/modificar",t).then((function(n){o.pass.activo=!0,o.pass.valido=n.data.estado,o.pass.msg=n.data.msg}))},o.modificarRolModal=function(){o.rol="",i.open(o,"modificar_rol","","sm").result.then((function(){}),(function(o){}))},o.modificarRol=function(t){o.cambioRol={activo:!1},n.put("perfil/rol/"+t).then((function(n){o.cambioRol.activo=!0,o.cambioRol.valido=n.data.estado,o.cambioRol.msg=n.data.msg,n.data.estado&&(o.tiempoRol=100,a((function(){o.tiempoRol-=1,0==o.tiempoRol&&r.location.reload()}),15,100))}))}}]),SistemaCTyP.controller("Contacto",["$scope","api",function(o,n){o.envio={estado:!1,enviando:!1,error:!1},o.enviarMensaje=function(t){o.envio={estado:!1,enviando:!0,error:!1},n.post("contacto_web",{contacto:t}).then((function(n){o.envio.enviando=!1,1==n.data.estado?o.envio.estado=!0:(o.envio.error=!0,o.envio.msg=n.data.msg)}))}}]),SistemaCTyP.controller("Login",["$scope","api","$window","$localStorage","$timeout","Modal",function(o,n,t,e,i,a){o.error=!1,o.loginnbr=0,o.login={},o.tipoPass="password",n.get("informacion/tipo_documento").then((function(n){o.tiposDocumento=n.data,o.login.tipoDocumento=n.data[0].id})),void 0!==e.login&&""!==e.login&&(o.loginAutomatico=!0,i((function(){$http.post("api/autologin",e.login).then((function(n){data=n.data,data.login?t.location.href="/":(o.loginnbr=o.loginnbr+1,o.error=!0,o.errorData=data.exp)}))}),3e3)),o.ingresarSistema=function(e){n.post("login",e).then((function(n){var e=n.data;e.login?t.location.href="/":(o.loginnbr=o.loginnbr+1,o.estado={error:!0,msg:e.exp})}))},$("#name").focus(),o.restablecerPass=function(){o.restablecer={tipoDocumento:o.tiposDocumento[0].id},o.estadoRestablecimiento={estado:!1,enviando:!1,error:!1},a.open(o,"restablecer_pass","","sm").result.then((function(o){}),(function(o){}))},o.enviarRestablecimiento=function(t){o.estadoRestablecimiento={estado:!1,enviando:!0,error:!1},n.post("pass/restablecer",t).then((function(n){o.estadoRestablecimiento.enviando=!1,n.data.estado?(o.estadoRestablecimiento.estado=!0,o.estadoRestablecimiento.email=n.data.email):(o.estadoRestablecimiento.error=!0,o.estadoRestablecimiento.msg=n.data.msg)}))}}]),SistemaCTyP.controller("Registro",["$scope","api",function(o,n){o.datos={},o.envio={estado:!1,enviando:!1,error:!1},n.get("inscripcion/activa").then((function(n){o.ediciones_congreso=n.data})),n.get("datos/congreso/categorias").then((function(n){o.datos.categoriasCongreso=n.data})),o.buscarInstitucion=function(o){return n.get("datos/buscar_institucion/"+o).then((function(o){return o.data}))},o.buscarFacultad=function(o,t){if(void 0!==t)return n.get("datos/buscar_facultad/"+o+"/"+t).then((function(o){return o.data}))},o.registrar=function(t){o.envio={estado:!1,enviando:!0,error:!1},n.post("inscripcion/basica",{trabajo:t}).then((function(n){o.envio.enviando=!1,!0===n.data.estado?o.envio.estado=!0:(o.envio.error=!0,o.envio.msg=n.data.msg)}))}}]),SistemaCTyP.controller("Verificacion",["$scope","api","$routeParams",function(o,n,t){var e=t.hash;o.envio={estado:!1,enviando:!0,error:!1},n.post("vfs",{hash:e}).then((function(n){o.envio.enviando=!1,!0===n.data.estado?o.envio.estado=!0:o.envio.error=!0,o.envio.msg=n.data.msg}))}]),SistemaCTyP.controller("Error",["$scope","api","$routeParams",function(o,n,t){var e=t.error;o.mensaje={vencido:"En enlace al que intenta acceder se encuentra vencido. Por favor solicite uno nuevo.",link:"La página que intenta acceder no existe. Verifique e intente de nuevo.",no_permitido:"No puede acceder al recurso solicitado."}[e]}]),SistemaCTyP.controller("Modal",["$uibModalInstance","$scope","data",function(o,n,t){var e=this;n.data=t,e.ok=function(n){o.close(n)},e.cerrar=function(n="cerrar"){o.close(n)},e.cancel=function(){o.dismiss("cancelar")}}]);