From 1f7bed117b46206e7517fdc04bc7d7c8e27556ff Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 16 Nov 2018 14:58:10 +0530 Subject: [PATCH] call tracking --- Apollo/api/application/config/routes.php | 2 + .../controllers/Call_Tracking_Controller.php | 32 ++- .../application/models/Calltracking_model.php | 35 ++- Apollo/assets/i18n/en.json | 3 +- Apollo/assets/js/config.constant.js | 4 + Apollo/assets/js/config.router.js | 8 + Apollo/assets/js/controllers/staffleadCtrl.js | 257 ++++++++++++++++++ Apollo/assets/views/StaffLeadDetails.html | 70 +++++ Apollo/assets/views/callTrackingDetails.html | 4 +- Apollo/assets/views/partials/nav.html | 16 ++ Apollo/assets/views/stafflead.html | 121 +++++++++ 11 files changed, 547 insertions(+), 5 deletions(-) create mode 100644 Apollo/assets/js/controllers/staffleadCtrl.js create mode 100644 Apollo/assets/views/StaffLeadDetails.html create mode 100644 Apollo/assets/views/stafflead.html diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 1862477e..8941f409 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -99,6 +99,8 @@ $route['autoTrackingDetails'] = 'Call_Tracking_Controller/autoTrackingDetails'; $route['getstaffcallDetails'] = 'Call_Tracking_Controller/getstaffcallDetails'; +$route['getstaffCountDetails'] = 'Call_Tracking_Controller/getstaffCountDetails'; + // university diff --git a/Apollo/api/application/controllers/Call_Tracking_Controller.php b/Apollo/api/application/controllers/Call_Tracking_Controller.php index 590cdb64..78af826d 100755 --- a/Apollo/api/application/controllers/Call_Tracking_Controller.php +++ b/Apollo/api/application/controllers/Call_Tracking_Controller.php @@ -522,7 +522,9 @@ public function getstaffcallDetails_post() $myDate = $this->post('date'); - $todaycalldetails = $this->Calltracking_model->GetStaffCallDetails($branchID,$myDate); + $staff = $this->post('staff'); + + $todaycalldetails = $this->Calltracking_model->GetStaffCallDetails($branchID,$myDate,$staff); if($todaycalldetails) @@ -541,6 +543,34 @@ public function getstaffcallDetails_post() } + +public function getstaffCountDetails_post() +{ + $branchID = $this->post('branch'); + // $myDate = date('Y-m-d'); + + $myDate = $this->post('date'); + + $todaycountdetails = $this->Calltracking_model->GetStaffCountDetails($branchID,$myDate); + + + if($todaycountdetails) + { + $todaycountdetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($todaycountdetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } +} + + + /* * End of call tracking */ diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index c72d1e6b..9ede1145 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -1638,7 +1638,7 @@ class Calltracking_model extends CI_Model { } -public function GetStaffCallDetails($branchID,$myDate) +public function GetStaffCallDetails($branchID,$myDate,$staff) { $this->db->select('LeadName,LD.MobileNumber,IsNewEnquiry,StatusCode,Course,University,FollowupComments,FollowupOn,AssignedStaff,ListName,Firstname,Lastname'); $this->db->from('T_Lead_Tracking_Followup LTF'); @@ -1649,6 +1649,7 @@ public function GetStaffCallDetails($branchID,$myDate) $this->db->join('T_PickListDetails PLD','PLD.ListCode = LTF.StatusName'); $this->db->where("date_format(LTF.CreatedOn,'%Y-%m-%d')=",$myDate); $this->db->where('LT.CreatedBranch',$branchID); + $this->db->where('LTF.AssignedStaff',$staff); $this->db->group_by('InteractionId'); $Details = $this->db->get()->result(); @@ -1672,6 +1673,38 @@ public function GetStaffCallDetails($branchID,$myDate) } + +public function GetStaffCountDetails($branchID,$myDate) +{ + + $this->db->select('AssignedStaff,Firstname,Lastname,SD.StaffID,count(InteractionId) as count'); + $this->db->from('T_Lead_Tracking_Followup LTF'); + $this->db->join('T_Login L','L.ID=LTF.AssignedStaff'); + $this->db->join('T_StaffDetails SD','SD.StaffID=L.StaffID'); + $this->db->where("date_format(LTF.CreatedOn,'%Y-%m-%d')=",$myDate); + $this->db->where('SD.BranchCode',$branchID); + $this->db->group_by('AssignedStaff'); + + $Details = $this->db->get()->result(); + + + // print_r($this->db->last_query());die(); + + if($Details) + { + $result_array['searchst'] = true; + $result_array['details'] = $Details; + } + else + { + $result_array['searchst'] = false; + $result_array['details'] = "No records found!"; + } + + return $result_array; + +} + } \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index 40d48509..80f7ec10 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -146,7 +146,8 @@ "details":"Add/View Leads", "close":"Closed Leads", "pending":"Open Leads", - "lead":"Daywise Leads" + "lead":"Daywise Leads", + "leadcount":"Staffwise Leads" }, "daybook": { "MAIN": "INCOME / EXPENSE", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 986eddc0..95c444a0 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -117,6 +117,10 @@ app.constant('JS_REQUIRES', { * call track * */ 'callTrackingCtrl': 'assets/js/controllers/callTrackingCtrl.js', + /* + * call track + * */ + 'staffleadCtrl': 'assets/js/controllers/staffleadCtrl.js', /* * status * */ diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index d1e89844..5e69bd86 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -489,6 +489,14 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com ncyBreadcrumb: { label: 'Open leads' } + }).state('app.call.leadcount', { + url: '/leadcount', + templateUrl: "assets/views/stafflead.html", + title: 'Staff leads', + resolve: loadSequence('spin', 'ladda', 'angular-ladda', 'staffleadCtrl','ngTable'), + ncyBreadcrumb: { + label: 'Staff leads' + } }).state('app.daybook', { url: '/daybook', template: '
STUDENT STATUS UPDATE
', diff --git a/Apollo/assets/js/controllers/staffleadCtrl.js b/Apollo/assets/js/controllers/staffleadCtrl.js new file mode 100644 index 00000000..783fff2a --- /dev/null +++ b/Apollo/assets/js/controllers/staffleadCtrl.js @@ -0,0 +1,257 @@ +'use strict'; +/*** controller***/ +app.controller('staffleadCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage" ,"$http", "$state","$modal","$log", + function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http,ipCookie ,$state,$modal,$log){ + + //function ($scope, apiPoint, $http, SweetAlert, $state,$modal, md5, ipCookie, $window, dateListDescService) { + + // DataTables configurable options + + + $scope.filters = { + + "from_date": "", + "to_date": "", + + }; + + + var localDetails = JSON.parse(localStorage.getItem('localObj')); + //var localDetails = ipCookie('cookiechk'); + + // console.log(localDetails); + + + // $scope.initHead = function() { +//console.log('rfd'); + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + // } + $scope.universitySearchData = ''; + + + $scope.filters = { + + "to_date": "", + + }; + + + $scope.init = function() + { + + // console.log('in') + var date = new Date(); + var t = new Date(date), + month = '' + (t.getMonth() + 1), + day = '' + t.getDate(), + year = t.getFullYear(); + + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + + var to_dt = [year, month ,day].join('-'); + + $scope.tod = to_dt; + + $scope.GetstaffwiseCounts($scope.tod); + + }; + + + + +$scope.changeDate = function() +{ + + + var to = $scope.filters.to_date; + //alert(to); + + if(to !='') + { + + var t = new Date(to), + month = '' + (t.getMonth() + 1), + day = '' + t.getDate(), + year = t.getFullYear(); + + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + + var to_dt = [year, month ,day].join('-'); + + $scope.tod = to_dt; + + } + + else + { + + var date = new Date(); + var t = new Date(date), + month = '' + (t.getMonth() + 1), + day = '' + t.getDate(), + year = t.getFullYear(); + + if (month.length < 2) month = '0' + month; + if (day.length < 2) day = '0' + day; + + var to_dt = [year, month ,day].join('-'); + + $scope.tod = to_dt; + + + } + + + +$scope.GetstaffwiseCounts($scope.tod); + +} + + +$scope.GetstaffwiseCounts = function (date) + { + + var getcountDetails = { + method: 'POST', + url: apiPoint.url + 'getstaffCountDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + + branch:JSON.parse(localStorage.getItem('localObj')).localBranchID, + date:date, + + } + }; + + + $http(getcountDetails).then(function (response) { + + // console.log(response.data.details); + + if (response.data.status == 200 && response.data.details !='No records found!' ) { + + $scope.SatffCountDetails=response.data.details; + $scope.callnodata=true; + $scope.calldata=false; + + for(var i=0;i<$scope.SatffCountDetails.length;i++) + $scope.SatffCountDetails[i].SL_NO = i+1; + + //console.log($scope.SatffCountDetails); + + } else { + // swal("Failed!", "No details Availble", "warning"); + + $scope.calldata=true; + $scope.callnodata=false; + + //console.log($scope.calldata); + + + } + + }); + + + + } + + +$scope.closeDetails = function() +{ + $scope.staffdet = '-1'; +} + + + +$scope.SatffCallDetails + +$scope.staffdet = '-1'; +$scope.AssignedStaff_id =''; + + $scope.getLeadDetails = function (staff) + { + var assignedstaffid = staff.AssignedStaff; + + var checkdate = $scope.tod; + + $scope.AssignedStaff_id =assignedstaffid; + + var getDetails = { + method: 'POST', + url: apiPoint.url + 'getstaffcallDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + + branch:JSON.parse(localStorage.getItem('localObj')).localBranchID, + date:checkdate, + staff:assignedstaffid, + + } + }; + + $http(getDetails).then(function (response) + { + + if (response.data.status == 200 && response.data.details !='No records found!' ) { + + $scope.SatffCallDetails=response.data.details; + $scope.calldetnodata=true; + $scope.calldetdata=false; + // console.log(response.data.details); + + // console.log($scope.SatffCallDetails) + + $scope.staffdet = $scope.SatffCallDetails[0].AssignedStaff; + + //console.log($scope.staffdet) + + for(var i=0;i<$scope.SatffCallDetails.length;i++) + $scope.SatffCallDetails[i].SL_NO = i+1; + + + + } else { + // swal("Failed!", "No details Availble", "warning"); + + $scope.calldetdata=true; + $scope.calldetnodata=false; + + } + + + }); + } + + + + + + }]); + + + + diff --git a/Apollo/assets/views/StaffLeadDetails.html b/Apollo/assets/views/StaffLeadDetails.html new file mode 100644 index 00000000..490dd46d --- /dev/null +++ b/Apollo/assets/views/StaffLeadDetails.html @@ -0,0 +1,70 @@ +
+
+
+ +

