CHANGE_MASTER_LIST_CONVERT_TO_NEW_THEME

This commit is contained in:
aadhavan valli 2024-08-22 17:11:26 +05:30
parent 73de4cf9ad
commit 9453085878
8 changed files with 1005 additions and 918 deletions

View File

@ -35,43 +35,49 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<section class="content"> <div class="content-page">
<div class="box"> <div class="content">
<div class="box-header"> <!-- Start Content-->
<CENTER>
<h3 class="box-title"> Asset Details</h3>
</CENTER>
</div>
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-6">
<form class="Date-filter-form" id="DateRangeFilter"> <div class="page-title-box page-title-box-alt">
<input type="hidden" name="table" value="requisition"> <h4 class="page-title">Asset Details</h4>
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div> </div>
<div class="col-xs-12 col-md-6 text-right"> </div>
<div class="form-group"> <div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addasset">Add New Asset</a> <a class="btn btn-success" href="<?php echo base_url(); ?>addasset">Add New Asset</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportasset">Export Asset Details <i class="fa fa-download" aira-hidden="true"></i></a> <a class="btn btn-success" href="<?php echo base_url(); ?>exportasset">Export Asset Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div> </div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;"> <div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="view_inward_gate_register" class="table dt-responsive nowrap w-100">
<thead>
</thead>
<tbody>
</tbody>
</table>
<table class="table table-bordered table-hover" id="asset_list_table" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;"> <thead style="background-color: #ddd;">
<tr> <tr>
<th>Created Date</th> <th>Created Date</th>
@ -122,13 +128,15 @@
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div> </div>
</div> </div>
</div> </div> <!-- container -->
</div> </div> <!-- content -->
</section>
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script> <script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<!-- <script type="text/javascript"> <!-- <script type="text/javascript">
@ -150,83 +158,81 @@
</script> --> </script> -->
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> --> <!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#asset_list_table').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
}); });
});
</script> </script>

View File

@ -35,38 +35,25 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header"> <div class="content-page">
<CENTER> <div class="content">
<h3 class="box-title"> Configuration Details</h3> <!-- Start Content-->
</CENTER>
</div>
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-6">
<form class="Date-filter-form" id="DateRangeFilter"> <div class="page-title-box page-title-box-alt">
<input type="hidden" name="table" value="requisition"> <h4 class="page-title">Configuration Details</h4>
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div> </div>
<div class="col-xs-12 col-md-6 text-right"> </div>
<div class="form-group"> <div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a> <a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
</div> </div>
</div> </div>
</div>
</div>
<div class="col-md-12">
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
@ -88,15 +75,23 @@
<?php } ?> <?php } ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); <div class="card">
?> </div> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
</div> <input type="hidden" name="table" value="requisition">
</div> <label for="fromDate">From:</label>
<div class="row"> <input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<div class="col-xs-12">
<table id="configtable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;"> <label for="toDate">To:</label>
<thead style="background-color: #ddd;"> <input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="config_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr> <tr>
<th>Create Date</th> <th>Create Date</th>
<th>Configuration ID</th> <th>Configuration ID</th>
@ -139,10 +134,15 @@
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div> </div>
</div> </div>
</div> </div> <!-- container -->
</div> <!-- content -->
</div> </div>
</section> </section>
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
@ -171,77 +171,78 @@
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
// Initialize the DataTable // Initialize the DataTable
var table = $('#configtable').DataTable({ var table = $('#config_list_table').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
}); });
});
</script> </script>

View File

