nhance-enrollment/app/Views/batch_list.php

225 lines
12 KiB
PHP
Executable File

<style>
.table-responsive {
overflow-x: auto;
}
.reload:hover {
cursor: pointer;
}
.truncate {
max-width: 80px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
<div class="col-12" id="second_page">
<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;">Batch List</h4>
</div>
</div>
<div class="table-responsive">
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive w-100">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">Batch Code</th>
<th class="font-weight-medium">File Name</th>
<th class="font-weight-medium">Client</th>
<th class="font-weight-medium">Client Branch</th>
<th class="font-weight-medium">Client Policy</th>
<th class="font-weight-medium">Event Type</th>
<th class="font-weight-medium">Insurer/ TPA</th>
<th class="font-weight-medium">Action</th>
<th class="font-weight-medium">Count</th>
<th class="font-weight-medium">()Amount</th>
<th class="font-weight-medium">User/Time</th>
<th class="font-weight-medium">Status</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if (isset($batch_list)) {
foreach ($batch_list as $key => $file) {
?>
<tr>
<td><b><?php echo ($key + 1) ?></b></td>
<td><?php echo $file['batch_code'] ?></td>
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name']?>
</td>
<td><?php echo $file['client_short_name'] ?></td>
<td><?php echo $file['branch_name'] ?></td>
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
<td><?php echo $file['event_type'] ?></td>
<td><?php echo $file['insurer_or_tpa'] ?></td>
<td><?php echo $file['actions'] ?></td>
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
<td><?php echo format_indian_number($file['amount'])?></td>
<td class="reload">
<?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd/m/Y') ?> by <?php echo get_username($file['created_by']) ?>
</td>
<td>
<?php if ($file['status'] == 'failed') { ?>
<?php echo $file['status']; ?>
<a href="<?= base_url('/util/export-import-error-list/') . $file['id'] ?>"
class="fe-alert-circle" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to show the error"></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } else if ($file['status'] == 'partially success') { ?>
<?php echo $file['status']; ?>
<?php if ($file['error_data'] != 0) { ?>
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top" title="<?= $file['error_data'] ?>"></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } ?>
<?php } else if ($file['status'] == 'failed-1') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top"
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the TPA ID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?> "></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } else if ($file['status'] == 'failed-2') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top"
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the UHID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?>"></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } else if ($file['status'] == 'failed-3') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top"
title="The Excel record count exceeds the DB record count."></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } else if ($file['status'] == 'failed-4') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top" title="Physical File Not Found."></a>
<?php } else if ($file['status'] == 'failed-5') { ?>
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top" title="Wrong File Uploaded"></a>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } else { ?>
<?php echo $file['status']; ?>
&nbsp;
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>"
class="fa fa-download" style="color: #000;" aria-hidden="true" target="_blank"
data-toggle="tooltip" data-placement="top" title="Click to Download"></a>
<?php } ?>
</td>
</tr>
<?php }
} ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<script>
$(document).ready(function() {
$('#datatable-buttons').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: 'Batch List',
className: 'my_class',
}],
initComplete: function(settings, json) {
$('.my_class').css({
position: "relative",
left: "50px"
});
},
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true
});
});
</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}`);
console.log('element', elements)
elements.forEach(element => {
const number = parseFloat(element.innerText.replace(/,/g, ''));
console.log('number', number)
if (!isNaN(number)) {
console.log(formatNumberInIndianRupees(number))
element.innerText = formatNumberInIndianRupees(number);
}
});
}
// Format numbers when the DOM content is loaded
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
formatNumbersByClass('indian-number');
}, 500);
});
</script>