Remove pagination from admin docket entries - show all on one page
This commit is contained in:
parent
1f3bf22553
commit
b48b51ab6e
2 changed files with 4 additions and 43 deletions
|
|
@ -20,24 +20,18 @@ class DocketEntryController extends Controller
|
|||
*/
|
||||
public function index(): Response
|
||||
{
|
||||
$paginated = DocketEntry::with('documents')
|
||||
$entries = DocketEntry::with('documents')
|
||||
->orderBy('date', 'desc')
|
||||
->paginate(20);
|
||||
->get();
|
||||
|
||||
return Inertia::render('Admin/DocketEntries/Index', [
|
||||
'entries' => $paginated->map(fn ($entry) => [
|
||||
'entries' => $entries->map(fn ($entry) => [
|
||||
'id' => $entry->id,
|
||||
'date' => $entry->date->format('m/d/Y'),
|
||||
'title' => $entry->title,
|
||||
'summary' => $entry->summary,
|
||||
'documents_count' => $entry->documents->count(),
|
||||
])->toArray(),
|
||||
'pagination' => [
|
||||
'current_page' => $paginated->currentPage(),
|
||||
'last_page' => $paginated->lastPage(),
|
||||
'per_page' => $paginated->perPage(),
|
||||
'total' => $paginated->total(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,8 @@ interface DocketEntry {
|
|||
documents_count: number;
|
||||
}
|
||||
|
||||
interface Pagination {
|
||||
current_page: number;
|
||||
last_page: number;
|
||||
per_page: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entries: DocketEntry[];
|
||||
pagination: Pagination;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
|
@ -44,7 +36,7 @@ const deleteEntry = (id: number, title: string) => {
|
|||
Manage Docket Entries
|
||||
</h1>
|
||||
<p class="text-sm text-gray-600 mt-1">
|
||||
{{ props.pagination.total }} total entries
|
||||
{{ props.entries.length }} total entries
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex gap-4">
|
||||
|
|
@ -143,31 +135,6 @@ const deleteEntry = (id: number, title: string) => {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<div v-if="props.pagination.last_page > 1" class="px-6 py-4 border-t border-gray-200">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-sm text-gray-700">
|
||||
Showing page {{ props.pagination.current_page }} of {{ props.pagination.last_page }}
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<Link
|
||||
v-if="props.pagination.current_page > 1"
|
||||
:href="route('admin.docket-entries.index', { page: props.pagination.current_page - 1 })"
|
||||
class="px-3 py-1 text-sm bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
Previous
|
||||
</Link>
|
||||
<Link
|
||||
v-if="props.pagination.current_page < props.pagination.last_page"
|
||||
:href="route('admin.docket-entries.index', { page: props.pagination.current_page + 1 })"
|
||||
class="px-3 py-1 text-sm bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
Next
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue