%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
/** Reports Dashboard **/ angular.module('MetronicApp').controller("ReportsDashboard", function($scope, $http, $state, $location, $stateParams, $timeout, Auth){ var RD=this; RD.top_limit = 10; RD.sdata = {dateFrom:'', dateTo:''}; $scope.tabType = $stateParams.tabType; $scope.label_percent = function(per){ return label_percent(per); } /** Dashboard Data */ RD.dashboardData = function(){ show_loader(); $http({url: API_URL+'reports/dashboard/'+RD.top_limit}).success( function(res){ RD.data=res.data; RD.dashboard_top_leads(); $timeout(function(){ handleEasyPieChart(); handleCounterup(); }); } ).error(function(res){showHttpErr(res);}); $scope.tabType='dashboard'; } RD.dashboard_top_leads=function(){ $http({url: API_URL+'reports/dashboard_top_leads/'+RD.top_limit}).success( function(res){ RD.data.lead_sources=res.data.lead_sources.result; RD.data.lead_states=res.data.lead_states.result; RD.data.lead_programmes=res.data.lead_programmes.result; } ).error(function(res){showHttpErr(res);}); } /** END */ RD.orderby=[]; RD.set_list_order=function(odrby, ind){ RD.orderby[ind]=odrby; } RD.groupLeads = function(){ show_loader(); $http({url: API_URL+'reports/leadGroupWise', params: RD.sdata}).success( function(res){ hide_loader(); RD.group_leads=res.result; } ).error(function(res){showHttpErr(res);}); $scope.tabType = 'group'; } /** Source Leads */ RD.sourceLeads = function(){ show_loader(); $http({url: API_URL+'reports/leadSourceWise', params: RD.sdata}).success( function(res){ hide_loader(); RD.source_leads=res.result; } ).error(function(res){showHttpErr(res);}); $scope.tabType = 'source'; } /** END */ /** State Leads */ RD.stateLeads = function(){ show_loader(); $http({url: API_URL+'reports/leadStateWise', params: RD.sdata}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); RD.state_leads=res.result; } ).error(function(res){showHttpErr(res);}); $scope.tabType = 'state'; } /** END */ /** Programme Leads */ RD.programmeLeads = function(){ show_loader(); $http({url: API_URL+'reports/leadProgrammeWise', params: RD.sdata}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); RD.prog_leads=res.result; } ).error(function(res){showHttpErr(res);}); $scope.tabType = 'prog'; } /** END */ RD.landingPageLeads = function(){ show_loader(); $http({url: API_URL+'reports/leadLandingPageWise', params: RD.sdata}).success( function(res){ hide_loader(); RD.lp_leads=res.result; } ).error(function(res){showHttpErr(res);}); $scope.tabType = 'lp'; } /** Handle Tabs Links */ RD.handleTabs = function(){ var tab = $scope.tabType; $('.tab-pane,.dash-tabs li').not(".app-status .tab-pane, .app-status li").removeClass('active'); switch (tab){ case 'dashboard': RD.dashboardData(); $('#tab-dashboard, #nav-dashboard').addClass('active'); break; case 'group': RD.groupLeads(); $('#tab1, #nav-group').addClass('active'); break; case 'source': RD.sourceLeads(); $('#tab2, #nav-source').addClass('active'); break; case 'state': RD.stateLeads(); $('#tab3, #nav-state').addClass('active'); break; case 'prog': RD.programmeLeads(); $('#tab4, #nav-prog').addClass('active'); break; case 'lp': RD.landingPageLeads(); $('#tab5, #nav-lp').addClass('active'); break; } } /** \ */ /** Init **/ RD.init=function(){ Scope = RD; //setBsDatepicker($('.date-picker')); //RD.dashboardData(); $timeout(function(){ RD.handleTabs(); initDashboardDaterange(); }); /** \ */ } RD.init(); }); /** Non Angular **/ /** Counter */ var handleCounterup = function () { if (!$().counterUp) { return; } $("[data-counter='counterup']").counterUp({ delay: 10, time: 1000 }); } /** \ */ /** EasyPieChart */ var handleEasyPieChart = function () { if (!$().easyPieChart) {return;} $('.easy-pie-chart .number.purple').easyPieChart({ animate: 1000, size: 75, lineWidth: 3, barColor: App.getBrandColor('purple') }); $('.easy-pie-chart .number.green').easyPieChart({ animate: 1000, size: 75, lineWidth: 3, barColor: App.getBrandColor('green') }); $('.easy-pie-chart .number.red').easyPieChart({ animate: 1000, size: 75, lineWidth: 3, barColor: App.getBrandColor('red') }); $('.easy-pie-chart .number.blue').easyPieChart({ animate: 1000, size: 75, lineWidth: 3, barColor: App.getBrandColor('blue') }); } /** \ */ function initDashboardDaterange() { if (!jQuery().daterangepicker) { return; } $('.report-range').daterangepicker({ "ranges": { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'Last Week': [moment().subtract(1, 'weeks').startOf('isoWeek'), moment().subtract(1, 'weeks').endOf('isoWeek')], 'This Week': [moment().subtract(0, 'weeks').startOf('isoWeek'), moment().subtract(0, 'weeks').endOf('isoWeek')], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')], 'This Year': [moment().startOf('year'), moment().endOf('year')], 'Last Year': [moment().startOf('year').subtract(1, 'years'), moment().endOf('year').subtract(1, 'years')], }, "locale": { "format": "MMM DD, YYYY", "separator": " - ", "applyLabel": "Apply", "cancelLabel": "Cancel", "fromLabel": "From", "toLabel": "To", "customRangeLabel": "Custom Range", "daysOfWeek": [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], "monthNames": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "firstDay": 1 }, "startDate": moment().startOf('year'), "endDate": moment().endOf('year'), opens: 'left', }, function (start, end, label) { if ($('.report-range').attr('data-display-range') != '0') { var sd = start.format('MMMM D, YYYY'); var ed = end.format('MMMM D, YYYY'); $('.report-range span').html(sd + ' - ' + ed); Scope.sdata.dateFrom = sd; Scope.sdata.dateTo = ed; Scope.handleTabs(); } }); if ($('.report-range').attr('data-display-range') != '0') { var sd = moment().startOf('year').format('MMMM D, YYYY'); var ed = moment().endOf('year').format('MMMM D, YYYY'); $('.report-range span').html(sd + ' - ' + ed); Scope.sdata.dateFrom = sd; Scope.sdata.dateTo = ed; } $('.report-range').show(); } //EOF