@ -29,91 +29,8 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Cost Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter" >
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-xs-12 col-md-6 text-right">
<div class="form-group">
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success">Add New Cost List</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportcost">Export Cost Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Create Date</th>
<th>Create Time</th>
<th>Cost Center Code</th>
<th>Cost Center Name</th>
<th>Created By</th>
<th>Active</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
$createdat = new DateTime($record->CreatedDate);
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr>
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td>
<td><?php echo $record->code ?></td>
<td><?php echo $record->CostCenterName ?></td>
<!-- <td><?php echo $record->ApprovedBy ?></td> -->
<td><?php echo $record->FirstName ?></td>
<td><?php
$R = '';
$record->IsActive == 1 ? $R = 'ACTIVE' : $R = 'INACTIVE';
echo $R;
?></td>
<td>
<?php
if ($record->DeletedBy == '') {
?>
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->CostCenterName; ?>" ><i class="fa fa-pencil"></i></a>
<a href="<?php echo base_url() . 'deleteCostCenter?CostCode=' . $record->code; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<!-- for Add and edit Modal -->
<div class="modal fade" id="ccwizard" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="ccwizard" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
@ -153,13 +70,96 @@
</div> </div>
</div> </div>
</div> </div>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
</section> <div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Cost Details</h4>
</div> </div>
</div>
<div class="col-6 text-right">
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success">Add New Cost List</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportcost">Export Cost Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="cost_listing" class="table dt-responsive nowrap w-100">
<thead style="background-color: #ddd;">
<tr>
<th>Create Date</th>
<th>Create Time</th>
<th>Cost Center Code</th>
<th>Cost Center Name</th>
<th>Created By</th>
<th>Active</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
$createdat = new DateTime($record->CreatedDate);
$date = $createdat->format('d-m-Y');
$time = $createdat->format('h:i A');
?>
<tr>
<td><?php echo $date; ?></td>
<td><?php echo $time; ?></td>
<td><?php echo $record->code ?></td>
<td><?php echo $record->CostCenterName ?></td>
<!-- <td><?php echo $record->ApprovedBy ?></td> -->
<td><?php echo $record->FirstName ?></td>
<td><?php
$R = '';
$record->IsActive == 1 ? $R = 'ACTIVE' : $R = 'INACTIVE';
echo $R;
?></td>
<td>
<?php
if ($record->DeletedBy == '') {
?>
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>" data-name="<?php echo $record->CostCenterName; ?>" ><i class="fas fa-pencil-alt"></i></a>
<a href="<?php echo base_url() . 'deleteCostCenter?CostCode=' . $record->code; ?>"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script> <script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -233,79 +233,79 @@ $(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) { $.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#cost_listing').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
}); });
}); });
</script> </script>
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->

View File

@ -41,12 +41,25 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- <section class="content-header"> --> <div class="content-page">
<section class="content"> <div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Department Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportdepartment">Export department details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
@ -68,48 +81,23 @@
<?php } ?> <?php } ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); <div class="card">
?> </div> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<center>
<h3 class="box-title">Department Details</h3>
</center>
</div>
<div class="container-fluid">
<!-- </section> -->
<!-- <section class="content"> -->
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div> <div class="error" id="error"></div>
</form> </form>
</div> <div class="card-body">
<div class="col-xs-12 col-md-6 text-right"> <table id="department_list_table" class="table dt-responsive nowrap w-100">
<div class="form-group"> <thead>
<a class="btn btn-success" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportdepartment">Export department details <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr> <tr>
<th>Create Date</th> <th>Create Date</th>
<th>Department Code</th> <th>Department Code</th>
@ -149,108 +137,96 @@
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
</div><!-- colsxs12 div closed-->
</div><!-- row div closed -->
</div><!-- containerfluid div closed -->
</div><!-- box div closed -->
</section>
</div><!-- content wrapper div closed -->
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<!-- <script type="text/javascript">
$(function () {
$('#datatable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script> -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) { $.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#department_list_table').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
}); });
});
</script> </script>

View File

@ -35,9 +35,26 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Material Master Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
@ -51,48 +68,25 @@
echo show_alert($type, $success); echo show_alert($type, $success);
} }
?> ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); <div class="card">
?> </div> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
</div>
</div>
</div>
<section class="content">
<div class="box">
<div class="box-header">
<CENTER>
<h3 class="box-title"> Material Master Details</h3>
</CENTER>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div> <div class="error" id="error"></div>
</form> </form>
</div> <div class="card-body">
<div class="col-xs-12 col-md-6 text-right"> <table id="raw_material_list_table" class="table dt-responsive nowrap w-100">
<div class="form-group"> <thead>
<a class="btn btn-success" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportmaterial">Export Material Master <i class="fa fa-download" aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr> <tr>
<th>Created Date</th> <th>Created Date</th>
<th>Material Code</th> <th>Material Code</th>
@ -133,14 +127,18 @@
} }
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div> </div>
</div> </div>
</div> </div> <!-- container -->
</div> </div> <!-- content -->
</section>
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<!-- <script type="text/javascript"> <!-- <script type="text/javascript">
@ -166,76 +164,76 @@
}; };
$(document).ready(function() { $(document).ready(function() {
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#raw_material_list_table').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
}); });
});
</script> </script>

