FIX_BDS common Issues
This commit is contained in:
parent
f862f06d61
commit
1b085f4c56
@ -7,6 +7,13 @@
|
|||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
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>
|
</style>
|
||||||
|
|
||||||
<div class="col-12" id="inception_list">
|
<div class="col-12" id="inception_list">
|
||||||
|
|||||||
@ -21,6 +21,18 @@
|
|||||||
.center-align-input {
|
.center-align-input {
|
||||||
text-align: center;
|
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>
|
</style>
|
||||||
|
|
||||||
<div class="container-fluid-min">
|
<div class="container-fluid-min">
|
||||||
@ -107,21 +119,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
<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">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th>S.No </th>
|
<th><div class="column-header">S.No</div></th>
|
||||||
<!-- <th>Client Name</th> -->
|
<!-- <th>Client Name</th> -->
|
||||||
<th>Insurer </th>
|
<th><div class="column-header">Insurer</div></th>
|
||||||
<th>Insurer<br> Branch </th>
|
<th><div class="column-header">Insurer<br> Branch</div></th>
|
||||||
<th>Statement<br> Month </th>
|
<th><div class="column-header">Statement<br> Month</div></th>
|
||||||
<th>Statement<br> No </th>
|
<th><div class="column-header">Statement<br> No</div></th>
|
||||||
<th>Invoice No </th>
|
<th><div class="column-header">Invoice No</div></th>
|
||||||
<th>Invoice Status </th>
|
<th><div class="column-header">Invoice Status</div></th>
|
||||||
<th>Invoice Date </th>
|
<th><div class="column-header">Invoice Date</div></th>
|
||||||
<th>Invoice Amount </th>
|
<th><div class="column-header">Invoice Amount</div></th>
|
||||||
<th>Realization <br>Amount </th>
|
<th><div class="column-header">Realization <br>Amount</div></th>
|
||||||
<th>Outstanding <br>Amount </th>
|
<th><div class="column-header">Outstanding <br>Amount</div></th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -213,8 +225,12 @@
|
|||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
language: {
|
language: {
|
||||||
search: "_INPUT_",
|
search: `
|
||||||
searchPlaceholder: "Search..."
|
<div class="datatable-search-wrapper">
|
||||||
|
_INPUT_
|
||||||
|
<i class="mdi mdi-magnify datatable-search-icon"></i>
|
||||||
|
</div>`,
|
||||||
|
searchPlaceholder: "Search"
|
||||||
},
|
},
|
||||||
paging: true, // Enable pagination
|
paging: true, // Enable pagination
|
||||||
pageLength: 25 // Set default number of rows per page (optional)
|
pageLength: 25 // Set default number of rows per page (optional)
|
||||||
|
|||||||
@ -169,8 +169,6 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
getClientAndBranchAndPolicy()
|
|
||||||
getURLParams()
|
|
||||||
$('#client_id').select2();
|
$('#client_id').select2();
|
||||||
$('#client_branch_id').select2();
|
$('#client_branch_id').select2();
|
||||||
$('#insurer_id').select2();
|
$('#insurer_id').select2();
|
||||||
@ -179,7 +177,9 @@
|
|||||||
$('#client_policy_id').select2();
|
$('#client_policy_id').select2();
|
||||||
$('#user_id').select2();
|
$('#user_id').select2();
|
||||||
|
|
||||||
})
|
getClientAndBranchAndPolicy();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function fetchEmpolyeeList(event) {
|
function fetchEmpolyeeList(event) {
|
||||||
event.preventDefault(); // Prevent default action
|
event.preventDefault(); // Prevent default action
|
||||||
@ -223,21 +223,30 @@
|
|||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
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() {
|
function getURLParams() {
|
||||||
const url = new URL(window.location.href);
|
const url = new URL(window.location.href);
|
||||||
const params = new URLSearchParams(url.search);
|
const params = new URLSearchParams(url.search);
|
||||||
|
|
||||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
const startDate = getSafeParam(params, 'start_date');
|
||||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
const endDate = getSafeParam(params, 'end_date');
|
||||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
const client_id = getSafeParam(params, 'client_id');
|
||||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
const insurer_id = getSafeParam(params, 'insurer_id');
|
||||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
const policy_type_id = getSafeParam(params, 'policy_type_id');
|
||||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
const date_type = getSafeParam(params, 'date_type');
|
||||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
const issuer = getSafeParam(params, 'issuer');
|
||||||
const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found
|
const client_branch_id = getSafeParam(params, 'client_branch_id');
|
||||||
const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found
|
const insurer_branch_id = getSafeParam(params, 'insurer_branch_id');
|
||||||
const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found
|
const client_policy_id = getSafeParam(params, 'client_policy_id');
|
||||||
const user_id = params.get('user_id') || 0; // Default to 0 if not found
|
const user_id = getSafeParam(params, 'user_id');
|
||||||
|
|
||||||
hideDateField(date_type)
|
hideDateField(date_type)
|
||||||
|
|
||||||
@ -258,24 +267,38 @@
|
|||||||
console.log('End Date:', endDate);
|
console.log('End Date:', endDate);
|
||||||
|
|
||||||
if (startDate != 0 && endDate != 0) {
|
if (startDate != 0 && endDate != 0) {
|
||||||
|
// wait for dropdowns (Select2) to be loaded
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('#start_date').val(startDate)
|
// Step 1: Set top-level fields first
|
||||||
$('#end_date').val(endDate)
|
$('#startDate').val(startDate);
|
||||||
$('#client_id').val(client_id).select2()
|
$('#endDate').val(endDate);
|
||||||
$('#insurer_id').val(insurer_id).select2()
|
$('#client_id').val(client_id).trigger('change.select2');
|
||||||
$('#user_id').val(user_id).select2()
|
$('#insurer_id').val(insurer_id).trigger('change.select2');
|
||||||
$('#policy_type_id').val(policy_type_id).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');
|
$('#date_type').val(date_type).trigger('change');
|
||||||
$('#issuer').val(issuer)
|
$('#issuer').val(issuer);
|
||||||
setTimeout(function() {
|
|
||||||
$('#client_branch_id').val(client_branch_id).select2()
|
|
||||||
$('#insurer_branch_id').val(insurer_branch_id).select2()
|
|
||||||
setTimeout(function() {
|
|
||||||
$('#client_policy_id').val(client_policy_id).select2();
|
|
||||||
}, 1000);
|
|
||||||
}, 2000)
|
|
||||||
}, 1000)
|
|
||||||
|
|
||||||
|
// 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;
|
insurer_branch_list = res.insurer_branch_data;
|
||||||
appendClients(res.client_data);
|
appendClients(res.client_data);
|
||||||
appendInsurer(res.insurer_data);
|
appendInsurer(res.insurer_data);
|
||||||
|
getURLParams();
|
||||||
} else {
|
} else {
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
}
|
}
|
||||||
@ -401,6 +425,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#client_id').append(option);
|
$('#client_id').append(option);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -469,7 +494,6 @@
|
|||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
// console.log('appendPolicies', data);
|
// console.log('appendPolicies', data);
|
||||||
// console.log('appendPolicies', $('#client_policy_id'));
|
// console.log('appendPolicies', $('#client_policy_id'));
|
||||||
|
|
||||||
$('#client_policy_id').empty();
|
$('#client_policy_id').empty();
|
||||||
$('#client_policy_id').append($('<option>', {
|
$('#client_policy_id').append($('<option>', {
|
||||||
value: '',
|
value: '',
|
||||||
@ -560,9 +584,10 @@
|
|||||||
let val = $(input).val();
|
let val = $(input).val();
|
||||||
if (val == 'statement_month') {
|
if (val == 'statement_month') {
|
||||||
$('#bds_title').text(' - Statement Month Wise List')
|
$('#bds_title').text(' - Statement Month Wise List')
|
||||||
} else {
|
|
||||||
$('#bds_title').text(' - Policy Wise List')
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// $('#bds_title').text(' - Policy Wise List')
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user