%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.isPublisher=false; $rootScope.modules=[]; $rootScope.apiUrl=API_URL; $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); setCookie('modules', JSON.stringify(res.modules), 1); }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.isPublisher=Auth.sessionVal('user_type')=='PUBLISHER'; $rootScope.isConsultant=Auth.sessionVal('user_type')=='CONSULTANT'; $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(){ deleteCookie('db_year'); var frm=$("#loginform"); hide_form_errors(frm); let ip=window.sessionStorage['ip'] || ''; let city=window.sessionStorage['city'] || ''; let region=window.sessionStorage['region'] || ''; let fd=frm.serialize()+'&ip='+ip+'&city='+city+'®ion='+region; show_loader(); $http({url:API_URL+'auth/login', method:'POST', data:fd}).success( function(res) { hide_loader(); if(res.success=='T'){ $scope.$parent.set_user_data(res); $rootScope.goto('dashboard'); //location.href="dashboard"; }else{ if(res.msg){ show_alert_msg(res.msg, 'E'); } show_form_errors(res.errors, frm); } } ).error(function(res){showHttpErr(res);}); } $scope.getLocationIfo=()=>{ show_loader(); let key='09624341197277d3a0265ed0d094180193beebd771a67693f8bc46ec'; $.ajax({ url:'https://api.ipdata.co/?api-key='+key, success:function(res){ hide_loader(); if(typeof res.ip !== "undefined"){ window.sessionStorage['ip']=res.ip; window.sessionStorage['city']=res.city || ''; window.sessionStorage['region']=res.city || ''; }else{ window.sessionStorage['ip']=''; window.sessionStorage['city']=''; window.sessionStorage['region']=''; } } }); } $scope.init=function(){ deleteCookie('db_year'); deleteCookie('caller_ids'); $scope.getLocationIfo(); $http({url: API_URL+'auth/logged_data'}).success( function(res) { $scope.$parent.set_user_data(res); if($rootScope.isLogged){ $rootScope.goto('dashboard'); //location.href="dashboard"; } } ).error(function(res){showHttpErr(res);}); } $scope.init(); }); /* Setup Layout Part - Header */ MetronicApp.controller("HeaderController", function($scope, $rootScope, $http, $timeout){ $scope.users=[]; $scope.getDB=()=>{ return getCookie('db_year') || ''; } $scope.setDB=(db_year)=>{ if(db_year==''){ deleteCookie('db_year'); }else{ setCookie('db_year', db_year, 1); } location.reload(); } $scope.getUsers=()=>{ $http({url:API_URL+'user/active_users/CALLER?noloader=1'}).success( function(res){ $scope.users=res.result; $timeout(()=>{ apply_select2($("#myusers_dd"), "My Leads"); let caller_ids=getCookie("caller_ids"); if(caller_ids){ caller_ids=JSON.parse(caller_ids); $("#myusers_dd").val(caller_ids); apply_select2($("#myusers_dd"), "My Leads"); //$("#myusers_dd").change(); } }); } ) } $scope.setCallerIds=()=>{ console.log(999) let val=$("#myusers_dd").val(); if(val){ if(val.indexOf("AllCallers")>=0){ val=["AllCallers"]; $("#myusers_dd").val(["AllCallers"]); apply_select2($("#myusers_dd"), "My Leads"); } }else{ val=[]; } setCookie('caller_ids', JSON.stringify(val), 1); location.reload(); } $rootScope.notiCount=0; $scope.increaseNotiCount=function(){ $rootScope.notiCount++; $scope.$digest(); } $rootScope.getNotificationCount=function(){ $http({url: API_URL+'common/getNotificationCount?noloader'}).success( function(res){ $rootScope.notiCount=res.n; } ); } $scope.$on('$includeContentLoaded', function() { Layout.initHeader(); // init header $scope.getUsers(); $rootScope.getNotificationCount(); }); }); /* 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