nhance/app/Views/employee_data_list.php

236 lines
9.6 KiB
PHP

<style>
.badge2 {
box-shadow: none;
}
.badge2-secondary2 {
color: #fff;
background-color: #187607;
}
.badge2 {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
</style>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<!-- <th class="font-weight-medium">Employee code</th> -->
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurer <br> name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">UHID</th>
<th class="font-weight-medium">Policy <br> status</th>
<th class="font-weight-medium">()Sum Insured</th>
<th class="font-weight-medium">()Premium</th>
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">
()Pro Rata <br> Premium</th>
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">()GST
</th>
<!-- <th class="font-weight-medium">Action</th> -->
</tr>
</thead>
<tbody class="font-12">
<?php
if(isset($employees))
{
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1)?></b></td>
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> -
<?php echo $employee['relationship']?> )</td>
<td><?php echo $employee['policy_name']?></td>
<td><?php echo $employee['insurer_short_name']?></td>
<td><?php echo $employee['tpa_id']?></td>
<td><?php echo $employee['uhid']?></td>
<td>
<?php
if ($employee['status'] == 'draft') {
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'active') {
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
} elseif ($employee['status'] == 'inactive') {
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
}elseif ($employee['status'] == 'expired') {
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
}elseif ($employee['status'] == 'enrolled') {
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
}else{
echo $employee['status'];
}
?>
</td>
<td class="indian-number"> <?php echo $employee['basic_cover_si']?> </td>
<td class="indian-number"><?php echo $employee['premium']?></td>
<td class="indian-number"><?php echo $employee['rata_premimum']?></td>
<td class="indian-number"><?php echo $employee['gst']?></td>
<!-- <td>
<div class="btn-group dropdown">
<a href="javascript: void(0);"
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#"><i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
Ticket</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
Unread</a>
</div>
</div>
</td> -->
</tr>
<?php }}?>
</tbody>
<tfoot>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Total</th>
<th class="indian-number"></th>
<th class="indian-number"></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css">
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/tippy.js@6"></script>
<script>
$(document).ready(function() {
$('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [{
"extend": 'csv',
"text": 'CSV',
"title": 'Employee-List',
"className": 'my_class',
"exportOptions": {
"columns": ':not(:last-child)'
},
}],
"initComplete": function(settings, json) {
$('.my_class').css({
"position": "relative",
"left": "82px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
// pagingType: 'full_numbers'
});
});
</script>
<script>
// Function to format a number in Indian Rupees format
function formatNumberInIndianRupees(number) {
const maxLength = 16;
let value = number.toString().replace(/\D/g, ''); // Remove non-numeric characters
// Limit the number of digits
value = value.slice(0, maxLength);
// Format the number with commas using Indian numbering system
const formattedNumber = Number(value).toLocaleString('en-IN');
return formattedNumber;
}
// Function to format numbers based on a class
function formatNumbersByClass(className) {
const elements = document.querySelectorAll(`.${className}`);
elements.forEach(element => {
const number = parseFloat(element.innerText.replace(/,/g, ''));
if (!isNaN(number)) {
element.innerText = formatNumberInIndianRupees(number);
}
});
}
// Format numbers when the DOM content is loaded
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
formatNumbersByClass('indian-number');
}, 500);
});
</script>
<script>
$(document).ready(function() {
var table = $('#tickets-table').DataTable({
"footer": true
});
var sumColumn9 = table.column(9).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b);
}, 0);
console.log(sumColumn9)
var sumColumn10 = table.column(10).data().reduce(function(a, b) {
return parseFloat(a) + parseFloat(b);
}, 0);
console.log(sumColumn10)
$('#tickets-table tfoot th:eq(9)').html(sumColumn9);
$('#tickets-table tfoot th:eq(10)').html(sumColumn10);
});
</script>