CHANGE TABLE COLUMN ORDER

This commit is contained in:
Srinivas-Saravanan 2024-11-15 17:37:10 +05:30
parent f7c7ec1078
commit c7ae0adc3f
8 changed files with 34 additions and 36 deletions

View File

@ -69,7 +69,8 @@
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [{
extend: 'print',
title: 'Expired Invoice Report',

View File

@ -64,7 +64,7 @@
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [
{
extend: 'print',

View File

@ -31,9 +31,12 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="col-md-12">
<button type="button" class="btn btn-primary show-column-selection-modal" style="margin-left: 870px;">Select Columns</button>
<div class="row mb-3">
<div class="col-md-12 d-flex justify-content-end">
<button type="button" class="btn btn-primary show-column-selection-modal">Select Columns</button>
</div>
</div>
<div class="table-responsive">
<table id="datatable-buttons" class="table table-striped nowrap w-100">
@ -117,7 +120,8 @@
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [{
extend: 'print',
text: 'Print',

View File

@ -30,37 +30,34 @@
<thead>
<tr>
<th hidden>id</th>
<th>From Subscription</th>
<th>To Subscription</th>
<th>Member Name</th>
<th>Mobile Number</th>
<th>Email</th>
<th>Scheme Code</th>
<th>From Subscription</th>
<th>To Subscription</th>
</tr>
</thead>
<tbody>
<?php foreach ($expired_customers as $row) { ?>
<tr>
<td style="text-align: center;"><?= date("d/m/Y", strtotime($row['from_subscription'])); ?></td>
<td style="text-align: center;"><?= date("d/m/Y", strtotime($row['to_subscription'])); ?></td>
<td hidden><?php echo $row["sub_id"]; ?></td>
<td style="text-align: left;"><?= $row['first_name'] . ' ' . $row['last_name'] ?></td>
<td><?= $row['mobile_no'] ?></td>
<td style="text-align: left;"><?= $row['email'] ?></td>
<td><?= $row['short_code'] ?></td>
<td style="text-align: center;"><?= date("d/m/Y", strtotime($row['from_subscription'])); ?></td>
<td style="text-align: center;"><?= date("d/m/Y", strtotime($row['to_subscription'])); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<!-- end row -->
<script>
$(document).ready(function() {
@ -68,8 +65,9 @@
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
buttons: [{
"dom": '<"row"<"col-md-6"B><"col-md-6"f>>rtip',
buttons: [
{
extend: 'print',
title: 'Expired Invoice Report',
text: 'Print',
@ -87,21 +85,18 @@
}
}
],
columnDefs: [{
columnDefs: [
{
type: 'date',
targets: [1, 2, 3, 4, 5, 6],
orderable: false
}
// Specify the column index for date sorting and disable sorting
]
});
// Add date range filter and dropdowns
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function(i) {
var title = $(this).text();
// For non-"Invoice Date" columns, add a dropdown
var uniqueValues = table.column(i).data().unique().sort();
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
.appendTo($(this).empty())
@ -116,7 +111,6 @@
select.append('<option value="' + d + '">' + d + '</option>');
});
$('input', this).on('keyup change', function() {
if (table.column(i).search() !== this.value) {
table
@ -127,12 +121,9 @@
});
});
// Add date range filter for "Invoice Date" column
moment.updateLocale('en', {
longDateFormat: {
L: 'DD/MM/YYYY',
// LTS: 'h:mm:ss A',
// LTS: 'h:mm A',
}
});
@ -171,10 +162,9 @@
dateRangeFilter.trigger('apply.daterangepicker');
});
// Trigger "Today" button click to set it as default if $select_data is empty
if ($select_data === '') {
$('.today-btn').trigger('click');
}
});
});
</script>
</script>

View File

@ -34,9 +34,12 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="col-md-12 d-flex justify-content-end">
<button type="button" class="btn btn-primary show-column-selection-modal" style="margin-left: auto;">Select Columns</button>
</div>
<div class="row mb-3">
<div class="col-md-12 d-flex justify-content-end">
<button type="button" class="btn btn-primary show-column-selection-modal">Select Columns</button>
</div>
</div>
<div class="table-responsive">
<table id="datatable-buttons" class="table table-striped nowrap w-100">
<thead>
@ -155,7 +158,7 @@
"order": [
[0, 'desc']
],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [{
extend: 'print',
text: 'Print',

View File

@ -93,7 +93,7 @@
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [
{
extend: 'print',

View File

@ -66,7 +66,7 @@
$(document).ready(function () {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": 'Bfrtip',
"dom": '<"row mb-3"<"col-md-6 d-flex align-items-center"B><"col-md-6 d-flex justify-content-end"f>>rtip',
buttons: [
{
extend: 'print',

View File

@ -32,6 +32,7 @@
<thead class="thead-light">
<tr>
<th hidden></th>
<th>Invoice Date</th>
<th>Member Name</th>
<th>Member's Mobile</th>
<th>From Subscription</th>
@ -39,7 +40,6 @@
<th>Short-Code</th>
<th>Expiring Status</th>
<th>Invoice Number</th>
<th>Invoice Date</th>
<th>Total () </th>
<th>Status</th>
<th align="center" id="action-column">Action</th>
@ -86,11 +86,12 @@
$message = "Expires in $daysRemaining days";
} else {
$class = 'text-success';
$message = "$daysRemaining days until expiration";
$message = "Expired in $daysRemaining days";
}
?>
<tr>
<td hidden><?= $row['invoice_date'] ?></td>
<td data-order="<?= strtotime($row['invoice_date']); ?>"><?= $invoice_date; ?></td>
<td data-order="<?= $row['customer_name']; ?>"><?= $row['customer_name']; ?></td>
<td data-order="<?= $row['mobile_no']; ?>"><?= $row['mobile_no']; ?></td>
<td data-order="<?= strtotime($row['from_subscription']); ?>"><?= $from_date; ?></td>
@ -98,8 +99,7 @@
<td data-order="<?= $row['scheme_code']; ?>"><?= $row['scheme_code']; ?></td>
<td data-order="<?= $message; ?>"><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
<td data-order="<?= $row['invoice_number']; ?>"><?= $row['invoice_number']; ?></td>
<td data-order="<?= strtotime($row['invoice_date']); ?>"><?= $invoice_date; ?></td>
<td data-order="<?= $row['total_amount']; ?>"><?=$row['total_amount']; ?></td>
<td style="text-align: end;" data-order="<?= $row['total_amount']; ?>"><?=$row['total_amount']; ?></td>
<td data-order="<?= $row['status']; ?>"><?= $row['status']; ?></td>
<td>
<a href="<?= base_url() . "new_subscription_invoice/" . $row['invoice_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>&nbsp;