<!DOCTYPE html>
<html>

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

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

        h2,
        h4 {
            margin: 0;
        }

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

        th,
        td {
            border: 1px solid #000;
            padding: 6px;
            text-align: left;
        }

        th {
            background: #eee;
        }

        .summary {
            margin-top: 15px;
        }
    </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;">
                    Laporan Riwayat Prediksi
                </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 class="summary">
        <p>Total Data: {{ count($rows) }}</p>
    </div>
    <table>
        <thead>
            <tr>
                <th>Kode</th>
                <th>Nama Barang</th>
                <th>Jenis</th>
                <th>Hasil Prediksi</th>
                <th>Satuan</th>
                <th>Tanggal Prediksi</th>
            </tr>
        </thead>
        <tbody>
            @foreach ($rows as $row)
                <tr>
                    <td>{{ $row->kode }}</td>
                    <td>{{ $row->nama_barang }}</td>
                    <td>{{ $row->jenis }}</td>
                    <td>
                        {{ number_format($row->jumlah_prediksi, 0, ',', '.') }}
                    </td>
                    <td>{{ $row->satuan }}</td>
                    <td>
                        {{ \Carbon\Carbon::parse($row->tanggal_prediksi)->format('d-m-Y') }}
                    </td>
                </tr>
            @endforeach
        </tbody>
    </table>
    <p style="margin-top:20px;">
        Laporan dibuat berdasarkan data riwayat hasil prediksi barang.
    </p>

</body>

</html>
