Merge remote-tracking branch 'origin/master'

# Conflicts:
#	Apollo/assets/js/controllers/dashboardCtrl.js
This commit is contained in:
gandhimathi 2017-12-01 11:36:03 +05:30
commit 8397cc45b0
5 changed files with 173 additions and 32 deletions

View File

@ -124,6 +124,7 @@ $route['updateAnnouncementDetails'] = 'Announcement_Controller/updateAnnouncemen
$route['getDashboardCallTrack'] = 'Call_Tracking_Controller/getDashboardCallTrack'; $route['getDashboardCallTrack'] = 'Call_Tracking_Controller/getDashboardCallTrack';
$route['getTotalStudent'] = 'Dashboard_Controller/getTotalStudent'; $route['getTotalStudent'] = 'Dashboard_Controller/getTotalStudent';
$route['getTotalEmployee'] = 'Dashboard_Controller/getTotalEmployee'; $route['getTotalEmployee'] = 'Dashboard_Controller/getTotalEmployee';
$route['getTotalUsers'] = 'Dashboard_Controller/getTotalUsers';

View File

@ -36,6 +36,24 @@ class Dashboard_Controller extends REST_Controller {
$this->load->model('Dashboard_model', 'dashboard_model'); $this->load->model('Dashboard_model', 'dashboard_model');
} }
public function getTotalUsers_post() {
$data = $this->post('data');
$totalUsers = $this->dashboard_model->get_total_users( $data );// Check if the employee exist
if ($totalUsers) {
$totalUsers['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalUsers, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getTotalStudent_post() { public function getTotalStudent_post() {
$data = $this->post('data'); $data = $this->post('data');
$totalStudents = $this->dashboard_model->get_total_students( $data );// Check if the employee exist $totalStudents = $this->dashboard_model->get_total_students( $data );// Check if the employee exist

View File

@ -14,6 +14,27 @@ class Dashboard_model extends CI_Model
/* /*
* get Dashboard Details * get Dashboard Details
*/ */
// get total number of users
public function get_total_users( $data ) {
$sql1 = "SELECT * from ".STUDENTS."";
$count1 = $this->db->query($sql1);
$sql2 = "SELECT * from ".STAFF."";
$count2 = $this->db->query($sql2);
if( $count2->num_rows() > 0) {
$result['status'] = true;
$result['total_student'] = $count1->num_rows();
$result['total_staff'] = $count2->num_rows();
$result['message'] = "Total Number of Users";
} else {
$result['status'] = true;
$result['total_student'] = $count1->num_rows();
$result['total_staff'] = $count2->num_rows();
$result['message'] = "No student Users";
}
return $result;
}
// get total number of students // get total number of students
public function get_total_students($data) { public function get_total_students($data) {

View File

@ -4,7 +4,7 @@
* Simple table with sorting and filtering on AngularJS * Simple table with sorting and filtering on AngularJS
*/ */
app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { 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 * used to get dash board call track details
* this method called from view ng-init directive * this method called from view ng-init directive
@ -12,7 +12,6 @@ app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ng
* */ * */
$scope.initCallTracking = function () { $scope.initCallTracking = function () {
$rootScope.pendingFolloupDetails = [];
var getCallTrack = { var getCallTrack = {
method: 'POST', method: 'POST',
url: apiPoint.url + 'getDashboardCallTrack/', url: apiPoint.url + 'getDashboardCallTrack/',
@ -24,39 +23,31 @@ app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ng
} }
}; };
$http(getCallTrack).then(function (response) { $http(getCallTrack).then(function (response) {
if (response.data.status==200) { if (response.data.status == 200) {
if(response.data.todayStatus){ if (response.data.todayStatus) {
$scope.todayFolloupDetails=response.data.todayFolloupDetails.trackingDetails; $scope.todayFolloupDetails = response.data.todayFolloupDetails.trackingDetails;
$scope.emptyDataToday=false; $scope.emptyDataToday = false;
} }
else{ else {
$scope.todayFolloupDetails=""; $scope.todayFolloupDetails = "";
$scope.emptyDataToday=true; $scope.emptyDataToday = true;
} }
if(response.data.todayPendingStatus){ if (response.data.todayPendingStatus) {
$scope.currentDate=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); $scope.pendingFolloupDetails = response.data.PendingFolloupDetails.trackingDetails;
$scope.emptyDataPending = false;
$scope.fetchFolloupDetails=response.data.PendingFolloupDetails.trackingDetails;
angular.forEach($scope.fetchFolloupDetails, function(value, key){
if(($scope.currentDate) < (value.FollowupOn)){
$rootScope.pendingFolloupDetails.push(value);
}
});
$scope.emptyDataPending=false;
} }
else{ else {
$scope.pendingFolloupDetails=""; $scope.pendingFolloupDetails = "";
$scope.emptyDataPending=true; $scope.emptyDataPending = true;
} }
if(response.data.todayLeadStatus){ if (response.data.todayLeadStatus) {
$scope.leadDetails=response.data.todayLeadDetails.trackingDetails; $scope.leadDetails = response.data.todayLeadDetails.trackingDetails;
$scope.emptyDataLead=false; $scope.emptyDataLead = false;
} }
else{ else {
$scope.leadDetails=""; $scope.leadDetails = "";
$scope.emptyDataLead=true; $scope.emptyDataLead = true;
} }
@ -64,8 +55,8 @@ app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ng
} else { } else {
$scope.emptyDataToday=true; $scope.emptyDataToday = true;
$scope.emptyDataPending=true; $scope.emptyDataPending = true;
} }
}); });
@ -73,3 +64,113 @@ app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ng
}]); }]);
app.controller('OnotherCtrl', ["$scope", "toaster", "$filter", "$http", "API_POINTS", "$state", '$cookies', 'ipCookie', function ($scope, toaster, $filter, $http, apiPoint, $state, $cookies, ipCookie) {
// get local cliend details
var localDetail = JSON.parse(localStorage.getItem('localObj'));
var localDetails = ipCookie('cookiechk');
$scope.init = function () {
$scope.this_Student = 0;
$scope.this_Staff = 0;
$scope.this_TotalUser = 0;
$scope.getTotalUsers();
}
// get Total Number of users in this application
$scope.getTotalUsers = function () {
var req = {
method: 'POST',
url: apiPoint.url + 'getTotalUsers/',
headers: {
'Content-Type': 'application/json'
},
data: {
data: localDetails
}
};
$http(req).then(function (response) {
if (response.data) {
// $scope.editBranchId = id;
$scope.this_Student = response.data.total_student;
$scope.this_Staff = response.data.total_staff;
$scope.this_TotalUser = $scope.this_Staff + $scope.this_Student;
// alert($scope.this_TotalUser);
$scope.data = [
{
value: $scope.this_Student,
color: '#46BFBD',
highlight: '#5AD3D1',
label: 'Student'
},
{
value: $scope.this_Staff,
color: '#FDB45C',
highlight: '#FFC870',
label: 'Staff'
}
];
$scope.total = $scope.this_TotalUser;
} else {
// $scope.this_Student = response.total_student;
// $scope.this_Staff = response.total_staff;
$scope.data = [
{
value: $scope.this_Student,
color: '#F7464A',
highlight: '#5AD3D1',
label: 'Student'
},
{
value: $scope.this_Staff,
color: '#FDB45C',
highlight: '#FFC870',
label: 'Staff'
}
];
$scope.this_TotalUser = 0;
$scope.total = $scope.this_TotalUser;
}
});
}
// Chart.js Data
// 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>'
};
}]);

View File

@ -149,7 +149,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div> <div>