From c89f2841f4a9d69757f38eb885bef524ca18ca67 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 5 Jan 2019 15:35:17 +0530 Subject: [PATCH] call tracking --- .../application/models/Calltracking_model.php | 127 ++++++++++++++++-- Apollo/api/application/models/Login_model.php | 8 +- .../assets/js/controllers/callTrackingCtrl.js | 8 ++ Apollo/assets/js/controllers/loginCtrl.js | 4 + Apollo/assets/js/controllers/sessionCtrl.js | 7 + Apollo/assets/views/partials/nav.html | 49 ++++++- 6 files changed, 184 insertions(+), 19 deletions(-) diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 65a719d6..42753040 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -216,6 +216,43 @@ class Calltracking_model extends CI_Model { { // if($userType != SUPER_ADMIN OR $userType== SUPER_ADMIN){ + + $userno = $requestedBy; + $branch = $branchID; + $EMPID = ''; + + $this->db->select('StaffID'); + $this->db->from('T_Login'); + $this->db->where('ID',$userno); + $EmpidDetails = $this->db->get(); + + $Empidarray = $EmpidDetails->result(); + + foreach($Empidarray as $em) + { + $EMPID = $em->StaffID; + } + + $this->db->select('CallModuleAccess'); + $this->db->from('T_Staff_BranchAccess'); + $this->db->where('StaffID',$EMPID); + $this->db->where('BranchCode',$branch); + $callaccessdetails = $this->db->get(); + + $callaccessdetails = $callaccessdetails->result(); + + $CallModuleAccess='0'; + + foreach($callaccessdetails as $ca) + { + if($ca->CallModuleAccess !='') + { + $CallModuleAccess = $ca->CallModuleAccess; + } + + } + + $this->db->select('LO.ID,ST.StaffID,ST.Firstname'); $this->db->from(LOGIN.' as LO'); $this->db->join(STAFF_BRANCH.' as STB', 'STB.StaffID = LO.StaffID'); @@ -224,22 +261,28 @@ class Calltracking_model extends CI_Model { $this->db->where('ST.IsActive',$status); $this->db->where('STB.IsActive',$status); $this->db->where('BR.IsActive',$status); - if($userType== ADMIN){ - $this->db->where('STB.BranchCode',$branchID); - $this->db->where('LO.ListCode !=',SUPER_ADMIN); - } - if($userType== EMPLOYEE){ - $this->db->where('STB.BranchCode',$branchID); - $this->db->where('LO.ID',$requestedBy); - } - if($userType== SUPER_ADMIN){ + // if($userType== ADMIN){ + // $this->db->where('STB.BranchCode',$branchID); + // $this->db->where('LO.ListCode !=',SUPER_ADMIN); + // } + // if($userType== EMPLOYEE){ + // $this->db->where('STB.BranchCode',$branchID); + // $this->db->where('LO.ID',$requestedBy); + // } + if(($userType== SUPER_ADMIN)||($CallModuleAccess == '1')){ $this->db->where('STB.BranchCode',$branchID); } - if($userType== TRAINEE){ - $this->db->where('STB.BranchCode',$branchID); + else + { + $this->db->where('STB.BranchCode',$branchID); $this->db->where('LO.ID',$requestedBy); } + + // if($userType== TRAINEE){ + // $this->db->where('STB.BranchCode',$branchID); + // $this->db->where('LO.ID',$requestedBy); + // } $staffDetails=$this->db->get(); if($staffDetails){ $result_staff = array(); @@ -277,6 +320,8 @@ class Calltracking_model extends CI_Model { }*/ + // print_r($this->db->last_query());die(); + return $result_staff; } @@ -586,7 +631,7 @@ class Calltracking_model extends CI_Model { $leadDet=$this->db->get(); - // print_r($this->db->last_query());die(); + // print_r($this->db->last_query());die(); if($this->db->affected_rows()==0){ $result_array['trackingStatus']=false; @@ -663,7 +708,9 @@ class Calltracking_model extends CI_Model { $this->db->select('*'); $this->db->from('T_Lead_Details'); - $this->db->where('DATE(CreatedOn)',$todayDate); + $this->db->join('T_Lead_Tracking','T_Lead_Tracking.LeadID=T_Lead_Details.LeadID'); + $this->db->where('DATE(T_Lead_Details.CreatedOn)',$todayDate); + $this->db->where('T_Lead_Tracking.CreatedBranch',$search['CreatedBranch']); $numberDetails = $this->db->get(); $number=$numberDetails->result(); @@ -909,6 +956,45 @@ class Calltracking_model extends CI_Model { public function getLoadFollowupDetails($trackingID) { + //sprint_r($trackingID);die(); + $userno = $trackingID['UpdatedBy']; + $branch = $trackingID['CreatedBranch']; + $EMPID = ''; + + $this->db->select('StaffID'); + $this->db->from('T_Login'); + $this->db->where('ID',$userno); + $EmpidDetails = $this->db->get(); + + $Empidarray = $EmpidDetails->result(); + + foreach($Empidarray as $em) + { + $EMPID = $em->StaffID; + } + + $this->db->select('CallModuleAccess'); + $this->db->from('T_Staff_BranchAccess'); + $this->db->where('StaffID',$EMPID); + $this->db->where('BranchCode',$branch); + $callaccessdetails = $this->db->get(); + + $callaccessdetails = $callaccessdetails->result(); + + $CallModuleAccess='0'; + + foreach($callaccessdetails as $ca) + { + if($ca->CallModuleAccess !='') + { + $CallModuleAccess = $ca->CallModuleAccess; + } + + } + + + + $this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.CreatedBranch,LT.PendingDocStatus,BR.BranchName,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.ReferredBy,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName'); $this->db->from(LEAD_DETAILS.' as LD'); $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); @@ -923,7 +1009,10 @@ class Calltracking_model extends CI_Model { $this->db->where('LT.CreatedBranch', $trackingID['CreatedBranch']); } - if ($trackingID['requestedDept'] == EMPLOYEE){ + // if ($trackingID['requestedDept'] == EMPLOYEE){ + + + if (($CallModuleAccess == '0')&& ($trackingID['requestedDept'] != SUPER_ADMIN)){ $this->db->where('LT.AssignedTo', $trackingID['UpdatedBy']); $this->db->where('LT.CreatedBranch', $trackingID['CreatedBranch']); @@ -932,6 +1021,11 @@ class Calltracking_model extends CI_Model { $leadDet=$this->db->get(); + + // print_r($this->db->last_query());die(); + + //print_r($leadDet->result());die(); + if($leadDet){ $result_array = array(); $result_array['followupStatus']=true; @@ -966,8 +1060,10 @@ class Calltracking_model extends CI_Model { $result[]=$tracking_array; + //print_r($result);die(); } + $result_array['trackingDetails']=$result; $result_array['statusDetails']=$this->getStatus($activityID); $result_array['staffDetails']=$this->getStaff("1",$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']); @@ -975,6 +1071,9 @@ class Calltracking_model extends CI_Model { $result_array['trackingDetails']=$result; + + //print_r($result_array['trackingDetails']);die(); + } else{ $result_array['followupStatus']=false; diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index eb526a35..da9eafa5 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -143,7 +143,7 @@ class Login_model extends CI_Model // echo 'no _if';die(); // print_r($loginDetails);die(); - $this->db->select('LO.MobileNumber, LO.ListCode, LO.ID, ST.IsActive,LO.StaffID'); + $this->db->select('LO.MobileNumber, LO.ListCode, LO.ID, ST.IsActive,LO.StaffID,ST.BranchCode,SC.CallModuleAccess'); $this->db->from('' . LOGIN . ' as LO'); $this->db->join('' . STAFF . ' as ST', 'LO.StaffID = ST.StaffID'); $this->db->join('' . STAFF_BRANCH . ' as SC', 'SC.StaffID = ST.StaffID'); @@ -154,9 +154,9 @@ class Login_model extends CI_Model // $this->db->where('BR.Is_StudentWebAccessActive', 1); $responseDetails = $this->db->get()->first_row(); - //print_r($responseDetails);die(); + // print_r($responseDetails);die(); - // print_r($this->db->last_query());die(); + //print_r($this->db->last_query());die(); if($responseDetails) @@ -207,7 +207,7 @@ class Login_model extends CI_Model $superadminpwd= md5($password); - $this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode, t2.FinanceModuleAccess'); + $this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode, t2.FinanceModuleAccess,t2.CallModuleAccess'); $this->db->from('' . LOGIN . ' as t1'); $this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT'); $this->db->where('t1.MobileNumber', $mobile); diff --git a/Apollo/assets/js/controllers/callTrackingCtrl.js b/Apollo/assets/js/controllers/callTrackingCtrl.js index 680e7a67..a09f00d2 100755 --- a/Apollo/assets/js/controllers/callTrackingCtrl.js +++ b/Apollo/assets/js/controllers/callTrackingCtrl.js @@ -1362,6 +1362,8 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", $scope.afterRefresh = function () { + + $rootScope.myModel1 = { "status":'', "date": '', @@ -1801,6 +1803,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", } }; $rootScope.loadFollowupDetails = function (trackID) { + + // alert('innn');die(); + // $scope.value = $rootScope.trackingid1; // console.log($scope.value+'caltracking'); if(trackID==null || trackID=='') @@ -1850,6 +1855,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", if (response.data.status==200 && response.data.followupStatus) { $rootScope.followupDetails=response.data.trackingDetails[0]; + + console.log($rootScope.followupDetails); + $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode; if($rootScope.followupDetails.followupDetails[0].FollowupOn.length==10){ $rootScope.currentDate1 = new Date($rootScope.followupDetails.followupDetails[0].FollowupOn.substring(6,10)+'-'+$rootScope.followupDetails.followupDetails[0].FollowupOn.substring(3,5)+'-'+$rootScope.followupDetails.followupDetails[0].FollowupOn.substring(0,2)); diff --git a/Apollo/assets/js/controllers/loginCtrl.js b/Apollo/assets/js/controllers/loginCtrl.js index a41ba2ea..69679fd5 100755 --- a/Apollo/assets/js/controllers/loginCtrl.js +++ b/Apollo/assets/js/controllers/loginCtrl.js @@ -72,11 +72,15 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc "localBranchID": $scope.responseData.BranchCode, 'localType': $scope.responseData.ListCode, 'is_DayBookApproval_Access': $scope.responseData.FinanceModuleAccess, + 'is_CalltrackApproval_Access': $scope.responseData.CallModuleAccess, 'localOn': localDateTime, 'status': 'active' } ipCookie('cookiechk', $scope.localStore, { expires: 21 }); localStorage.setItem('localObj', JSON.stringify($scope.localStore)); + + //console.log($scope.localStore); + if($scope.responseData.ListCode=='R001'){ $state.go('app.studentView'); } diff --git a/Apollo/assets/js/controllers/sessionCtrl.js b/Apollo/assets/js/controllers/sessionCtrl.js index 96f149ad..6a2b3b66 100755 --- a/Apollo/assets/js/controllers/sessionCtrl.js +++ b/Apollo/assets/js/controllers/sessionCtrl.js @@ -15,6 +15,7 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie', // $window.location.reload(); $scope.getLoginDash = ''; + $scope.is_active_CallTrackAccess = '0'; if (localDetail != null) { if (localDetail.localType == 'R004') { @@ -22,15 +23,21 @@ app.controller('sessionCtrl', ["$scope", "$localStorage", "$state", 'ipCookie', } else if (localDetail.localType == 'R003') { $scope.getLoginDash = 'Admin'; $scope.is_active_DayBookAprlAccess = localDetail.is_DayBookApproval_Access; + $scope.is_active_CallTrackAccess = localDetail.is_CalltrackApproval_Access; + } else if (localDetail.localType == 'R002') { $scope.getLoginDash = 'staff'; $scope.is_active_DayBookAprlAccess = localDetail.is_DayBookApproval_Access; + $scope.is_active_CallTrackAccess = localDetail.is_CalltrackApproval_Access; } else if (localDetail.localType == 'R001') { $scope.getLoginDash = 'student'; }else if (localDetail.localType == 'R005') { $scope.getLoginDash = 'trainee'; + $scope.is_active_CallTrackAccess = localDetail.is_CalltrackApproval_Access; } + + // console.log($scope.is_active_CallTrackAccess); } else { $state.go('login.signin'); } diff --git a/Apollo/assets/views/partials/nav.html b/Apollo/assets/views/partials/nav.html index 4e9ba27b..ddbea47b 100755 --- a/Apollo/assets/views/partials/nav.html +++ b/Apollo/assets/views/partials/nav.html @@ -1295,7 +1295,7 @@ @@ -1727,6 +1749,31 @@ --> + + +
  • + + PENDING DETAILS + +
  • + + + +
  • + + Staff Lead DETAILS + +
  • + + + + +