View File

@ -35,11 +35,10 @@
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-wrapper">
<section class="content">
<div class="row"> <div class="content-page">
<div class="col-md-12"> <div class="content">
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
@ -54,47 +53,41 @@
} }
?> ?>
<div class="row"> <!-- Start Content-->
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<center><b>
<h3 class="box-title">Supplier Listing</h3>
</b></center>
</div>
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-6"> <div class="col-6">
<form class="Date-filter-form" id="DateRangeFilter"> <div class="page-title-box page-title-box-alt">
<input type="hidden" name="table" value="requisition"> <h4 class="page-title">Supplier Listing</h4>
<label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div> </div>
<div class="col-xs-12 col-md-6 text-right"> </div>
<div class="col-6 text-right">
<div class="form-group"> <div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>addsupplier">Add New Supplier</a> <a class="btn btn-success" href="<?php echo base_url(); ?>addsupplier">Add New Supplier</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportsupplier">Export Supplier Details <i class="fa fa-download" aira-hidden="true"></i></a> <a class="btn btn-success" href="<?php echo base_url(); ?>exportsupplier">Export Supplier Details <i class="fa fa-download" aira-hidden="true"></i></a>
</div> </div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-12">
<table class="table table-bordered table-hover" id="datatable" style="background-color:#fff;font-size:11px !important;"> <div class="card">
<thead style="background-color: #ddd;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table class="table dt-responsive nowrap w-100" id="datatable" >
<thead >
<tr> <tr>
<th style="width:75px">Created Date</th> <th style="width:75px">Created Date</th>
<th>Supplier ID</th> <th>Supplier ID</th>
@ -131,7 +124,7 @@
<td><?php if ($record->IsActive == 0) { <td><?php if ($record->IsActive == 0) {
echo "Deactived"; echo "Deactived";
} else { ?> } else { ?>
<a onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i class="fa fa-trash" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
@ -141,13 +134,15 @@
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
// $(function () { // $(function () {
@ -189,77 +184,78 @@
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#datatable').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
}); });
}); });
</script> </script>

View File

@ -37,26 +37,85 @@
color: rgb(173, 3, 23); color: rgb(173, 3, 23);
} }
</style> </style>
<style>
.modal
{
padding-right:25% ! important;
}
.num{
text-align:right;
}
.modal-content
{
width: 800px ! important;
}
th {
white-space: nowrap;
}
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px; /* Adjust the gap as needed */
}
.Date-filter-form input, .Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
<div class="content-page"> <div class="content-page">
<div class="content"> <div class="content">
<!-- Start Content--> <!-- Start Content-->
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-6">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4><?= "Transporter Details"; ?></h4> <h4 class="page-title">Transporter Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a data-toggle="modal" href="#transporterwizard" data-id="0" data-name="" class="btn btn-success">Add New Transporter</a> </div> <a data-toggle="modal" href="#transporterwizard" data-id="0" data-name="" class="btn btn-success">Add New Transporter</a> </div>
</div> </div>
</div> </div>
</div>
<!-- end page title -->
<!-- Form row -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body"> <div class="card-body">
<table id="datatable-buttons" class="table dt-responsive nowrap w-100"> <table id="transporter_list" class="table dt-responsive nowrap w-100">
<thead> <thead>
<tr> <tr>
<th>Create Date</th> <th>Create Date</th>
@ -77,8 +136,8 @@
$time = $createdat->format('h:i A'); $time = $createdat->format('h:i A');
?> ?>
<tr> <tr>
<td align="right"><?php echo $date; ?></td> <td><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td> <td><?php echo $time; ?></td>
<td><?php echo $record->id ?></td> <td><?php echo $record->id ?></td>
<td><?php echo $record->name ?></td> <td><?php echo $record->name ?></td>
<td><?php echo $record->FirstName ?></td> <td><?php echo $record->FirstName ?></td>
@ -106,9 +165,11 @@
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
</div> </div>
</div>
</div> <!-- container --> </div> <!-- container -->
</div> <!-- content --> </div> <!-- content -->
</div> </div>
<!-- for Add and edit Modal --> <!-- for Add and edit Modal -->
<div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog" <div id="transporterwizard" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;"> aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -191,9 +252,10 @@
}); });
}); });
}); });
</script>
<script> $(document).ready(function() {
$('#datatable-buttons').DataTable({ // Initialize the DataTable
var table = $('#transporter_list').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [ buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
@ -201,7 +263,7 @@
pageLength: 10, // Default rows per page pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: true, // Responsive table responsive: true, // Responsive table
order: [[0, 'desc']], // Default ordering (column index 0, ascending) order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -209,4 +271,60 @@
} }
} }
}); });
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
</script> </script>

