Skip to content
Snippets Groups Projects
Commit 64f99d02 authored by Bitha17's avatar Bitha17
Browse files

add history pagination and edit display history by user id

parent fea20cbc
Branches
Tags
No related merge requests found
...@@ -22,7 +22,12 @@ ...@@ -22,7 +22,12 @@
$minStock = isset($_GET['min_stock']) ? $_GET['min_stock'] : null; $minStock = isset($_GET['min_stock']) ? $_GET['min_stock'] : null;
// Get search results or all pembelian (history) // Get search results or all pembelian (history)
$pembelians = $pembelianController->getAllPembelian(); $pembelians = $pembelianController->getPembelianByUserId($_SESSION['user_id']);
$paginationData = $pembelianController->paginateHistory($pembelians);
$pembelians = $paginationData['pembelian'];
$totalEvents = $paginationData['total'];
$currentPage = $paginationData['page'];
$maxPage = $paginationData['maxpage'];
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
...@@ -39,6 +44,7 @@ ...@@ -39,6 +44,7 @@
<link rel="stylesheet" type="text/css" href="/../../styles/container.css"> <link rel="stylesheet" type="text/css" href="/../../styles/container.css">
<link rel="stylesheet" type="text/css" href="/../../styles/auth.css"> <link rel="stylesheet" type="text/css" href="/../../styles/auth.css">
<link rel="stylesheet" type="text/css" href="/../../styles/dropdown.css"> <link rel="stylesheet" type="text/css" href="/../../styles/dropdown.css">
<link rel="stylesheet" type="text/css" href="/../../styles/pagination.css">
</head> </head>
<body> <body>
...@@ -52,6 +58,20 @@ ...@@ -52,6 +58,20 @@
include '../template/history.php'; include '../template/history.php';
endforeach;?> endforeach;?>
</div> </div>
<div class="pagination">
<?php if ($currentPage > 1) : ?>
<a href="?page=<?= $currentPage - 1 ?>">Previous</a>
<?php endif; ?>
<?php for ($i = 1; $i <= $maxPage; $i++) : ?>
<a href="?page=<?= $i ?>" <?= ($i == $currentPage) ? 'class="active"' : '' ?>><?= $i ?></a>
<?php endfor; ?>
<?php if ($currentPage < $maxPage) : ?>
<a href="?page=<?= $currentPage + 1 ?>">Next</a>
<?php endif; ?>
</div>
</div> </div>
<?php include '../template/footer.php';?> <?php include '../template/footer.php';?>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment