This commit is contained in:
resicovenba 2017-12-01 15:50:23 +05:30
commit a5a0d738d6
4 changed files with 83 additions and 153 deletions

View File

@ -15,11 +15,9 @@ class Calltracking_model extends CI_Model {
* */
public function getLeadDetails($requestedBy=null,$mobileNumber=null)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName');
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->where('LD.MobileNumber',$mobileNumber);
$leadDet=$this->db->get()->last_row();
$result_array = [];
@ -27,20 +25,38 @@ class Calltracking_model extends CI_Model {
$result_array['existLeadDetails']=$leadDet;
}
else{
$leadDet['LeadName']="";
$leadDet['MobileNumber']=$mobileNumber;
$leadDet['IsNewEnquiry']="1";
$leadDet['UniversityID']="";
$leadDet['UniversityName']="";
$leadDet['CourseID']="";
$leadDet['CourseName']="";
$leadDet['ActivityStatus']="";
$leadDet['AssignedTo']="";
$leadDet['StatusCode']="";
$result_array['existLeadDetails']=$leadDet;
$this->db->select('ST.MobileNumber,ST.Firstname,US.UniversityName,CU.CourseName');
$this->db->from(STUDENTS.' as ST');
$this->db->join(STUDENTCOURSE.' as STC', 'ST.StudentID = STC.StudentID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID');
$this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID');
$this->db->where('ST.MobileNumber',$mobileNumber);
$enrolledStudDet=$this->db->get()->last_row();
if($enrolledStudDet) {
$leadDet['LeadName'] = $enrolledStudDet->Firstname;
$leadDet['MobileNumber'] = $enrolledStudDet->MobileNumber;
$leadDet['IsNewEnquiry'] = "1";
$leadDet['University'] = $enrolledStudDet->UniversityName;
$leadDet['Course'] = $enrolledStudDet->CourseName;
$leadDet['ActivityStatus'] = "";
$leadDet['AssignedTo'] = "";
$leadDet['StatusCode'] = "";
$result_array['existLeadDetails'] = $leadDet;
}
else{
$leadDet['LeadName'] = "";
$leadDet['MobileNumber'] = "";
$leadDet['IsNewEnquiry'] = "1";
$leadDet['University'] = "";
$leadDet['Course'] = "";
$leadDet['ActivityStatus'] = "";
$leadDet['AssignedTo'] = "";
$leadDet['StatusCode'] = "";
$result_array['existLeadDetails'] = $leadDet;
}
}
// store lead,university and course details in comman array
$result_array['universityDetails']=$this->getUniversityDetails();
//$result_array['universityDetails']=$this->getUniversityDetails();
$result_array['activityDetails']=$this->getActivityDetails();
$result_array['statusDetails']=$this->getStatus();
$result_array['staffDetails']=$this->getStaff("1");
@ -208,11 +224,9 @@ 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,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
@ -241,10 +255,8 @@ class Calltracking_model extends CI_Model {
$tracking_array["Firstname"]=$row->Firstname;
$tracking_array["StatusCode"]=$row->StatusCode;
$tracking_array["statusListName"]=$row->statusListName;
$tracking_array["UniversityID"]=$row->UniversityID;
$tracking_array["UniversityName"]=$row->UniversityName;
$tracking_array["CourseID"]=$row->CourseID;
$tracking_array["CourseName"]=$row->CourseName;
$tracking_array["UniversityName"]=$row->University;
$tracking_array["CourseName"]=$row->Course;
$tracking_array["ListCode"]=$row->ListCode;
$tracking_array["ListName"]=$row->ListName;
// $tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
@ -261,9 +273,6 @@ class Calltracking_model extends CI_Model {
}
}
return $result_array;
}
@ -324,11 +333,9 @@ class Calltracking_model extends CI_Model {
public function getLoadFollowupDetails($trackingID)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
@ -353,10 +360,8 @@ class Calltracking_model extends CI_Model {
$tracking_array["Firstname"]=$row->Firstname;
$tracking_array["StatusCode"]=$row->StatusCode;
$tracking_array["statusListName"]=$row->statusListName;
$tracking_array["UniversityID"]=$row->UniversityID;
$tracking_array["UniversityName"]=$row->UniversityName;
$tracking_array["CourseID"]=$row->CourseID;
$tracking_array["CourseName"]=$row->CourseName;
$tracking_array["UniversityName"]=$row->University;
$tracking_array["CourseName"]=$row->Course;
$tracking_array["ListCode"]=$row->ListCode;
$tracking_array["ListName"]=$row->ListName;
$tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
@ -529,72 +534,4 @@ class Calltracking_model extends CI_Model {
}
}
/*
* 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->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;
}
}
}

View File

@ -20,10 +20,14 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
"enquiryStatus":''
};
//get current date
$scope.hideDateSearch=true;
$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.searchDate=$scope.currentDate;
@ -105,7 +109,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
data: {
studentName: myModel.studentName,
mobileNumber: myModel.mobileNumber,
universityID: myModel.universityName.universityID,
universityID: myModel.universityName,
courseName: myModel.courseName,
date: $scope.nextFollowupDate,
activity: myModel.activity,
@ -165,11 +169,6 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
//call form success
if(form.mobilenumber.$valid){
$scope.loading=true;
/* $scope.ldloading2 = {};
$scope.ldloading2[loading.replace('-', '_')] = true;*/
var lead = {
method: 'POST',
url: apiPoint.url + 'getTrackingLeadDetails/',
@ -183,29 +182,28 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
};
$http(lead).then(function (response) {
if (response.data.status==200) {
$scope.myModel.courseName=response.data.existLeadDetails.CourseID;
$scope.myModel.enquiryStatus=response.data.existLeadDetails.IsNewEnquiry;
$scope.activity=response.data.activityDetails;
$scope.status=response.data.statusDetails;
$scope.staffDetails=response.data.staffDetails;
$scope.university=response.data.universityDetails;
//$scope.university=response.data.universityDetails;
$scope.myModel.status=$scope.status[0].ListCode;
$scope.myModel.studentName=response.data.existLeadDetails.LeadName;
$scope.myModel.universityName=response.data.existLeadDetails.University;
$scope.myModel.courseName=response.data.existLeadDetails.Course;
// find index for university drop down list
for(var i in $scope.university) {
/* for(var i in $scope.university) {
if($scope.university[i].universityID==response.data.existLeadDetails.UniversityID){
$scope.myModel.universityName=$scope.university[i];
}
}
}*/
$scope.loading=false;
} else {
$scope.loading=false;
$scope.myModel.universityName="";
}
});
@ -367,6 +365,10 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
$rootScope.currentDate1=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
$rootScope.myModel1.date=$rootScope.followupDetails.followupDetails[0].FollowupOn;
// get 30 plus date for follwup details
$rootScope.modifyDate1 = moment();
$rootScope.modifyDate1.add(30, 'days');
$rootScope.futureDate1 = $filter('date')($scope.modifyDate1, 'dd-MM-yyyy');
$rootScope.myModel1.status=$rootScope.followupDetails.StatusCode;
$rootScope.trackingStatus=response.data.statusDetails;
} else {

View File

@ -15,6 +15,7 @@
}
</style>
<!-- start: PAGE TITLE -->
<section id="page-title">
@ -102,9 +103,10 @@
<fieldset>
<table class="table table-hover">
<thead>
<tr>
<tr >
<th ng-click="sort('TrackingID')">Tracking ID
<span class="glyphicon sort-icon" ng-show="sortKey=='TrackingID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
@ -126,12 +128,12 @@
<th>Assigned To
</th>
<th></th>
<th>Status</th>
</tr>
</thead>
<tbody dir-paginate="p in data|orderBy:sortKey:reverse|filter:search:strict|filter:search2:strict|itemsPerPage:10">
<tr>
<tr ng-click="setEditId(p);" title="Click to view tracking details">
<td><a href="#" class="text-orange" ng-click="setEditId(p);">{{p.TrackingID}}</a></td>
<td>{{p.followupDetails }}</td>
<td>{{p.LeadName}}</td>
@ -140,13 +142,17 @@
<td>{{p.CourseName }}</td>
<td>{{p.ListName}}</td>
<td>{{p.Firstname}}</td>
<td ng-if="p.StatusCode=='S001'"><a href="#" class="text-orange" ng-click="setEditId(p);" title="Open"><b class="fa fa-hover fa-phone " aria-hidden="true"></b>
<!--<td ng-if="p.StatusCode=='S001'"><a href="#" class="text-orange" ng-click="setEditId(p);" title="Open"><b class="fa fa-hover fa-phone " aria-hidden="true"></b>
</a></td>
<td ng-if="p.StatusCode!='S001'"><a href="#" class="text-green" ng-click="setEditId(p);" title="Close"><b class="fa fa-hover fa-phone " style="display: inline-block;
border-radius: 60px;
box-shadow: 0px 0px 2px green;
padding: 0.5em 0.6em;" aria-hidden="true"></b>
</a></td>
</a></td>-->
<td class="hidden-xs" ng-if="p.StatusCode=='S001'"><span class="label label-sm label-warning">{{p.statusListName}}</span></td>
<td class="hidden-xs" ng-if="p.StatusCode!='S001'"><span class="label label-sm label-success">{{p.statusListName}}</span></td>
</tr>
</tbody>
@ -156,14 +162,6 @@
</dir-pagination-controls>
</fieldset>
</div>
</div>
@ -255,18 +253,15 @@
<div class="col-md-3 form-group" ng-if="loading==false"
ng-class="{'has-error':Form.university.$dirty && Form.university.$invalid, 'has-success':Form.university.$valid}">
<label>
University <span class="symbol required"></span>
<label class="control-label">
University
</label>
<select class="form-control" name="university" tabindex="3" id="university"
ng-model="myModel.universityName"
ng-options="details.universityName for details in university"
required>
<option value=""> Select University</option>
</select>
<input type="text" placeholder="Enter University"
autofocus tabindex="3" class="form-control" name="university" id="university" ng-maxlength="50"
ng-model="myModel.universityName" ng-pattern="/^[a-zA-Z.,/\-\s]*$/" >
<span class="error text-small block"
ng-if="Form.university.$dirty && Form.university.$invalid">University is required</span>
<!--<span class="success text-small" ng-if="Form.university.$valid">Thank You!</span>-->
ng-if="Form.university.$error.maxlength || Form.university.$error.pattern">Enter a valid university name</span>
</div>
<div class="col-md-3" ng-if="loading==true">
@ -283,16 +278,15 @@
<div class="col-md-3 form-group" ng-if="loading==false"
ng-class="{'has-error':Form.course.$dirty && Form.course.$invalid, 'has-success':Form.course.$valid}">
<label>
Course Name <span class="symbol required"></span>
<label class="control-label">
Course Name
</label>
<select class="form-control" name="course" tabindex="4" id="course"
ng-model="myModel.courseName"
ng-options="courseDet.CourseID as courseDet.CourseName for courseDet in myModel.universityName.courseDetails" required>
<option value=""> Select Course</option>
</select>
<input type="text" placeholder="Enter Course"
autofocus tabindex="4" class="form-control" name="course" id="course" ng-maxlength="50"
ng-model="myModel.courseName" ng-pattern="/^[a-zA-Z.,/\-\s]*$/" >
<span class="error text-small block"
ng-if="Form.course.$dirty && Form.course.$invalid">Course is required</span>
ng-if="Form.course.$error.maxlength || Form.course.$error.pattern">Enter a valid course name</span>
</div>
@ -317,7 +311,7 @@
datepicker-options="dateOptions"
placeholder="Select Date"
min-date="currentDate"
max-date="minStartDate"
max-date="futureDate"
close-text="Close" required="required"/>
<span class="error text-small block"
ng-if="Form.date.$dirty && Form.date.$error.required">Date is required.</span>

View File

@ -107,7 +107,7 @@
datepicker-options="dateOptions"
placeholder="Select Date"
min-date="currentDate1"
max-date="minStartDate"
max-date="futureDate1"
close-text="Close" required="required"/>
<span class="error text-small block"
ng-if="Form.date.$dirty && Form.date.$error.required">Date is required.</span>
@ -146,12 +146,8 @@
<paneltool class="panel-tools" tool-collapse="tool-collapse" tool-refresh="load1" tool-dismiss="tool-dismiss"></paneltool>
</div>
<div collapse="lead" ng-init="lead=false" class="panel-wrapper">
<div class="panel-body" style="min-height:50px;max-height:100px;overflow-y: scroll;">
<ul class="timeline-xs">
<div class="panel-body panel-scroll height-200" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true">
<ul class="timeline-xs">
<li ng-class-odd="'timeline-item success'" ng-class-even="'timeline-item info'" ng-repeat="trackValues in followupDetails.collectTrackedID">
<div class="margin-left-15">
<div class="text-muted text-small">
@ -171,6 +167,7 @@
</li>
</ul>
</div>
</div>
</div>
@ -244,7 +241,7 @@
<paneltool class="panel-tools" tool-collapse="tool-collapse" tool-refresh="load1" tool-dismiss="tool-dismiss"></paneltool>
</div>
<div collapse="activities" ng-init="activities=false" class="panel-wrapper">
<div class="panel-body" style="min-height:150px;max-height:300px;overflow-y: scroll;">
<div class="panel-body panel-scroll height-350" perfect-scrollbar wheel-propagation="false" suppress-scroll-x="true">
<ul class="timeline-xs">
<li ng-class-odd="'timeline-item info'" ng-class-even="'timeline-item warning'" ng-repeat="message in followupDetails.followupDetails">
<div class="margin-left-15">