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

This commit is contained in:
VENKATESHWARAN 2025-11-10 18:07:39 +05:30
commit b59b83ad92
3 changed files with 96 additions and 48 deletions

View File

@ -7,6 +7,13 @@
table.dataTable tbody td {
padding: 4px 4px !important;
}
.column-header {
margin-right: 10px; /* Adjust this value as needed */
}
table[data-custom-table-css="table"].dataTable thead th {
padding-right: 20px !important;
}
</style>
<div class="col-12" id="inception_list">

View File

@ -21,6 +21,18 @@
.center-align-input {
text-align: center;
}
.column-header {
margin-right: 10px; /* Adjust this value as needed */
}
/* Center align header text and icons */
table[data-custom-table-css="table"].dataTable thead th {
padding-top: 3px !important;
padding-bottom: 4px !important;
padding-right: 15px !important;
padding-left: 15px !important;
}
</style>
<div class="container-fluid-min">
@ -107,21 +119,21 @@
</div>
<div class="table-responsive">
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" >
<thead class="bg-light">
<tr>
<th>S.No&nbsp;</th>
<th><div class="column-header">S.No</div></th>
<!-- <th>Client Name</th> -->
<th>Insurer&nbsp;</th>
<th>Insurer<br> Branch&nbsp;</th>
<th>Statement<br> Month&nbsp;</th>
<th>Statement<br> No&nbsp;</th>
<th>Invoice No&nbsp;</th>
<th>Invoice Status&nbsp;</th>
<th>Invoice Date&nbsp;</th>
<th>Invoice Amount&nbsp;</th>
<th>Realization <br>Amount&nbsp;</th>
<th>Outstanding <br>Amount&nbsp;</th>
<th><div class="column-header">Insurer</div></th>
<th><div class="column-header">Insurer<br> Branch</div></th>
<th><div class="column-header">Statement<br> Month</div></th>
<th><div class="column-header">Statement<br> No</div></th>
<th><div class="column-header">Invoice No</div></th>
<th><div class="column-header">Invoice Status</div></th>
<th><div class="column-header">Invoice Date</div></th>
<th><div class="column-header">Invoice Amount</div></th>
<th><div class="column-header">Realization <br>Amount</div></th>
<th><div class="column-header">Outstanding <br>Amount</div></th>
</tr>
</thead>
@ -213,8 +225,12 @@
]
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
search: `
<div class="datatable-search-wrapper">
_INPUT_
<i class="mdi mdi-magnify datatable-search-icon"></i>
</div>`,
searchPlaceholder: "Search"
},
paging: true, // Enable pagination
pageLength: 25 // Set default number of rows per page (optional)

View File

@ -169,8 +169,6 @@
$(document).ready(function() {
getClientAndBranchAndPolicy()
getURLParams()
$('#client_id').select2();
$('#client_branch_id').select2();
$('#insurer_id').select2();
@ -179,7 +177,9 @@
$('#client_policy_id').select2();
$('#user_id').select2();
})
getClientAndBranchAndPolicy();
});
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
@ -223,21 +223,30 @@
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function getSafeParam(params, paramName) {
const val = params.get(paramName);
if (val === null || val === '' || val === 'null' || val === 'undefined' || val === undefined) {
return '';
}
return val;
}
function getURLParams() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
const startDate = params.get('start_date') || 0; // Default to 0 if not found
const endDate = params.get('end_date') || 0; // Default to 0 if not found
const client_id = params.get('client_id') || 0; // Default to 0 if not found
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
const date_type = params.get('date_type') || 0; // Default to 0 if not found
const issuer = params.get('issuer') || 0; // Default to 0 if not found
const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found
const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found
const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found
const user_id = params.get('user_id') || 0; // Default to 0 if not found
const startDate = getSafeParam(params, 'start_date');
const endDate = getSafeParam(params, 'end_date');
const client_id = getSafeParam(params, 'client_id');
const insurer_id = getSafeParam(params, 'insurer_id');
const policy_type_id = getSafeParam(params, 'policy_type_id');
const date_type = getSafeParam(params, 'date_type');
const issuer = getSafeParam(params, 'issuer');
const client_branch_id = getSafeParam(params, 'client_branch_id');
const insurer_branch_id = getSafeParam(params, 'insurer_branch_id');
const client_policy_id = getSafeParam(params, 'client_policy_id');
const user_id = getSafeParam(params, 'user_id');
hideDateField(date_type)
@ -258,24 +267,38 @@
console.log('End Date:', endDate);
if (startDate != 0 && endDate != 0) {
setTimeout(function() {
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).select2()
$('#insurer_id').val(insurer_id).select2()
$('#user_id').val(user_id).select2()
$('#policy_type_id').val(policy_type_id).select2()
$('#date_type').val(date_type).trigger('change');
$('#issuer').val(issuer)
setTimeout(function() {
$('#client_branch_id').val(client_branch_id).select2()
$('#insurer_branch_id').val(insurer_branch_id).select2()
// wait for dropdowns (Select2) to be loaded
setTimeout(function() {
$('#client_policy_id').val(client_policy_id).select2();
}, 1000);
}, 2000)
}, 1000)
// Step 1: Set top-level fields first
$('#startDate').val(startDate);
$('#endDate').val(endDate);
$('#client_id').val(client_id).trigger('change.select2');
$('#insurer_id').val(insurer_id).trigger('change.select2');
$('#user_id').val(user_id).trigger('change.select2');
$('#policy_type_id').val(policy_type_id).trigger('change.select2');
$('#date_type').val(date_type).trigger('change');
$('#issuer').val(issuer);
// Step 2: Wait a bit to let change events happen
setTimeout(function() {
// populate branch dropdowns manually if data exists
if (client_id && branch_list[client_id]) {
appendBranch(branch_list[client_id]);
}
if (insurer_id && insurer_branch_list[insurer_id]) {
appendInsurerBranch(insurer_branch_list[insurer_id]);
}
// Step 3: Set branch selections
$('#client_branch_id').val(client_branch_id).trigger('change.select2');
$('#insurer_branch_id').val(insurer_branch_id).trigger('change.select2');
// Step 4: After branches, handle client policies
setTimeout(function() {
$('#client_policy_id').val(client_policy_id).trigger('change.select2');
}, 500);
}, 500);
}, 500);
}
}
@ -370,6 +393,7 @@
insurer_branch_list = res.insurer_branch_data;
appendClients(res.client_data);
appendInsurer(res.insurer_data);
getURLParams();
} else {
console.log('No data found');
}
@ -401,6 +425,7 @@
});
$('#client_id').append(option);
});
}
@ -469,7 +494,6 @@
function appendPolicies(data) {
// console.log('appendPolicies', data);
// console.log('appendPolicies', $('#client_policy_id'));
$('#client_policy_id').empty();
$('#client_policy_id').append($('<option>', {
value: '',
@ -560,9 +584,10 @@
let val = $(input).val();
if (val == 'statement_month') {
$('#bds_title').text(' - Statement Month Wise List')
} else {
$('#bds_title').text(' - Policy Wise List')
}
}
// else {
// $('#bds_title').text(' - Policy Wise List')
// }
}
</script>