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

This commit is contained in:
VENKATESHWARAN 2026-04-27 15:07:26 +05:30
commit ce334ee981
16 changed files with 141 additions and 252 deletions

View File

@ -1,4 +1,5 @@
<?php
helper('datatable_view');
$batch_header_labels = [
'S.No', 'Batch Code', 'File Name', 'Client', 'Client Branch', 'Client Policy',
'Event Type', 'Insurer/ TPA', 'Action', 'Count', '(₹)Amount', 'User/Time', 'Status', 'Action',

View File

@ -242,6 +242,7 @@
</div>
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("scroll-horizontal-datatable");
@ -329,6 +330,7 @@
}
});
});
*/
</script>

View File

@ -10,11 +10,20 @@
</style>
<script>
var pageHideMainNavTitle = true;
var pageTitle = 'Client Details - <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) ';
var pageBackButton = '<a href="<?= base_url("client/list"); ?>" class="topbar-icon-btn" data-toggle="tooltip" data-placement="top" title="Back to Client List" aria-label="Back to Client List"><i class="ri-arrow-left-s-line"></i></a>';
if (typeof window.applyTopNavbarTitle === 'function') {
window.applyTopNavbarTitle();
}
</script>
<div class="row" id="client_info">
<div class="col-12">
<div class="card">
<div class="card-body">
<div id="client_info">
<div class="row">
<div class="col-12">
<div id="accordion" class="mb-3">
<div class="card">
@ -23,14 +32,19 @@
<div class="col-6">
<h4 style="position: relative; left: 18px; top: 2px;">
<!--
<span class="client_info_close fs-6" id="close_btn">
<i class="mdi mdi-chevron-left" style="font-size: 28px;cursor:pointer;"></i>
</span>
</span>
-->
<span>
<!--
Client Basic Info -
<strong> <?= $client['client_name'] ?> ( <?= $client['short_name'] ?> ) </strong>
-->
Client Basic Information
</span>
</h4>
</div>
@ -228,8 +242,9 @@
</div>
<!-- end row -->
</div>
</div>
</div>
</div>
</div>

View File

@ -205,6 +205,10 @@ table.dataTable thead th {
<?php if(in_array(get_role_id(), [1, 5])) { ?>
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
<?php } ?>
<a class="dropdown-item" href="javascript:void(0);" onclick="openClientDetailsPage(<?= $row->id ?>)">
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>Open Client Details
</a>
</div>
</div>
</td>
@ -257,6 +261,7 @@ table.dataTable thead th {
<script>
document.addEventListener("DOMContentLoaded", function () {
/**
const table = document.getElementById("client-list-table");
// Create custom dropdown
@ -344,9 +349,9 @@ table.dataTable thead th {
activeDropdown = null;
}
});
*/
// Open client details page
function openClientDetailsPage(clientId) {
window.openClientDetailsPage = function(clientId) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -369,7 +374,7 @@ table.dataTable thead th {
$('.loader-mask').delay(350).fadeOut('slow');
}
});
}
};
});
</script>

View File

