@extends('layouts.dashboard')

@section('content')
<div class="container-fluid py-4">
    <h3 class="text-primary mb-3">Daftar Anggota</h3>

    @if(session('success'))
        <div class="alert alert-success">{{ session('success') }}</div>
    @endif

    <div class="mb-3 d-flex justify-content-between">
        <a href="{{ route('user.koleksi') }}" class="btn btn-outline-secondary">
            <i class="fas fa-arrow-left me-1"></i> Kembali ke Dashboard
        </a>

        <a href="{{ route('user.member.create') }}" class="btn btn-primary">
            <i class="fas fa-plus me-1"></i> Tambah Anggota
        </a>
    </div>

    <table class="table table-bordered">
        <thead class="table-light">
            <tr>
                <th>No</th>
                <th>Nama</th>
                <th>Email</th>
                <th>Alamat</th>
            </tr>
        </thead>
        <tbody>
            @forelse($anggota as $item)
                <tr>
                    <td>{{ $loop->iteration }}</td>
                    <td>{{ $item->nama }}</td>
                    <td>{{ $item->email }}</td>
                    <td>{{ $item->alamat }}</td>
                </tr>
            @empty
                <tr>
                    <td colspan="4" class="text-center">Belum ada anggota.</td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>
@endsection

