Show record details in listing filter footer Showing X of X of X Records

This commit is contained in:
johnnyq
2025-02-08 18:45:19 -05:00
parent d92b803526
commit 72ae7843f6
2 changed files with 843 additions and 5 deletions

View File

@@ -18,9 +18,9 @@ if ($total_found_rows > 5) {
<hr>
<div class="row">
<div class="col-sm mb-3">
<div class="col-sm mb-2">
<form action="post.php" method="post">
<select onchange="this.form.submit()" class="form-control select2 col-sm-2" name="change_records_per_page">
<select onchange="this.form.submit()" class="form-control select2 col-12 col-sm-3" name="change_records_per_page">
<option <?php if ($user_config_records_per_page == 5) { echo "selected"; } ?> >5</option>
<option <?php if ($user_config_records_per_page == 10) { echo "selected"; } ?> >10</option>
<option <?php if ($user_config_records_per_page == 20) { echo "selected"; } ?> >20</option>
@@ -29,10 +29,35 @@ if ($total_found_rows > 5) {
</select>
</form>
</div>
<div class="col-sm mb-3">
<p class="text-center mt-2"><?php echo $total_found_rows; ?></p>
<?php
// Number of records per page
$per_page = $user_config_records_per_page;
// Current page (make sure $page is set; default to 1)
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Calculate start and end item indexes
$start = ($page - 1) * $per_page + 1;
$end = $page * $per_page;
// Prevent $end from exceeding total found rows
if ($end > $total_found_rows) {
$end = $total_found_rows;
}
// Now output something like "Showing X to Y of Z records"
?>
<div class="col-sm mb-2">
<p class="text-center">
Showing <strong><?php echo $start; ?></strong> to <strong><?php echo $end; ?></strong> of <strong><?php echo $total_found_rows; ?></strong> records
</p>
<!--<p class="text-center mt-2"><?php echo $total_found_rows; ?></p> -->
</div>
<div class="col-sm mb-3">
<div class="col-sm mb-2">
<ul class="pagination justify-content-sm-end">