@ -91,9 +91,9 @@ if ($emp_show_branch) {
$emp_header_labels[] = 'Branch';
}
$emp_header_labels = array_merge($emp_header_labels, [
'Name', 'EMP Code', 'Relationship', 'Gender', 'Email', 'Mobile', 'Date of Birth',
'Policy name', 'Insurer name', 'TPA ID', 'Risk ID', 'Policy status',
'(₹)Sum Insured', '(₹)Premium', '(₹)Pro Rata Premium', '(₹)GST', 'Action',
'Name ', 'EMP Code ', 'Relationship ', 'Gender ', 'Email', 'Mobile', 'Date of Birth',
'Policy name ', 'Insurer name ', 'TPA ID ', 'Risk ID ', 'Policy status ',
'(₹)Sum Insured ', '(₹)Premium ', '(₹)Pro Rata Premium ', '(₹)GST ', 'Action ',
]);
$emp_col_count = count($emp_header_labels);
$emp_col_max_len = array_fill(0, $emp_col_count, 0);
@ -157,8 +157,20 @@ if (isset($employees)) {
$emp_col_max_len[$emp_col_count - 6] = max($emp_col_max_len[$emp_col_count - 6], mb_strlen('Total'));
$emp_col_min_px = array_fill(0, $emp_col_count, 80);
$emp_col_max_px = array_fill(0, $emp_col_count, 360);
$emp_col_min_px[0] = 48;
$emp_col_max_px[0] = 72;
$emp_col_min_px[0] = 64;
$emp_col_max_px[0] = 88;
$emp_dynamic_idx = 1;
if ($emp_show_client_branch || $emp_show_branch) {
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 120);
$emp_col_max_px[$emp_dynamic_idx] = max($emp_col_max_px[$emp_dynamic_idx], 190);
$emp_dynamic_idx++;
}
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 110); // Name
$emp_dynamic_idx++;
$emp_col_min_px[$emp_dynamic_idx] = max($emp_col_min_px[$emp_dynamic_idx], 100); // EMP Code
$emp_col_max_px[$emp_dynamic_idx] = max($emp_col_max_px[$emp_dynamic_idx], 140);
$emp_col_min_px[$emp_col_count - 1] = 72;
$emp_col_max_px[$emp_col_count - 1] = 96;
$emp_col_width_px = nhance_dt_column_widths_px($emp_header_labels, $emp_col_max_len, $emp_col_min_px, $emp_col_max_px);
@ -183,6 +195,11 @@ $gst_total = 0;
vertical-align: middle;
}
<?php endfor; ?>
#employee-data-list-table,
#employee-data-list-table_wrapper .dataTables_scrollHead table,
#employee-data-list-table_wrapper .dataTables_scrollBody table {
table-layout: fixed !important;
}
#employee-data-list-table tbody td:not(:last-child) {
overflow: hidden;
text-overflow: ellipsis;
@ -201,6 +218,15 @@ $gst_total = 0;
font-size: 13px;
line-height: 1.25;
}
#employee-data-list-table_wrapper table.dataTable thead .sorting:before,
#employee-data-list-table_wrapper table.dataTable thead .sorting:after,
#employee-data-list-table_wrapper table.dataTable thead .sorting_asc:before,
#employee-data-list-table_wrapper table.dataTable thead .sorting_asc:after,
#employee-data-list-table_wrapper table.dataTable thead .sorting_desc:before,
#employee-data-list-table_wrapper table.dataTable thead .sorting_desc:after {
right: 0.55rem !important;
opacity: 1 !important;
}
</style>
<div class="row" id="client_list">
@ -213,7 +239,7 @@ $gst_total = 0;
</div>
</div>
<div class="table-responsive">
<table data-custom-table-css="table" class="table table-hover m-0 table-centered nowrap w-100 dt-responsive" cellspacing="0" id="employee-data-list-table">
<table data-custom-table-css="table" class="table table-hover m-0 table-centered nowrap w-100" cellspacing="0" id="employee-data-list-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">S.No&nbsp;</th>
@ -240,7 +266,7 @@ $gst_total = 0;
<th class="font-weight-medium">Policy status&nbsp;</th>
<th class="font-weight-medium">()Sum Insured&nbsp;</th>
<th class="font-weight-medium">()Premium&nbsp;</th>
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">()Pro Rata <br> Premium&nbsp;</th>
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">()Pro Rata Premium&nbsp;</th>
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">()GST&nbsp;</th>
<th class="font-weight-medium" > Action &nbsp;</th>
</tr>
@ -344,29 +370,17 @@ $gst_total = 0;
<tfoot>
<tr>
<th></th>
<?php if (isset($getData)) {
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<th></th>
<?php }
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<th></th>
<?php } } ?>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Total</th>
<th><?php echo format_indian_number($pro_rata_total); ?></th>
<th><?php echo format_indian_number($gst_total); ?></th>
<th></th>
<?php for ($i = 0; $i < $emp_col_count; $i++) : ?>
<?php if ($i === ($emp_col_count - 4)) : ?>
<th>Total</th>
<?php elseif ($i === ($emp_col_count - 3)) : ?>
<th><?php echo format_indian_number($pro_rata_total); ?></th>
<?php elseif ($i === ($emp_col_count - 2)) : ?>
<th><?php echo format_indian_number($gst_total); ?></th>
<?php else : ?>
<th></th>
<?php endif; ?>
<?php endfor; ?>
</tr>
</tfoot>
</table>

View File

