Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
41efe875e2
@ -317,10 +317,10 @@ class EmployeeController extends AdminController
|
|||||||
$branch_id = isset($post_data['client_branch_id']) ? $post_data['client_branch_id'] : $this->request->getPost('branch_id');
|
$branch_id = isset($post_data['client_branch_id']) ? $post_data['client_branch_id'] : $this->request->getPost('branch_id');
|
||||||
$action = isset($post_data['file_action']) ? $post_data['file_action'] : $this->request->getPost('upload-action-type');
|
$action = isset($post_data['file_action']) ? $post_data['file_action'] : $this->request->getPost('upload-action-type');
|
||||||
|
|
||||||
if(empty($post_data)){
|
if (empty($post_data)) {
|
||||||
$hr_file_id = $this->request->getPost('hr_file_id') ?? null;
|
$hr_file_id = $this->request->getPost('hr_file_id') ?? null;
|
||||||
}else{
|
} else {
|
||||||
$hr_file_id = $post_data['hr_file_id'] ?? null ;
|
$hr_file_id = $post_data['hr_file_id'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hr_id = $post_data['created_by'] ?? null;
|
$hr_id = $post_data['created_by'] ?? null;
|
||||||
@ -342,9 +342,9 @@ class EmployeeController extends AdminController
|
|||||||
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
|
||||||
//endof validation process
|
//endof validation process
|
||||||
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
||||||
if(!empty($post_data)){
|
if (!empty($post_data)) {
|
||||||
return ['status' => false, 'message' => 'File rejected with errors', 'file_id' => $file_id];
|
return ['status' => false, 'message' => 'File rejected with errors', 'file_id' => $file_id];
|
||||||
}else{
|
} else {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File rejected with errors'], 200);
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File rejected with errors'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,6 +363,9 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$get_data = $this->request->getGet();
|
||||||
|
// dd($get_data);
|
||||||
|
|
||||||
$data['tab_name'] = 'View Inception';
|
$data['tab_name'] = 'View Inception';
|
||||||
$data['page_name'] = 'View Inception';
|
$data['page_name'] = 'View Inception';
|
||||||
|
|
||||||
@ -389,7 +392,17 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$query = $this->fileModel
|
$query = $this->fileModel
|
||||||
->select([
|
->select([
|
||||||
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by',
|
'files.id',
|
||||||
|
'files.file_name',
|
||||||
|
'files.created_by',
|
||||||
|
'files.created_at',
|
||||||
|
'files.is_active',
|
||||||
|
'files.status',
|
||||||
|
'files.client_id',
|
||||||
|
'files.policy_id',
|
||||||
|
'files.client_branch_id',
|
||||||
|
'files.action',
|
||||||
|
'files.uploaded_by',
|
||||||
'up.emp_code',
|
'up.emp_code',
|
||||||
// 'up.first_name',
|
// 'up.first_name',
|
||||||
'c.short_name',
|
'c.short_name',
|
||||||
@ -397,8 +410,8 @@ class EmployeeController extends AdminController
|
|||||||
'cp.id as client_policy_id',
|
'cp.id as client_policy_id',
|
||||||
'"0" as employee_count',
|
'"0" as employee_count',
|
||||||
'"0" as total',
|
'"0" as total',
|
||||||
'policy_type.policy_type' ,
|
'policy_type.policy_type',
|
||||||
'cp.policy_no' ,
|
'cp.policy_no',
|
||||||
"CASE
|
"CASE
|
||||||
WHEN files.hr_id IS NOT NULL THEN
|
WHEN files.hr_id IS NOT NULL THEN
|
||||||
CONCAT(
|
CONCAT(
|
||||||
@ -419,18 +432,49 @@ class EmployeeController extends AdminController
|
|||||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||||
->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left')
|
->join("client_rm cr", "cr.client_id = c.id and cr.is_active = 1", 'left')
|
||||||
->where('files.is_active', 1);
|
->where('files.is_active', 1);
|
||||||
if (in_array($role_id, [2, 3])) {
|
|
||||||
|
|
||||||
|
if (!empty($get_data['start_date'] ?? null) && !empty($get_data['end_date'] ?? null)) {
|
||||||
|
// 1. If dates are provided, use the user's filter
|
||||||
|
$start = change_date_format($get_data['start_date'], 'd/m/Y', 'Y-m-d') . ' 00:00:00';
|
||||||
|
$end = change_date_format($get_data['end_date'], 'd/m/Y', 'Y-m-d') . ' 23:59:59';
|
||||||
|
|
||||||
|
$query->where('files.created_at >=', $start)
|
||||||
|
->where('files.created_at <=', $end);
|
||||||
|
} else {
|
||||||
|
if(empty($get_data['tab_type'] ?? null)){
|
||||||
|
// 2. Default: If no dates are selected, show last 90 days (or all data)
|
||||||
|
$query->where('files.created_at >=', date('Y-m-d 00:00:00', strtotime('-90 days')))
|
||||||
|
->where('files.created_at <=', date('Y-m-d 23:59:59'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['client_id'] ?? null)){
|
||||||
|
$query->where('files.client_id', $get_data['client_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['client_branch_id'] ?? null)){
|
||||||
|
$query->where('files.client_branch_id', $get_data['client_branch_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['policy_id'] ?? null)){
|
||||||
|
$query->where('files.policy_id', $get_data['policy_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['event_type'] ?? null)){
|
||||||
|
$query->where('files.action', $get_data['event_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($role_id, [2, 3])) {
|
||||||
// If the user is a Account Manager or Manager, filter by user_id
|
// If the user is a Account Manager or Manager, filter by user_id
|
||||||
$query->where('cr.user_id', (int)$user_id);
|
$query->where('cr.user_id', (int)$user_id);
|
||||||
}
|
}
|
||||||
// ->where('files.created_by', get_session_userid())
|
|
||||||
$data['fileList'] = $query->groupBy("files.id")->orderBy('files.created_at', 'desc')
|
$data['fileList'] = $query->groupBy("files.id")
|
||||||
// $data['fileList'] = $query
|
->orderBy('files.created_at', 'desc')
|
||||||
->limit(2000)
|
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
// dd($this->fileModel->getLastQuery());
|
// dd($this->fileModel->getLastQuery());
|
||||||
// dd($data['fileList']);
|
// dd($data['fileList']);
|
||||||
|
|
||||||
@ -471,18 +515,58 @@ class EmployeeController extends AdminController
|
|||||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left')
|
->join("client_rm cr", "cr.client_id = clients.id and cr.is_active = 1", 'left')
|
||||||
->where('batch_files.is_active', 1);
|
->where('batch_files.is_active', 1);
|
||||||
|
|
||||||
|
if (!empty($get_data['start_date'] ?? null) && !empty($get_data['end_date'] ?? null)) {
|
||||||
|
// 1. If dates are provided, use the user's filter
|
||||||
|
$start = change_date_format($get_data['start_date'], 'd/m/Y', 'Y-m-d') . ' 00:00:00';
|
||||||
|
$end = change_date_format($get_data['end_date'], 'd/m/Y', 'Y-m-d') . ' 23:59:59';
|
||||||
|
|
||||||
|
$query2->where('batch_files.created_at >=', $start)
|
||||||
|
->where('batch_files.created_at <=', $end);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(empty($get_data['tab_type'] ?? null)){
|
||||||
|
// 2. Default: If no dates are selected, show last 90 days (or all data)
|
||||||
|
$query2->where('batch_files.created_at >=', date('Y-m-d 00:00:00', strtotime('-90 days')))
|
||||||
|
->where('batch_files.created_at <=', date('Y-m-d 23:59:59'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['client_id'] ?? null)){
|
||||||
|
$query2->where('batch_files.client_id', $get_data['client_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['client_branch_id'] ?? null)){
|
||||||
|
$query2->where('batch_files.client_branch_id', $get_data['client_branch_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['policy_id'] ?? null)){
|
||||||
|
$query2->where('batch_files.client_policy_id', $get_data['policy_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['event_type'] ?? null)){
|
||||||
|
$query2->where('batch_files.event_type', $get_data['event_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['insurer_or_tpa'] ?? null)){
|
||||||
|
$query2->where('batch_files.insurer_or_tpa', $get_data['insurer_or_tpa']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($get_data['action_type'] ?? null)){
|
||||||
|
$query2->where('batch_files.actions', $get_data['action_type']);
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($role_id, [2, 3])) {
|
if (in_array($role_id, [2, 3])) {
|
||||||
|
|
||||||
// If the user is a Account Manager or Manager, filter by user_id
|
// If the user is a Account Manager or Manager, filter by user_id
|
||||||
$query2->where('cr.user_id', (int)$user_id);
|
$query2->where('cr.user_id', (int)$user_id);
|
||||||
}
|
}
|
||||||
// ->where('files.created_by', get_session_userid())
|
|
||||||
$data['batch_list'] = $query2->groupBy("batch_files.id")->orderBy('batch_files.id', 'desc')
|
|
||||||
->limit(1500)
|
|
||||||
->find();
|
|
||||||
|
|
||||||
|
$data['batch_list'] = $query2->groupBy("batch_files.id")
|
||||||
|
->orderBy('batch_files.id', 'desc')
|
||||||
|
->find();
|
||||||
|
|
||||||
|
|
||||||
// dd($data['fileList']);die();
|
// dd($data['fileList']);die();
|
||||||
|
|||||||
@ -389,15 +389,17 @@ table.dataTable tbody td {
|
|||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right" style="cursor: pointer;">
|
<div class="dropdown-menu dropdown-menu-right" style="cursor: pointer;">
|
||||||
<a class="dropdown-item btnEdit" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle btnEdit"></i>Edit</a>
|
<a class="dropdown-item btnEdit" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle btnEdit"></i>Edit</a>
|
||||||
<?php if($row->is_active == 1 && in_array(get_session_userid(), [1, 5])) { ?>
|
<?php if (in_array(get_role_id(), [1, 5])): ?>
|
||||||
<a class="dropdown-item btnDelete" data-id="<?php echo $row->id; ?>"><i data-id="<?php echo $row->id; ?>" class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle btnDelete"></i>Delete</a>
|
<?php if ($row->is_active == 1): ?>
|
||||||
<?php } ?>
|
<a class="dropdown-item btnDelete" data-id="<?php echo $row->id; ?>">
|
||||||
<?php if($row->is_active == 0 && in_array(get_session_userid(), [1, 5])) { ?>
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
<a class="dropdown-item btnActivate" data-id="<?php echo $row->id; ?>">
|
|
||||||
<i class="mdi mdi-account-check mr-2 text-muted font-18 vertical-middle btnActivate" data-id="<?php echo $row->id; ?>"></i>
|
|
||||||
Activate
|
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php else: ?>
|
||||||
|
<a class="dropdown-item btnActivate" data-id="<?php echo $row->id; ?>">
|
||||||
|
<i class="mdi mdi-account-check mr-2 text-muted font-18 vertical-middle"></i>Activate
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
<style>
|
<style>
|
||||||
.table-responsive {
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reload:hover {
|
.reload:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -14,10 +11,6 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataTables_length label {
|
|
||||||
height: 21px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TPA variation modal layout */
|
/* TPA variation modal layout */
|
||||||
#tpa_variation_modal .modal-dialog {
|
#tpa_variation_modal .modal-dialog {
|
||||||
max-width: 95%;
|
max-width: 95%;
|
||||||
@ -74,6 +67,31 @@
|
|||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
/* Compact table + buttons (NHance) */
|
||||||
|
#datatable-buttons thead th,
|
||||||
|
#datatable-buttons tbody td {
|
||||||
|
padding: 5px 11px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action dropdown toggle in rows */
|
||||||
|
#datatable-buttons .dropdown-toggle.btn-sm {
|
||||||
|
padding: 4px 9px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DataTables toolbar buttons (Export/Filter/Clear Filter) */
|
||||||
|
#datatable-buttons_wrapper .dt-buttons .btn {
|
||||||
|
padding: 6px 13px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#datatable-buttons_wrapper .dt-buttons .btn .btn-custom {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="col-12" id="second_page">
|
<div class="col-12" id="second_page">
|
||||||
@ -539,29 +557,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#datatable-buttons').DataTable({
|
$('#datatable-buttons').DataTable({
|
||||||
// dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||||
// "<'row'<'col-sm-12'tr>>" +
|
|
||||||
// "<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
|
||||||
// buttons: [{
|
|
||||||
// extend: 'csv',
|
|
||||||
// text: 'CSV',
|
|
||||||
// title: 'Batch List',
|
|
||||||
// className: 'my_class',
|
|
||||||
// }],
|
|
||||||
// initComplete: function(settings, json) {
|
|
||||||
// $('.my_class').css({
|
|
||||||
// position: "relative",
|
|
||||||
// left: "50px"
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>", lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
buttons: [
|
||||||
buttons: [{
|
{
|
||||||
extend: 'collection',
|
extend: 'collection',
|
||||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||||
className: 'btn app-btn-secondary ',
|
className: 'btn app-btn-secondary mr-2',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
@ -570,6 +573,20 @@
|
|||||||
className: 'app-btn-primary ',
|
className: 'app-btn-primary ',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '<i class="mdi mdi-filter" ></i><span class=" btn-custom"> Filter </span>',
|
||||||
|
className: 'btn app-btn-primary mr-2',
|
||||||
|
action: function(e, dt, node, config) {
|
||||||
|
openPolicyFilterNav(2);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '<i class="mdi mdi-filter-remove"></i><span class="btn-custom"> Clear Filter </span>',
|
||||||
|
className: 'btn app-btn-info mr-2 hide-clear-filter',
|
||||||
|
action: function(e, dt, node, config) {
|
||||||
|
clearFilterData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ option:disabled {
|
|||||||
<div class="card mb-1">
|
<div class="card mb-1">
|
||||||
|
|
||||||
<h4 class="m-1">
|
<h4 class="m-1">
|
||||||
<span>Filters</span>
|
<!-- <span>Filters</span> -->
|
||||||
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
||||||
aria-expanded="true">
|
aria-expanded="true">
|
||||||
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||||
@ -658,6 +658,7 @@ function appendClients(data) {
|
|||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
}
|
}
|
||||||
$('#client_id').append(option);
|
$('#client_id').append(option);
|
||||||
|
$('#client_id_for_filter').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,10 +8,36 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataTables_length label {height: 21px !important;}
|
|
||||||
|
|
||||||
.column-header { margin-right: 10px; /* Adjust this value as needed */ }
|
.column-header { margin-right: 10px; /* Adjust this value as needed */ }
|
||||||
|
|
||||||
|
/* Compact table + buttons (NHance) */
|
||||||
|
#tickets-table thead th,
|
||||||
|
#tickets-table tbody td {
|
||||||
|
padding: 6px 12px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tickets-table .font-12 {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action dropdown toggle in rows */
|
||||||
|
#tickets-table .dropdown-toggle.btn-sm {
|
||||||
|
padding: 4px 9px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DataTables toolbar buttons (Export/Filter/Clear Filter) */
|
||||||
|
#tickets-table_wrapper .dt-buttons .btn {
|
||||||
|
padding: 6px 13px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tickets-table_wrapper .dt-buttons .btn .btn-custom {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -170,7 +196,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('body').on('click', '.view_emp_list', function() {
|
|
||||||
|
$('body').on('click', '.view_emp_list', function() {
|
||||||
|
|
||||||
console.log('file_id', 'file_id');
|
console.log('file_id', 'file_id');
|
||||||
$('#emp_data_success').empty();
|
$('#emp_data_success').empty();
|
||||||
@ -236,11 +263,9 @@ $('body').on('click', '.view_emp_list', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('body').on('click', '.upload_button', function() {
|
||||||
|
|
||||||
$('body').on('click', '.upload_button', function() {
|
|
||||||
|
|
||||||
$('#uploadForm')[0].reset();
|
$('#uploadForm')[0].reset();
|
||||||
console.log('file_id');
|
console.log('file_id');
|
||||||
@ -250,10 +275,9 @@ $('body').on('click', '.upload_button', function() {
|
|||||||
$('#file_policy_id').val(fileId.client_policy_id)
|
$('#file_policy_id').val(fileId.client_policy_id)
|
||||||
$('#file_branch_id').val(fileId.client_branch_id)
|
$('#file_branch_id').val(fileId.client_branch_id)
|
||||||
$('#file_upload_actions').val(fileId.action)
|
$('#file_upload_actions').val(fileId.action)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('body').on('click', '.truncate2', function(event) {
|
||||||
$('body').on('click', '.truncate2', function(event) {
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// console.log(event);
|
// console.log(event);
|
||||||
@ -324,9 +348,9 @@ $('body').on('click', '.truncate2', function(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleNoDataFound(response, fileId) {
|
function handleNoDataFound(response, fileId) {
|
||||||
if (response.role == 1 || response.role == 5) {
|
if (response.role == 1 || response.role == 5) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: response.message,
|
title: response.message,
|
||||||
@ -392,9 +416,9 @@ function handleNoDataFound(response, fileId) {
|
|||||||
icon: "error"
|
icon: "error"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#uploadForm').submit(function() {
|
$('#uploadForm').submit(function() {
|
||||||
|
|
||||||
var isValid = $('#uploadForm').parsley().validate();
|
var isValid = $('#uploadForm').parsley().validate();
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
@ -452,9 +476,9 @@ $('#uploadForm').submit(function() {
|
|||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
$('body').on('click', '.reload', function() {
|
$('body').on('click', '.reload', function() {
|
||||||
|
|
||||||
console.log('status');
|
console.log('status');
|
||||||
status = this.getAttribute('data-id')
|
status = this.getAttribute('data-id')
|
||||||
@ -462,26 +486,20 @@ $('body').on('click', '.reload', function() {
|
|||||||
if (status == 'inprogress') {
|
if (status == 'inprogress') {
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
|
|
||||||
// dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// "<'row'<'col-sm-12'tr>>" +
|
|
||||||
// "<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
|
||||||
dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>", lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
buttons: [
|
||||||
buttons: [{
|
{
|
||||||
extend: 'collection',
|
extend: 'collection',
|
||||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||||
className: 'btn app-btn-secondary ',
|
className: 'btn app-btn-secondary mr-2',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
@ -493,6 +511,20 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '<i class="mdi mdi-filter" ></i><span class=" btn-custom"> Filter </span>',
|
||||||
|
className: 'btn app-btn-primary mr-2',
|
||||||
|
action: function(e, dt, node, config) {
|
||||||
|
openPolicyFilterNav(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '<i class="mdi mdi-filter-remove"></i><span class="btn-custom"> Clear Filter </span>',
|
||||||
|
className: 'btn app-btn-info mr-2 hide-clear-filter',
|
||||||
|
action: function(e, dt, node, config) {
|
||||||
|
clearFilterData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
@ -507,27 +539,9 @@ $(document).ready(function() {
|
|||||||
searchPlaceholder: "Search",
|
searchPlaceholder: "Search",
|
||||||
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
||||||
},
|
},
|
||||||
// "buttons": [{
|
|
||||||
// "extend": 'csv',
|
|
||||||
// "text": 'CSV',
|
|
||||||
// "title": 'Employee-Upload-List',
|
|
||||||
// "className": 'my_class',
|
|
||||||
// "exportOptions": {
|
|
||||||
// "columns": ':not(:last-child)'
|
|
||||||
// },
|
|
||||||
// }],
|
|
||||||
// "initComplete": function(settings, json) {
|
|
||||||
// $('.my_class').css({
|
|
||||||
// "position": "relative",
|
|
||||||
// "left": "79px"
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// language: {
|
|
||||||
// search: "_INPUT_",
|
|
||||||
// searchPlaceholder: "Search..."
|
|
||||||
// },
|
|
||||||
paging: true,
|
paging: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1,12 +1,112 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.dataTable thead th {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataTables_filter {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar {
|
||||||
|
height: 100%;
|
||||||
|
width: 0;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1001;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
overflow-x: hidden;
|
||||||
|
transition: 0.5s;
|
||||||
|
box-shadow: -2px 0 5px rgba(0,0,0,0.1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar-header {
|
||||||
|
padding: 15px 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #dee2e6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar-header h4 {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reduce filter header height (this view only) */
|
||||||
|
#filter-sidebar .filter-sidebar-header {
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#filter-sidebar .filter-sidebar-header .closebtn {
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar-header .closebtn {
|
||||||
|
font-size: 28px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #6c757d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar .closebtn:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar-content {
|
||||||
|
padding: 20px;
|
||||||
|
flex-grow: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-sidebar-footer {
|
||||||
|
padding: 15px 20px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
border-top: 1px solid #dee2e6;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Slightly smaller filter buttons (this view only) */
|
||||||
|
#filter-sidebar .filter-sidebar-footer {
|
||||||
|
padding: 12px 16px;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#filter-sidebar .filter-sidebar-footer .btn {
|
||||||
|
padding: 4px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Also shrink DataTables toolbar buttons on this page */
|
||||||
|
.dataTables_wrapper .dt-buttons .btn {
|
||||||
|
padding: 4px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataTables_wrapper .dt-buttons .btn .btn-custom {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide-clear-filter{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -51,6 +151,105 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div id="filter-sidebar" class="filter-sidebar">
|
||||||
|
|
||||||
|
<div class="filter-sidebar-header">
|
||||||
|
<h4 class="m-0">Filter</h4>
|
||||||
|
<a href="javascript:void(0)" class="closebtn" onclick="closeFilterNav()">×</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="filter-sidebar-content">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
|
<input type="hidden" id="tab_type" value="1">
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>Client<span class="text-danger"></span></label> <br/>
|
||||||
|
<select name="client_id" class="form-control" id="client_id_for_filter">
|
||||||
|
<option value="">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="client_branch_id" class="form-control" id="client_branch_id_for_filter">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>Policy<span class="text-danger" id="policy_danger"></span></label> <br />
|
||||||
|
<select name="client_policy_id" class="form-control" id="policy_id_for_filter">
|
||||||
|
<option value="">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label>Event<span class="text-danger"></span></label> <br />
|
||||||
|
<select name="event_type" class="form-control" id="event_type_for_filter">
|
||||||
|
<option value="">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($events) && count($events)) {
|
||||||
|
foreach ($events as $key => $action) {
|
||||||
|
echo "<option value='$key'>$action</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12" id="date_div">
|
||||||
|
<label>Date<span class="text-danger"></span></label>
|
||||||
|
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||||
|
<i class="mdi mdi-calendar-blank"></i>
|
||||||
|
<span></span> <i class="mdi mdi-menu-down"></i>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" id="startDate">
|
||||||
|
<input type="hidden" id="endDate">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12 hide_filter_input">
|
||||||
|
<label>Insurer/TPA Data<span class="text-danger"></span></label> <br />
|
||||||
|
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa_for_filter">
|
||||||
|
<option value="">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($insurer_or_tpa) && count($insurer_or_tpa)) {
|
||||||
|
foreach ($insurer_or_tpa as $key => $action) {
|
||||||
|
echo "<option value=" . $key . ">" . $action . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12 hide_filter_input">
|
||||||
|
<label>Action<span class="text-danger"></span></label> <br />
|
||||||
|
<select name="action_type" class="form-control" id="action_type">
|
||||||
|
<option value="">Select</option>
|
||||||
|
<?php
|
||||||
|
if (isset($import_or_export) && count($import_or_export)) {
|
||||||
|
foreach ($import_or_export as $key => $action) {
|
||||||
|
echo "<option value=" . $key . ">" . $action . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="filter-sidebar-footer">
|
||||||
|
<a href="<?= base_url("/employee/upload"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||||
|
<a href="<?= base_url("/employee/upload"); ?>" class="btn btn-primary" id="get_base_url" onclick="fetchFilterData(event); closeFilterNav();">Submit</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row" id="client_add">
|
<div class="row" id="client_add">
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -92,9 +291,113 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
let tab = urlParams.get('tab_type');
|
||||||
|
|
||||||
|
console.log('Detected Tab Parameter:', tab);
|
||||||
|
|
||||||
|
// 1. Show/Hide Clear Filter Button
|
||||||
|
if (tab && tab !== "") {
|
||||||
|
$('.hide-clear-filter').show();
|
||||||
|
} else {
|
||||||
|
$('.hide-clear-filter').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. The Tab Switcher Logic
|
||||||
|
function activateTab(tabId) {
|
||||||
|
var targetLink = $('#' + tabId);
|
||||||
|
if (targetLink.length > 0) {
|
||||||
|
// Try Method A: Bootstrap 4/5 Standard
|
||||||
|
if (typeof bootstrap !== 'undefined' && bootstrap.Tab) {
|
||||||
|
var tabTrigger = new bootstrap.Tab(targetLink[0]);
|
||||||
|
tabTrigger.show();
|
||||||
|
} else if ($.fn.tab) {
|
||||||
|
targetLink.tab('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try Method B: Manual Fallback (Force Display)
|
||||||
|
$('.nav-link').removeClass('active active-tab').attr('aria-expanded', 'false');
|
||||||
|
targetLink.addClass('active active-tab').attr('aria-expanded', 'true');
|
||||||
|
|
||||||
|
var targetPane = targetLink.attr('href');
|
||||||
|
$('.tab-pane').removeClass('show active');
|
||||||
|
$(targetPane).addClass('show active');
|
||||||
|
|
||||||
|
console.log('Manually activated tab: ' + tabId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute with a slight delay to ensure includes are loaded
|
||||||
|
setTimeout(function() {
|
||||||
|
if (tab === "2" || tab === "kyc_tab") {
|
||||||
|
activateTab('kyc_tab');
|
||||||
|
} else if (tab === "3" || tab === "hr_tab") {
|
||||||
|
activateTab('hr_tab');
|
||||||
|
} else {
|
||||||
|
activateTab('general_tab');
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
// 3. Keep the Sidebar input updated for future filters
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
$('#tab_type').val($(e.target).attr('id'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$('#client_id_for_filter').select2();
|
||||||
|
$('#client_branch_id_for_filter').select2();
|
||||||
|
$('#policy_id_for_filter').select2();
|
||||||
|
|
||||||
|
$('#client_id_for_filter').on('change', function() {
|
||||||
|
|
||||||
|
let client_id = $(this).val();
|
||||||
|
console.log('client_id_for_filter', client_id);
|
||||||
|
|
||||||
|
if(branch_list != '') {
|
||||||
|
// console.log(branch_list[client_id]);
|
||||||
|
let data = branch_list[client_id];
|
||||||
|
appendBranchForFilter(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#client_branch_id_for_filter').on('change', function() {
|
||||||
|
|
||||||
|
let branch_id = $(this).val();
|
||||||
|
console.log("client_branch_id_for_filter", branch_id);
|
||||||
|
|
||||||
|
if(policy_list != '' && branch_id != '') {
|
||||||
|
let data = policy_list[branch_id];
|
||||||
|
appendPoliciesForFilter(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Modified by Gemini Code Assist */
|
||||||
|
function openPolicyFilterNav(input) {
|
||||||
|
|
||||||
|
if(input == 2){
|
||||||
|
$('.hide_filter_input').show();
|
||||||
|
}else{
|
||||||
|
$('.hide_filter_input').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("filter-sidebar").style.width = "350px";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modified by Gemini Code Assist */
|
||||||
|
function closeFilterNav() {
|
||||||
|
document.getElementById("filter-sidebar").style.width = "0";
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
if (window.location.hash === '#KYC-DOC-tab') {
|
if (window.location.hash === '#KYC-DOC-tab') {
|
||||||
@ -115,4 +418,181 @@
|
|||||||
.toLowerCase() // convert everything to lowercase
|
.toLowerCase() // convert everything to lowercase
|
||||||
.replace(/\b\w/g, char => char.toUpperCase()); // capitalize each word
|
.replace(/\b\w/g, char => char.toUpperCase()); // capitalize each word
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendBranchForFilter(data) {
|
||||||
|
|
||||||
|
$('#client_branch_id_for_filter').empty();
|
||||||
|
$('#client_branch_id_for_filter').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id_param == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#client_branch_id_for_filter').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendPoliciesForFilter(data) {
|
||||||
|
|
||||||
|
$('#policy_id_for_filter').empty();
|
||||||
|
$('#policy_id_for_filter').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select',
|
||||||
|
selected: true
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
|
});
|
||||||
|
if (client_policy_param == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policy_id_for_filter').append(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
|
||||||
|
var activeTabId = $(e.target).attr('id'); // Gets the ID of the clicked tab
|
||||||
|
var activeTabText = $(e.target).text().trim(); // Gets the text inside the tab
|
||||||
|
|
||||||
|
console.log("Tab Changed!");
|
||||||
|
console.log("Active Tab ID: " + activeTabId);
|
||||||
|
console.log("Active Tab Name: " + activeTabText);
|
||||||
|
|
||||||
|
if(activeTabId == 'kyc_tab'){
|
||||||
|
$('#tab_type').val(2)
|
||||||
|
$('.hide_filter_input').show();
|
||||||
|
}else{
|
||||||
|
$('#tab_type').val(1)
|
||||||
|
$('.hide_filter_input').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function fetchFilterData(event)
|
||||||
|
{
|
||||||
|
event.preventDefault(); // Prevent default action (navigation)
|
||||||
|
|
||||||
|
// 1. Get the current active tab type (from your hidden input)
|
||||||
|
var tab_type = $('#tab_type').val();
|
||||||
|
|
||||||
|
// 2. Get data using the CORRECT IDs from your HTML sidebar
|
||||||
|
var client_id = $('#client_id_for_filter').val();
|
||||||
|
var branch_id = $('#client_branch_id_for_filter').val();
|
||||||
|
var policy_id = $('#policy_id_for_filter').val();
|
||||||
|
var event_type = $('#event_type_for_filter').val();
|
||||||
|
var insurer_or_tpa = $('#insurer_or_tpa_for_filter').val();
|
||||||
|
var action_type = $('#action_type').val(); // This ID was correct
|
||||||
|
|
||||||
|
// Note: If you have date pickers elsewhere, keep these.
|
||||||
|
// Otherwise, ensure they exist in your UI.
|
||||||
|
var start_date = $('#startDate').val() || '';
|
||||||
|
var end_date = $('#endDate').val() || '';
|
||||||
|
|
||||||
|
// 3. Construct the Query Parameters object
|
||||||
|
var queryParams = {
|
||||||
|
tab_type: tab_type,
|
||||||
|
client_id: client_id,
|
||||||
|
branch_id: branch_id,
|
||||||
|
policy_id: policy_id,
|
||||||
|
event_type: event_type,
|
||||||
|
insurer_or_tpa: insurer_or_tpa,
|
||||||
|
action_type: action_type,
|
||||||
|
start_date: start_date,
|
||||||
|
end_date: end_date
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("Filters applied:", queryParams);
|
||||||
|
|
||||||
|
// 4. Build the Query String and Redirect
|
||||||
|
const queryString = new URLSearchParams(queryParams).toString();
|
||||||
|
const baseUrl = $('#get_base_url').attr('href');
|
||||||
|
console.log("queryString to:", queryString);
|
||||||
|
console.log("baseUrl to:", baseUrl);
|
||||||
|
|
||||||
|
const apiURL = baseUrl + "?" + queryString;
|
||||||
|
|
||||||
|
console.log("Redirecting to:", apiURL);
|
||||||
|
window.location.href = apiURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearFilterData(){
|
||||||
|
|
||||||
|
const url = $('#get_base_url').attr('href');
|
||||||
|
console.log("url to:", url);
|
||||||
|
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
// 1. Check if dates exist in URL, otherwise leave them null/empty
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const startDateParam = urlParams.get('start_date');
|
||||||
|
const endDateParam = urlParams.get('end_date');
|
||||||
|
|
||||||
|
var start = startDateParam ? moment(startDateParam, 'DD/MM/YYYY') : null;
|
||||||
|
var end = endDateParam ? moment(endDateParam, 'DD/MM/YYYY') : null;
|
||||||
|
|
||||||
|
function cb(start, end) {
|
||||||
|
if (start && end) {
|
||||||
|
$('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
|
||||||
|
$('#startDate').val(start.format('DD/MM/YYYY'));
|
||||||
|
$('#endDate').val(end.format('DD/MM/YYYY'));
|
||||||
|
} else {
|
||||||
|
// Display a placeholder if no date is selected
|
||||||
|
$('#reportrange span').html('Select Date Range');
|
||||||
|
$('#startDate').val('');
|
||||||
|
$('#endDate').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#reportrange').daterangepicker({
|
||||||
|
autoUpdateInput: false, // CRITICAL: Prevents the picker from forcing a value
|
||||||
|
startDate: start || moment().subtract(29, 'days'),
|
||||||
|
endDate: end || moment(),
|
||||||
|
locale: {
|
||||||
|
cancelLabel: 'Clear',
|
||||||
|
format: 'DD/MM/YYYY'
|
||||||
|
},
|
||||||
|
ranges: {
|
||||||
|
'Today': [moment(), moment()],
|
||||||
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||||
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||||
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||||
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||||
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle the "Apply" button click
|
||||||
|
$('#reportrange').on('apply.daterangepicker', function(ev, picker) {
|
||||||
|
cb(picker.startDate, picker.endDate);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle the "Cancel/Clear" button click
|
||||||
|
$('#reportrange').on('cancel.daterangepicker', function(ev, picker) {
|
||||||
|
cb(null, null);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Run once on load
|
||||||
|
cb(start, end);
|
||||||
|
|
||||||
|
$('#clear-filters').on('click', function() {
|
||||||
|
// ... (your existing dropdown resets) ...
|
||||||
|
cb(null, null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -351,6 +351,24 @@
|
|||||||
.hr-item:nth-child(4) { animation-delay: 0.2s; }
|
.hr-item:nth-child(4) { animation-delay: 0.2s; }
|
||||||
.hr-item:nth-child(5) { animation-delay: 0.25s; }
|
.hr-item:nth-child(5) { animation-delay: 0.25s; }
|
||||||
|
|
||||||
|
/* Reduce gap between accordion and cards (this tab only) */
|
||||||
|
#KYC-DOC-tab #accordion.mb-3 {
|
||||||
|
margin-bottom: 0.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#KYC-DOC-tab #accordion .card.mb-1 {
|
||||||
|
margin-bottom: 0.35rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#KYC-DOC-tab #accordion .card-body {
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
padding-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#KYC-DOC-tab #file_list {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||||
@ -360,7 +378,7 @@
|
|||||||
<div class="card mb-1">
|
<div class="card mb-1">
|
||||||
|
|
||||||
<h4 class="m-1">
|
<h4 class="m-1">
|
||||||
<span>Filters</span>
|
<!-- <span>Filters</span> -->
|
||||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user