diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php
index 9bb82924..6583c9f4 100644
--- a/Apollo/api/application/models/Calltracking_model.php
+++ b/Apollo/api/application/models/Calltracking_model.php
@@ -118,7 +118,7 @@ class Calltracking_model extends CI_Model {
public function getStatus()
{
$this->db->select('ListCode,ListName');
- $this->db->where('ListCode !=','S003');
+ $this->db->where('ListCode !=',REOPEN);
$this->db->where('ListGroup','1');
$this->db->order_by('ListCode','ASC');
$status = $this->db->get(PICK_LIST_DETAILS);
@@ -407,7 +407,9 @@ class Calltracking_model extends CI_Model {
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$todayFollowupDate=$now->format('d-m-Y');
- $follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,'S001');
+
+ $todayDateTime=$now->format('Y-m-d');
+ $follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1');
if($follouwpDetails){
$result_array['todayStatus']=true;
$result_array['todayFolloupDetails']=$follouwpDetails;
@@ -417,8 +419,28 @@ class Calltracking_model extends CI_Model {
$result_array['todayFolloupDetails']="";
}
- /* $follouwpPendingDetails=$this->getPendingFollowupDetails($todayFollowupDate,'S001');
-print_r($follouwpPendingDetails);die();*/
+ $follouwpPendingDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'2');
+
+ if($follouwpPendingDetails){
+ $result_array['todayPendingStatus']=true;
+ $result_array['PendingFolloupDetails']=$follouwpPendingDetails;
+ }
+ else{
+ $result_array['todayPendingStatus']=false;
+ $result_array['PendingFolloupDetails']="";
+
+ }
+ $todayLeadDetails=$this->todayFollowupDetails($todayDateTime,OPEN,'3');
+ if($todayLeadDetails){
+ $result_array['todayLeadStatus']=true;
+ $result_array['todayLeadDetails']=$todayLeadDetails;
+ }
+ else{
+ $result_array['todayLeadStatus']=false;
+ $result_array['todayLeadDetails']="";
+
+ }
+
return $result_array;
}
@@ -426,19 +448,149 @@ print_r($follouwpPendingDetails);die();*/
* get date wise followup details
* @params date and status and check status
* */
- public function todayFollowupDetails($todayDate=null,$status=null)
+ public function todayFollowupDetails($todayDate=null,$status=null,$check=null)
{
$this->db->distinct();
+ $this->db->select('LT.TrackingID');
+ $this->db->from(LEAD_DETAILS.' as LD');
+ $this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
+ $this->db->order_by('LT.TrackingID','ASC');
+ if($check!='3'){
+ $this->db->where('LT.StatusCode !=',$status);
+ }
+ else if($check=='3'){
+ $this->db->like('LD.CreatedOn', $todayDate, 'after');
+ }
+
+ $leadDetails=$this->db->get();
+ if($leadDetails){
+ $result_array = array();
+ foreach ($leadDetails->result() as $row){
+ $this->db->select('LTF.TrackingID,LTF.InteractionId');
+ $this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
+ $this->db->where('LTF.TrackingID',$row->TrackingID);
+ $lastFollowpID=$this->db->get()->last_row();
+ // get last followup details date wise
+ $this->db->distinct();
+ $this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
+ $this->db->from(LEAD_DETAILS.' as LD');
+ $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
+ $this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
+ $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
+ $this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
+ $this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
+
+ // check today date based follwup details
+ if($check=='1'){
+ $this->db->where('LTF.FollowupOn',$todayDate);
+ $this->db->where('LT.StatusCode !=',$status);
+ }
+ // check today date based pending followp details
+ else if($check=='2'){
+ $this->db->where('LTF.FollowupOn <= ',$todayDate);
+ $this->db->where('LT.StatusCode !=',$status);
+ }
+ else if($check=='3'){
+ $this->db->like('LD.CreatedOn', $todayDate, 'after');
+ }
+ $trackDetails=$this->db->get();
+ foreach ($trackDetails->result() as $row1)
+ {
+ $tracking_array["LeadID"]=$row1->LeadID;
+ $tracking_array["LeadName"]=$row1->LeadName;
+ $tracking_array["MobileNumber"]=$row1->MobileNumber;
+ $tracking_array["TrackingID"]=$row1->TrackingID;
+ $tracking_array["FollowupOn"]=$row1->FollowupOn;
+ $tracking_array["StatusCode"]=$row1->StatusCode;
+ $tracking_array["statusListName"]=$row1->statusListName;
+ $tracking_array["ListCode"]=$row1->ListCode;
+ $tracking_array["ListName"]=$row1->ListName;
+
+
+ $result[]=$tracking_array;
+
+
+ }
+
+
+
+ }
+ $result_array['trackingDetails']=$result;
+ return $result_array;
+
+ }
+
+ else{
+ return false;
+ }
+
+ }
+
+ /*
+ * get today created lead details for dashboard
+ * @params today date
+ * created by kms
+ * */
+ public function todayLeadDetails($todayDate=null)
+ {
+ /* $this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
- $this->db->where('LTF.FollowupOn',$todayDate);
- $this->db->where('LT.StatusCode',$status);
- $this->db->order_by('LT.TrackingID','ASC');
- return $this->db->get()->result();
+ $this->db->like('LD.CreatedOn', $todayDate, 'after');
+ $this->db->order_by('LT.TrackingID','DESC');
+
+ return $this->db->get()->result();*/
+
+ $this->db->distinct();
+ $this->db->select('LT.TrackingID,LD.LeadID');
+ $this->db->from(LEAD_DETAILS.' as LD');
+ $this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
+ $this->db->order_by('LD.LeadID','DESC');
+ $this->db->like('LD.CreatedOn', $todayDate, 'after');
+ $leadDetails=$this->db->get();
+ if($leadDetails){
+ foreach ($leadDetails->result() as $row){
+ $this->db->select('LTF.TrackingID,LTF.InteractionId');
+ $this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
+ $this->db->where('LTF.TrackingID',$row->TrackingID);
+ $lastFollowpID=$this->db->get()->last_row();
+ // get last followup details date wise
+ $this->db->distinct();
+ $this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
+ $this->db->from(LEAD_DETAILS.' as LD');
+ $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
+ $this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
+ $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
+ $this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
+ $this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
+ foreach ($trackDetails->result() as $row1)
+ {
+ $tracking_array["LeadID"]=$row1->LeadID;
+ $tracking_array["LeadName"]=$row1->LeadName;
+ $tracking_array["MobileNumber"]=$row1->MobileNumber;
+ $tracking_array["TrackingID"]=$row1->TrackingID;
+ $tracking_array["FollowupOn"]=$row1->FollowupOn;
+ $tracking_array["StatusCode"]=$row1->StatusCode;
+ $tracking_array["statusListName"]=$row1->statusListName;
+ $tracking_array["ListCode"]=$row1->ListCode;
+ $tracking_array["ListName"]=$row1->ListName;
+
+ $result[]=$tracking_array;
+
+
+ }
+
+ }
+ }
+
+ else{
+ return false;
+ }
+
}
}
\ No newline at end of file
diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js
index c2c359f9..c905b8a2 100644
--- a/Apollo/assets/js/controllers/dashboardCtrl.js
+++ b/Apollo/assets/js/controllers/dashboardCtrl.js
@@ -10,7 +10,7 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams",
* this method called from view ng-init directive
* created by kms
* */
- $scope.todayFolloupDetails="";
+
$scope.initCallTracking = function () {
var getCallTrack = {
method: 'POST',
@@ -25,15 +25,38 @@ app.controller('dashboardCtrl', ["$scope","toaster", "$filter", "ngTableParams",
$http(getCallTrack).then(function (response) {
if (response.data.status==200) {
if(response.data.todayStatus){
- $scope.todayFolloupDetails=response.data.todayFolloupDetails;
+
+ $scope.todayFolloupDetails=response.data.todayFolloupDetails.trackingDetails;
+ $scope.emptyDataToday=false;
}
else{
- $scope.todayFolloupDetails='EMPTY';
+ $scope.todayFolloupDetails="";
+ $scope.emptyDataToday=true;
}
+ if(response.data.todayPendingStatus){
+ $scope.pendingFolloupDetails=response.data.PendingFolloupDetails.trackingDetails;
+ $scope.emptyDataPending=false;
+ }
+ else{
+ $scope.pendingFolloupDetails="";
+ $scope.emptyDataPending=true;
+ }
+ if(response.data.todayLeadStatus){
+ $scope.leadDetails=response.data.todayLeadDetails.trackingDetails;
+ $scope.emptyDataLead=false;
+ }
+ else{
+ $scope.leadDetails="";
+ $scope.emptyDataLead=true;
+ }
+
+
+
} else {
- $scope.todayFolloupDetails='EMPTY';
+ $scope.emptyDataToday=true;
+ $scope.emptyDataPending=true;
}
});
diff --git a/Apollo/assets/views/dashboard.html b/Apollo/assets/views/dashboard.html
index 0d256d51..e809332f 100644
--- a/Apollo/assets/views/dashboard.html
+++ b/Apollo/assets/views/dashboard.html
@@ -16,17 +16,18 @@