<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Daftar Alumni') }}
        </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-sm sm:rounded-lg">
                <div class="p-6">
                    <div class="flex justify-between items-center mb-4">
                        <h1 class="text-xl font-bold text-gray-900">Daftar Alumni</h1>
                        <a href="{{ route('alumnis.create') }}" class="btn-primary">Tambah Alumni</a>
                    </div>
                    
                    @if(session('success'))
                        <div class="alert-success mb-4">{{ session('success') }}</div>
                    @endif
                    
                    <div class="overflow-x-auto">
                        <table class="table w-full border rounded-lg overflow-hidden">
                            <thead>
                                <tr class="table-header">
                                    <th class="px-3 py-2">No</th>
                                    <th class="px-3 py-2">Santri</th>
                                    <th class="px-3 py-2">Tahun Lulus</th>
                                    <th class="px-3 py-2">Aktivitas</th>
                                    <th class="px-3 py-2">Kontak</th>
                                    <th class="px-3 py-2">Keterangan</th>
                                    <th class="px-3 py-2">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach($alumnis as $alumni)
                                <tr class="table-row">
                                    <td class="px-3 py-2">{{ $loop->iteration + ($alumnis->currentPage()-1)*$alumnis->perPage() }}</td>
                                    <td class="px-3 py-2">{{ $alumni->nama_santri }}</td>
                                    <td class="px-3 py-2">{{ $alumni->tahun_lulus }}</td>
                                    <td class="px-3 py-2">{{ $alumni->aktivitas_setelah_lulus }}</td>
                                    <td class="px-3 py-2">{{ $alumni->kontak }}</td>
                                    <td class="px-3 py-2">{{ $alumni->keterangan }}</td>
                                    <td class="px-3 py-2 space-x-1">
                                        <a href="{{ route('alumnis.show', $alumni) }}" class="btn-accent btn-sm">Detail</a>
                                        <a href="{{ route('alumnis.edit', $alumni) }}" class="btn-accent btn-sm">Edit</a>
                                        <form action="{{ route('alumnis.destroy', $alumni) }}" method="POST" style="display:inline-block;">
                                            @csrf
                                            @method('DELETE')
                                            <button type="submit" class="btn-primary btn-sm" onclick="return confirm('Yakin hapus?')">Hapus</button>
                                        </form>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                    {{ $alumnis->links() }}
                </div>
            </div>
        </div>
    </div>
</x-app-layout> 