%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
/** App Controller **/
MetronicApp.controller("App", function($scope, $rootScope, $http, $state, Auth){
$rootScope.VERSION=VERSION;
$rootScope.siteName=SITE_NAME;
$rootScope.PageTitle=SITE_NAME;
$rootScope.isLogged=false;
$rootScope.loggedUserName='';
$rootScope.userType='';
$rootScope.isAdmin=false;
$rootScope.modules=[];
$scope.$on('$viewContentLoaded', function() {
//setTimeout(function(){Layout.initSidebar($state);}, 200);
//Layout.initSidebar($state);
Layout.fixContentHeight();
$(window).scrollTop(0);
});
$rootScope.$on('$stateChangeStart', function(event, res){
clearTimeout(jsInterval);
$('body').removeClass('modal-open');
$('.modal-backdrop').remove();
show_loader();
if(res.name!='login' && !Auth.isLogged()){
event.preventDefault();
$rootScope.goto('login');
return;
}
if(typeof res.pageTitle != "undefined"){
$rootScope.PageTitle=res.pageTitle+' | '+SITE_NAME;
}else{
$rootScope.PageTitle='Welcome to: '+SITE_NAME;
}
});
$rootScope.$on('$stateChangeSuccess', function() {
Layout.setAngularJsSidebarMenuActiveLink('match', null, $state); // activate selected link in the sidebar menu
});
$rootScope.goto=function(state, data){
$('body').removeClass('modal-open');
$('.modal-backdrop').remove();
show_loader();
if(!data){
data={};
}
$state.go(state, data, {reload: true});
}
$rootScope.sessionVal=function(key){
return Auth.sessionVal(key);
}
$rootScope.clearLoggedData=function(){
Auth.delSession();
$rootScope.isLogged=false;
$rootScope.modules=[];
$rootScope.userType='';
}
$rootScope.logout=function(){
show_loader();
$http({url: API_URL+'auth/logout'}).success(
function(res) {
$rootScope.clearLoggedData();
$rootScope.goto("login");
}
).error(function(res){showHttpErr(res);});
}
$rootScope.goback=function(){
if($state.current.name=='login'){
return;
}
window.history.back();
}
$rootScope.set_user_data=function(res){
if(res.dtl){
Auth.setSession(res.dtl);
}else{
$rootScope.clearLoggedData();
}
$rootScope.isLogged=Auth.isLogged();
$rootScope.loggedUserName=Auth.sessionVal('name');
$rootScope.userType=Auth.sessionVal('user_type');
$rootScope.isAdmin=Auth.sessionVal('user_type')=='ADMIN';
$rootScope.modules=res.modules;
}
$rootScope.init=function(){
$http({url: API_URL+'auth/logged_data?noloader'}).success(
function(res) {
$rootScope.set_user_data(res);
}
).error(function(res){showHttpErr(res);});
}
$rootScope.init();
});
/** Login Controller **/
MetronicApp.controller("Login", function($scope, $rootScope, $http, $state, Auth){
$scope.login=function(){
var frm=$("#loginform");
hide_form_errors(frm);
show_loader();
$http({url:API_URL+'auth/login', method:'POST', data:(frm.serialize())}).success(
function(res) {
hide_loader();
if(res.success=='T'){
$scope.$parent.set_user_data(res);
$rootScope.goto('dashboard');
}else{
if(res.msg){
show_alert_msg(res.msg, 'E');
}
show_form_errors(res.errors, frm);
}
}
).error(function(res){showHttpErr(res);});
}
$scope.init=function(){
$http({url: API_URL+'auth/logged_data'}).success(
function(res) {
$scope.$parent.set_user_data(res);
if($rootScope.isLogged){
$rootScope.goto('dashboard');
}
}
).error(function(res){showHttpErr(res);});
}
$scope.init();
});
/* Setup Layout Part - Header */
MetronicApp.controller("HeaderController", function($scope){
$scope.$on('$includeContentLoaded', function() {
Layout.initHeader(); // init header
});
});
/* Setup Layout Part - Sidebar */
MetronicApp.controller("SidebarController", function($state, $scope){
$scope.$on('$includeContentLoaded', function() {
Layout.initSidebar($state); // init sidebar
});
});
/* Setup Layout Part - Quick Sidebar */
MetronicApp.controller('QuickSidebarController', function($scope) {
$scope.$on('$includeContentLoaded', function() {
setTimeout(function(){
QuickSidebar.init(); // init quick sidebar
}, 2000)
});
});
/* Setup Layout Part - Footer */
MetronicApp.controller('FooterController', function($scope) {
$scope.$on('$includeContentLoaded', function() {
Layout.initFooter(); // init footer
});
});
//EOF