This commit is contained in:
resicovenba 2018-01-08 10:24:02 +05:30
commit ee084347b3
6 changed files with 543 additions and 89 deletions

View File

@ -104,6 +104,7 @@ class Call_Tracking_Controller extends REST_Controller {
$tracking_details['CreatedBy'] = $this->post('createdBy');
$tracking_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
$tracking_details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
$tracking_details['CreatedBranch'] = $this->post('branchId');
//store tracking followup details
$tracking_followup_details['FollowupOn'] = $this->post('date');
$tracking_followup_details['FollowupComments'] = $this->post('comments');
@ -138,7 +139,9 @@ class Call_Tracking_Controller extends REST_Controller {
{
$search['requestedBy'] = $this->post('requestedBy');
$search['requestedDept'] = $this->post('requestedDept');
// $search['searchDate'] = $this->post('searchDate');
$search['branchID'] = $this->post('branchId');
$search['searchDate'] = $this->post('searchDate');
$search['CreatedBranch'] = $this->post('branchId');
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
// $search['searchName']= $this->post('searchName');
$getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search);
@ -213,6 +216,7 @@ 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');
$getLoadDetails = $this->Calltracking_model->getLoadFollowupDetails($get_details);
if ($getLoadDetails)
@ -240,6 +244,7 @@ class Call_Tracking_Controller extends REST_Controller {
public function getDashboardCallTrack_post()
{
$search['requestedBy'] = $this->post('requestedBy');
$search['BranchID'] = $this->post('branchId');
$getdashBoardCallDetails = $this->Calltracking_model->getDashboardTrackingDetails($search);
if ($getdashBoardCallDetails)
{
@ -268,6 +273,7 @@ class Call_Tracking_Controller extends REST_Controller {
$search['requestedBy'] = $this->post('requestedBy');
$search['requestedDept'] = $this->post('requestedDept');
$search['loadDate'] = $this->post('loadDate');
$search['CreatedBranch'] = $this->post('branchId');
// $search['searchDate'] = $this->post('searchDate');
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
// $search['searchName']= $this->post('searchName');
@ -299,6 +305,7 @@ class Call_Tracking_Controller extends REST_Controller {
$search['requestedBy'] = $this->post('requestedBy');
$search['requestedDept'] = $this->post('requestedDept');
$search['loadDate'] = $this->post('loadDate');
$search['CreatedBranch'] = $this->post('branchId');
// $search['searchDate'] = $this->post('searchDate');
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
// $search['searchName']= $this->post('searchName');
@ -331,6 +338,7 @@ class Call_Tracking_Controller extends REST_Controller {
$search['requestedBy'] = $this->post('requestedBy');
$search['requestedDept'] = $this->post('requestedDept');
$search['loadDate'] = $this->post('loadDate');
$search['CreatedBranch'] = $this->post('branchId');
// $search['searchDate'] = $this->post('searchDate');
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
// $search['searchName']= $this->post('searchName');

View File

@ -251,16 +251,39 @@ class Calltracking_model extends CI_Model {
public function getTrackingDetails($search=null)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,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');
$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,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.IsActive', '1');
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
if($search['searchDate']!='' OR $search['searchDate']!=null){
/* if(sizeof($search['searchDate']) == '1'){
$this->db->where('LTF.FollowupOn <= ', $search['searchDate'][0]);
$this->db->where('PLD1.ListName !=', 'CLOSE');
}*/
$this->db->where_in('LTF.FollowupOn', $search['searchDate']);
$this->db->order_by('LTF.FollowupOn','DESC');
$this->db->group_by('LT.TrackingID');
}
else{
$this->db->order_by('LTF.FollowupOn','DESC');
$this->db->group_by('LT.TrackingID');
}
// $this->db->group_by('LD.MobileNumber');
$leadDet=$this->db->get();
if($this->db->affected_rows()==0){
$result_array['trackingStatus']=false;
$result_array['trackingDetails']="";
@ -290,22 +313,107 @@ class Calltracking_model extends CI_Model {
$tracking_array["AlternateMobile"]=$row->AlternateMobile;
$tracking_array["Address"]=$row->Address;
// $tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
$followupDetails=$this->getTrackingFollowup($row->TrackingID);
// $followupDetails=$this->getTrackingFollowup($row->TrackingID);
$tracking_array["followupDetails"]=$followupDetails[0]->FollowupOn;
// $tracking_array["followupDetails"]=$followupDetails[0]->FollowupOn;
$tracking_array["followupDetails"]=$row->FollowupOn;
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
// $result_array['statusDetails']=$this->getStatus();
}
}
$result_array['pendingTrackingDetails'] = $this->getPrevPendingTrackingDetails($search);
return $result_array;
}
public function getPrevPendingTrackingDetails($search=null)
{
$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,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.IsActive', '1');
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
if(($search['searchDate']!='' OR $search['searchDate']!=null) AND sizeof($search['searchDate']) == '1'){
// $this->db->where('LTF.FollowupOn <= ', $search['searchDate'][0]);
$this->db->where('PLD1.ListName !=', 'CLOSE');
$leadDet=$this->db->get();
if($leadDet->result()){
$result_array['trackingStatus']=true;
foreach ($leadDet->result() as $row)
{
$tracking_array["LeadID"]=$row->LeadID;
$tracking_array["LeadName"]=$row->LeadName;
$tracking_array["MobileNumber"]=$row->MobileNumber;
$tracking_array["IsNewEnquiry"]=$row->IsNewEnquiry;
$tracking_array["TrackingID"]=$row->TrackingID;
$tracking_array["ActivityStatus"]=$row->ActivityStatus;
$tracking_array["AssignedTo"]=$row->AssignedTo;
$tracking_array["Firstname"]=$row->Firstname;
$tracking_array["StatusCode"]=$row->StatusCode;
$tracking_array["statusName"]=$row->statusListName;
$tracking_array["UniversityName"]=$row->University;
$tracking_array["CourseName"]=$row->Course;
$tracking_array["ActivityID"]=$row->ActivityID;
$tracking_array["ActivityName"]=$row->ActivityName;
$tracking_array["AlternateMobile"]=$row->AlternateMobile;
$tracking_array["Address"]=$row->Address;
// $tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
// $followupDetails=$this->getTrackingFollowup($row->TrackingID);
// $tracking_array["followupDetails"]=$followupDetails[0]->FollowupOn;
$tracking_array["followupDetails"]=$row->FollowupOn;
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
// $result_array['statusDetails']=$this->getStatus();
$result_array['trackingDetails']=$result;
}
}
else{
$result_array['trackingStatus']=false;
}
}
else{
$result_array['trackingStatus']=false;
}
return $result_array;
}
/*
* get never closed tracking list by current date
* created by kms
* */
/*
* get tracking followup Details
@ -333,17 +441,27 @@ class Calltracking_model extends CI_Model {
public function updateFollowupDetails($updateDetails=null,$insertDetails=null)
{
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertDetails);
// this if for insert follow up details
if($this->db->affected_rows() == '1'){
$this->db->where('TrackingID',$updateDetails['TrackingID']);
$upateStatus=$this->db->update(LEAD_TRACKING, $updateDetails);
$result['followupStatus'] = true;
$result['trackingID'] = $updateDetails['TrackingID'];
$result['message'] = "Successfully followup details added";
$deactivateStatus['IsActive']=false;
$this->db->where('TrackingID',$updateDetails['TrackingID']);
$this->db->update(LEAD_TRACKING_FOLLOWUP, $deactivateStatus);
if($this->db->affected_rows() > '0') {
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertDetails);
// this if for insert follow up details
if ($this->db->affected_rows() == '1') {
$this->db->where('TrackingID', $updateDetails['TrackingID']);
$upateStatus = $this->db->update(LEAD_TRACKING, $updateDetails);
$result['followupStatus'] = true;
$result['trackingID'] = $updateDetails['TrackingID'];
$result['message'] = "Successfully followup details added";
} else {
$result['followupStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
else{
$activateStatus['IsActive']=true;
$this->db->where('TrackingID',$updateDetails['TrackingID']);
$this->db->update(LEAD_TRACKING_FOLLOWUP, $activateStatus);
$result['followupStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
@ -371,6 +489,10 @@ class Calltracking_model extends CI_Model {
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LT.TrackingID',$trackingID['TrackingID']);
if($trackingID['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $trackingID['CreatedBranch']);
}
$leadDet=$this->db->get();
@ -398,7 +520,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);
$tracking_array["collectTrackedID"]=$this->getStudentTrackedID($row->MobileNumber,$trackingID['CreatedBranch']);
$result[]=$tracking_array;
@ -424,7 +546,7 @@ class Calltracking_model extends CI_Model {
* @params mobile number
* created by kms
* */
public function getStudentTrackedID($stuMobile=null)
public function getStudentTrackedID($stuMobile=null,$branchId=null)
{
$this->db->distinct();
$this->db->select('LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,PLD.ListName');
@ -433,6 +555,11 @@ 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);
}
$this->db->order_by('LT.TrackingID','ASC');
$studeTrackID = $this->db->get();
return $studeTrackID->result();
@ -451,7 +578,8 @@ class Calltracking_model extends CI_Model {
$follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1');
// $follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1');
$follouwpDetails=$this->todayFollowUp($todayFollowupDate,$serach);
if($follouwpDetails){
$result_array['todayStatus']=true;
$result_array['todayFolloupDetails']=$follouwpDetails;
@ -461,7 +589,8 @@ class Calltracking_model extends CI_Model {
$result_array['todayFolloupDetails']="";
}
$follouwpPendingDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'2');
// $follouwpPendingDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'2');
$follouwpPendingDetails=$this->tillPendingTrackingDetails(CLOSE,$serach);
if($follouwpPendingDetails){
$result_array['todayPendingStatus']=true;
@ -472,7 +601,8 @@ class Calltracking_model extends CI_Model {
$result_array['PendingFolloupDetails']="";
}
$todayLeadDetails=$this->todayFollowupDetails($todayDateTime,OPEN,'3');
// $todayLeadDetails=$this->todayFollowupDetails($todayDateTime,OPEN,'3');
$todayLeadDetails=$this->todayCreatedLead($todayDateTime,$serach);
if($todayLeadDetails){
$result_array['todayLeadStatus']=true;
$result_array['todayLeadDetails']=$todayLeadDetails;
@ -486,6 +616,145 @@ class Calltracking_model extends CI_Model {
return $result_array;
}
/*
* get dash board today followupdetails
* created by kms
* */
public function todayFollowUp($todayDate,$search=null){
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
if($search['BranchID'] !='All'){
$this->db->where('LT.CreatedBranch', $search['BranchID']);
}
$this->db->where('LTF.FollowupOn',$todayDate);
$trackDetails=$this->db->get();
if($trackDetails->result()){
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["statusName"]=$row1->statusListName;
$tracking_array["ActivityID"]=$row1->ActivityID;
$tracking_array["ActivityName"]=$row1->ActivityName;
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
return $result_array;
}
else {
return false;
}
}
/*
* get today lead details
* created by kms
* */
public function todayCreatedLead($todayDate,$search=null){
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.IsActive', '1');
if($search['BranchID'] !='All'){
$this->db->where('LT.CreatedBranch', $search['BranchID']);
}
$this->db->like('LD.CreatedOn', $todayDate, 'after');
$trackDetails=$this->db->get();
if($trackDetails->result()){
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["statusName"]=$row1->statusListName;
$tracking_array["ActivityID"]=$row1->ActivityID;
$tracking_array["ActivityName"]=$row1->ActivityName;
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
return $result_array;
}
else {
return false;
}
}
/*
* get till pending tracking details
* created by kms
* */
public function tillPendingTrackingDetails($status,$search=null){
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,AV.ActivityID,AV.ActivityName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.IsActive', '1');
$this->db->where('PLD1.ListName !=', $status);
if($search['BranchID'] !='All'){
$this->db->where('LT.CreatedBranch', $search['BranchID']);
}
$trackDetails=$this->db->get();
if($trackDetails->result()){
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["statusName"]=$row1->statusListName;
$tracking_array["ActivityID"]=$row1->ActivityID;
$tracking_array["ActivityName"]=$row1->ActivityName;
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
return $result_array;
}
else {
return false;
}
}
/*
* get date wise followup details
* @params date and status and check status
@ -638,6 +907,10 @@ class Calltracking_model extends CI_Model {
if($search['loadDate'] !='' ) {
$this->db->like('LD.CreatedOn', $search['loadDate'], 'after');
}
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
$this->db->order_by('LT.TrackingID', 'DESC');
$leadDet=$this->db->get();
if($this->db->affected_rows()==0){
@ -703,6 +976,10 @@ class Calltracking_model extends CI_Model {
if($search['loadDate'] !='' ) {
$this->db->like('LT.UpdatedOn', $search['loadDate'], 'after');
}
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
$this->db->like('PLD1.ListName', 'CLOSE', 'after');
$this->db->order_by('LT.TrackingID', 'DESC');
$leadDet=$this->db->get();
@ -769,6 +1046,10 @@ class Calltracking_model extends CI_Model {
if($search['loadDate'] !='' ){
$this->db->like('LT.UpdatedOn', $search['loadDate'], 'after');
}
if($search['CreatedBranch'] !='All'){
$this->db->where('LT.CreatedBranch', $search['CreatedBranch']);
}
$this->db->where('PLD1.ListName !=', 'CLOSE');
$this->db->order_by('LT.TrackingID', 'DESC');

View File

@ -24,26 +24,101 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
//get current date
$scope.hideDateSearch=true;
$scope.modifyMinDate = moment();
$scope.minDate = $filter('date')($scope.modifyMinDate, 'MM-dd-yyyy');
$scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
// get 30 plus date for follwup details
$scope.modifyDate = moment();
$scope.modifyDate.add(30, 'days');
$scope.futureDate = $filter('date')($scope.modifyDate, 'dd-MM-yyyy');
$scope.myModel.date=$scope.currentDate;
$scope.search=$scope.currentDate;
$scope.myModel.search=$filter('date')(new Date(), 'yyyy-MM-dd');
$scope.myModel.searchDate=$scope.currentDate;
$scope.toMinDate = $filter('date')($scope.modifyMinDate, 'MM-dd-yyyy');
$scope.checkDate = function (value) {
if(value==null || value==undefined){
$scope.search='';
$scope.checkDate = function (value,type) {
if(value.searchDate==null || value.searchDate==undefined){
$scope.myModel.search='';
$scope.toMinDate = '';
$scope.myModel.dateTo='';
}
else{
$scope.filterSearch=$filter('date')(value, 'dd-MM-yyyy');
if(type=='2'){
$scope.myModel.search = $filter('date')(value.searchDate, 'yyyy-MM-dd');
$scope.toMinDate = $filter('date')(value.searchDate, 'MM-dd-yyyy');
}
}
$scope.searchDateArray(value);
}
/*
* check to date
* */
$scope.checkToDate = function (value) {
if(value.searchDate==null || value.searchDate==undefined){
swal("Failed!", 'Please Select From Date', "error");
$scope.myModel.dateTo='';
$scope.myModel.search='';
$scope.toMinDate = '';
}
else{
$scope.filterSearch=$filter('date')(value.searchDate, 'dd-MM-yyyy');
$scope.search=$scope.filterSearch;
}
$scope.searchDateArray(value);
}
/*
* make a search date array
*/
$scope.searchDateArray=function (dateValue) {
var listDate = [];
if((dateValue.search !=null && dateValue.search !=undefined) && (dateValue.dateTo !=null && dateValue.dateTo !=undefined && dateValue.dateTo !='')){
var startDate =dateValue.search;
var endDate = $filter('date')(dateValue.dateTo, 'yyyy-MM-dd');
var dateMove = new Date(startDate);
var strDate = startDate;
if(strDate == endDate){
var startDate =dateValue.search;
// var endDate = $filter('date')(dateValue.searchDate, 'yyyy-MM-dd');
var strDate = startDate;
var arrayDate = $filter('date')(strDate, 'dd-MM-yyyy');
listDate.push(arrayDate);
}
else{
while (strDate < endDate){
var strDate = dateMove.toISOString().slice(0,10);
var arrayDate = $filter('date')(strDate, 'dd-MM-yyyy');
listDate.push(arrayDate);
dateMove.setDate(dateMove.getDate()+1);
};
}
}
else if((dateValue.search !=null && dateValue.search !=undefined) && (dateValue.dateTo ==null || dateValue.dateTo ==undefined || dateValue.dateTo =='')){
var startDate =dateValue.search;
// var endDate = $filter('date')(dateValue.searchDate, 'yyyy-MM-dd');
var strDate = startDate;
var arrayDate = $filter('date')(strDate, 'dd-MM-yyyy');
listDate.push(arrayDate);
}
$scope.init(listDate);
}
/*
@ -133,8 +208,8 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
alterMobile:myModel.alterMobileNumber,
address:myModel.address,
enquiryStatus:myModel.enquiryStatus,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
@ -234,19 +309,22 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
};
// sorting function for table params
$scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
/*
*get tracking list
* created by kms
* */
$scope.init = function (form,myModel,type) {
$scope.init = function (myModel) {
$scope.data = [];
if(myModel!='' && myModel!=undefined){
$scope.finalSearchArry=myModel;
}
else{
$scope.finalSearchArry="";
}
$scope.loader = true;
var getTrackDetails = {
@ -257,12 +335,44 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
searchDate: $scope.finalSearchArry
}
};
$http(getTrackDetails).then(function (response) {
if(response.data.pendingTrackingDetails.trackingStatus && response.data.trackingDetails.length > 0){
$scope.loader = false;
//$scope.currentDate1=$filter('date')(new Date(), 'dd-MM-yyyy');
$scope.tillPendingDetails = response.data.pendingTrackingDetails.trackingDetails;
angular.forEach($scope.tillPendingDetails, function (value, key) {
$scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
// $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
$scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
if (($scope.currentDate) > (value.followupDetails) && (value.statusName!='CLOSE')) {
$scope.data.push(value);
}
if (response.data.status == 200 && response.data.trackingStatus == true) {
});
angular.forEach(response.data.trackingDetails, function (value1, key1) {
$scope.data.push(value1);
});
$rootScope.trackingStatus = response.data.statusDetails;
localStorage.setItem('trackingList', JSON.stringify($scope.data));
}
else if (response.data.status == 200 && response.data.trackingStatus == true && response.data.pendingTrackingDetails.trackingStatus !=true) {
$scope.loader = false;
$rootScope.trackingStatus = response.data.statusDetails;
@ -270,33 +380,46 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
$scope.data = response.data.trackingDetails;
localStorage.setItem('trackingList', JSON.stringify($scope.data));
}
else if (response.data.trackingStatus != true && response.data.pendingTrackingDetails.trackingStatus) {
// this for search box
/* $scope.search = {searchDate: ''};
$scope.tableParams = new ngTableParams({
page: 1,
count: 10,
filter: $scope.search
}, {
total: data.length,
getData: function ($defer, params) {
var orderedData = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
orderedData = params.filter() ? $filter('filter')(orderedData, params.filter().followupDate) : orderedData;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});*/
$scope.loader = false;
$rootScope.trackingStatus = response.data.statusDetails;
} else {
$scope.tillPendingDetails = response.data.pendingTrackingDetails.trackingDetails;
angular.forEach($scope.tillPendingDetails, function (value, key) {
$scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
// $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
$scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
if (($scope.currentDate) > (value.followupDetails) && (value.statusName!='CLOSE')) {
$scope.data.push(value);
}
});
localStorage.setItem('trackingList', JSON.stringify($scope.data));
}
else {
$scope.loader = false;
$scope.branchInfo = '';
$scope.data='';
}
});
}
// sorting function for table params
$scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
@ -389,7 +512,8 @@ app.controller('callTrackingLeadCtrl', ["$scope","$rootScope","toaster", "$filte
data: {
loadDate:$scope.loadDate,
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(getRecentlead).then(function (response) {
@ -515,7 +639,9 @@ app.controller('callTrackingCloseCtrl', ["$scope","$rootScope","toaster", "$filt
data: {
loadDate:$scope.loadDate,
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(getRecentclose).then(function (response) {
@ -641,7 +767,8 @@ app.controller('callTrackingPendingCtrl', ["$scope","$rootScope","toaster", "$fi
data: {
loadDate:$scope.loadDate,
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(getRecentclose).then(function (response) {
@ -671,7 +798,9 @@ app.controller('callTrackingPendingCtrl', ["$scope","$rootScope","toaster", "$fi
});*/
} else {
}
else {
$scope.loader = false;
$scope.data='';
@ -1062,7 +1191,8 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
date: $scope.nextFollowupDate,
status: myModel1.status,
comments: myModel1.comments,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
}
};
$http(update).then(function (response) {
@ -1088,7 +1218,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
},
data: {
trackingID: trackID,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(load).then(function (response) {
@ -1139,6 +1271,24 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
}]);
app.filter('unique', function() {
return function(collection, primaryKey, secondaryKey) { //optional secondary key
var output = [],
keys = [];
angular.forEach(collection, function(item) {
var key;
secondaryKey === undefined ? key = item[primaryKey] : key = item[primaryKey][secondaryKey];
if(keys.indexOf(key) === -1) {
keys.push(key);
output.push(item);
}
});
return output;
};
});

View File

@ -20,7 +20,9 @@ app.controller('dashboardCtrl', ["$scope","$rootScope", "toaster", "$filter", "n
'Content-Type': 'application/json'
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(getCallTrack).then(function (response) {

View File

@ -32,30 +32,19 @@
</section>
<!-- end: PAGE TITLE -->
<!-- start: LIST GROUP -->
<div class="container-fluid container-fullw bg-white" ng-controller="callTrackingCtrl" data-ng-init="init(viewForm,myModel,'')">
<div class="container-fluid container-fullw bg-white" ng-controller="callTrackingCtrl" data-ng-init="checkDate(myModel,'1')">
<div class="row">
<tabset class="tabbable">
<tab heading="View Tracking List" id="viewtrack">
<div class="container-fluid container-fullw">
<div class="row">
<div class="col-md-12" ng-if="loader == true " align="center">
<spinner name="html5spinner">
<div class="overlay"></div>
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
</div>
<div class="please-wait">Please Wait...</div>
</spinner>
</div>
<!-- <div class="col-md-12" ng-if="emptyData == false && loader == false " style="min-height: 281px;">
<p style="color: red;" align="center"><strong><h3 class="text-center">oops! No
records found... </h3></strong></p>
</div>-->
<div class="col-md-12" ng-if="loader == false">
<div class="col-md-12" >
<div class="row">
@ -75,23 +64,34 @@
ng-model="myModel.searchDate"
is-open="startOpen"
ng-init="startOpen = false"
name="date"
name="date1"
datepicker-options="dateOptions"
placeholder="Select Date"
placeholder="Select From Date"
max-date="minStartDate"
close-text="Close" ng-change="checkDate(myModel.searchDate);">
close-text="Close" ng-change="checkDate(myModel,'2');">
<input class="form-control" type="text" ng-model="search" id="search" autofocus placeholder="Search Date" ng-hide="hideDateSearch==true" />
<input class="form-control" type="text" ng-model="myModel.search" id="search" autofocus placeholder="Search Date" ng-hide="hideDateSearch==true" />
</div>
<div class="col-md-2">
<div data-ng-controller="DatepickerDemoCtrl">
<input type="text" class="form-control " ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="myModel.dateTo"
is-open="startOpen" ng-init="startOpen = false" name="addDate" datepicker-options="dateOptions"
min-date="toMinDate"
placeholder="Select To Date" close-text="Close" required="required" ng-change="checkToDate(myModel);"
show-button-bar="true" />
</div>
</div>
<div class="col-md-2">
<input class="form-control" type="text" ng-model="search2" id="search2" autofocus tabindex="2" placeholder="Search " />
</div>
<!-- Search By Activity-->
<div class="col-md-2 col-md-offset-2">
<div class="col-md-2 col-md">
<input class="form-control" type="text" ng-model="search3.ActivityName" id="search3" autofocus tabindex="3" placeholder="Search Activity" />
</div>
<!-- Search By Assign To-->
@ -107,7 +107,20 @@
</div>
<div class="table-responsive">
<div class="col-md-12" ng-if="loader == true " align="center">
<spinner name="html5spinner">
<div class="overlay"></div>
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
</div>
<div class="please-wait">Please Wait...</div>
</spinner>
</div>
<div class="table-responsive" ng-if="loader == false">
<fieldset>
@ -138,7 +151,7 @@
</tr>
</thead>
<tbody dir-paginate="p in data|orderBy:sortKey:reverse|filter:search:strict|filter:search2:strict| filter:search3:strict| filter:search4:strict| filter:search5:strict|itemsPerPage:10">
<tbody dir-paginate="p in data|unique:'TrackingID' |orderBy:sortKey:reverse|filter:search2:strict| filter:search3:strict| filter:search4:strict| filter:search5:strict|itemsPerPage:10">
<tr ng-click="setEditId(p,search,search2,search3.ActivityName,search4.Firstname,search5.statusName);">
<td><a class="text-orange" ng-click="setEditId(p,search,search2,search3.ActivityName,search4.Firstname,search5.statusName);">{{p.TrackingID}}</a></td>
<td>{{p.followupDetails }}</td>
@ -326,7 +339,7 @@
name="date"
datepicker-options="dateOptions"
placeholder="Select Date"
min-date="currentDate"
min-date="minDate"
max-date="futureDate"
close-text="Close" required="required"/>
<span class="error text-small block"

View File

@ -69,15 +69,15 @@
<tbody>
<tr>
<td class="text-primary">Student Name</td>
<td>
<td><span class="text-blue text-bold">
{{followupDetails.LeadName}}
{{followupDetails.LeadName}}</span>
</td>
</tr>
<tr>
<td>Mobile Number</td>
<td>
{{followupDetails.MobileNumber}} </td>
<td><span class="text-blue text-bold">
{{followupDetails.MobileNumber}} </span></td>
</tr>
<tr>
@ -215,8 +215,8 @@
<div class="col-xs-6 text-center no-padding">
<a tooltip="Click to view details" class="text-green" ng-click="loadFollowupDetails(trackValues.TrackingID);">
<i class="fa fa-pencil text-green"></i> Tracking ID {{trackValues.TrackingID}}
<a tooltip="Click to view details" class="text-green " ng-click="loadFollowupDetails(trackValues.TrackingID);">
<i class="fa fa-pencil text-green"></i> <span class="text-bold">Tracking ID {{trackValues.TrackingID}}</span>
</a>
</div>
</div>