@ -239,6 +239,7 @@
</div>
</div>
<!--
<script>
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("scroll-horizontal-datatable");
@ -328,6 +329,7 @@
});
});
</script>
-->
@ -338,11 +340,7 @@ $(document).ready(function () {
if (ticketsTable.length) {
ticketsTable.DataTable({
// dom:
// "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
// "<'row'<'col-sm-12'tr>>" +
// "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
"<'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]],
@ -409,110 +407,23 @@ $(document).ready(function () {
} else {
console.error("Table not found.");
}
});
$(document).ready(function() {
getURLParams()
getURLParams();
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
var start_date = $('#startDate').val();
var end_date = $('#endDate').val();
var client_id = $('#client_id').val();
var insurer_id = $('#insurer_id').val();
var policy_type_id = $('#policy_type_id').val();
var date_type = $('#date_type').val();
var issuer = $('#issuer').val();
console.log(start_date + '-' + end_date);
var queryParams = {
start_date: start_date,
end_date: end_date,
client_id: client_id,
insurer_id: insurer_id,
policy_type_id: policy_type_id,
date_type: date_type,
issuer: issuer,
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
}
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
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
hideDateField(date_type)
console.log('startDate', startDate)
console.log('endDate', endDate)
console.log('client_id', client_id)
console.log('insurer_id', insurer_id)
console.log('policy_type_id', policy_type_id)
console.log('date_type', date_type)
console.log('issuer', issuer)
// Log the values or use them as needed
console.log('Start Date:', startDate);
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).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
}, 1000)
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange').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'));
function cb(startDate, endDate) {
$('#reportrange').html(startDate.format('D-MM-YYYY') + ' - ' + endDate.format('D-MM-YYYY'));
$('#startDate').val(startDate.format('DD-MM-YYYY'));
$('#endDate').val(endDate.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
@ -525,18 +436,24 @@ $(function() {
'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')
]
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
}
});
}, cb);
$(document).ready(function() {
getURLParams()
$('#client_id').select2();
$('#insurer_id').select2();
$('#policy_type_id').select2();
})
cb(start, end);
$('#clear-filters').on('click', function() {
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide();
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(moment().subtract(29, 'days'), moment());
});
});
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
@ -568,7 +485,9 @@ $(function() {
}
function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
return Object.keys(obj).map(function(key) {
return encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]);
}).join('&');
}
function getURLParams() {
@ -599,78 +518,17 @@ $(function() {
if (startDate != 0 && endDate != 0) {
setTimeout(function() {
$('#start_date').val(startDate)
$('#end_date').val(endDate)
$('#client_id').val(client_id).change()
$('#insurer_id').val(insurer_id).change()
$('#policy_type_id').val(policy_type_id).change()
$('#date_type').val(date_type)
$('#issuer').val(issuer)
}, 1000)
$('#startDate').val(startDate);
$('#endDate').val(endDate);
$('#client_id').val(client_id).change();
$('#insurer_id').val(insurer_id).change();
$('#policy_type_id').val(policy_type_id).change();
$('#date_type').val(date_type);
$('#issuer').val(issuer);
}, 300);
}
}
$(function() {
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search);
// Get start and end dates from URL parameters, or use default values
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
// Parse the dates to moment objects
var start = moment(startDateParam, 'DD-MM-YYYY');
var end = moment(endDateParam, 'DD-MM-YYYY');
// var start = moment().subtract(29, 'days');
// var end = moment();
function cb(start, end) {
$('#reportrange').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'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
locale: {
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')
]
}
}, cb);
cb(start, end);
$('#clear-filters').on('click', function() {
// Reset all select dropdowns to the first option
$('#client_id').val('0').change();
$('#insurer_id').val('0').change();
$('#policy_type_id').val('0').change();
$('#date_type').val('0');
$('#issuer').val('0');
$('#date_div').hide()
// Reset the date range picker to default
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
$('#reportrange').data('daterangepicker').setEndDate(moment());
cb(start, end); // Update the displayed date range
});
});
function hideDateField(input = null) {
let val = $('#date_type').val();

View File

@ -614,6 +614,7 @@ $isl_col_width_px = nhance_dt_column_widths_px($isl_header_labels, $isl_col_max_
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
/**
const table = document.getElementById("insurer-statement-list-table");
// Create custom dropdown
@ -690,6 +691,7 @@ $isl_col_width_px = nhance_dt_column_widths_px($isl_header_labels, $isl_col_max_
activeDropdown = null;
}
});
*/
});
</script>

View File

