634 lines
24 KiB
PHP
Executable File
634 lines
24 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 11/15/17
|
|
* Time: 5:41 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
|
/** @noinspection PhpIncludeInspection */
|
|
require_once APPPATH . '/libraries/REST_Controller.php';
|
|
|
|
/**
|
|
* This is an example of a few basic user interaction methods you could use
|
|
* all done with a hardcoded array
|
|
*
|
|
* @package CodeIgniter
|
|
* @subpackage Rest Server
|
|
* @category Controller
|
|
* @author
|
|
* @license MIT
|
|
* @link
|
|
*/
|
|
class Call_Tracking_Controller extends REST_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
|
|
// Configure limits on our controller methods
|
|
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
|
|
$this->methods['getTrackingLeadDetails_get']['limit'] = 500; // 500 requests per hour per user/key
|
|
$this->methods['getTrackingLeadDetails_post']['limit'] = 1000; // 100 requests per hour per user/key
|
|
$this->methods['getTrackingLeadDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
|
|
$this->methods['addTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['updateFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['loadFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getDashboardCallTrack_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentLeadDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentCloseDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentPendingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['callAsImportantFlag_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
|
|
|
|
// load the model
|
|
$this->load->model('Calltracking_model', 'Calltracking_model');
|
|
|
|
}
|
|
|
|
/*
|
|
* get lead details with mobile number
|
|
* created by kms
|
|
* */
|
|
public function getTrackingLeadDetails_post()
|
|
{
|
|
$requestedBy = $this->post('requestedBy');
|
|
$mobileNumber = $this->post('mobileNumber');
|
|
$branchID = $this->post('branchID');
|
|
$loginType = $this->post('userType');
|
|
$getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber,$branchID,$loginType);
|
|
|
|
if ($getLeadDetails)
|
|
{
|
|
$getLeadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* add tracking lead details
|
|
* created by kms
|
|
* */
|
|
|
|
public function addLeadTrackingDetails_post()
|
|
{
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
//store lead details
|
|
$lead_details['LeadName'] = $this->post('studentName');
|
|
$lead_details['MobileNumber'] = $this->post('mobileNumber');
|
|
$lead_details['IsNewEnquiry'] = $this->post('enquiryStatus');
|
|
$lead_details['CreatedBy'] = $this->post('createdBy');
|
|
$lead_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
|
|
//store tracking details
|
|
$tracking_details['University'] = $this->post('universityID');
|
|
$tracking_details['Course'] = $this->post('courseName');
|
|
$tracking_details['ActivityStatus'] = $this->post('activity');
|
|
$tracking_details['AssignedTo'] = $this->post('assignedTo');
|
|
// echo $tracking_details['AssignedTo'];
|
|
$tracking_details['StatusCode'] = $this->post('status');
|
|
$tracking_details['ReferredBy'] = $this->post('referedBy');
|
|
$tracking_details['AlternateMobile'] = $this->post('alterMobile');
|
|
$tracking_details['Address'] = $this->post('address');
|
|
$tracking_details['EmailID'] =$this->post('emailId');
|
|
|
|
$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');
|
|
$tracking_followup_details['CreatedBy'] = $this->post('createdBy');
|
|
$tracking_followup_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$tracking_followup_details['StatusName'] = $this->post('status');
|
|
$tracking_followup_details['AssignedStaff'] = $this->post('assignedTo');
|
|
// echo $tracking_followup_details['AssignedStaff'];
|
|
|
|
$AssignedTo = $this->post('assignedTo');
|
|
// $MobileNo = $this->post('MobileNo');
|
|
//echo $AssignedTo;
|
|
// echo $MobileNo;
|
|
$message = $this->post('msgactivity');
|
|
// echo $message;die();
|
|
|
|
|
|
|
|
|
|
$leadDetails = $this->Calltracking_model->addleadDetails($AssignedTo,$lead_details,$tracking_details,$tracking_followup_details,$message);
|
|
// Check if the users data store contains users (in case the database result returns NULL)
|
|
if ($leadDetails)
|
|
{
|
|
$leadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($leadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'Something went wrong.please try again!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get tracking details
|
|
* created by kms
|
|
* */
|
|
public function getTrackingDetails_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
// $search['branchID'] = $this->post('branchId');
|
|
$search['searchDate'] = $this->post('searchDate');
|
|
// print_r( $search['searchDate']);
|
|
$search['CreatedBranch'] = $this->post('branchId');
|
|
|
|
// $search['callTrackingaccess'] = $this->post('callTrackingaccess');
|
|
|
|
// echo $search['callTrackingaccess'];die();
|
|
|
|
$status=$this->post('status');
|
|
|
|
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
|
|
// $search['searchName']= $this->post('searchName');
|
|
$getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search,$status);
|
|
|
|
|
|
// print_r($getTrackedDetails);
|
|
// die();
|
|
|
|
if ($getTrackedDetails)
|
|
{
|
|
$getTrackedDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getTrackedDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* update tracking followup details
|
|
* created by kms
|
|
* */
|
|
public function updateFollowupDetails_post()
|
|
{
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
|
|
//store followup details for update
|
|
$update_followup_details['TrackingID'] = $this->post('trackingID');
|
|
$update_followup_details['UpdatedBy'] = $this->post('updatedBy');
|
|
$update_followup_details['StatusCode'] = $this->post('status');
|
|
$update_followup_details['AssignedTo'] = $this->post('assignedTo');
|
|
$update_followup_details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$update_followup_details['CreatedBranch'] = $this->post('branchId');
|
|
$update_followup_details['Address'] = $this->post('address');
|
|
$update_followup_details['AlternateMobile'] = $this->post('alternateMobile');
|
|
$update_followup_details['ReferredBy'] = $this->post('referredBy');
|
|
$update_followup_details['University'] = $this->post('universityName');
|
|
$update_followup_details['Course'] = $this->post('courseName');
|
|
$update_followup_details['PendingDocStatus'] = $this->post('pendingDocStatus');
|
|
// store followup details for insert
|
|
$followup_details['TrackingID'] = $this->post('trackingID');
|
|
$followup_details['FollowupOn'] = $this->post('date');
|
|
$followup_details['CreatedBy'] = $this->post('updatedBy');
|
|
$followup_details['FollowupComments'] = $this->post('comments');
|
|
$followup_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$followup_details['StatusName'] = $this->post('status');
|
|
$followup_details['AssignedStaff'] = $this->post('assignedTo');
|
|
|
|
|
|
|
|
|
|
|
|
$updateDetails = $this->Calltracking_model->updateFollowupDetails($update_followup_details,$followup_details);// Check if the users data store contains users (in case the database result returns NULL)
|
|
// echo "com";
|
|
// print_r($followup_details);
|
|
// print_r($update_followup_details);
|
|
// exit();
|
|
if ($updateDetails)
|
|
{
|
|
$updateDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'Something went wrong.please try again!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* load followup details
|
|
* created by kms
|
|
* */
|
|
|
|
public function loadFollowupDetails_post()
|
|
{
|
|
$get_details['TrackingID'] = $this->post('trackingID');
|
|
$get_details['UpdatedBy'] = $this->post('updatedBy');
|
|
$get_details['CreatedBranch'] = $this->post('branchId');
|
|
$get_details['requestedDept'] = $this->post('requestedDept');
|
|
|
|
$getLoadDetails = $this->Calltracking_model->getLoadFollowupDetails($get_details);
|
|
|
|
if ($getLoadDetails)
|
|
{
|
|
$getLoadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getLoadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get dash board call track details
|
|
* created by kms
|
|
* */
|
|
|
|
public function getDashboardCallTrack_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['BranchID'] = $this->post('branchId');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
|
|
$getdashBoardCallDetails = $this->Calltracking_model->getDashboardTrackingDetails($search);
|
|
if ($getdashBoardCallDetails)
|
|
{
|
|
$getdashBoardCallDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getdashBoardCallDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get recent call lead details
|
|
* created by kms
|
|
* */
|
|
|
|
public function getRecentLeadDetails_post()
|
|
{
|
|
$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');
|
|
$getRecentLeadDetails = $this->Calltracking_model->getRecentleadDetails($search);
|
|
|
|
if ($getRecentLeadDetails)
|
|
{
|
|
$getRecentLeadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get recent close details
|
|
* created by kms
|
|
* */
|
|
public function getRecentCloseDetails_post()
|
|
{
|
|
$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');
|
|
$getRecentCloseDetails = $this->Calltracking_model->getRecentCloseDetails($search);
|
|
|
|
if ($getRecentCloseDetails)
|
|
{
|
|
$getRecentCloseDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentCloseDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* get recent pending details
|
|
* created by kms
|
|
* */
|
|
public function getRecentPendingDetails_post()
|
|
{
|
|
$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');
|
|
$getRecentPendingDetails = $this->Calltracking_model->getRecentPendingDetails($search);
|
|
|
|
if ($getRecentPendingDetails)
|
|
{
|
|
$getRecentPendingDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentPendingDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* mark as important for call
|
|
* created by kms
|
|
* */
|
|
public function callAsImportantFlag_post(){
|
|
$trackID = $this->post('trackId');
|
|
$flagStatus = $this->post('flag');
|
|
$updateFlag = $this->Calltracking_model->updateFlagStatus($trackID,$flagStatus);
|
|
|
|
if ($updateFlag)
|
|
{
|
|
$updateFlag['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($updateFlag, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* Auto call tracking
|
|
* by sriram
|
|
*/
|
|
public function autoAddlead_post(){
|
|
$student = $this->post('student');
|
|
$comments = $this->post('comments');
|
|
//print_r($comments);die;
|
|
if(!empty($student)){
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
//store lead details
|
|
$Student_Id = '';
|
|
foreach($student as $index =>$student){
|
|
|
|
|
|
$lead_details['LeadName'] = $student['Student_name'];
|
|
$lead_details['MobileNumber'] = $student['Phone_number'];
|
|
$lead_details['IsNewEnquiry'] = 1;
|
|
$CreatedBy = $this->post('createdBy');
|
|
|
|
|
|
//store tracking details
|
|
$tracking_details['University'] = $student['University'];
|
|
$tracking_details['Course'] = $student['Course_name'];
|
|
$tracking_details['ActivityStatus'] = $this->post('activity');
|
|
$tracking_details['AssignedTo'] = $this->post('assignedTo');
|
|
$tracking_details['StatusCode'] = $this->post('status');
|
|
$tracking_details['ReferredBy'] = $this->post('referedBy');
|
|
$tracking_details['AlternateMobile'] = $student['AlternateNumber'];
|
|
$tracking_details['Address'] = $student['address'];
|
|
|
|
|
|
$tracking_details['CreatedBranch'] = $this->post('branchId');
|
|
//store tracking followup details
|
|
$tracking_followup_details['FollowupOn'] = $this->post('date');
|
|
$tracking_followup_details['FollowupComments'] = $comments[$index];
|
|
|
|
$tracking_followup_details['StatusName'] = $this->post('status');
|
|
$tracking_followup_details['AssignedStaff'] = $this->post('assignedTo');
|
|
//print_r(array($lead_details,$tracking_details,$tracking_followup_details));
|
|
|
|
$leadDetails['leadDetails'] = $this->Calltracking_model->getaddautocall($lead_details,$tracking_details,$tracking_followup_details,$CreatedBy);// Check if the users data store contains users (in case the database result returns NULL)
|
|
|
|
|
|
}
|
|
// print_r($leadDetails);die;
|
|
if (sizeof($leadDetails)>0)
|
|
{
|
|
$leadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($leadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'Something went wrong.please try again!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
}
|
|
}
|
|
|
|
public function autoTrackingDetails_post(){
|
|
// $student = $this->post('student');
|
|
// if(!empty($student)){
|
|
// foreach($student as $student){
|
|
// $requestedBy = $this->post('requestedBy');
|
|
// $mobileNumber = $student['Phone_number'];
|
|
// $branchID = $this->post('branchID');
|
|
// $loginType = $this->post('userType');
|
|
// $getLeadDetails['getLeadDetails'] = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber,$branchID,$loginType);
|
|
// }
|
|
// }
|
|
// // print_r($getLeadDetails);die;
|
|
// if (sizeof($getLeadDetails)>0)
|
|
// {
|
|
// $getLeadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// // Set the response and exit
|
|
// $this->response($getLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
// }
|
|
// else
|
|
// {
|
|
// // Set the response and exit
|
|
// $this->response([
|
|
// 'message' => 'No records found!',
|
|
// 'status' => REST_Controller::HTTP_NOT_FOUND
|
|
// ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
// }
|
|
}
|
|
|
|
|
|
public function getstaffcallDetails_post()
|
|
{
|
|
$branchID = $this->post('branch');
|
|
// $myDate = date('Y-m-d');
|
|
|
|
$myDate = $this->post('date');
|
|
|
|
$staff = $this->post('staff');
|
|
|
|
$todaycalldetails = $this->Calltracking_model->GetStaffCallDetails($branchID,$myDate,$staff);
|
|
|
|
|
|
if($todaycalldetails)
|
|
{
|
|
$todaycalldetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($todaycalldetails, 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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
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
|
|
*/
|
|
public function updateFollowupDetails2_post()
|
|
{
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
$student = $this->post('student');
|
|
|
|
foreach($student as $index =>$student){
|
|
|
|
if($this->post('status') == '' || $this->post('status') == NULL){
|
|
$status = $student['StatusCode'];
|
|
}else{
|
|
$status = $this->post('status');
|
|
}
|
|
$update_followup_details['TrackingID'] = $student['TrackingID'];
|
|
$update_followup_details['UpdatedBy'] = $this->post('createdBy');
|
|
$update_followup_details['StatusCode'] = $status;
|
|
$update_followup_details['AssignedTo'] = $this->post('assignedTo');
|
|
$update_followup_details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$update_followup_details['CreatedBranch'] = $this->post('branchId');
|
|
|
|
// followup details for insert
|
|
$followup_details['TrackingID'] = $student['TrackingID'];
|
|
$followup_details['FollowupOn'] = $this->post('date');
|
|
$followup_details['CreatedBy'] = $this->post('createdBy');
|
|
$followup_details['FollowupComments'] = $this->post('comments');
|
|
$followup_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$followup_details['StatusName'] = $status;
|
|
$followup_details['AssignedStaff'] = $this->post('assignedTo');
|
|
$leadDetails['leadDetails'] = $this->Calltracking_model->updateFollowupDetails2($update_followup_details,$followup_details);
|
|
}
|
|
|
|
if (sizeof($leadDetails)>0)
|
|
{
|
|
$leadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($leadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else {
|
|
// Set the response and exit
|
|
$this->response(['message' => 'Something went wrong.please try again!','status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
}
|
|
|
|
} |