fix: [archived-records] 페이지네이션 오류 수정

- GROUP BY + paginate() 조합 시 total count 오류 해결 (서브쿼리 방식)
- DB::table() 사용 시 page 파라미터 명시적 전달
- 커스텀 페이지네이션을 공용 컴포넌트(partials.pagination)로 교체

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-30 23:11:38 +09:00
parent 049fa7ed61
commit bbf34e9f3f
2 changed files with 28 additions and 63 deletions

View File

@@ -74,57 +74,9 @@ class="text-blue-600 hover:text-blue-900 transition"
</table>
</div>
{{-- 페이지네이션 --}}
@if($records->hasPages())
<div class="px-6 py-4 border-t border-gray-200">
<div class="flex items-center justify-between">
<div class="text-sm text-gray-700">
<span class="font-medium">{{ $records->total() }}</span> 작업
<span class="font-medium">{{ $records->firstItem() }}</span> -
<span class="font-medium">{{ $records->lastItem() }}</span> 표시
</div>
<div class="flex gap-2">
{{-- 이전 페이지 --}}
@if($records->onFirstPage())
<span class="px-3 py-1 text-sm text-gray-400 bg-gray-100 rounded cursor-not-allowed">이전</span>
@else
<button type="button"
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
hx-get="/api/admin/archived-records?page={{ $records->currentPage() - 1 }}"
hx-target="#archived-record-table"
hx-include="#filterForm">
이전
</button>
@endif
{{-- 페이지 번호 --}}
@foreach(range(max(1, $records->currentPage() - 2), min($records->lastPage(), $records->currentPage() + 2)) as $page)
@if($page == $records->currentPage())
<span class="px-3 py-1 text-sm text-white bg-blue-600 rounded">{{ $page }}</span>
@else
<button type="button"
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
hx-get="/api/admin/archived-records?page={{ $page }}"
hx-target="#archived-record-table"
hx-include="#filterForm">
{{ $page }}
</button>
@endif
@endforeach
{{-- 다음 페이지 --}}
@if($records->hasMorePages())
<button type="button"
class="px-3 py-1 text-sm text-gray-700 bg-white border border-gray-300 rounded hover:bg-gray-50"
hx-get="/api/admin/archived-records?page={{ $records->currentPage() + 1 }}"
hx-target="#archived-record-table"
hx-include="#filterForm">
다음
</button>
@else
<span class="px-3 py-1 text-sm text-gray-400 bg-gray-100 rounded cursor-not-allowed">다음</span>
@endif
</div>
</div>
</div>
@endif
{{-- 페이지네이션 (공용 컴포넌트) --}}
@include('partials.pagination', [
'paginator' => $records,
'target' => '#archived-record-table',
'includeForm' => '#filterForm'
])