apollodec/Apollo/assets/js/controllers/dashboardCtrl.js
2017-12-01 10:31:59 +05:30

123 lines
3.6 KiB
JavaScript

'use strict';
/**
* controllers for ng-table
* Simple table with sorting and filtering on AngularJS
*/
app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) {
/*
* used to get dash board call track details
* this method called from view ng-init directive
* created by kms
* */
$scope.initCallTracking = function () {
var getCallTrack = {
method: 'POST',
url: apiPoint.url + 'getDashboardCallTrack/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(getCallTrack).then(function (response) {
if (response.data.status==200) {
if(response.data.todayStatus){
$scope.todayFolloupDetails=response.data.todayFolloupDetails.trackingDetails;
$scope.emptyDataToday=false;
}
else{
$scope.todayFolloupDetails="";
$scope.emptyDataToday=true;
}
if(response.data.todayPendingStatus){
$scope.pendingFolloupDetails=response.data.PendingFolloupDetails.trackingDetails;
$scope.emptyDataPending=false;
}
else{
$scope.pendingFolloupDetails="";
$scope.emptyDataPending=true;
}
if(response.data.todayLeadStatus){
$scope.leadDetails=response.data.todayLeadDetails.trackingDetails;
$scope.emptyDataLead=false;
}
else{
$scope.leadDetails="";
$scope.emptyDataLead=true;
}
} else {
$scope.emptyDataToday=true;
$scope.emptyDataPending=true;
}
});
};
}]);
app.controller('OnotherCtrl', ["$scope", function ($scope) {
// Chart.js Data
$scope.data = [
{
value: 50,
color: '#46BFBD',
highlight: '#5AD3D1',
label: 'Student'
},
{
value: 100,
color: '#FDB45C',
highlight: '#FFC870',
label: 'Staff'
}
];
$scope.total = 150;
// Chart.js Options
$scope.options = {
// Sets the chart to be responsive
responsive: false,
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke: true,
//String - The colour of each segment stroke
segmentStrokeColor: '#fff',
//Number - The width of each segment stroke
segmentStrokeWidth: 2,
//Number - The percentage of the chart that we cut out of the middle
percentageInnerCutout: 50, // This is 0 for Pie charts
//Number - Amount of animation steps
animationSteps: 100,
//String - Animation easing effect
animationEasing: 'easeOutBounce',
//Boolean - Whether we animate the rotation of the Doughnut
animateRotate: true,
//Boolean - Whether we animate scaling the Doughnut from the centre
animateScale: false,
//String - A legend template
legendTemplate: '<ul class="tc-chart-js-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'
};
}]);