ria/app/Views/AmendPOlist.php

266 lines
12 KiB
PHP
Executable File

<!-- In this purchase order listing , datatable is used for sorting , pagination and etc.. , new design is used for table fro the theme-->
<style>
.pagination {
margin: 0px !important;
}
.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;
}
th,
td {
white-space: nowrap;
}
.th-total-order-value{
text-align:"right" !important;
width:55%;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Purchase</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Purchase Order</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Amendment Purchase Order List</h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('amendmentpurchaseorderFilter'); ?>">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search"
value="<?= $fromDate?>"
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search"
value="<?= $toDate ?>"
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"
style="cursor:pointer;"
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body" style="overflow-x:scroll;">
<table id="amend_po_list" class="table table-bordered table-hover">
<thead>
<tr>
<!-- <th>#</th> -->
<th>Created Date</th>
<th>PONO</th>
<th>PO Type</th>
<th>Supplier Name</th>
<th class="th th-total-order-value">
Total Order Value</th>
<th>PO Status</th>
<th>Delivery Option</th>
<th>Delivery Date</th>
<th>Delivery Schedule</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($POData)) {
$index = 0;
foreach ($POData as $record) {
$index = $index + 1;
?>
<tr id="<?php echo $index; ?>">
<!-- <td align="left"><?php echo $index; ?></td> -->
<td><?php $Pdt = new DateTime($record->CreatedDate);
$PODate = $Pdt->format('d-m-Y');
echo $PODate
?></td>
<td><?php echo $record->PONO ?></td>
<td><?php echo $record->ReqType ?></td>
<td><?php echo $record->SupplierName ?></td>
<td align="right"><?php echo $record->TotalOrderValue ?></td>
<!-- <td><?php echo $record->StatusName ?></td> -->
<td><?php
$statusMappings = [
'PO APPROVED' => 'AWAITING APPROVE',
'AWAITING RELEASE' => 'AWAITING APPROVE',
'RELEASER ONHOLD' => 'APPROVER ONHOLD',
'PO RELEASED' => 'PO APPROVED',
];
if (isset($record->StatusName) && !empty($record->StatusName)) {
if (isset($statusMappings[$record->StatusName])) {
echo $statusMappings[$record->StatusName];
} else {
echo $record->StatusName;
}
} else {
echo "Status not provided";
}
?>
</td>
<td align="center"><?php $option = 'By Deliver Date';
if ($record->DeliveryOption == 1) {
$option = "By Schedule";
} else if ($record->DeliveryOption == 2) {
$option = "By Dispatch Instruction";
}
echo $option ?></td>
<td><?php
if ($record->DeliveryOption == 0) {
$Ddt = new DateTime($record->DeliveryDate);
$Deliverydt = $Ddt->format('d-m-Y');
echo $Deliverydt;
} else if ($record->DeliveryOption == 1) {
$Deliverydt = '';
echo $Deliverydt;
} ?></td>
<td align="center"> <?php echo $record->DeliverySchedule ?></td>
<td> <a data-toggle="tooltip" href="<?php echo base_url() . 'EditAmendPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType . '&CapitalRange=' . $record->CapitalRange; ?>"><i class="fas fa-pencil-alt" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit Purchase Order details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="tooltip" href="<?php echo base_url() . 'EditAmendPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType . '&CapitalRange=' . $record->CapitalRange; ?>"> &nbsp;&nbsp;&nbsp; <a data-toggle="tooltip" href="<?php echo base_url() . 'purchaseorder/CreatePOPrint?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType; ?>"><i class="fa fa-print" data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Print the Purchase Order details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
<?php
} ?>
</tr>
<?php
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<script>
$(document).ready(function() {
$(document).on('click', '.text-truncate', function() {
$(this).toggleClass('expanded');
});
// Initialize the DataTable
var table = $('#amend_po_list').DataTable({
dom: 'Blfrtip',
buttons: [
'excel', 'pdf'
],
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
order:false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
window.location="amendmentpurchaseorder"
});
});
</script>
<script>
$(document).ready(function() {
$('#fromDate , #toDate').change(function() {
let fromDate = $('#fromDate').val();
let toDate = $('#toDate').val();
let fromDateObj = new Date(fromDate.split('-').reverse().join('-'));
let toDateObj = new Date(toDate.split('-').reverse().join('-'));
if (fromDateObj > toDateObj) {
alert('Incorrect Date Applied For Filter..!!');
$('#toDate').attr('min', fromDate);
$('#toDate').val('');
}
});
});
</script>