CHANGE_API 3
This commit is contained in:
parent
ef11ed776e
commit
12f262e2fa
@ -9,6 +9,8 @@ use App\Models\ThzMasterModel;
|
||||
use App\Models\ThzMasterNotesModel;
|
||||
use App\ControllerCleaners\ThzControllerCleaner;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
|
||||
|
||||
class ThzController extends BaseController
|
||||
{
|
||||
@ -19,6 +21,7 @@ class ThzController extends BaseController
|
||||
protected $thzControllerCleaner;
|
||||
|
||||
protected $userModel;
|
||||
protected $clientPolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -26,6 +29,7 @@ class ThzController extends BaseController
|
||||
$this->thzMasterNotesModel = new ThzMasterNotesModel();
|
||||
$this->thzControllerCleaner = new ThzControllerCleaner();
|
||||
$this->userModel = new UserModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
@ -70,6 +74,7 @@ class ThzController extends BaseController
|
||||
$data['page_name'] = "Ticket List";
|
||||
$data['ticket_data'] = $tickets;
|
||||
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['1', '5'])->findAll(); // enga 5-"head" and 1-"admin" role person thaan assignee..
|
||||
$data['client_list'] = $this->clientModel->getCreatedByUserName();
|
||||
return $this->loadLayout('thz_list', $data);
|
||||
}
|
||||
|
||||
@ -81,7 +86,7 @@ class ThzController extends BaseController
|
||||
|
||||
public function ticketConversationSave(){
|
||||
|
||||
$data = $this->request->getJSON(true);
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$result = $this->thzMasterNotesModel->insert($data);
|
||||
|
||||
@ -97,6 +102,35 @@ class ThzController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function ticketAutoFetchDetails(){
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$client_id = $data['client_id'];
|
||||
$mobile = $data['mobile'];
|
||||
|
||||
if($client_id && $mobile){
|
||||
$details = $this->thzMasterModel->ticketAutoFetchDetails($client_id,$mobile);
|
||||
|
||||
if(empty($details)){
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'No Data found']))->setStatusCode(400);
|
||||
}else{
|
||||
|
||||
$policyIds = array_column($details, 'policy_id');
|
||||
$policyIds = array_filter($policyIds);
|
||||
$clientPolicy = $this->clientPolicyModel->whereIn('policy_id', $policyIds)->where('is_active', 1)->get()->getResultArray();
|
||||
$result['client'] =[];
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
return $this->response->setJSON((['status' => 'error', 'message' => 'Client and Mobile Not found']))->setStatusCode(400);
|
||||
}
|
||||
|
||||
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function ticketConversationList(){
|
||||
|
||||
$data = $this->request->getGet();
|
||||
|
||||
@ -39,4 +39,29 @@ class ThzMasterModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function ticketAutoFetchDetails(){
|
||||
|
||||
$autofetch_sql = "SELECT
|
||||
employees.id,employees.client_id,
|
||||
employees.client_branch_id as branch_id,
|
||||
employees.mobile,
|
||||
employees.emp_code,
|
||||
employees.name,
|
||||
employee_polices.client_policy_id as policy_id
|
||||
FROM employees
|
||||
LEFT JOIN employee_polices
|
||||
ON employee_polices.employee_id = employees.id
|
||||
WHERE employees.emp_status IN ('active','draft','enrolled')
|
||||
AND employees.is_active = 1
|
||||
AND employees.mobile = " . $mobile . "
|
||||
AND employees.client_id = " . $client_id . "
|
||||
ORDER BY employees.id DESC";
|
||||
|
||||
$result = $this->db->query($autofetch_sql)->getResultArray();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user