Skip to main content
Sign in
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
No related branches found
No related tags found
No related merge requests found
......@@ -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';?>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment