<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SURAT KEPUTUSAN HASIL REKOMENDASI</title>
    <!-- Link to Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <style>
    .decision-letter {
        margin: 0 auto;
        padding: 20px;
    }

    .header {
        text-align: center;
        margin-bottom: 20px;
    }

    .content {
        font-size: 16px;
    }

    .info {
        margin: 20px 0;
    }
    </style>
</head>

<body>
    <div class="container">
        <div class="decision-letter">
            <div class="header">
                <h1>SURAT KEPUTUSAN HASIL REKOMENDASI</h1>
                <h2>PEMILIHAN JENIS MAKANAN PENDERITA STUNTING</h2>
            </div>
            <div class="content">
                <p>Berdasarkan perhitungan menggunakan sistem pendukung keputusan menggunakan metode SAW dengan
                    melakukan penilaian terhadap kriteria pada masing masing. Maka didapatkan hasil urutan peringkat
                    makanan terbaik.</p>
                <div class="info">
                    <p><strong>Nama:</strong> <?= $data_hasil->nama_balita ?></p>
                    <p><strong>Umur:</strong> <?= $data_hasil->umur ?> bulan</p>
                    <p><strong>Jenis kelamin:</strong><?= $data_hasil->jk ?></p>
                    <p><strong>Berat badan:</strong> <?= $data_hasil->berat_badan ?>kg</p>
                    <p><strong>Tinggi badan:</strong> <?= $data_hasil->tinggi_badan ?>cm</p>
                    <p><strong>Nama Orangtua:</strong> <?= $data_hasil->nama_ortu?></p>
                    <p><strong>Status gizi:</strong> <?= $data_hasil->status_gizi ?></p>
                </div>
            </div>
            <hr>
            <div class="table-responsive">

                <h2><strong>Rekomendasi Jenis Makanan</strong></h2>
                <table id="example4" class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Nama Makanan</th>
                            <th>Keterangan</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><?= $data_hasil->hasil ?></td>
                            <td><?php 
                            $ket = $this->db->query("SELECT keterangan FROM alternatif WHERE nama_alternatif = '$data_hasil->hasil'")->row();
                            echo $ket->keterangan?></td>
                        </tr>
                    </tbody>
                </table>
            </div>

        </div>
    </div>
    <!-- Link to Bootstrap JS and Popper.js -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.9.1/dist/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
    <script>
    // Memicu fungsi print() secara otomatis saat halaman dimuat
    window.onload = function() {
        window.print();
    };
    </script>
</body>

</html>