MIF_E31222596/website/resources/views/nilai_santris/index.blade.php

165 lines
12 KiB
PHP

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Daftar nilai santri') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-2xl">
<div class="p-8">
<!-- Header Section -->
<div class="mb-8">
<h2 class="text-3xl font-bold text-gray-800 mb-2">Rekap Nilai Santri</h2>
<p class="text-gray-600">Kelola dan pantau nilai akademik santri dengan mudah</p>
</div>
<!-- Filter Form -->
<div class="bg-gray-50 rounded-xl p-6 mb-8">
<form method="GET" class="grid grid-cols-1 md:grid-cols-5 gap-4 items-end">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Kelas</label>
<select name="kelas_id" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required>
<option value="">Pilih Kelas</option>
@foreach($kelasList as $k)
<option value="{{ $k->id }}" {{ $kelasId==$k->id?'selected':'' }}>{{ $k->nama_kelas }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Mata Pelajaran</label>
<select name="mapel_id" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" required>
<option value="">Pilih Mapel</option>
@foreach($mapelList as $m)
<option value="{{ $m->id }}" {{ $mapelId==$m->id?'selected':'' }}>{{ $m->nama_mapel }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Tanggal</label>
<input type="date" name="tanggal" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors" value="{{ $tanggal }}">
</div>
<div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-6 rounded-lg transition-colors duration-200 flex items-center justify-center">
<i class="fas fa-search mr-2"></i>
Tampilkan
</button>
</div>
<!-- <div>
@if($kelasId && $mapelId)
<a href="{{ route('nilai_santris.create', ['kelas_id'=>$kelasId, 'mapel_id'=>$mapelId, 'tanggal'=>$tanggal]) }}" class="w-full bg-green-600 hover:bg-green-700 text-white font-medium py-3 px-6 rounded-lg transition-colors duration-200 flex items-center justify-center">
<i class="fas fa-plus mr-2"></i>
Input Nilai
</a>
@endif
</div> -->
</form>
</div>
<!-- Data Table -->
@if($santris->count())
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gradient-to-r from-green-600 to-yellow-400 text-white">
<tr>
<th class="px-6 py-4 text-left text-sm font-semibold">No</th>
<th class="px-6 py-4 text-left text-sm font-semibold">Nama Santri</th>
<th class="px-6 py-4 text-left text-sm font-semibold">Nilai</th>
<th class="px-6 py-4 text-left text-sm font-semibold">Keterangan</th>
<th class="px-6 py-4 text-left text-sm font-semibold">Semester</th>
<th class="px-6 py-4 text-left text-sm font-semibold">Jenis Nilai</th>
<th class="px-6 py-4 text-center text-sm font-semibold">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($santris as $i => $santri)
<tr class="hover:bg-gray-50 transition-colors">
<td class="px-6 py-4 text-sm text-gray-900">{{ $i+1 }}</td>
<td class="px-6 py-4">
<div class="flex items-center">
<div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mr-3">
<span class="text-green-600 font-semibold text-sm">{{ substr($santri->nama, 0, 1) }}</span>
</div>
<span class="font-medium text-gray-900">{{ $santri->nama }}</span>
</div>
</td>
<td class="px-6 py-4">
@if(isset($nilaiSantris[$santri->id]))
@php
$nilai = $nilaiSantris[$santri->id]->nilai;
$nilaiColors = [
'A' => 'bg-green-100 text-green-800',
'B' => 'bg-yellow-100 text-yellow-800',
'C' => 'bg-yellow-200 text-yellow-900',
'D' => 'bg-orange-100 text-orange-800',
'E' => 'bg-red-100 text-red-800'
];
$grade = $nilai >= 90 ? 'A' : ($nilai >= 80 ? 'B' : ($nilai >= 70 ? 'C' : ($nilai >= 60 ? 'D' : 'E')));
$color = $nilaiColors[$grade];
@endphp
<div class="flex items-center space-x-2">
<span class="text-lg font-bold text-gray-900">{{ $nilai }}</span>
<span class="inline-flex px-2 py-1 text-xs font-semibold rounded-full {{ $color }}">
{{ $grade }}
</span>
</div>
@else
<span class="text-gray-400">-</span>
@endif
</td>
<td class="px-6 py-4 text-sm text-gray-600">
{{ $nilaiSantris[$santri->id]->keterangan ?? '-' }}
</td>
<td class="px-6 py-4 text-sm text-gray-900">
@if(isset($nilaiSantris[$santri->id]))
{{ $nilaiSantris[$santri->id]->semester ? $nilaiSantris[$santri->id]->semester->semester : '-' }}
@else
-
@endif
</td>
<td class="px-6 py-4 text-sm text-gray-900">
{{ $nilaiSantris[$santri->id]->jenis_nilai ?? '-' }}
</td>
<td class="px-6 py-4 text-center">
@if(isset($nilaiSantris[$santri->id]))
<div class="flex items-center justify-center space-x-2">
<a href="{{ route('nilai_santris.edit', $nilaiSantris[$santri->id]->id) }}" class="inline-flex items-center px-3 py-2 text-sm font-medium text-yellow-900 bg-yellow-300 rounded-lg hover:bg-yellow-400 transition-colors">
<i class="fas fa-edit mr-1"></i>
Edit
</a>
<form action="{{ route('nilai_santris.destroy', $nilaiSantris[$santri->id]->id) }}" method="POST" class="inline-block" onsubmit="return confirm('Yakin hapus nilai ini?')">
@csrf
@method('DELETE')
<button type="submit" class="inline-flex items-center px-3 py-2 text-sm font-medium text-red-600 bg-red-100 rounded-lg hover:bg-red-200 transition-colors">
<i class="fas fa-trash mr-1"></i>
Hapus
</button>
</form>
</div>
@else
<span class="text-gray-400 text-sm">Belum ada data</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@elseif($kelasId && $mapelId)
<div class="text-center py-12">
<div class="w-16 h-16 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i class="fas fa-exclamation-triangle text-yellow-600 text-2xl"></i>
</div>
<h3 class="text-lg font-medium text-gray-900 mb-2">Tidak ada data santri</h3>
<p class="text-gray-600">Tidak ada data santri di kelas yang dipilih.</p>
</div>
@endif
</div>
</div>
</div>
</div>
</x-app-layout>