@extends('layouts.admin')

@section('content')
<div class="content-wrapper pb-0 min-vh-100">
    <div class="page-header flex-wrap">
        <h3 class="mb-0">Laporan Nasabah</h3>
    </div>

    <div class="card">
        <div class="card-body">
            <a href="{{ url('admin/laporancetak') }}" target="_blank" class="btn btn-primary mb-3">
                Cetak Laporan
            </a>

            <div class="table-responsive">
                <table class="table table-bordered" id="datatable">
                    <thead>
                        <tr>
                            <th>Nama</th>
                            <th>Golongan Pekerjaan</th>
                            <th>Status Pekerjaan</th>
                            <th>Jumlah Pinjaman</th>
                            <th>History Pinjaman</th>
                            <th>Tabungan Wajib</th>
                            <th>Kelayakan</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($nasabah as $n)
                        <tr>
                            <td>{{ $n->nama }}</td>
                            <td>{{ $n->golongan_pekerjaan }}</td>
                            <td>{{ $n->status_pekerjaan }}</td>
                            <td>Rp. {{ number_format($n->jumlah_pinjaman, 0, ',', '.') }}</td>
                            <td>Rp. {{ number_format($n->history_pinjaman, 0, ',', '.') }}</td>
                            <td>Rp. {{ number_format($n->tabungan_simpanan_wajib, 0, ',', '.') }}</td>
                            <td>
                                <span class="badge {{ $n->kelayakan == 'Layak' ? 'bg-success' : 'bg-danger' }}">
                                    {{ $n->kelayakan }}
                                </span>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection