Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-04-30 09:53:36 +05:30
commit e845c19f35
3 changed files with 71 additions and 8 deletions

View File

@ -189,13 +189,23 @@ class TicketController extends BaseController
$isFromDashboard = $this->request->getPost("is_dashboard");
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
if (isset($isFromDashboard) && !empty($isFromDashboard)){
$data['page_name'] = "Claims";
$data['ticket_data'] = $this->ticketSearch(3);
if ($isFromDashboard == 1) {
$data['ticket_data'] = $this->ticketSearch(3);
}else if ($isFromDashboard == 2){
$data['ticket_data'] = $this->ticketSearch(4);
}
$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();
// dd($data);
return $this->loadLayout('ticket_search', $data);
}else{
}
else{
$data['ticket_data'] = $this->ticketSearch();
$html = view('ticket_list', $data);
return $this->respond(['status' => true, 'html' => $html], 200);
@ -239,7 +249,7 @@ class TicketController extends BaseController
->groupBy('tm.id, tm.created_at, latest_history.created_at');
//action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard
//action 1 get last 100 rows, action 2 filter and get all rows related to that, action 3 gets according to dashboard, action 4 gets according to ACM
if ($action == 1) {
$query = $db->table('ticket_master tm')
@ -336,6 +346,16 @@ class TicketController extends BaseController
}
// dd($where);
} else if ($action == 4){
$acm_id = $this->request->getPost('ids');
// dd($acm_id);
if (!empty($acm_id)) {
$where = "tm.acm_id = $acm_id";
} else {
$where = '1 = 0'; // No valid IDs, return empty result
}
} else {
$search_data = $this->request->getPost();
// print_r($search_data); die()
@ -1364,7 +1384,8 @@ class TicketController extends BaseController
if ($received_data['report_type'] == "acc_manager_wise_status"){
$viewData['policy_type'] = $received_data['policy_type'];
$viewData['account_manager_wise_data'] = $this->ticketMasterModel->accountManagerWiseReport($policy_type,$fromDate,$toDate);
// print_rr($viewData);
// print_rr($viewData);die();
if ($policy_type == 1){
$viewData['column_order'] = [
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
@ -1382,6 +1403,7 @@ class TicketController extends BaseController
$ordered_data[] = $temp;
}
$viewData['tpa_wise_data'] = $ordered_data;
// print_rr($viewData);die();
$html = view('claims_report_acc_manager_wise', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else{
@ -1400,6 +1422,7 @@ class TicketController extends BaseController
$ordered_data[] = $temp;
}
$viewData['tpa_wise_data'] = $ordered_data;
// print_rr($viewData);die();
$html = view('claims_report_acc_manager_wise', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}

View File

@ -607,6 +607,7 @@ class TicketMasterModel extends Model
// Construct the final SQL query
$sql = "
SELECT
user_profiles.id as ACM_ID,
user_profiles.first_name AS ACM_NAME,
$dynamicSelect,
($dynamicTotal) AS TOTAL
@ -623,7 +624,6 @@ class TicketMasterModel extends Model
";
$result = $this->db->query($sql)->getResultArray();
// dd($result);
return $result;
} else {
@ -677,6 +677,7 @@ class TicketMasterModel extends Model
// Construct the final SQL query
$sql = "
SELECT
user_profiles.id as ACM_ID,
user_profiles.first_name AS ACM_NAME,
$dynamicSelect,
($dynamicTotal) AS TOTAL,
@ -696,8 +697,9 @@ class TicketMasterModel extends Model
// Execute the query
$result = $this->db->query($sql)->getResultArray();
// print_rr($result);die();
return $result;
}
}

View File

@ -18,6 +18,10 @@
.right-align-input {
text-align: right;
}
#scroll-horizontal-datatable tbody tr:hover {
background-color: #e0e0e0;
}
</style>
<div class="col-12">
@ -47,7 +51,7 @@
<?php foreach ($account_manager_wise_data as $row): ?>
<tr>
<?php foreach ($column_order as $col_name): ?>
<td><?= $row[$col_name] ?></td>
<td onclick = "redirectToClaimList(<?=$row['ACM_ID'] ?>)"><?= $row[$col_name] ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
@ -101,3 +105,37 @@
}
});
</script>
<script>
function redirectToClaimList(id) {
// alert("Redirecting to claim list..."+id);
data = {
is_dashboard: 2,
ids : id
}
redirectWithPost("<?= base_url("ticket/list") ?>", data);
}
function redirectWithPost(url, data = {}) {
const form = document.createElement('form');
form.method = 'POST';
form.action = url;
for (const key in data) {
if (data.hasOwnProperty(key)) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = data[key];
form.appendChild(input);
}
}
document.body.appendChild(form);
form.submit();
}
</script>