From d19263b5560ae9a29d6a767141db5ce437399307 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 4 Jan 2019 16:26:02 +0530 Subject: [PATCH] call tracking --- Apollo/api/application/config/constants.php | 1 + .../controllers/Employee_Controller.php | 9 +- .../application/models/Calltracking_model.php | 134 ++++++++++++++++-- .../api/application/models/Employee_model.php | 3 +- .../assets/js/controllers/callTrackingCtrl.js | 4 +- Apollo/assets/js/controllers/employeeCtrl.js | 23 ++- .../views/editEmployeeBranchDetails.html | 68 +++++++-- Apollo/assets/views/employeeDetails.html | 24 +++- 8 files changed, 236 insertions(+), 30 deletions(-) diff --git a/Apollo/api/application/config/constants.php b/Apollo/api/application/config/constants.php index 152ae0db..5be79ed6 100755 --- a/Apollo/api/application/config/constants.php +++ b/Apollo/api/application/config/constants.php @@ -89,6 +89,7 @@ defined('ADMIN') OR define('ADMIN','R003'); defined('EMPLOYEE') OR define('EMPLOYEE','R002'); defined('STUDENT') OR define('STUDENT','R001'); defined('TRAINEE') OR define('TRAINEE','R005'); +defined('CALLADMIN') OR define('CALLADMIN','R006'); //status code defined('OPEN') OR define('OPEN','S001'); defined('CLOSE') OR define('CLOSE','S002'); diff --git a/Apollo/api/application/controllers/Employee_Controller.php b/Apollo/api/application/controllers/Employee_Controller.php index b281cbe4..e4834ee2 100755 --- a/Apollo/api/application/controllers/Employee_Controller.php +++ b/Apollo/api/application/controllers/Employee_Controller.php @@ -175,7 +175,7 @@ class Employee_Controller extends REST_Controller { // add employee without image public function addEmployee_post() { $data = $this->post('data'); - + $createdBy = $this->post('createdBy'); $imagename = ''; @@ -204,6 +204,8 @@ class Employee_Controller extends REST_Controller { $req['FinanceModuleAccess'] = $data['finaceModuleAccess']; + $req['CallModuleAccess'] = $data['callModuleAccess']; + $req['DOJ'] = $data['dateofjoining']; $req['JobResponsibility'] = $data['jobResponsibility']; // $req['DOJ'] = $data['dateofjoining']; @@ -448,6 +450,7 @@ class Employee_Controller extends REST_Controller { $req['JobResponsibility'] = $this->post('JobResponsibility'); $req['FinanceModuleAccess'] = $this->post('FinanceModuleAccess') == 1 ? '1' : '0'; + $req['CallModuleAccess'] = $this->post('CallModuleAccess') == 1 ? '1' : '0'; $req['CreatedBy'] = $this->post('updateBy'); $date = date('Y-m-d H:i:s'); $req['IsActive'] = '1'; @@ -480,12 +483,16 @@ class Employee_Controller extends REST_Controller { $req['HomeBranch'] = $this->post('HomeBranch'); $req['FinanceModuleAccess'] = $this->post('FinanceModuleAccess') == 1 ? '1' : '0'; + + $req['CallModuleAccess'] = $this->post('CallModuleAccess') == 1 ? '1' : '0'; $req['IsActive'] = $this->post('IsActive') == 1 ? '1' : '0'; // echo $req['FinanceModuleAccess'];exit(); $req['UpdatedBy'] = $this->post('updateBy'); $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; + // echo $req['CallModuleAccess'];die(); + $updateFor = $this->post('ID'); $updateBranch = $this->employee_model->upate_employee_branch( $updateFor, $req );// Check if the employee exist diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 13284f20..65a719d6 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -235,6 +235,11 @@ class Calltracking_model extends CI_Model { if($userType== SUPER_ADMIN){ $this->db->where('STB.BranchCode',$branchID); } + + if($userType== TRAINEE){ + $this->db->where('STB.BranchCode',$branchID); + $this->db->where('LO.ID',$requestedBy); + } $staffDetails=$this->db->get(); if($staffDetails){ $result_staff = array(); @@ -486,6 +491,58 @@ class Calltracking_model extends CI_Model { public function getTrackingDetails($search=null,$status) { + + //print_r($search);die(); + + $userno = $search['requestedBy']; + $branch = $search['CreatedBranch']; + //echo $branch;die(); + + // echo $search['requestedDept'] ;die(); + + $EMPID = ''; + + $this->db->select('StaffID'); + $this->db->from('T_Login'); + $this->db->where('ID',$userno); + $EmpidDetails = $this->db->get(); + + //print_r($EmpidDetails->result());die(); + + $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(); + + // print_r($callaccessdetails);die() ; + + $CallModuleAccess='0'; + + foreach($callaccessdetails as $ca) + { + if($ca->CallModuleAccess !='') + { + $CallModuleAccess = $ca->CallModuleAccess; + } + + } + + // echo $CallModuleAccess;die(); + + + + $this->db->select('LTF.FollowupOn,LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.Flag,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName,LTF.FollowupComments,LT.ReferredBy as ReferredBy'); $this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF'); $this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID'); @@ -497,14 +554,16 @@ class Calltracking_model extends CI_Model { $this->db->where('PLD1.ListName !=', 'CLOSE'); $this->db->where('LTF.IsActive', '1'); - if($search['CreatedBranch'] !='All' AND $search['requestedDept'] != EMPLOYEE){ + if($search['CreatedBranch'] !='All'){ $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); } - if ($search['requestedDept'] == EMPLOYEE){ + // if (($search['requestedDept'] == EMPLOYEE)||($search['requestedDept'] == TRAINEE)){ + + if (($CallModuleAccess == '0')&&($search['requestedDept'] != SUPER_ADMIN)){ $this->db->where('LT.AssignedTo', $search['requestedBy']); - $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); + // $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); } if($search['searchDate']!='' OR $search['searchDate']!=null){ @@ -526,6 +585,9 @@ class Calltracking_model extends CI_Model { $leadDet=$this->db->get(); + + // print_r($this->db->last_query());die(); + if($this->db->affected_rows()==0){ $result_array['trackingStatus']=false; $result_array['trackingDetails']=""; @@ -572,7 +634,7 @@ class Calltracking_model extends CI_Model { } } - +//print_r($result_array);die(); if($status!=true) @@ -585,8 +647,8 @@ class Calltracking_model extends CI_Model { $result_array['pendingTrackingDetails']=1; } - // print_r($result_array); - // die(); + // print_r($result_array); + // die(); //print_r($this->db->last_query()); @@ -618,6 +680,61 @@ class Calltracking_model extends CI_Model { public function getPrevPendingTrackingDetails($search=null) { + + + + + $userno = $search['requestedBy']; + $branch = $search['CreatedBranch']; + // echo $userno;die(); + + // echo $search['requestedDept'] ;die(); + + $EMPID = ''; + + $this->db->select('StaffID'); + $this->db->from('T_Login'); + $this->db->where('ID',$userno); + $EmpidDetails = $this->db->get(); + + //print_r($EmpidDetails->result());die(); + + $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(); + + // print_r($callaccessdetails);die() ; + + $CallModuleAccess='0'; + + foreach($callaccessdetails as $ca) + { + if($ca->CallModuleAccess !='') + { + $CallModuleAccess = $ca->CallModuleAccess; + } + + } + + + + + + + + $this->db->select('LTF.FollowupOn,LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.Flag,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName,LTF.FollowupComments'); $this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF'); $this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID'); @@ -628,12 +745,13 @@ class Calltracking_model extends CI_Model { $this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode'); $this->db->where('LTF.IsActive', '1'); $this->db->where('PLD1.ListName !=', 'CLOSE'); - if($search['CreatedBranch'] !='All' AND $search['requestedDept'] != EMPLOYEE){ + if($search['CreatedBranch'] !='All'){ $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); } - if ($search['requestedDept'] == EMPLOYEE){ + // if ($search['requestedDept'] == EMPLOYEE + if (($CallModuleAccess == '0')&& ($search['requestedDept'] != SUPER_ADMIN)){ $this->db->where('LT.AssignedTo', $search['requestedBy']); $this->db->where('LT.CreatedBranch', $search['CreatedBranch']); diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php index 605098d5..365d0ae4 100755 --- a/Apollo/api/application/models/Employee_model.php +++ b/Apollo/api/application/models/Employee_model.php @@ -351,7 +351,7 @@ class Employee_model extends CI_Model // add employee public function add_employee($empArr, $createdBy, $imageName, $imageSource, $imageSize) { - // print_r($empArr);exit(); + //print_r($empArr);exit(); if( $imageSource == '') { // add employee without image $imageNameDb = 'default.jpeg'; $empArr['ProfilePicPath'] = "employee/".$imageNameDb; @@ -364,6 +364,7 @@ class Employee_model extends CI_Model $branchArr['ListCode'] = $empArr['ListCode']; $branchArr['JobResponsibility'] = $empArr['JobResponsibility']; $branchArr['FinanceModuleAccess'] = $empArr['FinanceModuleAccess']; + $branchArr['CallModuleAccess'] = $empArr['CallModuleAccess']; $branchArr['HomeBranch'] = 1; $this->db->insert(STAFF_BRANCH, $branchArr); if ($this->db->affected_rows() == '1') { diff --git a/Apollo/assets/js/controllers/callTrackingCtrl.js b/Apollo/assets/js/controllers/callTrackingCtrl.js index 9877526a..680e7a67 100755 --- a/Apollo/assets/js/controllers/callTrackingCtrl.js +++ b/Apollo/assets/js/controllers/callTrackingCtrl.js @@ -437,9 +437,11 @@ $scope.trackingTodayno=0; - // console.log(myModel); + // console.log(logcheck); var logcheck = JSON.parse(localStorage.getItem('localObj')); + //console.log(logcheck); + const LOCALTYPE = logcheck.localType; if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE=='R005')) { diff --git a/Apollo/assets/js/controllers/employeeCtrl.js b/Apollo/assets/js/controllers/employeeCtrl.js index 8d911999..2281944e 100755 --- a/Apollo/assets/js/controllers/employeeCtrl.js +++ b/Apollo/assets/js/controllers/employeeCtrl.js @@ -242,6 +242,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'JobResponsibility': '', 'IsActive': '', 'FinanceModuleAccess': '', + 'callModuleAccess':'', 'HomeBranch': '', 'IsActive': '' } @@ -257,6 +258,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ $scope.empEditBranchDetails.BranchCode = p.BranchCode; $scope.empEditBranchDetails.JobResponsibility = p.JobResponsibility; $scope.empEditBranchDetails.FinanceModuleAccess = p.FinanceModuleAccess == 1 ? true : false; + $scope.empEditBranchDetails.callModuleAccess = p.CallModuleAccess == 1 ? true : false; $scope.empEditBranchDetails.HomeBranch = p.HomeBranch; $scope.empEditBranchDetails.IsActive = p.IsActive == 1 ? true : false ; } @@ -274,6 +276,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'JobResponsibility': '', 'IsActive': '', 'FinanceModuleAccess': '', + 'callModuleAccess':'', 'HomeBranch': '', 'IsActive': '' } @@ -311,6 +314,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'updateBranch': $scope.empEditBranchDetails.BranchCode, 'updateBy': localDetails.localUserID, 'FinanceModuleAccess': $scope.empEditBranchDetails.FinanceModuleAccess == true ? 1 : 0, + 'CallModuleAccess': $scope.empEditBranchDetails.callModuleAccess == true ? 1 : 0, 'HomeBranch': $scope.empEditBranchDetails.HomeBranch, 'IsActive': $scope.empEditBranchDetails.IsActive == true ? 1 : 0 } @@ -376,10 +380,13 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'BranchCode': '', 'JobResponsibility': '', 'IsActive': '', - 'FinanceModuleAccess': '' + 'FinanceModuleAccess': '', + 'callModuleAccess':'' } $scope.addEmpBranchDetails = function(emp, form) { + + // console.log(form);return false;; if (form.$invalid) { var field = null, firstError = null; for (field in form) { @@ -403,8 +410,9 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'updateBranch': $scope.empAddBranchDetails.BranchCode, 'updateBy': localDetails.localUserID, 'FinanceModuleAccess': $scope.empAddBranchDetails.FinanceModuleAccess == true ? 1 : 0, + 'CallModuleAccess': $scope.empAddBranchDetails.callModuleAccess == true ? 1 : 0, } - + // console.log($scope.addEmpNewBranch);return false; var req = { method: 'POST', url: apiPoint.url + 'addEmpBranchDetail/', @@ -600,6 +608,10 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ // add empolyee $scope.employeeForm = { submit: function (form, myModel) { + + + + //alert('in');return false; // var formate = "yyyy-MM-dd'T'HH:mm:ssZ"; // var date = $filter('date')(new Date($scope.myModel.dateofbirth), formate); // alert(date); @@ -631,6 +643,9 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ // alert(JSON.stringify($scope.myModel)); + +//console.log(myModel);return false; + var idProof = $scope.files[0]; if (idProof !== undefined) { var formData = new FormData(); @@ -704,7 +719,9 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'role': '', 'jobResponsibility': '', 'switchsetting': true, - 'finaceModuleAccess': false + 'finaceModuleAccess': false, + 'callModuleAccess':false + }; } } diff --git a/Apollo/assets/views/editEmployeeBranchDetails.html b/Apollo/assets/views/editEmployeeBranchDetails.html index feb00509..7943150b 100755 --- a/Apollo/assets/views/editEmployeeBranchDetails.html +++ b/Apollo/assets/views/editEmployeeBranchDetails.html @@ -12,18 +12,13 @@ - - - - - - + + + + + + + @@ -33,6 +28,12 @@ + + + + +
Branch - Role - JobResponsibility - FinanceModule Access - Status - - BranchRoleJobResponsibilityFinanceModule AccessCallTracking AccessStatus
{{s.JobResponsibility}} Active In-ActiveActive + In-ActiveActive In-Active @@ -105,6 +106,27 @@ + + + +
+ +
+ + +
+ +
+ + + + + +
+ + + +
+ +
+ + +
+ +
+ + + + + + +
diff --git a/Apollo/assets/views/employeeDetails.html b/Apollo/assets/views/employeeDetails.html index 27f72bb9..3c476def 100755 --- a/Apollo/assets/views/employeeDetails.html +++ b/Apollo/assets/views/employeeDetails.html @@ -493,11 +493,27 @@
-
+ +
+ +
+ + +
+ +
+ + + + + + +