init
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<style>
|
||||
.dark-header thead th {
|
||||
background-color: #343a40; /* Dark gray background */
|
||||
color: white; /* White text color */
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="text-left">Users <a class="btn btn-primary" href="/admin/users/add">Add</a></h2>
|
||||
<!-- Table Responsive Wrapper -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover dark-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Email</th>
|
||||
<th>Company</th>
|
||||
<th>Role</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($data['data'] as $key => $value) {
|
||||
echo ' <tr>';
|
||||
echo ' <td>' . $value->id . ' <br/><a class=" text-info" href="/admin/users/edit/' . $value->id . '">edit</a> <a class="text-danger" href="/admin/users/delete/' . $value->id . '">delete</a></td>';
|
||||
echo ' <td>' . $value->email . ' </td>';
|
||||
echo ' <td>' . $value->company . ' </td>';
|
||||
echo ' <td>' . $value->role . ' </td>';
|
||||
echo ' <td>' . $value->status . ' </td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Retrieve parameters
|
||||
$total = $data['total'];
|
||||
$currentPage = $data['page'];
|
||||
$perPage = 10;
|
||||
|
||||
// Calculate the number of pages
|
||||
$totalPages = ceil($total / $perPage);
|
||||
|
||||
// Define a range of pages to show at any given time
|
||||
$range = 2; // This can be adjusted as needed
|
||||
|
||||
$startPage = ($currentPage - $range) > 0 ? ($currentPage - $range) : 1;
|
||||
$endPage = ($currentPage + $range) < $totalPages ? ($currentPage + $range) : $totalPages;
|
||||
|
||||
?>
|
||||
<!-- Pagination -->
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
<li class="ml-2">
|
||||
<a href="?page=1" aria-label="Previous">
|
||||
<span aria-hidden="true">««</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="ml-2">
|
||||
<a href="?page=<?= ($currentPage - 1) > 0 ? $currentPage - 1 : 1 ?>" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
for ($i = $startPage; $i <= $endPage; $i++) {
|
||||
echo '<li class="ml-2' . ($currentPage == $i ? ' active' : '') . '"><a href="?page=' . $i . '">' . $i . '</a></li>';
|
||||
}
|
||||
?>
|
||||
<li class="ml-2">
|
||||
<a href="?page=<?= ($currentPage + 1) < $totalPages ? $currentPage + 1 : $totalPages ?>" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="ml-2">
|
||||
<a href="?page=<?= $totalPages ?>" aria-label="Next">
|
||||
<span aria-hidden="true">»»</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
Reference in New Issue
Block a user