@extends('layouts.app')

@section('title', 'Data Admin - INUFA')

@section('header')
<div class="flex space-x-8">
    <a href="{{ route('pengguna') }}" class="font-semibold border-b-2 border-white pb-1">Data Admin</a>
    <!-- <a href="{{ route('admin') }}" class="font-semibold">Data User</a> -->
</div>
@endsection

@section('content')
<!-- Add Button -->
<div class="mb-6">
    <a href="{{ route('pengguna.create') }}" class="inline-block bg-white text-gray-800 px-4 py-2 rounded font-semibold">
        Tambah Admin
    </a>
</div>

<!-- Table -->
<div class="bg-white rounded shadow overflow-x-auto">
    <table class="w-full table-fixed">
        <thead>
            <tr class="bg-gray-100">
                <th class="py-3 px-4 text-left w-12 border-r">No</th>
                <th class="py-3 px-4 text-left w-36 border-r">Nama</th>
                <th class="py-3 px-4 text-left w-36 border-r">Username</th>
                <th class="py-3 px-4 text-left w-48 border-r">Email</th>
                <th class="py-3 px-4 text-left w-36 border-r">No.Telp</th>
                <th class="py-3 px-4 text-left border-r">Alamat</th>
                <th class="py-3 px-4 text-center w-24">Aksi</th>
            </tr>
        </thead>
        <tbody>
            @forelse($pengguna as $index => $user)
            <tr class="border-t">
                <td class="py-3 px-4 border-r">{{ $user->id }}</td>
                <td class="py-3 px-4 border-r">{{ $user->nama }}</td>
                <td class="py-3 px-4 border-r">{{ $user->username }}</td>
                <td class="py-3 px-4 border-r">{{ $user->email }}</td>
                <td class="py-3 px-4 border-r">{{ $user->no_telp }}</td>
                <td class="py-3 px-4 border-r">{{ $user->alamat }}</td>
                <td class="py-3 px-4 text-center">
                    <form action="{{ route('pengguna.destroy', $user->id) }}" method="POST">
                        @csrf
                        @method('DELETE')
                        <button type="submit" class="bg-red-500 text-white px-4 py-1 rounded-sm font-medium text-sm">
                            Hapus
                        </button>
                    </form>
                </td>
            </tr>
            @empty
            <tr class="border-t">
                <td colspan="7" class="py-3 px-4 text-center">Tidak ada data admin</td>
            </tr>
            @endforelse
        </tbody>
    </table>
</div>
@endsection 