MERGE_CODE_MERGE : RV
This commit is contained in:
commit
165011cf14
@ -129,7 +129,7 @@ class TicketController extends BaseController
|
|||||||
$data['ticket_type'] = $this->ticketType;
|
$data['ticket_type'] = $this->ticketType;
|
||||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||||
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
|
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
|
||||||
|
$data['ticket_data'] = $this->ticketSearch(1);
|
||||||
return $this->loadLayout('ticket_search', $data);
|
return $this->loadLayout('ticket_search', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -139,32 +139,50 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticketSearch()
|
public function ticketSearch($action = null)
|
||||||
{
|
{
|
||||||
$search_data = $this->request->getPost();
|
//action 1 get last 100 rows, action 2 filter and get all rows related to that
|
||||||
// print_r($search_data);
|
if ($action == 1) {
|
||||||
$where = [];
|
$data = $this->ticketMasterModel
|
||||||
foreach ($search_data as $search_objects => $key) {
|
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
||||||
if ($key != null && $key != '' && $key != 0) {
|
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
||||||
$where[$search_objects] = $key;
|
insurers.name as insurer_name, clients.client_name,
|
||||||
|
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||||
|
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
||||||
|
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
||||||
|
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
||||||
|
->where('ticket_master.is_active', 1)
|
||||||
|
->orderBy('ticket_master.id', 'DESC')
|
||||||
|
->limit(100)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
} else {
|
||||||
|
$search_data = $this->request->getPost();
|
||||||
|
// print_r($search_data);
|
||||||
|
$where = [];
|
||||||
|
foreach ($search_data as $search_objects => $key) {
|
||||||
|
if ($key != null && $key != '' && $key != 0) {
|
||||||
|
$where[$search_objects] = $key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// print_rr($where);
|
||||||
// print_rr($where);
|
$data = $this->ticketMasterModel
|
||||||
$data = $this->ticketMasterModel
|
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
||||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
|
||||||
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
||||||
insurers.name as insurer_name, clients.client_name,
|
insurers.name as insurer_name, clients.client_name,
|
||||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
||||||
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
||||||
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
||||||
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
||||||
->where('ticket_master.is_active', 1)
|
->where('ticket_master.is_active', 1)
|
||||||
->where($where)
|
->where($where)
|
||||||
->findAll();
|
->findAll();
|
||||||
// print_rr($data);
|
// print_rr($data);
|
||||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||||
// print_rr($data);die();
|
// print_rr($data);die();
|
||||||
return $data;
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticket_form($ticket_type)
|
public function ticket_form($ticket_type)
|
||||||
@ -202,8 +220,8 @@ class TicketController extends BaseController
|
|||||||
// Fetch ACM Users
|
// Fetch ACM Users
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$data['acms'] = $db->table('user_profiles')
|
$data['acms'] = $db->table('user_profiles')
|
||||||
->select('id, first_name')
|
->select('id, first_name')
|
||||||
->where(['is_active' => 1, 'role' => 3])
|
->where(['is_active' => 1, 'role' => 3])
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
@ -242,7 +260,7 @@ class TicketController extends BaseController
|
|||||||
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
$data['message_data'] = $this->getTicketMessage($ticket_id);
|
||||||
$data['view_ticket_page'] = [];
|
$data['view_ticket_page'] = [];
|
||||||
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
$data['member_data'] = $this->employeeModel->getEmployeeByEmployeeCode($ticket_data['emp_code']);
|
||||||
|
$data['ticket_history'] = $this->ticketHistory($ticket_id);
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
return $this->loadLayout('ticket_edit_onbording', $data);
|
return $this->loadLayout('ticket_edit_onbording', $data);
|
||||||
@ -313,7 +331,7 @@ class TicketController extends BaseController
|
|||||||
if ($return_value) {
|
if ($return_value) {
|
||||||
//mail trigger part
|
//mail trigger part
|
||||||
$mail_responce = $this->sendAutoMailTrigger($return_value);
|
$mail_responce = $this->sendAutoMailTrigger($return_value);
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' =>$mail_responce], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
||||||
}
|
}
|
||||||
@ -337,7 +355,7 @@ class TicketController extends BaseController
|
|||||||
//mail trigger part
|
//mail trigger part
|
||||||
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
$mail_responce = $this->sendAutoMailTrigger($ticket_id);
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' =>$mail_responce], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200);
|
||||||
}
|
}
|
||||||
@ -528,7 +546,6 @@ class TicketController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Final Email Data");
|
$this->myLogger->logme('error', "Final Email Data");
|
||||||
|
|
||||||
return $mailData;
|
return $mailData;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->myLogger->logme('ERROR', "Exception in constructMailContent: " . $e->getMessage());
|
$this->myLogger->logme('ERROR', "Exception in constructMailContent: " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
@ -539,10 +556,10 @@ class TicketController extends BaseController
|
|||||||
{
|
{
|
||||||
$this->myLogger->logme('error', "Replacing placeholders in content");
|
$this->myLogger->logme('error', "Replacing placeholders in content");
|
||||||
|
|
||||||
if(!empty($ticket_data) && !empty($content)){
|
if (!empty($ticket_data) && !empty($content)) {
|
||||||
foreach ($this->placeHolders as $key => $value) {
|
foreach ($this->placeHolders as $key => $value) {
|
||||||
$replaceData = strtoupper($ticket_data[$value]) ?? '';
|
$replaceData = strtoupper($ticket_data[$value]) ?? '';
|
||||||
if($value == "emp_code"){
|
if ($value == "emp_code") {
|
||||||
$replaceData = $ticket_data[$value] ?? '';
|
$replaceData = $ticket_data[$value] ?? '';
|
||||||
}
|
}
|
||||||
$content = str_replace($key, $replaceData, $content);
|
$content = str_replace($key, $replaceData, $content);
|
||||||
@ -600,7 +617,7 @@ class TicketController extends BaseController
|
|||||||
$auto_mail_enable = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
$auto_mail_enable = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
|
||||||
|
|
||||||
$mail_responce = [];
|
$mail_responce = [];
|
||||||
if($auto_mail_enable['is_auto_mail'] == 1){
|
if ($auto_mail_enable['is_auto_mail'] == 1) {
|
||||||
$mail_content = $this->constructMailContent($ticket_id);
|
$mail_content = $this->constructMailContent($ticket_id);
|
||||||
$mail_responce = $this->sendTrigger($mail_content);
|
$mail_responce = $this->sendTrigger($mail_content);
|
||||||
}
|
}
|
||||||
@ -611,5 +628,121 @@ class TicketController extends BaseController
|
|||||||
//---- End Email Trigger Part----------------------------------------------------------------------------------------------
|
//---- End Email Trigger Part----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public function ticketHistory($ticket_id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
th.id,
|
||||||
|
th.field_name,
|
||||||
|
th.display_name,
|
||||||
|
th.old_value,
|
||||||
|
th.new_value,
|
||||||
|
th.created_at,
|
||||||
|
CONCAT(creator.first_name, ' ', creator.last_name) as modified_by,
|
||||||
|
-- Claim Status
|
||||||
|
old_status.claim_status as old_status_value,
|
||||||
|
new_status.claim_status as new_status_value,
|
||||||
|
|
||||||
|
-- Account Manager
|
||||||
|
CONCAT(old_account_manager.first_name, ' ', old_account_manager.last_name) as old_account_manager,
|
||||||
|
CONCAT(new_account_manager.first_name, ' ', new_account_manager.last_name) as new_account_manager,
|
||||||
|
|
||||||
|
-- Insured Employee ID Change
|
||||||
|
old_insured_emp.name as old_insured_id_name,
|
||||||
|
new_insured_emp.name as new_insured_id_name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM
|
||||||
|
ticket_history th
|
||||||
|
|
||||||
|
-- Join for the user who made the change
|
||||||
|
LEFT JOIN user_profiles creator
|
||||||
|
ON th.created_by = creator.id
|
||||||
|
|
||||||
|
-- Status value lookups
|
||||||
|
LEFT JOIN ticket_claim_status old_status
|
||||||
|
ON th.field_name = 'claim_status_id'
|
||||||
|
AND th.old_value = old_status.id
|
||||||
|
AND old_status.is_active = 1
|
||||||
|
LEFT JOIN ticket_claim_status new_status
|
||||||
|
ON th.field_name = 'claim_status_id'
|
||||||
|
AND th.new_value = new_status.id
|
||||||
|
|
||||||
|
LEFT JOIN user_profiles as old_account_manager
|
||||||
|
ON th.field_name = 'acm_id'
|
||||||
|
AND th.old_value = old_account_manager.id
|
||||||
|
|
||||||
|
LEFT JOIN user_profiles as new_account_manager
|
||||||
|
ON th.field_name = 'acm_id'
|
||||||
|
AND th.new_value = new_account_manager.id
|
||||||
|
|
||||||
|
LEFT JOIN employees as old_insured_emp
|
||||||
|
ON th.field_name = 'insured_emp_id'
|
||||||
|
AND th.old_value = old_insured_emp.id
|
||||||
|
|
||||||
|
LEFT JOIN employees as new_insured_emp
|
||||||
|
ON th.field_name = 'insured_emp_id'
|
||||||
|
AND th.new_value = new_insured_emp.id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
th.ticket_id = $ticket_id
|
||||||
|
AND th.is_active = 1
|
||||||
|
ORDER BY
|
||||||
|
th.created_at DESC";
|
||||||
|
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
|
||||||
|
$priorityType = $this->priorityType;
|
||||||
|
$relationshipType = $this->relationshipType;
|
||||||
|
$modeOFIntimate = $this->modeOFIntimate;
|
||||||
|
$claim_type = $this->claimType;
|
||||||
|
foreach ($data as &$row) {
|
||||||
|
if ($row['field_name'] == 'claim_status_id') {
|
||||||
|
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
|
||||||
|
$new_new_value = $row['new_status_value'];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'acm_id') {
|
||||||
|
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
|
||||||
|
$new_new_value = $row['new_account_manager'];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'insured_emp_id') {
|
||||||
|
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
|
||||||
|
$new_new_value = $row['new_insured_id_name'];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'priority') {
|
||||||
|
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
|
||||||
|
$new_new_value = $priorityType[$row['new_value']];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'relationship') {
|
||||||
|
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
|
||||||
|
$new_new_value = $relationshipType[$row['new_value']];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'mode_of_intimation') {
|
||||||
|
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
|
||||||
|
$new_new_value = $modeOFIntimate[$row['new_value']];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'claim_type') {
|
||||||
|
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
|
||||||
|
$new_new_value = $claim_type[$row['new_value']];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} elseif ($row['field_name'] == 'claim_type') {
|
||||||
|
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
|
||||||
|
$new_new_value = $claim_type[$row['new_value']];
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
$row['new_value'] = $new_new_value;
|
||||||
|
} else {
|
||||||
|
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
|
||||||
|
$row['old_value'] = $new_old_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,8 @@ class TicketHistoryModel extends Model
|
|||||||
protected $returnType = 'array';
|
protected $returnType = 'array';
|
||||||
protected $useSoftDeletes = false;
|
protected $useSoftDeletes = false;
|
||||||
protected $protectFields = true;
|
protected $protectFields = true;
|
||||||
protected $allowedFields = [];
|
protected $allowedFields = ['id','field_name','display_name','old_value',
|
||||||
|
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
protected $allowCallbacks = true;
|
protected $allowCallbacks = true;
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
<table id="scroll-horizontal-datatable" class="table w-100">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Field</th>
|
<th>Field</th>
|
||||||
<th>Old Value</th>
|
<!-- <th>Old Value</th>
|
||||||
<th>New Value</th>
|
<th>New Value</th> -->
|
||||||
|
<th>Change</th>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Date/Time</th>
|
<th>Date/Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -16,12 +17,11 @@
|
|||||||
<?php if (isset($ticket_history)) { ?>
|
<?php if (isset($ticket_history)) { ?>
|
||||||
<?php foreach($ticket_history as $index => $row){ ?>
|
<?php foreach($ticket_history as $index => $row){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['status']; ?></td>
|
<td><?php echo $row['display_name']; ?></td>
|
||||||
<td><?php echo $row['claim_no']; ?></td>
|
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
|
||||||
<td><?php echo $row['tpa_id']; ?></td>
|
<!-- <td><?php //echo $row['new_value']; ?></td> -->
|
||||||
<td><?php echo $row['emp_name']; ?></td>
|
<td><?php echo $row['modified_by']; ?></td>
|
||||||
<td><?php echo $row['insurer_name']; ?></td>
|
<td><?php echo $row['created_at']; ?></td>
|
||||||
<td><?php echo $row['client_name']; ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -31,3 +31,43 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end col-->
|
</div> <!-- end col-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||||
|
|
||||||
|
if (ticketsTable.length) {
|
||||||
|
ticketsTable.DataTable({
|
||||||
|
// scrollX: true,
|
||||||
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'>>" + // Filter left, buttons right
|
||||||
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||||
|
// buttons: [{
|
||||||
|
// extend: 'csv',
|
||||||
|
// text: 'CSV',
|
||||||
|
// title: 'Ticket_History',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// extend: 'excel',
|
||||||
|
// text: 'Excel',
|
||||||
|
// title: 'Ticket_History',
|
||||||
|
// exportOptions: {
|
||||||
|
// orthogonal: 'sort'
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ],
|
||||||
|
language: {
|
||||||
|
search: "_INPUT_",
|
||||||
|
searchPlaceholder: "Search..."
|
||||||
|
},
|
||||||
|
paging: true, // Enable pagination
|
||||||
|
pageLength: 10, // Set default number of rows per page (optional)
|
||||||
|
ordering: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("Table atet found.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -161,7 +161,7 @@ function fetchTicketListData() {
|
|||||||
var requestData = {
|
var requestData = {
|
||||||
ticket_type_id: ticket_type,
|
ticket_type_id: ticket_type,
|
||||||
pod_no: pod_no,
|
pod_no: pod_no,
|
||||||
claim_no: claim_no,
|
claim_number: claim_no,
|
||||||
emp_code: emp_code,
|
emp_code: emp_code,
|
||||||
claim_status_id: claim_status,
|
claim_status_id: claim_status,
|
||||||
emp_mobile: emp_mobile_no,
|
emp_mobile: emp_mobile_no,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user