MERGE_UAT_LIVE_ISSUES
This commit is contained in:
commit
92265bfe8e
@ -316,11 +316,11 @@ class EmployeeController extends AdminController
|
||||
$policy_id = isset($post_data['policy_id']) ? $post_data['policy_id'] : $this->request->getPost('policy_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');
|
||||
|
||||
if(empty($post_data)){
|
||||
|
||||
if (empty($post_data)) {
|
||||
$hr_file_id = $this->request->getPost('hr_file_id') ?? null;
|
||||
}else{
|
||||
$hr_file_id = $post_data['hr_file_id'] ?? null ;
|
||||
} else {
|
||||
$hr_file_id = $post_data['hr_file_id'] ?? 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]);
|
||||
//endof validation process
|
||||
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];
|
||||
}else{
|
||||
} else {
|
||||
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['page_name'] = 'View Inception';
|
||||
|
||||
@ -371,7 +374,7 @@ class EmployeeController extends AdminController
|
||||
//for inception upload
|
||||
$data['actions'] = ['all' => 'All', 'inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||
|
||||
|
||||
// $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$data['import_or_export'] = ['import' => 'Upload', 'export' => 'Download'];
|
||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||
@ -388,49 +391,90 @@ class EmployeeController extends AdminController
|
||||
$user_id = get_session_userid();
|
||||
|
||||
$query = $this->fileModel
|
||||
->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',
|
||||
'up.emp_code',
|
||||
// 'up.first_name',
|
||||
'c.short_name',
|
||||
'cb.branch_name',
|
||||
'cp.id as client_policy_id',
|
||||
'"0" as employee_count',
|
||||
'"0" as total',
|
||||
'policy_type.policy_type' ,
|
||||
'cp.policy_no' ,
|
||||
"CASE
|
||||
WHEN files.hr_id IS NOT NULL THEN
|
||||
CONCAT(
|
||||
(
|
||||
SELECT lc.name
|
||||
FROM level_contacts lc
|
||||
WHERE lc.id = files.hr_id
|
||||
LIMIT 1
|
||||
),
|
||||
' (HR)'
|
||||
)
|
||||
ELSE up.first_name
|
||||
END AS first_name
|
||||
"
|
||||
])
|
||||
->join('user_profiles up', 'files.created_by = up.id', 'left')
|
||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->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("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left')
|
||||
->where('files.is_active', 1);
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by 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
|
||||
->limit(2000)
|
||||
->find();
|
||||
->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',
|
||||
'up.emp_code',
|
||||
// 'up.first_name',
|
||||
'c.short_name',
|
||||
'cb.branch_name',
|
||||
'cp.id as client_policy_id',
|
||||
'"0" as employee_count',
|
||||
'"0" as total',
|
||||
'policy_type.policy_type',
|
||||
'cp.policy_no',
|
||||
"CASE
|
||||
WHEN files.hr_id IS NOT NULL THEN
|
||||
CONCAT(
|
||||
(
|
||||
SELECT lc.name
|
||||
FROM level_contacts lc
|
||||
WHERE lc.id = files.hr_id
|
||||
LIMIT 1
|
||||
),
|
||||
' (HR)'
|
||||
)
|
||||
ELSE up.first_name
|
||||
END AS first_name
|
||||
"
|
||||
])
|
||||
->join('user_profiles up', 'files.created_by = up.id', 'left')
|
||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->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("client_rm cr", "cr.client_id = c.id and cr.is_active = 1", 'left')
|
||||
->where('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';
|
||||
|
||||
$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
|
||||
$query->where('cr.user_id', (int)$user_id);
|
||||
}
|
||||
|
||||
$data['fileList'] = $query->groupBy("files.id")
|
||||
->orderBy('files.created_at', 'desc')
|
||||
->find();
|
||||
|
||||
// dd($this->fileModel->getLastQuery());
|
||||
// dd($data['fileList']);
|
||||
|
||||
@ -467,22 +511,62 @@ class EmployeeController extends AdminController
|
||||
policy_type.policy_type
|
||||
|
||||
")
|
||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left')
|
||||
->where('batch_files.is_active', 1);
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by 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();
|
||||
|
||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->join("client_rm cr", "cr.client_id = clients.id and cr.is_active = 1", 'left')
|
||||
->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 the user is a Account Manager or Manager, filter by user_id
|
||||
$query2->where('cr.user_id', (int)$user_id);
|
||||
}
|
||||
|
||||
$data['batch_list'] = $query2->groupBy("batch_files.id")
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
->find();
|
||||
|
||||
|
||||
// dd($data['fileList']);die();
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
<style>
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.reload:hover {
|
||||
cursor: pointer;
|
||||
@ -14,10 +11,6 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.dataTables_length label {
|
||||
height: 21px !important;
|
||||
}
|
||||
|
||||
/* TPA variation modal layout */
|
||||
#tpa_variation_modal .modal-dialog {
|
||||
max-width: 95%;
|
||||
@ -74,6 +67,31 @@
|
||||
padding: 4px 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>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -539,39 +557,38 @@
|
||||
});
|
||||
|
||||
$('#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>>>" +
|
||||
// "<'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>>>" +
|
||||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'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>>",
|
||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||
buttons: [{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Batch List',
|
||||
className: 'app-btn-primary ',
|
||||
}
|
||||
]
|
||||
"<'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]],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary mr-2',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Batch List',
|
||||
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: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
||||
|
||||
@ -13,7 +13,7 @@ option:disabled {
|
||||
<div class="card mb-1">
|
||||
|
||||
<h4 class="m-1">
|
||||
<span>Filters</span>
|
||||
<!-- <span>Filters</span> -->
|
||||
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
||||
aria-expanded="true">
|
||||
<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);
|
||||
}
|
||||
$('#client_id').append(option);
|
||||
$('#client_id_for_filter').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -8,10 +8,36 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dataTables_length label {height: 21px !important;}
|
||||
|
||||
.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>
|
||||
|
||||
@ -170,177 +196,110 @@
|
||||
|
||||
|
||||
<script>
|
||||
$('body').on('click', '.view_emp_list', function() {
|
||||
|
||||
console.log('file_id', 'file_id');
|
||||
$('#emp_data_success').empty();
|
||||
$('#title').html(' ');
|
||||
var file_id = $(this).attr('data-id');
|
||||
console.log(file_id);
|
||||
$('body').on('click', '.view_emp_list', function() {
|
||||
|
||||
var queryParams = {
|
||||
file_id: file_id,
|
||||
};
|
||||
console.log('file_id', 'file_id');
|
||||
$('#emp_data_success').empty();
|
||||
$('#title').html(' ');
|
||||
var file_id = $(this).attr('data-id');
|
||||
console.log(file_id);
|
||||
|
||||
console.log('queryParams', queryParams)
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
console.log('queryString', queryString)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var uri = '<?= base_url('util/view-success-emp-list') ?>?' + queryString
|
||||
console.log(uri)
|
||||
|
||||
$.ajax({
|
||||
url: uri,
|
||||
data: {
|
||||
var queryParams = {
|
||||
file_id: file_id,
|
||||
},
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
};
|
||||
|
||||
console.log(res);
|
||||
console.log('queryParams', queryParams)
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
console.log('queryString', queryString)
|
||||
|
||||
if (res) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var uri = '<?= base_url('util/view-success-emp-list') ?>?' + queryString
|
||||
console.log(uri)
|
||||
|
||||
$.ajax({
|
||||
url: uri,
|
||||
data: {
|
||||
file_id: file_id,
|
||||
},
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
var title = " - ";
|
||||
|
||||
if (res.file_data) {
|
||||
title += (res.file_data.file_name || "") + " - ";
|
||||
title += (res.file_data.short_name || "") + " - ";
|
||||
title += (res.file_data.policy_name || "") + " - ";
|
||||
title += (res.file_data.action || "") + " - ";
|
||||
title += (res.file_data.status || "");
|
||||
}
|
||||
|
||||
$('#title_header_name').html(title);
|
||||
$('#emp_data_success').html(res.data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
var title = " - ";
|
||||
})
|
||||
|
||||
if (res.file_data) {
|
||||
title += (res.file_data.file_name || "") + " - ";
|
||||
title += (res.file_data.short_name || "") + " - ";
|
||||
title += (res.file_data.policy_name || "") + " - ";
|
||||
title += (res.file_data.action || "") + " - ";
|
||||
title += (res.file_data.status || "");
|
||||
}
|
||||
$('body').on('click', '.upload_button', function() {
|
||||
|
||||
$('#title_header_name').html(title);
|
||||
$('#emp_data_success').html(res.data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something went wrong', 'Warning');
|
||||
$('#uploadForm')[0].reset();
|
||||
console.log('file_id');
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
console.log(fileId); // Use fileId as needed
|
||||
$('#file_client_id').val(fileId.client_id)
|
||||
$('#file_policy_id').val(fileId.client_policy_id)
|
||||
$('#file_branch_id').val(fileId.client_branch_id)
|
||||
$('#file_upload_actions').val(fileId.action)
|
||||
})
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
$('body').on('click', '.truncate2', function(event) {
|
||||
|
||||
})
|
||||
event.preventDefault();
|
||||
// console.log(event);
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
console.log('Truncate File ID' + fileId);
|
||||
|
||||
|
||||
|
||||
$('body').on('click', '.upload_button', function() {
|
||||
|
||||
$('#uploadForm')[0].reset();
|
||||
console.log('file_id');
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
console.log(fileId); // Use fileId as needed
|
||||
$('#file_client_id').val(fileId.client_id)
|
||||
$('#file_policy_id').val(fileId.client_policy_id)
|
||||
$('#file_branch_id').val(fileId.client_branch_id)
|
||||
$('#file_upload_actions').val(fileId.action)
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.truncate2', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
// console.log(event);
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
console.log('Truncate File ID' + fileId);
|
||||
|
||||
Swal.fire({
|
||||
title: "Do you want to truncate data from uploaded file?",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Delete",
|
||||
confirmButtonColor: "#ff3333",
|
||||
}).then((result) => {
|
||||
|
||||
console.log(result);
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId;
|
||||
// console.log('Truncate API URL : ', apiURL);
|
||||
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log('Truncate Response', response)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
Swal.fire({
|
||||
title: "Deleted!",
|
||||
icon: "success"
|
||||
});
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('No data found', response);
|
||||
handleNoDataFound(response, fileId);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: 'Something went wrong! Try later',
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.error('Error fetching data from API:', error);
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
function handleNoDataFound(response, fileId) {
|
||||
if (response.role == 1 || response.role == 5) {
|
||||
Swal.fire({
|
||||
title: response.message,
|
||||
title: "Do you want to truncate data from uploaded file?",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Delete",
|
||||
confirmButtonColor: "#ff3333",
|
||||
}).then((result) => {
|
||||
|
||||
console.log(result);
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId + '/' + <?= get_role_id(); ?>;
|
||||
|
||||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId;
|
||||
// console.log('Truncate API URL : ', apiURL);
|
||||
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
@ -348,6 +307,9 @@ function handleNoDataFound(response, fileId) {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log('Truncate Response', response)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -360,11 +322,7 @@ function handleNoDataFound(response, fileId) {
|
||||
});
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('No data found', response);
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
handleNoDataFound(response, fileId);
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
@ -374,127 +332,201 @@ function handleNoDataFound(response, fileId) {
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.error('Error fetching data from API:', error);
|
||||
console.error('Something went wrong! Try later', 'Error');
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$('#uploadForm').submit(function() {
|
||||
function handleNoDataFound(response, fileId) {
|
||||
if (response.role == 1 || response.role == 5) {
|
||||
Swal.fire({
|
||||
title: response.message,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Delete",
|
||||
confirmButtonColor: "#ff3333",
|
||||
}).then((result) => {
|
||||
|
||||
var isValid = $('#uploadForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
console.log(result);
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId + '/' + <?= get_role_id(); ?>;
|
||||
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
Swal.fire({
|
||||
title: "Deleted!",
|
||||
icon: "success"
|
||||
});
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('No data found', response);
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: 'Something went wrong! Try later',
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.error('Error fetching data from API:', error);
|
||||
console.error('Something went wrong! Try later', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
$('#uploadForm').submit(function() {
|
||||
|
||||
// return false;
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
headers: {
|
||||
// "Content-Type":"multipart/form-data",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
var isValid = $('#uploadForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(response);
|
||||
$('#uploadForm')[0].reset();
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success(
|
||||
'File upload successs, Data validation is in-progress',
|
||||
'Success');
|
||||
$('.close').click()
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
// alert(response.message);
|
||||
toastr.error(response.message, 'Failed');
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
// alert('Something went wrong! Try later');
|
||||
// return false;
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
headers: {
|
||||
// "Content-Type":"multipart/form-data",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
console.log(response);
|
||||
$('#uploadForm')[0].reset();
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success(
|
||||
'File upload successs, Data validation is in-progress',
|
||||
'Success');
|
||||
$('.close').click()
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
// alert(response.message);
|
||||
toastr.error(response.message, 'Failed');
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
// alert('Something went wrong! Try later');
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
$('#uploadForm')[0].reset();
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
$('#uploadForm')[0].reset();
|
||||
$('body').on('click', '.reload', function() {
|
||||
|
||||
console.log('status');
|
||||
status = this.getAttribute('data-id')
|
||||
console.log(status);
|
||||
if (status == 'inprogress') {
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
$('body').on('click', '.reload', function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
console.log('status');
|
||||
status = this.getAttribute('data-id')
|
||||
console.log(status);
|
||||
if (status == 'inprogress') {
|
||||
window.location.reload(true);
|
||||
}
|
||||
})
|
||||
$('#tickets-table').DataTable({
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#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>>>" +
|
||||
|
||||
|
||||
|
||||
// "<'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>>>" +
|
||||
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'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>>",
|
||||
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||
buttons: [{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary ',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Employee-Upload-List',
|
||||
className: 'app-btn-primary ',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
]
|
||||
"<'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]],
|
||||
buttons: [
|
||||
{
|
||||
extend: 'collection',
|
||||
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
||||
className: 'btn app-btn-secondary mr-2',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
||||
title: 'Employee-Upload-List',
|
||||
className: 'app-btn-primary ',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
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: {
|
||||
search: `
|
||||
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
||||
@ -507,27 +539,9 @@ $(document).ready(function() {
|
||||
searchPlaceholder: "Search",
|
||||
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>
|
||||
@ -1,12 +1,112 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
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;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@ -51,6 +151,105 @@
|
||||
}
|
||||
</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="col-12">
|
||||
@ -92,9 +291,113 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<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() {
|
||||
|
||||
if (window.location.hash === '#KYC-DOC-tab') {
|
||||
@ -115,4 +418,181 @@
|
||||
.toLowerCase() // convert everything to lowercase
|
||||
.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>
|
||||
@ -351,6 +351,24 @@
|
||||
.hr-item:nth-child(4) { animation-delay: 0.2s; }
|
||||
.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>
|
||||
|
||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||
@ -360,7 +378,7 @@
|
||||
<div class="card mb-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">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user