NonInventPurchasingSystem/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/AllPR.cshtml
2026-02-19 17:23:28 +08:00

111 lines
3.5 KiB
Plaintext

<!-- AllPR.cshtml - Example View Component -->
<div class="tab-content-wrapper">
<table id="PRTable" class="row-border" cellspacing="0" width="100%">
<thead >
<tr>
<th style="width:7%">PRNo</th>
<th style="width:7%">New PRNo</th>
<th style="width:50%">ItemName's</th>
<th style="width:9%">Req. Date</th>
<th style="width:14%">Req. By</th>
<th style="width:8%">DateNeeded</th>
<th style="width:7%">ChargeTo</th>
<th style="width:7%">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script>
$(document).ready(function () {
loader = $('#overlay, #loader');
UserRights = document.getElementById("roleRights").value;
const reportTitle = `All Purchase Request - as of ${getFormattedDateTime()}`;
prTable = $('#PRTable').DataTable({
ajax: {
url: '/PRMgmt/GetAllPR',
type: 'GET',
beforeSend: function () {
loader.show();
},
complete: function () {
loader.hide();
},
error: function (xhr, error, thrown) {
loader.hide();
console.error('Error loading data:', error);
if (typeof toastr !== 'undefined') {
toastr.error('Failed to load data. Please try again.');
}
}
},
dom: 'lBfrtip',
buttons: [
{
extend: 'csv',
title: reportTitle
},
{
extend: 'excel',
title: reportTitle
},
{
extend: 'pdf',
title: reportTitle
}
],
initComplete: function () {
initializeColumnSearch({
tableId: '#PRTable',
dataTable: prTable,
searchableColumns: [
{
columnIndex: 0,
columnName: 'PR No',
placeholder: 'Enter PR Number...',
searchType: 'text',
searchMode: 'exact',
width: '150px'
},
{
columnIndex: 2,
columnName: 'Item Name',
placeholder: 'Enter Item Name...',
searchType: 'text',
searchMode: 'contains',
width: '200px'
},
{
columnIndex: 6,
columnName: 'Department',
placeholder: 'Select Department...',
searchType: 'select',
searchMode: 'exact',
width: '150px'
}
]
});
const uniqueSearchClass = 'column-search-input-PRTable';
populateSelectOptions(prTable, 6, '.' + uniqueSearchClass + '[data-column="6"]');
restoreSearchFromURL(uniqueSearchClass, '#PRTable');
},
columns: colOnPRTable,
order: [[3, 'asc']],
rowCallback: rowStatusColorCallback,
responsive: true,
language: {
emptyTable: "No record available",
loadingRecords: "Loading data...",
processing: "Processing..."
},
error: errorHandler
});
});
</script>