@ -138,7 +138,9 @@ $kyc_col_width_px = nhance_dt_column_widths_px($kyc_header_labels, $kyc_col_max_
</div><!-- end col -->
</div>
<!-- end row -->
<script>
/**
document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("kyc-list-table");
@ -226,6 +228,7 @@ $kyc_col_width_px = nhance_dt_column_widths_px($kyc_header_labels, $kyc_col_max_
}
});
});
*/
</script>
<script>

View File

@ -1453,35 +1453,6 @@ $(function(){
});
}
function nhApplyMenuScrollLimit($menu, usableSpace) {
if (!$menu || !$menu.length) {
return;
}
var $items = $menu.children('.dropdown-item:visible, a:visible, button:visible');
var visibleItems = 3;
var fixedMenuMax = 0;
if ($items.length) {
$items.slice(0, visibleItems).each(function () {
fixedMenuMax += $(this).outerHeight(true) || 0;
});
}
if (!fixedMenuMax) {
fixedMenuMax = 132; // safe default for 3 items
}
fixedMenuMax += 14; // include menu paddings/borders
var viewportMax = Math.max(140, usableSpace - 12);
var finalMax = Math.max(132, Math.min(fixedMenuMax, viewportMax));
$menu.css({
maxHeight: finalMax + 'px',
overflowY: 'auto',
overflowX: 'hidden',
scrollBehavior: 'smooth',
overscrollBehavior: 'contain',
zIndex: '20050'
});
}
function nhNormalizeActionCells(tableApi) {
if (!tableApi) {
return;
@ -1584,12 +1555,16 @@ $(function(){
$dd.data('nh-auto-dropup', 1);
}
// Keep height capped to ~3 items and allow vertical scroll for extra actions.
// Keep action menu fully expanded (no inner scroll).
if ($menu.length && menuHeight > 0) {
var usableSpace = openUp ? above : below;
nhApplyMenuScrollLimit($menu, usableSpace);
$menu.addClass('nh-action-menu-elevated');
$menu.scrollTop(0);
$menu.css({
maxHeight: '',
overflowY: '',
overflowX: '',
scrollBehavior: '',
overscrollBehavior: '',
zIndex: '20050'
}).addClass('nh-action-menu-elevated');
}
});

View File

@ -367,6 +367,7 @@ table.dataTable thead th {
<?php include('policy_transaction_endorsement_form_2.php'); ?>
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("tickets-table");
@ -446,6 +447,7 @@ table.dataTable thead th {
}
});
});
*/
</script>
<script>
var client_list = '';

View File

@ -426,7 +426,7 @@ table.dataTable tbody td {
function closeFilterNav() {
document.getElementById("filter-sidebar").style.width = "0";
}
/**
document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table");
@ -518,6 +518,7 @@ document.addEventListener("DOMContentLoaded", function () {
}
});
});
*/
</script>
<script>

View File

@ -195,6 +195,7 @@ $pt_col_width_px = nhance_dt_column_widths_px($pt_header_labels, $pt_col_max_len
<!-- end row -->
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("policy-type-list-table");
@ -276,6 +277,7 @@ $pt_col_width_px = nhance_dt_column_widths_px($pt_header_labels, $pt_col_max_len
}
});
});
*/
</script>

View File

@ -639,6 +639,7 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
</script>
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("pos-list-table");
@ -726,4 +727,5 @@ $pos_col_width_px = nhance_dt_column_widths_px($pos_header_labels, $pos_col_max_
}
});
});
*/
</script>

View File

@ -590,6 +590,7 @@
}
</script>
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("scroll-horizontal-datatable");
@ -676,4 +677,5 @@
}
});
});
*/
</script>

View File

@ -144,6 +144,7 @@ $tpa_col_width_px = nhance_dt_column_widths_px($tpa_header_labels, $tpa_col_max_
<!-- end row -->
<script>
/**
document.addEventListener("DOMContentLoaded", function() {
const table = document.getElementById("tpa-list-table");
if (!table) {
@ -234,6 +235,7 @@ $tpa_col_width_px = nhance_dt_column_widths_px($tpa_header_labels, $tpa_col_max_
}
});
});
*/
</script>
<script>

View File

@ -757,6 +757,9 @@ div.dataTables_wrapper table.dataTable tbody td.table-action-cell .dropdown-menu
border: 1px solid rgba(0, 0, 0, 0.12) !important;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12) !important;
z-index: 1080 !important;
max-height: none !important;
overflow-y: visible !important;
overflow-x: visible !important;
}
div.dataTables_wrapper table.dataTable tbody td.table-action-cell .dropdown-menu .dropdown-item {