%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
/** User Profile **/ angular.module('MetronicApp').controller("UserProfile", function($scope, $http, $state, $location, $timeout, Auth){ var UP=this; UP.save=function(){ var frm=$("#frm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'user/update_profile', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success( function(res) { hide_loader(); //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); }else{ show_form_errors(res.errors, frm); show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } /** Logo **/ UP.browse_logo=function(){ $("#logo").click(); $("#logo").off('change'); $("#logo").on('change', function(){ if(check_image($(this)[0])){ show_loader(); var formData=new FormData(); formData.append('logo', document.getElementById('logo').files[0]); $http({url:API_URL+'user/upload_logo', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); if(res.success=='T'){ UP.dtl.logo=res.logo; show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } }); } UP.delete_logo=function(){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url:API_URL+'user/delete_logo'}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); if(res.success=='T'){ UP.dtl.logo=''; show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } /** Change Password **/ UP.change_pass=function(){ var frm=$("#passform"); UP.pass_submit=true; hide_form_errors(frm); $http({url: API_URL+'user/change_pass', method: 'POST', data: (frm.serialize())}).success( function(res) { //res=Auth.checkRes(res); UP.pass_submit=false; if(res.success=='T'){ show_alert_msg("Password changed successfully"); frm[0].reset(); }else{ show_form_errors(res.errors, frm); } } ).error(function(res){showHttpErr(res);}); } /** \ **/ /** Init **/ UP.init=function(){ show_loader(); $http({url: API_URL+'user/detail'}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); UP.dtl=res; } ).error(function(res){showHttpErr(res);}); } UP.init(); }); /** Users **/ angular.module('MetronicApp').controller("Users", function($scope, $http, $state, $location, $timeout, Auth){ var CR=this; CR.sdata={p:1, type:'USER'}; CR.open_form=function(dtl){ hide_form_errors($("#frm")); $(".mchk").prop('checked', false); CR.dtl=dtl?dtl:{status:'1', id:'', lead_restrict:'0', type:CR.sdata.type, campus_offline_user:'N'}; if(dtl){ var modules=dtl.modules.split(","); for(i=0; i<modules.length; i++){ $(".mchk[value='"+modules[i]+"']").prop('checked', true); } } showModal($("#formModal"), true); } CR.lists=function(p, type){ show_loader(); CR.sdata.type=type || CR.sdata.type; CR.sdata.p=p?p:1; $http({url: API_URL+'user/lists', params:CR.sdata}).success( function(res){ CR.result=res.result; CR.page=res.page; hide_loader(); } ).error(function(res){showHttpErr(res);}); } CR.save=function(){ var frm=$("#frm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'user/save', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success( function(res) { hide_loader(); if(res.success=='T'){ show_alert_msg(res.msg); CR.lists(CR.dtl.id?CR.sdata.p:1); hideModal($("#formModal")); if(angular.isDefined(res.regional_officers)){ CR.regional_officers=res.regional_officers; } }else{ show_form_errors(res.errors, frm); show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.edit=function(id, clone){ show_loader(); $http({url: API_URL+'user/detail/'+id}).success( function(res){ hide_loader(); if(clone=='T'){ res.id=''; res.clone_data_set_id=res.data_set_id; } CR.open_form(res); } ); } CR.delete=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'user/delete', method:'POST', data:(( {id:id} ))}).success( function(res){ hide_loader(); if(res.success=='T'){ show_alert_msg(res.msg); var pg=CR.sdata.p; if(CR.page.total==1){ pg=1; } CR.lists(pg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.getSplitDatasetHistory=function(id){ CR.dsHistoryFilter='All'; show_loader(); $http({url: API_URL+'counselor/detail/'+id}).success( function(res){ CR.dsHistory={ name:res.name, initialSplitDatasetHistory:res.splitDatasetHistory, count:0, }; CR.handleDsFilterChange('All'); showModal($("#dsHistoryModal"), true); } ); } CR.handleDsFilterChange=(value)=>{ CR.dsHistoryFilter=value; if(value==='All'){ CR.dsHistory.splitDatasetHistory=CR.dsHistory.initialSplitDatasetHistory.filter((v)=>{return true}) } if(value==='Active'){ CR.dsHistory.splitDatasetHistory=CR.dsHistory.initialSplitDatasetHistory.filter((v)=>{return !v.expired}) } if(value==='Expired'){ CR.dsHistory.splitDatasetHistory=CR.dsHistory.initialSplitDatasetHistory.filter((v)=>{return v.expired}) } CR.dsHistory.count=0; for(v of CR.dsHistory.splitDatasetHistory){ CR.dsHistory.count+=v.no_of_leads*1; } } /** Init **/ CR.init=function(){ show_loader(); $http({url: API_URL+'user/init', params:CR.sdata}).success( function(res){ CR.result=res.result; CR.page=res.page; CR.modules=res.modules; CR.modules_groups=res.modules_groups; CR.regional_officers=res.regional_officers; CR.all_managers=res.all_managers; CR.data_set_users=res.data_set_users; CR.user_types=res.user_types; //CR.user_types=['USER', 'CALLER_MANAGER', 'REGIONAL_OFFICER', 'PUBLISHER']; } ).error(function(res){showHttpErr(res);}); } CR.init(); }); //EOF