nhance/app/Views/payout_list.php

357 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
.badge-container {
background: #F0F0F0;
padding: 6px 12px;
border-radius: 6px;
font-size: 14px;
display: inline-block;
}
.summary-box {
background: #e3f2fd;
padding: 15px;
border-radius: 6px;
margin-bottom: 20px;
border-left: 4px solid #2196F3;
}
</style>
<style>
.summary-box {
padding: 10px;
margin-bottom: 15px;
}
.summary-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
font-size: 13px;
}
.summary-row:last-child {
margin-bottom: 0;
font-size: 12px;
font-weight: bold;
padding-top: 4px;
border-top: 1px solid #2196F3;
}
.summary-row {
padding: 0px 0;
font-size: 13px;
}
.summary-row span:last-child {
font-weight: bold;
font-size: 12px !important;
}
.utr-section {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #eee;
}
.utr-heading {
margin-bottom: 10px;
font-size: 15px;
}
.utr-form-group {
margin-bottom: 10px;
}
.utr-label {
font-size: 13px;
margin-bottom: 5px;
}
.utr-small-text {
color: #666;
display: block;
margin-top: 3px;
font-size: 11px;
}
.utr-submit-wrapper {
margin-bottom: 10px;
margin-top: 24px;
}
.utr-list {
margin-top: 15px;
border-top: 1px solid #eee;
}
.utr-table {
font-size: 13px;
}
.utr-table thead tr {
font-size: 13px;
}
.utr-table tbody {
font-size: 13px;
}
.utr-dropdown-item {
font-size: 13px;
padding: 5px 15px;
}
.utr-icon {
font-size: 16px;
}
#payout_modal .modal-body {
max-height: 550px; /* adjust as needed */
overflow-y: auto;
}
</style>
<style>
.utr-table td,
.utr-table th {
padding: 3px 8px !important;
vertical-align: middle;
line-height: 1.2;
}
.utr-table tbody tr {
height: 30px;
}
.utr-table thead th {
padding: 5px 8px !important;
}
.utr-table .btn-sm {
padding: 1px 6px;
font-size: 11px;
}
.utr-table .mdi {
font-size: 14px;
}
.utr-table .dropdown-menu {
min-width: 110px;
}
.utr-dropdown-item {
padding: 7px 10px !important;
}
table[data-custom-table-css="table"] tbody tr td {
padding: 1px 10px !important;
line-height: 12px;
min-height: 40px;
vertical-align: middle;
}
</style>
<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;">Payout List <span id="payout_title"></span></h4>
</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 class="font-weight-medium">S.No.</th>
<th class="font-weight-medium">Inovice No</th>
<th class="font-weight-medium">Invoice Date</th>
<th class="font-weight-medium">Invoice Amount</th>
<th class="font-weight-medium">UTR Total Amount</th>
<th class="font-weight-medium">Balance</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Agent</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody>
<?php if (isset($payout_list_data) && !empty($payout_list_data)) { ?>
<?php foreach($payout_list_data as $index => $row){ ?>
<tr>
<td> <?= $index + 1 ?> </td>
<td> <?= $row['invoice_no'] ?> </td>
<td> <?= change_date_format($row['invoice_no'], null, 'd-M-Y') ?? "" ?> </td>
<td> <?= format_indian_number($row['invoice_amount']) ?> </td>
<td> <?= format_indian_number($row['total_utr_amount']) ?> </td>
<td> <?= format_indian_number($row['balance_amount']) ?> </td>
<td> <?= $row['status_text'] ?> </td>
<td> <?= $row['agent_name'] ?? " - " ?> </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" onclick="fetchUtrDetails(<?= $row['id'] ?>, '<?= $row['invoice_no'] ?>')"><i class="mdi mdi-bank-transfer mr-2 text-muted font-18 vertical-middle"></i>UTR</a>
<a href="<?= base_url('payout/invoices/save?type="edit"') ?>" class="dropdown-item"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a href="<?= base_url('payout/invoices/save?type="adjustment"') ?>" class="dropdown-item"><i class="mdi mdi-tune mr-2 text-muted font-18 vertical-middle"></i>Adjustment</a>
</div>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
</div><!-- end col -->
</div>
</div>
<div class="modal fade" id="payout_modal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-bs-backdrop="static">
<div class="modal-dialog modal-lg" style="max-width: 800px;">
<div class="modal-content">
<div class="modal-header" style="background-color: gainsboro;">
<h5 class="modal-title" id="myCenterModalLabel">UTR <span id="heading"></span></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="modal_body">
</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-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
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',
title: 'List',
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
},
{
extend: 'excel',
title: 'List',
sheetName: 'Policy-Tranction-payout-List',
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
className: 'app-btn-primary ',
}
]
}
],
language: {
search: `
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
_INPUT_
<i class="mdi mdi-magnify datatable-search-icon"
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666;"></i>
<i class="mdi mdi-close-circle datatable-clear-icon"
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666; display:none;"></i>
</div>`,
searchPlaceholder: "Search",
emptyTable: '<div class="text-center text-muted">No Data found</div>'
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false
});
} else {
console.error("Table atet found.");
}
});
function fetchUtrDetails(invoice_id, invoice_no)
{
if (!invoice_id) {
toastr.warning("Invoice Id not found!", "WARNING");
return false;
}
let heading_text = ' - ( Invoice No : ' + invoice_no + ' )';
$('#modal_body').empty();
$('#heading').text(heading_text);
$('#modal_body').append('<div class="text-center p-5"><div class="spinner-border text-primary" role="status"><span class="sr-only">Loading...</span></div></div>');
var myModal = new bootstrap.Modal(document.getElementById('payout_modal'));
myModal.show();
let url = '<?= base_url('payout/fetchUtrDetails') ?>';
// Data to send in the AJAX request
let requestData = {
invoice_id: invoice_id,
};
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// Send AJAX request
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
console.log('Data fetched successfully:', response);
$('#modal_body').empty();
$('#heading').text(heading_text);
$('#modal_body').append(response.data);
if (response.status == false) {
toastr.warning(response.message || 'Unable to fetch data', 'WARNING');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, function(xhr, status, error) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
});
}
</script>