Skip to content

Commit

Permalink
fixed page numbering when records are less than page size
Browse files Browse the repository at this point in the history
  • Loading branch information
mkocansey committed Dec 13, 2024
1 parent dba9972 commit 7402941
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions resources/views/components/pagination.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
$next_button_status_css = ($default_page == $total_pages) ? $inactive_css : $default_button_css;
$prev_button_status_css = ($default_page == 1) ? $inactive_css : $default_button_css;
$to = $page_size*$default_page;
$to = ($to > $total_records) ? $total_records : $to;
$from = $to - ($page_size-1);
$from = ($to == $total_records) ? 1 : $from;
$prev_page = $default_page-1;
$next_page = $default_page+1;
$prev_page = ($prev_page <= 0) ? 0 : $default_page-1;
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/rating.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
'name' => 'rating',
'name' => defaultBladewindName(),
'rating' => 0,
'size' => config('bladewind.rating.size', 'small'),
'color' => 'orange',
Expand All @@ -13,7 +13,7 @@
],
])
@php
$name = str_replace(' ', '-', $name);
$name = str_replace(' ', '-', $name);
$size_adjustment = ($size == 'big') ? 2 : 1;
$clickable = parseBladewindVariable($clickable);
@endphp
Expand Down
1 change: 0 additions & 1 deletion resources/views/components/table-icons.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
size="tiny"
icon="{{ $icon['icon'] }}"
color="{{ $icon['color'] ?? '' }}"
{{--title="{{$icon['tip']??''}}"--}}
onclick="{!! build_click($icon['click'], $row) ?? 'void(0)' !!}"
type="{!! isset($icon['color']) ? 'primary' : 'secondary' !!}"/>
@if(!empty($icon['tip'])) </a>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function pagination_row($row_number, $page_size=25, $default_page=1): string
<div class="@if($has_border && !$celled) border border-gray-200/70 dark:border-dark-700/60 @endif border-collapse max-w-full">
<div class="w-full">
@if($searchable)
<div class="bw-table-filter-bar">
<div class="bw-table-filter-bar @if($has_shadow) drop-shadow shadow shadow-gray-200/70 dark:shadow-md dark:shadow-dark-950/20 @endif">
<x-bladewind::input
name="bw-search-{{$name}}"
placeholder="{{$search_placeholder}}"
Expand Down

0 comments on commit 7402941

Please sign in to comment.