nhance/app/Views/bds_renewal_report_list.php
2025-09-25 11:12:29 +05:30

188 lines
8.0 KiB
PHP

<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<div class="col-12" id="inception_list">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Renewal Policy List</h4>
</div>
</div>
<div>
<div class="table-responsive">
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>
<div class="column-header">S.No&nbsp;</div>
</th>
<th>
<div class="column-header">Renewal Month</div>
</th>
<th>
<div class="column-header">Issuer</div>
</th>
<th>
<div class="column-header">Policy No</div>
</th>
<th>
<div class="column-header">Policy</div>
</th>
<th>
<div class="column-header">Insurer Name</div>
</th>
<th>
<div class="column-header">Insurer Branch</div>
</th>
<th>
<div class="column-header">Insured</div>
</th>
<th>
<div class="column-header">Client Type</div>
</th>
<th>
<div class="column-header">Business Type</div>
</th>
<th>
<div class="column-header">Date of Issue </div>
</th>
<th>
<div class="column-header">Policy Start Date</div>
</th>
<th>
<div class="column-header">Policy Expiry Date</div>
</th>
<th>
<div class="column-header">Vehicle No</div>
</th>
<th>
<div class="column-header">Lead Status</div>
</th>
</tr>
</thead>
<tbody>
<?php foreach($renewal_data as $index => $row) { ?>
<tr>
<td><?php echo $index+1; ?></td>
<td><?php echo empty($row['policy_end_date']) ? ' - ' : date('M-Y', strtotime($row['policy_end_date'])); ?>
<td><?php echo $issuer[$row['issuer']] ?? ' - '; ?></td>
<td><?php echo $row['policy_no'] ?? ' - '; ?></td>
<td><?php echo $row['policy_type'] ?? ' - '; ?></td>
<td><?php echo $row['insurer_name'] ?? ' - '; ?></td>
<td><?php echo $row['insurer_branch_name'] ?? ' - '; ?></td>
<td><?php echo $row['client_name'] ?? ' - ' ?></td>
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
<td><?php echo $row['revenue_type'] ?? ' - ' ?></td>
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?>
</td>
<td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?>
</td>
<td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?>
</td>
<td><?php echo $row['vehicle_no'] ?? ' - ' ?></td>
<td><?php echo ucfirst($row['lead_status'] ?? ' - ') ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
// Datatable document ready
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-2'f><'col-sm-10 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
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: 'Renewal-List',
},
{
extend: 'excel',
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
title: 'Renewal-List',
exportOptions: {
orthogonal: 'sort'
},
}
]
}
],
language: {
search: `
<div class="datatable-search-wrapper">
_INPUT_
<i class="mdi mdi-magnify datatable-search-icon"></i>
</div>`,
searchPlaceholder: "Search"
},
paging: true, // Enable pagination
pageLength: 20, // Set default number of rows per page (optional)
ordering: true,
});
} else {
console.error("Table atet found.");
}
});
// Global DataTables defaults
$.extend(true, $.fn.dataTable.defaults, {
language: {
search: "", // remove "Search:" label
searchPlaceholder: "Search"
},
paging: true,
pageLength: 10,
ordering: false
});
// Global init hook
$(document).on('init.dt', function (e, settings) {
let $filter = $(settings.nTableWrapper).find('.dataTables_filter');
let $input = $filter.find('input');
if (!$filter.hasClass('custom-search')) {
// Wrap in Bootstrap input-group
$input
.addClass('form-control')
.wrap('<div class="input-group"></div>');
// Append icon
$input.after(`
<span class="input-group-text bg-white border-0">
<i class="mdi mdi-magnify"></i>
</span>
`);
// Align to right
$filter.addClass('text-right custom-search');
}
});
</script>