Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
003a192b7f
@ -520,6 +520,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||
$routes->get("cdSummaryData", "EmployeeRestController::cdSummaryData");
|
||||
$routes->get("cdTransactionData", "EmployeeRestController::cdTransactionData");
|
||||
$routes->match( ['get', 'post'], 'claimsSearch','EmployeeRestController::claimsSearch');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||
@ -531,8 +533,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
||||
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
|
||||
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
|
||||
@ -2396,6 +2396,150 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function claimsSearch()
|
||||
{
|
||||
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
$data['claim_status'] = $this->claimStatusModel->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
$data['ticket_type'] = [
|
||||
["ticket_type" => "1", "type_name" => "Claim-GMC"],
|
||||
["ticket_type" => "2", "type_name" => "Claim-GPA"],
|
||||
["ticket_type" => "3", "type_name" => "EDLI"],
|
||||
["ticket_type" => "4", "type_name" => "GTLI"],
|
||||
];
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
|
||||
}
|
||||
|
||||
$db = db_connect();
|
||||
|
||||
$search_data = $this->request->getJSON(true); // Get JSON as associative array
|
||||
|
||||
$client_id = isset($search_data['client_id']) ? (int) $search_data['client_id'] : 0;
|
||||
unset($search_data['client_id']);
|
||||
|
||||
$from_date = isset($search_data['from_date']) ? $search_data['from_date'] : null;
|
||||
$to_date = isset($search_data['to_date']) ? $search_data['to_date'] : null;
|
||||
unset($search_data['from_date'], $search_data['to_date']);
|
||||
|
||||
$where = [];
|
||||
|
||||
// Dynamically build WHERE conditions from non-empty parameters
|
||||
foreach ($search_data as $key => $value) {
|
||||
if (!empty($value) && $value !== 0 && $value !== '0') {
|
||||
$where["tm.$key"] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$builder = $db->table('ticket_master tm');
|
||||
$builder->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name_sub',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.client_policy_id',
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
]);
|
||||
|
||||
$builder->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left');
|
||||
$builder->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left');
|
||||
$builder->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left');
|
||||
|
||||
$builder->where('tm.is_active', 1);
|
||||
|
||||
if ($client_id > 0) {
|
||||
$builder->where('tm.client_id', $client_id);
|
||||
}
|
||||
|
||||
if (!empty($from_date) && !empty($to_date)) {
|
||||
$from_date_mysql = date('Y-m-d', strtotime($from_date));
|
||||
$to_date_mysql = date('Y-m-d', strtotime($to_date));
|
||||
$builder->where("DATE(tm.created_at) BETWEEN '$from_date_mysql' AND '$to_date_mysql'");
|
||||
}
|
||||
|
||||
if (!empty($where)) {
|
||||
$builder->where($where);
|
||||
}
|
||||
|
||||
$builder->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $builder->get()->getResultArray();
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
|
||||
}
|
||||
|
||||
public function claimView()
|
||||
{
|
||||
$ticket_id = $this->request->getGet('ticket_id');
|
||||
$ticketController = new TicketController;
|
||||
$data['ticket_history'] = $ticketController->ticketHistory($ticket_id);
|
||||
$data['claims_data'] = $this->ticketMaster->getTicketDataByTicketID($ticket_id);
|
||||
$data['ticket_data'] = $ticketController->getMoreInfo($requestFrom = 'rest', $ticket_id);
|
||||
|
||||
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function exportCashDepositData()
|
||||
|
||||
@ -1854,8 +1854,12 @@ class TicketController extends BaseController
|
||||
$this->loadLayout("ticket_feedback_list",$data);
|
||||
}
|
||||
|
||||
public function getMoreInfo() {
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
public function getMoreInfo($requestFrom = null , $ticket_id) {
|
||||
|
||||
if($requestFrom == null){
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
||||
|
||||
$fields = $this->extraFields;
|
||||
@ -1919,6 +1923,9 @@ class TicketController extends BaseController
|
||||
|
||||
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
||||
|
||||
if($requestFrom == 'rest'){
|
||||
return $data_to_send;
|
||||
}
|
||||
// Send response based on data availability
|
||||
if (!empty($data_to_send)) {
|
||||
return $this->respond(['status' => true, 'data' => $data_to_send], 200);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user