diff --git a/app/Views/history/history.php b/app/Views/history/history.php index 52750e59be9d945eb7ba244a3ee286066cb339da..77552fd3202c47dcfc215e077c9d1630d127a72c 100644 --- a/app/Views/history/history.php +++ b/app/Views/history/history.php @@ -22,7 +22,12 @@ $minStock = isset($_GET['min_stock']) ? $_GET['min_stock'] : null; // 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> @@ -39,6 +44,7 @@ <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/dropdown.css"> + <link rel="stylesheet" type="text/css" href="/../../styles/pagination.css"> </head> <body> @@ -52,6 +58,20 @@ include '../template/history.php'; endforeach;?> </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> <?php include '../template/footer.php';?>