@extends('dashboard.layouts.app') @section('title', 'Data Sekolah') @section('content')
Data Sekolah
@csrf
@csrf
@csrf
Tambah Data
@if(session('success')) @endif @if(session('error')) @endif @if(session('import_errors')) @endif
@forelse($sekolahs as $sekolah) @empty @endforelse
No NPSN Nama Sekolah Jenjang Status Kecamatan Desa Treatment Aksi
{{ ($sekolahs->currentPage() - 1) * $sekolahs->perPage() + $loop->iteration }} {{ $sekolah->npsn }} {{ $sekolah->nama_sekolah }} {{ ucfirst($sekolah->jenjang) }} {{ ucfirst($sekolah->status) }} {{ $sekolah->kecamatan?->nama_kecamatan ?? '-' }} {{ $sekolah->desa?->nama_desa ?? '-' }} @php $treatments = []; if (strtolower($sekolah->rusak_ringan ?? '') === 'ya') { $treatments[] = ['label' => 'Rusak Ringan', 'color' => 'warning', 'custom' => false]; } if (strtolower($sekolah->rusak_sedang ?? '') === 'ya') { $treatments[] = ['label' => 'Rusak Sedang', 'color' => 'warning', 'custom' => true, 'bg' => '#ff9800']; } if (strtolower($sekolah->rusak_berat ?? '') === 'ya') { $treatments[] = ['label' => 'Rusak Berat', 'color' => 'danger', 'custom' => false]; } if (strtolower($sekolah->kelas_baru ?? '') === 'ya') { $treatments[] = ['label' => 'Kelas Baru', 'color' => 'success', 'custom' => false]; } if (strtolower($sekolah->air_garam ?? '') === 'ya') { $treatments[] = ['label' => 'Air Garam', 'color' => 'info', 'custom' => false]; } @endphp @if(count($treatments) > 0)
@foreach($treatments as $treatment) @if(isset($treatment['custom']) && $treatment['custom']) {{ $treatment['label'] }} @else {{ $treatment['label'] }} @endif @endforeach
@else - @endif
@csrf @method('DELETE')
Tidak ada data
@if($sekolahs->hasPages())
@php $currentPage = $sekolahs->currentPage(); $lastPage = $sekolahs->lastPage(); // Selalu tampilkan halaman pertama $showFirst = true; $showLast = true; // Tentukan range halaman yang ditampilkan di tengah $range = 2; // 2 halaman sebelum dan sesudah halaman aktif $startPage = max(1, $currentPage - $range); $endPage = min($lastPage, $currentPage + $range); // Jika halaman pertama sudah termasuk dalam range, jangan tampilkan terpisah if ($startPage <= 1) { $showFirst = false; $startPage = 1; } // Jika halaman terakhir sudah termasuk dalam range, jangan tampilkan terpisah if ($endPage >= $lastPage) { $showLast = false; $endPage = $lastPage; } // Tampilkan halaman pertama if ($showFirst) { $isActive = 1 == $currentPage; $class = $isActive ? 'index active' : 'index'; echo '1'; // Tampilkan ellipsis jika ada gap if ($startPage > 2) { echo '...'; } } // Tampilkan halaman dalam range for ($i = $startPage; $i <= $endPage; $i++) { // Skip halaman pertama dan terakhir jika sudah ditampilkan terpisah if (($showFirst && $i == 1) || ($showLast && $i == $lastPage)) { continue; } $isActive = $i == $currentPage; $class = $isActive ? 'index active' : 'index'; echo '' . $i . ''; } // Tampilkan halaman terakhir if ($showLast) { // Tampilkan ellipsis jika ada gap if ($endPage < $lastPage - 1) { echo '...'; } $isActive = $lastPage == $currentPage; $class = $isActive ? 'index active' : 'index'; echo '' . $lastPage . ''; } @endphp
@endif
@endsection