diff --git a/Apollo/api/application/controllers/Call_Tracking_Controller.php b/Apollo/api/application/controllers/Call_Tracking_Controller.php index d781bfb9..9b765e3f 100755 --- a/Apollo/api/application/controllers/Call_Tracking_Controller.php +++ b/Apollo/api/application/controllers/Call_Tracking_Controller.php @@ -56,7 +56,9 @@ class Call_Tracking_Controller extends REST_Controller { { $requestedBy = $this->post('requestedBy'); $mobileNumber = $this->post('mobileNumber'); - $getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber); + $branchID = $this->post('branchID'); + $loginType = $this->post('userType'); + $getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber,$branchID,$loginType); if ($getLeadDetails) { @@ -139,7 +141,7 @@ class Call_Tracking_Controller extends REST_Controller { { $search['requestedBy'] = $this->post('requestedBy'); $search['requestedDept'] = $this->post('requestedDept'); - $search['branchID'] = $this->post('branchId'); + // $search['branchID'] = $this->post('branchId'); $search['searchDate'] = $this->post('searchDate'); $search['CreatedBranch'] = $this->post('branchId'); // $search['searchMobileNumber'] = $this->post('searchMobileNumber'); @@ -176,6 +178,7 @@ class Call_Tracking_Controller extends REST_Controller { $update_followup_details['TrackingID'] = $this->post('trackingID'); $update_followup_details['UpdatedBy'] = $this->post('updatedBy'); $update_followup_details['StatusCode'] = $this->post('status'); + $update_followup_details['AssignedTo'] = $this->post('assignedTo'); $update_followup_details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); // store followup details for insert @@ -217,6 +220,8 @@ class Call_Tracking_Controller extends REST_Controller { $get_details['TrackingID'] = $this->post('trackingID'); $get_details['UpdatedBy'] = $this->post('updatedBy'); $get_details['CreatedBranch'] = $this->post('branchId'); + $get_details['requestedDept'] = $this->post('requestedDept'); + $getLoadDetails = $this->Calltracking_model->getLoadFollowupDetails($get_details); if ($getLoadDetails) @@ -245,6 +250,8 @@ class Call_Tracking_Controller extends REST_Controller { { $search['requestedBy'] = $this->post('requestedBy'); $search['BranchID'] = $this->post('branchId'); + $search['requestedDept'] = $this->post('requestedDept'); + $getdashBoardCallDetails = $this->Calltracking_model->getDashboardTrackingDetails($search); if ($getdashBoardCallDetails) { diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 38bee274..82ecc855 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -13,7 +13,7 @@ class Calltracking_model extends CI_Model { * @params mobile number,requestedby * created by kms * */ - public function getLeadDetails($requestedBy=null,$mobileNumber=null) + public function getLeadDetails($requestedBy=null,$mobileNumber=null,$branchID=null,$userType=null) { $this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address'); $this->db->from(LEAD_DETAILS.' as LD'); @@ -63,7 +63,7 @@ class Calltracking_model extends CI_Model { //$result_array['universityDetails']=$this->getUniversityDetails(); $result_array['activityDetails']=$this->getActivityDetails(); // $result_array['statusDetails']=$this->getStatus(); - $result_array['staffDetails']=$this->getStaff("1"); + $result_array['staffDetails']=$this->getStaff("1",$branchID,$userType,$requestedBy); return $result_array; } @@ -175,12 +175,19 @@ class Calltracking_model extends CI_Model { * * */ - public function getStaff($status=null) + public function getStaff($status=null,$branchID=null,$userType=null,$requestedBy) { $this->db->select('LO.ID,ST.StaffID,ST.Firstname'); $this->db->from(LOGIN.' as LO'); $this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID'); $this->db->where('ST.IsActive',$status); + if($userType== ADMIN){ + $this->db->where('ST.BranchCode',$branchID); + $this->db->where('LO.ListCode !=',SUPER_ADMIN); + } + if($userType== EMPLOYEE){ + $this->db->where('LO.ID',$requestedBy); + } $staffDetails=$this->db->get(); if($staffDetails){ $result_staff = array(); @@ -264,6 +271,11 @@ class Calltracking_model extends CI_Model { $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); } + if ($search['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $search['requestedBy']); + + } if($search['searchDate']!='' OR $search['searchDate']!=null){ /* if(sizeof($search['searchDate']) == '1'){ $this->db->where('LTF.FollowupOn <= ', $search['searchDate'][0]); @@ -348,6 +360,11 @@ class Calltracking_model extends CI_Model { if($search['CreatedBranch'] !='All'){ $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); + } + if ($search['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $search['requestedBy']); + } if(($search['searchDate']!='' OR $search['searchDate']!=null) AND sizeof($search['searchDate']) == '1'){ @@ -492,6 +509,11 @@ class Calltracking_model extends CI_Model { if($trackingID['CreatedBranch'] !='All'){ $this->db->where('LT.CreatedBranch', $trackingID['CreatedBranch']); + } + if ($trackingID['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $trackingID['UpdatedBy']); + } $leadDet=$this->db->get(); @@ -520,7 +542,7 @@ class Calltracking_model extends CI_Model { $tracking_array["AlternateMobile"]=$row->AlternateMobile; $tracking_array["Address"]=$row->Address; $tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID); - $tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch']); + $tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']); $result[]=$tracking_array; @@ -528,6 +550,9 @@ class Calltracking_model extends CI_Model { } $result_array['trackingDetails']=$result; $result_array['statusDetails']=$this->getStatus($activityID); + $result_array['staffDetails']=$this->getStaff("1",$trackingID['CreatedBranch'],$trackingID['requestedDept'],$trackingID['UpdatedBy']); + + $result_array['trackingDetails']=$result; } @@ -546,7 +571,7 @@ class Calltracking_model extends CI_Model { * @params mobile number * created by kms * */ - public function getStudentTrackedID($stuMobile=null,$branchId=null) + public function getStudentTrackedID($stuMobile=null,$branchId=null,$reqDept=null,$updatedBy=null) { $this->db->distinct(); $this->db->select('LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,PLD.ListName'); @@ -555,9 +580,15 @@ class Calltracking_model extends CI_Model { $this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus'); $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.StatusCode'); $this->db->where('LD.MobileNumber',$stuMobile); + if($branchId !='All'){ $this->db->where('LT.CreatedBranch', $branchId); + } + if ($reqDept == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $updatedBy); + } $this->db->order_by('LT.TrackingID','ASC'); @@ -634,6 +665,11 @@ class Calltracking_model extends CI_Model { if($search['BranchID'] !='All'){ $this->db->where('LT.CreatedBranch', $search['BranchID']); + } + if ($search['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $search['requestedBy']); + } $this->db->where('LTF.FollowupOn',$todayDate); $trackDetails=$this->db->get(); @@ -680,6 +716,11 @@ class Calltracking_model extends CI_Model { if($search['BranchID'] !='All'){ $this->db->where('LT.CreatedBranch', $search['BranchID']); + } + if ($search['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $search['requestedBy']); + } $this->db->like('LD.CreatedOn', $todayDate, 'after'); $trackDetails=$this->db->get(); @@ -727,6 +768,11 @@ class Calltracking_model extends CI_Model { if($search['BranchID'] !='All'){ $this->db->where('LT.CreatedBranch', $search['BranchID']); + } + if ($search['requestedDept'] == EMPLOYEE){ + + $this->db->where('LT.AssignedTo', $search['requestedBy']); + } $trackDetails=$this->db->get(); diff --git a/Apollo/assets/js/controllers/callTrackingCtrl.js b/Apollo/assets/js/controllers/callTrackingCtrl.js index 0fff435d..a98e175c 100755 --- a/Apollo/assets/js/controllers/callTrackingCtrl.js +++ b/Apollo/assets/js/controllers/callTrackingCtrl.js @@ -267,7 +267,9 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter", }, data: { requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - mobileNumber:mobile + mobileNumber:mobile, + branchID:JSON.parse(localStorage.getItem('localObj')).localBranchID, + userType:JSON.parse(localStorage.getItem('localObj')).localType, } }; $http(lead).then(function (response) { @@ -1190,6 +1192,7 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", trackingID: followupDetails.TrackingID, date: $scope.nextFollowupDate, status: myModel1.status, + assignedTo: myModel1.assignStaff, comments: myModel1.comments, updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, @@ -1219,7 +1222,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", data: { trackingID: trackID, updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + requestedDept: JSON.parse(localStorage.getItem('localObj')).localType, + } }; @@ -1234,8 +1239,11 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", $rootScope.modifyDate1 = moment(); $rootScope.modifyDate1.add(30, 'days'); $rootScope.futureDate1 = $filter('date')($scope.modifyDate1, 'dd-MM-yyyy'); - $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode; + // $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode; $rootScope.trackingStatus=response.data.statusDetails; + $rootScope.myModel1.assignStaff=$rootScope.followupDetails.AssignedTo; + $rootScope.staffDetails=response.data.staffDetails; + } else { swal("Failed!", response.data.message, "error"); } diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index a17c4394..7bfd2aa4 100755 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -21,7 +21,8 @@ app.controller('dashboardCtrl', ["$scope","$rootScope", "toaster", "$filter", "n }, data: { requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + requestedDept: JSON.parse(localStorage.getItem('localObj')).localType } }; diff --git a/Apollo/assets/views/callTrackingFollowup.html b/Apollo/assets/views/callTrackingFollowup.html index b424336f..a81e08c1 100755 --- a/Apollo/assets/views/callTrackingFollowup.html +++ b/Apollo/assets/views/callTrackingFollowup.html @@ -151,13 +151,26 @@ + + Assigned To + + + + Status -