From a82675346390a3798e34a9ba075344067e561c58 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 1 Dec 2017 11:34:38 +0530 Subject: [PATCH 1/2] course details changes done --- Apollo/assets/js/controllers/dashboardCtrl.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index 745209ff..cf9663eb 100644 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -4,7 +4,7 @@ * 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) { +app.controller('dashboardCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { /* * used to get dash board call track details * this method called from view ng-init directive @@ -12,6 +12,7 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams", * */ $scope.initCallTracking = function () { + $rootScope.pendingFolloupDetails = []; var getCallTrack = { method: 'POST', url: apiPoint.url + 'getDashboardCallTrack/', @@ -26,15 +27,23 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams", if (response.data.status==200) { if(response.data.todayStatus){ - $scope.todayFolloupDetails=response.data.todayFolloupDetails.trackingDetails; - $scope.emptyDataToday=false; + $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.currentDate=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); + + $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{ @@ -63,3 +72,4 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams", }; }]); + From 268914c651c85f1ef01d04bc6e3fb0a4d63a2516 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 1 Dec 2017 11:43:15 +0530 Subject: [PATCH 2/2] course details changes done --- Apollo/assets/js/controllers/dashboardCtrl.js | 93 ++++++++++--------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index 1acfe976..3f3ba20a 100644 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -4,7 +4,7 @@ * 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) { +app.controller('dashboardCtrl', ["$scope","$rootScope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope, toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { /* * used to get dash board call track details * this method called from view ng-init directive @@ -12,54 +12,63 @@ app.controller('dashboardCtrl', ["$scope", "toaster", "$filter", "ngTableParams" * */ $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) { + $rootScope.pendingFolloupDetails = []; + if(JSON.parse(localStorage.getItem('localObj')).localUserID!=null){ + 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; + $scope.todayFolloupDetails = response.data.todayFolloupDetails.trackingDetails; + $scope.emptyDataToday = false; + } + else { + $scope.todayFolloupDetails = ""; + $scope.emptyDataToday = true; + } + if (response.data.todayPendingStatus) { + $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); + + $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 { + $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 { - } else { + $scope.emptyDataToday = true; + $scope.emptyDataPending = true; - $scope.emptyDataToday = true; - $scope.emptyDataPending = true; - - } - }); + } +}); +} }; }]);