@extends('layouts.app')

@section('content')
<!-- Background seluruh halaman -->
<div style="background-color: #e0e0e0; width: 100%; min-height: 100vh; border-radius: 15px; padding: 1rem;">

    <!-- Header -->
    <div style="background-color: #000; color: #fff; padding: 0.1rem; border-radius: 0.5rem;">
        <h1 class="m-0">Data Kas</h1>
    </div>

    <!-- Konten utama -->
    <div class="container mt-4">
        <div class="card p-3 border border-secondary" style="border-radius: 15px; background-color: #fff;">
            <h5 class="card-title">Tabel Data Kas</h5>
            <table class="table table-bordered table-hover mb-0">
                <thead class="table-dark">
                    <tr>
                        <th>Tanggal</th>
                        <th>Kategori</th>
                        <th>Barang</th>
                        <th>Jumlah</th>
                        <th>Masuk</th>
                        <th>Keluar</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($data_kas as $item)
                        <tr>
                            <td>{{ $item->tanggal }}</td>
                            <td>{{ $item->kategori }}</td>
                            <td>{{ $item->barang ?? '-' }}</td>
                            <td>Rp {{ number_format($item->jumlah, 0, ',', '.') }}</td>
                            <td>
                                @if ($item instanceof App\Models\SosialKasPemasukan)
                                    Rp {{ number_format($item->jumlah, 0, ',', '.') }}
                                @else
                                    -
                                @endif
                            </td>
                            <td>
                                @if ($item instanceof App\Models\SosialKasPengeluaran)
                                    Rp {{ number_format($item->jumlah, 0, ',', '.') }}
                                @else
                                    -
                                @endif
                            </td>
                        </tr>
                    @endforeach
                    <tr>
                        <td colspan="4"><strong>Total Masuk</strong></td>
                        <td><strong>Rp {{ number_format($total_pemasukan, 0, ',', '.') }}</strong></td>
                        <td></td>
                    </tr>
                    <tr>
                        <td colspan="4"><strong>Total Keluar</strong></td>
                        <td></td>
                        <td><strong>Rp {{ number_format($total_pengeluaran, 0, ',', '.') }}</strong></td>
                    </tr>
                    <tr>
                        <td colspan="4"><strong>Saldo Akhir</strong></td>
                        <td><strong>Rp {{ number_format($saldo_akhir, 0, ',', '.') }}</strong></td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
@endsection
