Enhance README and refactor code structure for improved functionality
🚀 Deploy website via FTP / 🎉 Deploy (push) Failing after 8s
🚀 Deploy website via FTP / 🎉 Deploy (push) Failing after 8s
- Updated README.md with detailed project description, features, and installation instructions. - Refactored functions.php to include configuration settings and improved database handling. - Modified index.php for better user experience and added pagination controls. - Introduced new utility functions for API handling and database interactions. - Added CSS styles for improved layout and visibility of elements. - Removed vault.csv as data is now managed through the database. - Implemented FTP deployment workflow for automated deployment. - Added exception handling classes for better error management. - Created JavaScript functions for pagination of transaction records.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
let currentPage = 1;
|
||||
|
||||
function paginate() {
|
||||
const table = document.getElementById('data');
|
||||
const rows = table.querySelectorAll('tbody tr');
|
||||
const totalPages = Math.ceil(rows.length / rowsPerPage);
|
||||
|
||||
// Hide all rows
|
||||
rows.forEach(row => row.style.display = 'none');
|
||||
|
||||
// Show only the rows for the current page
|
||||
let startRow = (currentPage - 1) * rowsPerPage;
|
||||
let endRow = Math.min(currentPage * rowsPerPage, rows.length);
|
||||
|
||||
for (let i = startRow; i < endRow; i++) {
|
||||
rows[i].style.display = '';
|
||||
}
|
||||
|
||||
// Update pagination info
|
||||
document.getElementById('page-info').textContent = `Page ${currentPage} of ${totalPages}`;
|
||||
|
||||
// Optionally hide the "Previous" button on the first page and the "Next" button on the last page
|
||||
document.querySelector('#pagination-controls > button:nth-child(1)').disabled = currentPage === 1;
|
||||
document.querySelector('#pagination-controls > button:nth-child(2)').disabled = currentPage === 1;
|
||||
document.querySelector('#pagination-controls > button:nth-child(4)').disabled = currentPage === totalPages;
|
||||
document.querySelector('#pagination-controls > button:nth-child(5)').disabled = currentPage === totalPages;
|
||||
|
||||
// Make the table visible after pagination is applied
|
||||
table.style.visibility = 'visible';
|
||||
}
|
||||
|
||||
function changePage(direction) {
|
||||
const totalPages = Math.ceil(document.querySelectorAll('#data tbody tr').length / rowsPerPage);
|
||||
|
||||
if (direction === -999) {
|
||||
currentPage = 1; // Go to first page
|
||||
} else if (direction === 999) {
|
||||
currentPage = totalPages; // Go to last page
|
||||
} else if ((direction === -1 && currentPage > 1) || (direction === 1 && currentPage < totalPages)) {
|
||||
currentPage += direction; // Move one step
|
||||
}
|
||||
|
||||
paginate();
|
||||
}
|
||||
Reference in New Issue
Block a user