call tracking

This commit is contained in:
venbatechnologies@gmail.com 2019-01-05 15:35:17 +05:30
parent ee2eb5ef3d
commit c89f2841f4
6 changed files with 184 additions and 19 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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');
}

View File

@ -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');
}

View File

@ -1295,7 +1295,7 @@
</div>
</a>
<ul class="sub-menu">
<li ui-sref-active="active">
<li ui-sref-active="active" >
<a ui-sref="app.call.tracking" ng-click="checkStaff()">
<span class="title" translate="sidebar.nav.tracking.details"> ADD/VIEW DETAILS </span>
</a>
@ -1317,6 +1317,28 @@
</li>-->
<!-- <li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.close" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.close"> CLOSE DETAILS </span>
</a>
</li> -->
<li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.pending" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.pending"> PENDING DETAILS </span>
</a>
</li>
<li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.leadcount" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.leadcount"> Staff Lead DETAILS </span>
</a>
</li>
</ul>
</li>
@ -1727,6 +1749,31 @@
</li>-->
<!-- <li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.close" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.close"> CLOSE DETAILS </span>
</a>
</li>
-->
<li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.pending" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.pending"> PENDING DETAILS </span>
</a>
</li>
<li ui-sref-active="active" ng-if="is_active_CallTrackAccess == '1'">
<a ui-sref="app.call.leadcount" ng-click="checkAdmin()">
<span class="title" translate="sidebar.nav.tracking.leadcount"> Staff Lead DETAILS </span>
</a>
</li>
</ul>
</li>