@extends('layouts.app')
@section('title', 'Admin')
@section('content')
<div class="flex justify-end mb-4">
    <a href="{{ route('panel.admins.create') }}" class="bg-blue-600 text-white rounded px-4 py-2 text-sm font-medium">+ Yeni Admin</a>
</div>
<div class="bg-white rounded shadow overflow-x-auto">
    <table class="w-full text-sm">
        <thead class="bg-slate-100 text-left"><tr><th class="p-3">Ad</th><th class="p-3">E-posta</th><th class="p-3">Durum</th><th class="p-3">İşlem</th></tr></thead>
        <tbody>
        @forelse ($admins as $admin)
            <tr class="border-t">
                <td class="p-3">{{ $admin->name }}</td>
                <td class="p-3">{{ $admin->email }}</td>
                <td class="p-3">{{ $admin->status==='active' ? 'Aktif':'Pasif' }}</td>
                <td class="p-3 flex gap-2">
                    <a href="{{ route('panel.admins.edit', $admin) }}" class="text-slate-600 hover:underline">Düzenle</a>
                    <form method="POST" action="{{ route('panel.admins.destroy', $admin) }}" onsubmit="return confirm('Emin misiniz?')">
                        @csrf @method('DELETE')
                        <button class="text-red-600 hover:underline">Sil</button>
                    </form>
                </td>
            </tr>
        @empty
            <tr><td colspan="4" class="p-6 text-center text-slate-400">Kayıt bulunamadı.</td></tr>
        @endforelse
        </tbody>
    </table>
</div>
<div class="mt-4">{{ $admins->links() }}</div>
@endsection
