<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Monitoring Prediksi PDF</title>

    <style>
        body {
            font-family: sans-serif;
            font-size: 11px;
        }

        h2,
        h4 {
            margin: 0;
        }

        .header {
            margin-bottom: 15px;
        }

        .summary {
            margin: 10px 0;
        }

        .cards {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
        }

        .card {
            flex: 1;
            border: 1px solid #ddd;
            padding: 10px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
        }

        th,
        td {
            border: 1px solid #000;
            padding: 6px;
            font-size: 10px;
        }

        th {
            background: #eee;
        }
    </style>
</head>

<body>

    <table style="width:100%; border:none; margin-bottom:15px;">
        <tr>
            <td style="width:80px; border:none; text-align:center;">
                <img src="{{ public_path('images/logo-pmi.png') }}" width="60">
            </td>
            <td style="border:none;">
                <h2 style="margin:0;">UDD PMI Jember</h2>
                <h4 style="margin:4px 0;">Monitoring Prediksi Barang Habis Pakai</h4>
                <p style="margin:2px 0;">Periode: {{ $periode }}</p>
                <p style="margin:2px 0;">Tanggal Cetak: {{ date('d-m-Y') }}</p>
            </td>
        </tr>
    </table>
    <hr>
    <div style="margin-top:10px; margin-bottom:15px;">
        <p>Total Barang : {{ $totalBarang }}</p>
        <p>Naik : {{ $totalNaik }}</p>
        <p>Stabil : {{ $totalStabil }}</p>
        <p>Turun : {{ $totalTurun }}</p>
    </div>
    <table>
        <thead>
            <tr>
                <th>Kode</th>
                <th>Nama</th>
                <th>Jenis</th>
                <th>Satuan</th>
                <th>Prediksi</th>
                <th>Pemakaian</th>
                <th>Selisih</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($rows as $r)
                <tr>
                    <td>{{ $r->kode }}</td>
                    <td>{{ $r->nama_barang }}</td>
                    <td>{{ $r->jenis }}</td>
                    <td>{{ $r->satuan }}</td>
                    <td>{{ $r->jumlah_prediksi }}</td>
                    <td>{{ $r->pemakaian_terakhir ?? 0 }}</td>
                    <td>{{ $r->selisih }}</td>
                    <td>{{ $r->status }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>

</body>

</html>
