@extends('layouts.app')

@section('title', 'Status Pembayaran Siswa')

@push('styles')
<style>
    .card-title { font-weight: 600; }
    .table-valign-middle td { vertical-align: middle; }
</style>
@endpush

@section('content')
<div class="row">
    <div class="col-12">
        <div class="card shadow-sm">
            <div class="card-header border-0">
                <h3 class="card-title">Status Pembayaran Siswa Kelas {{ $kelas->nama_kelas }}</h3>
            </div>
            <div class="card-body table-responsive p-0">
                <table class="table table-striped table-valign-middle">
                    <thead>
                        <tr>
                            <th>No</th>
                            <th>NIS</th>
                            <th>Nama Siswa</th>
                            <th>Status Pembayaran Bulan Berjalan</th>
                            <th>Nominal Tunggakan Bulan Berjalan</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse($siswaList as $index => $siswa)
                        <tr>
                            <td>{{ $index + 1 }}</td>
                            <td>{{ $siswa->nis }}</td>
                            <td>{{ $siswa->nama }}</td>
                            <td>
                                @if($siswa->status_bulan_ini === 'lunas')
                                    <span class="text-success"><i class="fas fa-check"></i> Lunas</span>
                                @elseif(in_array($siswa->status_bulan_ini, ['belum_bayar', 'kurang']))
                                    <span class="text-danger"><i class="fas fa-times"></i> Belum Lunas</span>
                                @else
                                    <span class="text-muted">Tidak Ada Tagihan</span>
                                @endif
                            </td>
                            <td>
                                @if($siswa->nominal_tunggakan_bulan_ini > 0)
                                    <span class="text-danger font-weight-bold">Rp {{ number_format($siswa->nominal_tunggakan_bulan_ini, 0, ',', '.') }}</span>
                                @else
                                    <span class="text-success">Rp 0</span>
                                @endif
                            </td>
                        </tr>
                        @empty
                        <tr>
                            <td colspan="5" class="text-center text-muted">Belum ada data siswa di kelas ini.</td>
                        </tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection
