nhance/app/Views/employee_data_list.php

259 lines
11 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;
}
.table-responsive {
overflow-x: auto;
}
.word-wrap {
word-wrap: break-word;
white-space: normal;
}
</style>
<?php $pro_rata_total = 0; $gst_total = 0 ?>
<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>
<div class="table-responsive">
<table class="table table-hover m-0 table-centered dt-responsive 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 isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></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><?php echo format_indian_number($employee['basic_cover_si'])?> </td>
<td><?php echo format_indian_number($employee['premium'])?></td>
<td><?php $pro_rata_total = $pro_rata_total + $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum'])?></td>
<td><?php $gst_total = $gst_total + $employee['gst']; echo format_indian_number($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><?php echo format_indian_number($pro_rata_total) ?></th>
<th><?php echo format_indian_number($gst_total) ?></th>
</tr>
</tfoot>
</table>
</div>
</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)', // Adjust as needed
footer: true // Include the footer in the export
}
}],
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 = 24;
// let value = number.toString().replace(/[^\d.]/g, ''); // Remove non-numeric characters
// // Limit the number of digits before the decimal point
// if (value.includes('.')) {
// let parts = value.split('.');
// parts[0] = parts[0].slice(0, maxLength); // Limit the integer part
// value = parts.join('.');
// } else {
// value = value.slice(0, maxLength);
// }
// // Convert to a number and format with commas using the Indian numbering system
// const formattedNumber = Number(value).toLocaleString('en-IN', {
// maximumFractionDigits: 2 // Optional: limit to 2 decimal places if required
// });
// 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>