Chọn giáo viên
Tổng số GV: {{ $totalTeachersCount }}
@forelse($teachers as $index => $teacher) @php $coursesStr = implode(', ', $teacher->courses ?? []); @endphp @empty @endforelse
STT Tên giáo viên Tài khoản Email Khóa học tham gia Hành động
{{ $index + 1 }} {{ $teacher->name }} {{ $teacher->username ?? 'N/A' }} {{ $teacher->email }}{{ $coursesStr ?: '-' }}
Không có giáo viên
@if($teachers->hasPages())
Hiển thị {{ $teachers->firstItem() ?? 0 }} đến {{ $teachers->lastItem() ?? 0 }} trong tổng số {{ $teachers->total() }} kết quả
@if($teachers->onFirstPage()) @else @endif @php $currentPage = $teachers->currentPage(); $lastPage = $teachers->lastPage(); $onEachSide = 2; // Số trang hiển thị mỗi bên của trang hiện tại // Tính toán phạm vi trang cần hiển thị $windowStart = max(1, $currentPage - $onEachSide); $windowEnd = min($lastPage, $currentPage + $onEachSide); @endphp {{-- Hiển thị trang đầu tiên nếu không nằm trong window --}} @if($windowStart > 1) 1 @if($windowStart > 2) ... @endif @endif {{-- Hiển thị các trang trong window --}} @for($page = $windowStart; $page <= $windowEnd; $page++) @if($page == $currentPage) {{ $page }} @else {{ $page }} @endif @endfor {{-- Hiển thị trang cuối cùng nếu không nằm trong window --}} @if($windowEnd < $lastPage) @if($windowEnd < $lastPage - 1) ... @endif {{ $lastPage }} @endif @if($teachers->hasMorePages()) @else @endif
@endif