View File

@ -36,11 +36,23 @@
} }
</style> </style>
<div class="content-wrapper">
<section class="content"> <div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">User Listing</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a>
</div>
</div>
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
@ -54,48 +66,25 @@
echo show_alert($type, $success); echo show_alert($type, $success);
} }
?> ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); <div class="card">
?> </div> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<center><b>
<h3 class="box-title">User Listing</h3>
</b></center>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6">
<form class="Date-filter-form" id="DateRangeFilter">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input type="text" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input type="text" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit">Search</button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fa fa-repeat" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div> <div class="error" id="error"></div>
</form> </form>
</div> <div class="card-body">
<div class="col-xs-12 col-md-6 text-right"> <table id="user_list_table" class="table dt-responsive nowrap w-100">
<div class="form-group"> <thead>
<a class="btn btn-success" href="<?php echo base_url(); ?>addNew">Add New User</a> <tr> <th>Created Date</th>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table class="table table-hover table-bordered" id="datatable" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th>Created Date</th>
<!-- <th>User Id</th> --> <!-- <th>User Id</th> -->
<th>User Name</th> <th>User Name</th>
<th>Email</th> <th>Email</th>
@ -126,7 +115,7 @@
<td><?php echo $record->DepartmentName ?></td> <td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td> <td><?php echo $record->role ?></td>
<td> <td>
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a> <a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fas fa-pencil-alt"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td> </td>
@ -135,15 +124,18 @@
} }
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div> </div>
</div> </div>
</div> </div> <!-- container -->
</div> </div> <!-- content -->
</section>
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
// $(function () { // $(function () {
@ -192,78 +184,78 @@
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
$(document).ready(function() { $(document).ready(function() {
// Initialize the DataTable // Initialize the DataTable
var table = $('#datatable').DataTable({ var table = $('#user_list_table').DataTable({
"paging": true, dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
"lengthChange": true, buttons: [
"searching": true, 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
"ordering": true,
"columnDefs": [{
"targets": 0,
"type": "date-eu"
}],
"aaSorting": [
[0, "desc"]
], ],
"info": true, pageLength: 10, // Default rows per page
"autoWidth": true, lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
"pageLength": 10, responsive: true, // Responsive table
"lengthMenu": [10, 25, 50, 100], order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
}); paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
// Initialize the datepickers previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
$("#fromDate").datepicker({ }
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
} }
}); });
$("#toDate").datepicker({ // Date range filter function
dateFormat: 'dd-mm-yy', $.fn.dataTable.ext.search.push(
onSelect: function(selectedDate) { function(settings, data, dataIndex) {
var maxDate = $(this).datepicker("getDate"); var fromDate = $('#fromDate').val();
$("#fromDate").datepicker("option", "maxDate", maxDate); var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
}); });
// Reset button functionality // Reset button functionality
$("#resetButton").click(function() { $("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null); $("#fromDate").val('');
$("#toDate").datepicker("setDate", null); $("#toDate").val('');
$("#toDate").datepicker("option", "minDate", null); table.draw(); // Redraw the table to clear the filter
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
}); });
// Date range filter // Automatically focus and open the To Date picker when From Date is selected
$.fn.dataTable.ext.search.push( document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
function(settings, data, dataIndex) { // Set the min attribute of the To Date input to the selected From Date
var fromDate = $("#fromDate").datepicker("getDate"); toDateInput.min = fromDate;
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column // Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
// Convert dateStr to Date object toDateInput.value = fromDate;
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
} }
return date >= fromDate && date <= toDate;
}
);
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
}); });
});
</script> </script>