call tracking filter

This commit is contained in:
gayathri1990 2018-09-07 10:29:58 +05:30
parent b05c3e9496
commit 9c6020d2e3
4 changed files with 52 additions and 24 deletions

View File

@ -148,10 +148,14 @@ class Call_Tracking_Controller extends REST_Controller {
$search['requestedDept'] = $this->post('requestedDept'); $search['requestedDept'] = $this->post('requestedDept');
// $search['branchID'] = $this->post('branchId'); // $search['branchID'] = $this->post('branchId');
$search['searchDate'] = $this->post('searchDate'); $search['searchDate'] = $this->post('searchDate');
// print_r( $search['searchDate']);
$search['CreatedBranch'] = $this->post('branchId'); $search['CreatedBranch'] = $this->post('branchId');
$status=$this->post('status');
// $search['searchMobileNumber'] = $this->post('searchMobileNumber'); // $search['searchMobileNumber'] = $this->post('searchMobileNumber');
// $search['searchName']= $this->post('searchName'); // $search['searchName']= $this->post('searchName');
$getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search); $getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search,$status);
if ($getTrackedDetails) if ($getTrackedDetails)
{ {

View File

@ -352,8 +352,9 @@ class Calltracking_model extends CI_Model {
* created by kms * created by kms
* */ * */
public function getTrackingDetails($search=null) public function getTrackingDetails($search=null,$status)
{ {
$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,LT.Flag,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName'); $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,LT.Flag,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->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID'); $this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
@ -437,7 +438,16 @@ class Calltracking_model extends CI_Model {
} }
} }
if($status!=true)
{
$result_array['pendingTrackingDetails'] = $this->getPrevPendingTrackingDetails($search); $result_array['pendingTrackingDetails'] = $this->getPrevPendingTrackingDetails($search);
// print_r( $result_array['pendingTrackingDetails']);
}
else
{
$result_array['pendingTrackingDetails']=1;
}
return $result_array; return $result_array;

View File

@ -60,6 +60,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
$scope.checkDate = function (value,type) { $scope.checkDate = function (value,type) {
// console.log(value.searchDate);
if(value.searchDate==null || value.searchDate==undefined){ if(value.searchDate==null || value.searchDate==undefined){
$scope.myModel.search=''; $scope.myModel.search='';
@ -68,33 +69,38 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
} }
else{ else{
if(type=='2'){ if(type=='2'){
$scope.myModel.search = $filter('date')(value.searchDate, 'yyyy-MM-dd'); $scope.myModel.search = $filter('date')(value.searchDate, 'yyyy-MM-dd');
$scope.toMinDate = $filter('date')(value.searchDate, 'MM-dd-yyyy'); $scope.toMinDate = $filter('date')(value.searchDate, 'MM-dd-yyyy');
} }
} }
$scope.searchDateArray(value); $scope.searchDateArray(value,type);
} }
/* /*
* check to date * check to date
* */ * */
$scope.checkToDate = function (value) { $scope.status='';
$scope.checkToDate = function (value,status) {
$scope.status=status;
if(value.searchDate==null || value.searchDate==undefined){ if(value.searchDate==null || value.searchDate==undefined){
swal("Failed!", 'Please Select From Date', "error"); swal("Failed!", 'Please Select From Date', "error");
$scope.myModel.dateTo=''; $scope.myModel.dateTo='';
$scope.myModel.search=''; $scope.myModel.search='';
$scope.toMinDate = ''; $scope.toMinDate = '';
} }
else{
$scope.filterSearch=$filter('date')(value.searchDate, 'dd-MM-yyyy');
$scope.search=$scope.filterSearch;
else{
if(value.searchDate!=null && value.dateTo!=null && status=='true')
{
$scope.filterSearch=$filter('date')(value.searchDate,value.dateTo);
$scope.search=$scope.filterSearch;
}
} }
$scope.searchDateArray(value); $scope.searchDateArray(value,status);
} }
@ -102,8 +108,8 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
/* /*
* make a search date array * make a search date array
*/ */
$scope.searchDateArray=function (dateValue) { $scope.searchDateArray=function (dateValue,status) {
var listDate = []; var listDate = [];
if((dateValue.search !=null && dateValue.search !=undefined) && (dateValue.dateTo !=null && dateValue.dateTo !=undefined && dateValue.dateTo !='')){ if((dateValue.search !=null && dateValue.search !=undefined) && (dateValue.dateTo !=null && dateValue.dateTo !=undefined && dateValue.dateTo !='')){
var startDate =dateValue.search; var startDate =dateValue.search;
@ -117,6 +123,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
var strDate = startDate; var strDate = startDate;
var arrayDate = $filter('date')(strDate, 'dd-MM-yyyy'); var arrayDate = $filter('date')(strDate, 'dd-MM-yyyy');
listDate.push(arrayDate); listDate.push(arrayDate);
} }
else{ else{
while (strDate < endDate){ while (strDate < endDate){
@ -404,19 +411,19 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
* */ * */
$scope.init = function (myModel) { $scope.init = function (myModel) {
// console.log(myModel);
var logcheck = JSON.parse(localStorage.getItem('localObj')); var logcheck = JSON.parse(localStorage.getItem('localObj'));
const LOCALTYPE = logcheck.localType; const LOCALTYPE = logcheck.localType;
if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE=='R005')) { if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE=='R005')) {
console.log("if");
}else { }else {
if(logcheck != null && LOCALTYPE !='R001') { if(logcheck != null && LOCALTYPE !='R001') {
console.log("else if");
$state.go('app.dashboard'); $state.go('app.dashboard');
} else { } else {
console.log("else else");
//ipCookie.remove('cookiechk'); //ipCookie.remove('cookiechk');
window.localStorage.clear(); window.localStorage.clear();
$state.go('login.signin'); $state.go('login.signin');
@ -432,6 +439,9 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
$scope.data = []; $scope.data = [];
if(myModel!='' && myModel!=undefined){ if(myModel!='' && myModel!=undefined){
$scope.finalSearchArry=myModel; $scope.finalSearchArry=myModel;
} }
else{ else{
$scope.finalSearchArry=""; $scope.finalSearchArry="";
@ -449,7 +459,8 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, 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, branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
searchDate: $scope.finalSearchArry searchDate: $scope.finalSearchArry,
status: $scope.status
} }
}; };
$http(getTrackDetails).then(function (response) { $http(getTrackDetails).then(function (response) {
@ -521,7 +532,11 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
}); });
localStorage.setItem('trackingList', JSON.stringify($scope.data)); localStorage.setItem('trackingList', JSON.stringify($scope.data));
} }
else if(response.data.trackingStatus == 1)
{
console.log('hai');
}
else { else {
$scope.loader = false; $scope.loader = false;
@ -651,8 +666,7 @@ app.controller('callTrackingLeadCtrl', ["$scope","$rootScope","toaster", "$filte
//from date change //from date change
$scope.checkDate = function (value) { $scope.checkDate = function (value) {
$scope.myModel.search = $filter('date')(value.leadDate, 'yyyy-MM-dd'); $scope.myModel.search = $filter('date')(value.leadDate, 'yyyy-MM-dd');
@ -687,14 +701,14 @@ app.controller('callTrackingLeadCtrl', ["$scope","$rootScope","toaster", "$filte
const LOCALTYPE = logcheck.localType; const LOCALTYPE = logcheck.localType;
if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R005' || LOCALTYPE == 'R002')) { if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R005' || LOCALTYPE == 'R002')) {
console.log("if"); // console.log("if");
}else { }else {
if(logcheck != null && LOCALTYPE !='R001') { if(logcheck != null && LOCALTYPE !='R001') {
console.log("else if"); // console.log("else if");
$state.go('app.dashboard'); $state.go('app.dashboard');
} else { } else {
console.log("else else"); // console.log("else else");
//ipCookie.remove('cookiechk'); //ipCookie.remove('cookiechk');
window.localStorage.clear(); window.localStorage.clear();
$state.go('login.signin'); $state.go('login.signin');

View File

@ -92,7 +92,7 @@
<input type="text" class="form-control " ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="myModel.dateTo" <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" is-open="startOpen" ng-init="startOpen = false" name="addDate" datepicker-options="dateOptions"
min-date="toMinDate" min-date="toMinDate"
placeholder="Select To Date" close-text="Close" required="required" ng-change="checkToDate(myModel);" ng-readonly="true" placeholder="Select To Date" close-text="Close" required="required" ng-change="checkToDate(myModel,'true');" ng-readonly="true"
show-button-bar="true" /> show-button-bar="true" />
</div> </div>