Fetching ...

+
+
+

No Records Found

+
+
+ +
+ + Lead Details + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SlNoStaff NameUniversityCourseFollowup DateStudent NameMobile NumberFollow up CommentsStatus
{{p.SL_NO}}{{p.Firstname}}{{p.Lastname}}{{p.University}}{{p.Course}}{{p.FollowupOn}}{{p.LeadName}}{{p.MobileNumber}}{{p.FollowupComments}}{{p.ListName}}
+
+
+
+ +
+
+
+
+ + +
+ + + +
+ +
+ + +
+ + \ No newline at end of file diff --git a/Apollo/assets/views/callTrackingDetails.html b/Apollo/assets/views/callTrackingDetails.html index b1db71d3..a7e2225c 100755 --- a/Apollo/assets/views/callTrackingDetails.html +++ b/Apollo/assets/views/callTrackingDetails.html @@ -671,7 +671,7 @@ - +
- + --> diff --git a/Apollo/assets/views/partials/nav.html b/Apollo/assets/views/partials/nav.html index f20aed6b..a701c45b 100755 --- a/Apollo/assets/views/partials/nav.html +++ b/Apollo/assets/views/partials/nav.html @@ -270,6 +270,14 @@ +
  • + + Staff Lead DETAILS + +
  • + + + +
    +
    +
    + +

    {{ mainTitle }}

    + + Staffwise leads. + +
    + +
    +
    + + +
    + +
    + + +
    +
    +
    + + + +
    + +
    + +

    + + +
    + + +

    + +
    +
    +

    No Records Found !!

    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    S.NoStaff NameCall CountDetails
    {{p.SL_NO}}{{p.Firstname}} {{p.Lastname}}{{p.count}} + +
    + +
    + + + + +
    +
    +
    +
    +
    + +
    \ No newline at end of file